@wallet-standard/wallet
Advanced tools
Comparing version 1.0.0-rc.4 to 1.0.0-rc.5
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.registerWallet = void 0; | ||
exports.DEPRECATED_registerWallet = exports.registerWallet = void 0; | ||
function registerWallet(wallet) { | ||
@@ -49,10 +49,28 @@ const callback = ({ register }) => register(wallet); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
preventDefault() { } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopImmediatePropagation() { } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopPropagation() { } | ||
/** @deprecated */ | ||
preventDefault() { | ||
throw new Error('preventDefault cannot be called'); | ||
} | ||
/** @deprecated */ | ||
stopImmediatePropagation() { | ||
throw new Error('stopImmediatePropagation cannot be called'); | ||
} | ||
/** @deprecated */ | ||
stopPropagation() { | ||
throw new Error('stopPropagation cannot be called'); | ||
} | ||
} | ||
_WindowRegisterWalletEvent_detail = new WeakMap(); | ||
/** @deprecated */ | ||
function DEPRECATED_registerWallet(wallet) { | ||
var _a; | ||
registerWallet(wallet); | ||
try { | ||
((_a = window.navigator).wallets || (_a.wallets = [])).push(({ register }) => register(wallet)); | ||
} | ||
catch (error) { | ||
console.error('window.navigator.wallets could not be pushed\n', error); | ||
} | ||
} | ||
exports.DEPRECATED_registerWallet = DEPRECATED_registerWallet; | ||
//# sourceMappingURL=register.js.map |
@@ -44,10 +44,27 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
preventDefault() { } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopImmediatePropagation() { } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopPropagation() { } | ||
/** @deprecated */ | ||
preventDefault() { | ||
throw new Error('preventDefault cannot be called'); | ||
} | ||
/** @deprecated */ | ||
stopImmediatePropagation() { | ||
throw new Error('stopImmediatePropagation cannot be called'); | ||
} | ||
/** @deprecated */ | ||
stopPropagation() { | ||
throw new Error('stopPropagation cannot be called'); | ||
} | ||
} | ||
_WindowRegisterWalletEvent_detail = new WeakMap(); | ||
/** @deprecated */ | ||
export function DEPRECATED_registerWallet(wallet) { | ||
var _a; | ||
registerWallet(wallet); | ||
try { | ||
((_a = window.navigator).wallets || (_a.wallets = [])).push(({ register }) => register(wallet)); | ||
} | ||
catch (error) { | ||
console.error('window.navigator.wallets could not be pushed\n', error); | ||
} | ||
} | ||
//# sourceMappingURL=register.js.map |
import type { Wallet } from '@wallet-standard/base'; | ||
export declare function registerWallet(wallet: Wallet): void; | ||
/** @deprecated */ | ||
export declare function DEPRECATED_registerWallet(wallet: Wallet): void; | ||
//# sourceMappingURL=register.d.ts.map |
{ | ||
"name": "@wallet-standard/wallet", | ||
"version": "1.0.0-rc.4", | ||
"version": "1.0.0-rc.5", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -29,3 +29,3 @@ "repository": "https://github.com/wallet-standard/wallet-standard", | ||
"dependencies": { | ||
"@wallet-standard/base": "^1.0.0-rc.4" | ||
"@wallet-standard/base": "^1.0.0-rc.5" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
import type { | ||
DEPRECATED_WalletsWindow, | ||
Wallet, | ||
@@ -8,15 +9,13 @@ WalletEventsWindow, | ||
declare const window: WalletEventsWindow; | ||
export function registerWallet(wallet: Wallet): void { | ||
const callback: WindowRegisterWalletEventCallback = ({ register }) => register(wallet); | ||
try { | ||
window.dispatchEvent(new WindowRegisterWalletEvent(callback)); | ||
(window as WalletEventsWindow).dispatchEvent(new WindowRegisterWalletEvent(callback)); | ||
} catch (error) { | ||
console.error('wallet-standard:register-wallet event could not be dispatched\n', error); | ||
} | ||
try { | ||
window.addEventListener('wallet-standard:app-ready', ({ detail: api }) => callback(api)); | ||
(window as WalletEventsWindow).addEventListener('wallet-standard:app-ready', ({ detail: api }) => | ||
callback(api) | ||
); | ||
} catch (error) { | ||
@@ -47,10 +46,26 @@ console.error('wallet-standard:app-ready event listener could not be added\n', error); | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
preventDefault() {} | ||
/** @deprecated */ | ||
preventDefault(): never { | ||
throw new Error('preventDefault cannot be called'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopImmediatePropagation() {} | ||
/** @deprecated */ | ||
stopImmediatePropagation(): never { | ||
throw new Error('stopImmediatePropagation cannot be called'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
stopPropagation() {} | ||
/** @deprecated */ | ||
stopPropagation(): never { | ||
throw new Error('stopPropagation cannot be called'); | ||
} | ||
} | ||
/** @deprecated */ | ||
export function DEPRECATED_registerWallet(wallet: Wallet): void { | ||
registerWallet(wallet); | ||
try { | ||
((window as DEPRECATED_WalletsWindow).navigator.wallets ||= []).push(({ register }) => register(wallet)); | ||
} catch (error) { | ||
console.error('window.navigator.wallets could not be pushed\n', error); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44716
543