@solana/wallet-adapter-bitpie
Advanced tools
Comparing version 0.3.0 to 0.4.0
import { BaseSignerWalletAdapter } from '@solana/wallet-adapter-base'; | ||
import { PublicKey, Transaction } from '@solana/web3.js'; | ||
export interface BitpieWalletAdapterConfig { | ||
pollInterval?: number; | ||
pollCount?: number; | ||
} | ||
@@ -13,5 +11,4 @@ export declare class BitpieWalletAdapter extends BaseSignerWalletAdapter { | ||
get publicKey(): PublicKey | null; | ||
get ready(): boolean; | ||
get connecting(): boolean; | ||
get connected(): boolean; | ||
ready(): Promise<boolean>; | ||
connect(): Promise<void>; | ||
@@ -18,0 +15,0 @@ disconnect(): Promise<void>; |
@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { BaseSignerWalletAdapter, pollUntilReady, WalletAccountError, WalletNotConnectedError, WalletNotFoundError, WalletPublicKeyError, WalletSignTransactionError, } from '@solana/wallet-adapter-base'; | ||
import { BaseSignerWalletAdapter, WalletAccountError, WalletNotConnectedError, WalletNotReadyError, WalletPublicKeyError, WalletSignTransactionError, } from '@solana/wallet-adapter-base'; | ||
import { PublicKey } from '@solana/web3.js'; | ||
@@ -19,4 +19,2 @@ export class BitpieWalletAdapter extends BaseSignerWalletAdapter { | ||
this._publicKey = null; | ||
if (!this.ready) | ||
pollUntilReady(this, config.pollInterval || 1000, config.pollCount || 3); | ||
} | ||
@@ -26,10 +24,19 @@ get publicKey() { | ||
} | ||
get ready() { | ||
return typeof window !== 'undefined' && !!window.bitpie; | ||
} | ||
get connecting() { | ||
return this._connecting; | ||
} | ||
get connected() { | ||
return !!this._wallet; | ||
ready() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') | ||
return false; | ||
if (document.readyState === 'complete') | ||
return !!window.bitpie; | ||
return new Promise((resolve) => { | ||
function listener() { | ||
window.removeEventListener('load', listener); | ||
resolve(!!window.bitpie); | ||
} | ||
window.addEventListener('load', listener); | ||
}); | ||
}); | ||
} | ||
@@ -42,5 +49,5 @@ connect() { | ||
this._connecting = true; | ||
const wallet = typeof window !== 'undefined' && window.bitpie; | ||
if (!wallet) | ||
throw new WalletNotFoundError(); | ||
if (!(yield this.ready())) | ||
throw new WalletNotReadyError(); | ||
const wallet = window.bitpie; | ||
let account; | ||
@@ -47,0 +54,0 @@ try { |
export * from './adapter'; | ||
export * from './wallet'; |
export * from './adapter'; | ||
export * from './wallet'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@solana/wallet-adapter-bitpie", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -25,10 +25,10 @@ "repository": "https://github.com/solana-labs/wallet-adapter", | ||
"peerDependencies": { | ||
"@solana/wallet-adapter-base": "^0.7.0", | ||
"@solana/wallet-adapter-base": "^0.8.0", | ||
"@solana/web3.js": "^1.20.0" | ||
}, | ||
"devDependencies": { | ||
"@solana/wallet-adapter-base": "^0.7.0", | ||
"@solana/wallet-adapter-base": "^0.8.0", | ||
"@solana/web3.js": "^1.20.0" | ||
}, | ||
"gitHead": "ec6efb647304d3655c95909d3f998f8fc0baf6d5" | ||
"gitHead": "137794254bdd45d8ebc0f59394d7919bf8599f6e" | ||
} |
import { | ||
BaseSignerWalletAdapter, | ||
pollUntilReady, | ||
WalletAccountError, | ||
WalletNotConnectedError, | ||
WalletNotFoundError, | ||
WalletNotReadyError, | ||
WalletPublicKeyError, | ||
@@ -24,6 +23,3 @@ WalletSignTransactionError, | ||
export interface BitpieWalletAdapterConfig { | ||
pollInterval?: number; | ||
pollCount?: number; | ||
} | ||
export interface BitpieWalletAdapterConfig {} | ||
@@ -40,4 +36,2 @@ export class BitpieWalletAdapter extends BaseSignerWalletAdapter { | ||
this._publicKey = null; | ||
if (!this.ready) pollUntilReady(this, config.pollInterval || 1000, config.pollCount || 3); | ||
} | ||
@@ -49,6 +43,2 @@ | ||
get ready(): boolean { | ||
return typeof window !== 'undefined' && !!window.bitpie; | ||
} | ||
get connecting(): boolean { | ||
@@ -58,4 +48,15 @@ return this._connecting; | ||
get connected(): boolean { | ||
return !!this._wallet; | ||
async ready(): Promise<boolean> { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') return false; | ||
if (document.readyState === 'complete') return !!window.bitpie; | ||
return new Promise((resolve) => { | ||
function listener() { | ||
window.removeEventListener('load', listener); | ||
resolve(!!window.bitpie); | ||
} | ||
window.addEventListener('load', listener); | ||
}); | ||
} | ||
@@ -68,5 +69,6 @@ | ||
const wallet = typeof window !== 'undefined' && window.bitpie; | ||
if (!wallet) throw new WalletNotFoundError(); | ||
if (!(await this.ready())) throw new WalletNotReadyError(); | ||
const wallet = window!.bitpie!; | ||
let account: string; | ||
@@ -73,0 +75,0 @@ try { |
export * from './adapter'; | ||
export * from './wallet'; |
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
33290
15
303