@solana/wallet-adapter-clover
Advanced tools
Comparing version 0.2.0 to 0.3.0
import { BaseSignerWalletAdapter } from '@solana/wallet-adapter-base'; | ||
import { PublicKey, Transaction } from '@solana/web3.js'; | ||
export interface CloverWalletAdapterConfig { | ||
pollInterval?: number; | ||
pollCount?: number; | ||
} | ||
@@ -13,5 +11,4 @@ export declare class CloverWalletAdapter 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, WalletNotInstalledError, 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 CloverWalletAdapter extends BaseSignerWalletAdapter { | ||
this._publicKey = null; | ||
if (!this.ready) | ||
pollUntilReady(this, config.pollInterval || 1000, config.pollCount || 3); | ||
} | ||
@@ -26,11 +24,21 @@ get publicKey() { | ||
} | ||
get ready() { | ||
var _a; | ||
return typeof window !== 'undefined' && !!((_a = window.clover_solana) === null || _a === void 0 ? void 0 : _a.isCloverWallet); | ||
} | ||
get connecting() { | ||
return this._connecting; | ||
} | ||
get connected() { | ||
return !!this._publicKey; | ||
ready() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') | ||
return false; | ||
if (document.readyState === 'complete') | ||
return !!((_a = window.clover_solana) === null || _a === void 0 ? void 0 : _a.isCloverWallet); | ||
return new Promise((resolve) => { | ||
function listener() { | ||
var _a; | ||
window.removeEventListener('load', listener); | ||
resolve(!!((_a = window.clover_solana) === null || _a === void 0 ? void 0 : _a.isCloverWallet)); | ||
} | ||
window.addEventListener('load', listener); | ||
}); | ||
}); | ||
} | ||
@@ -43,7 +51,5 @@ connect() { | ||
this._connecting = true; | ||
const wallet = typeof window !== 'undefined' && window.clover_solana; | ||
if (!wallet) | ||
throw new WalletNotFoundError(); | ||
if (!wallet.isCloverWallet) | ||
throw new WalletNotInstalledError(); | ||
if (!(yield this.ready())) | ||
throw new WalletNotReadyError(); | ||
const wallet = window.clover_solana; | ||
let account; | ||
@@ -50,0 +56,0 @@ try { |
export * from './adapter'; | ||
export * from './wallet'; |
export * from './adapter'; | ||
export * from './wallet'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@solana/wallet-adapter-clover", | ||
"version": "0.2.0", | ||
"version": "0.3.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, | ||
WalletNotInstalledError, | ||
WalletNotReadyError, | ||
WalletPublicKeyError, | ||
@@ -26,6 +24,3 @@ WalletSignTransactionError, | ||
export interface CloverWalletAdapterConfig { | ||
pollInterval?: number; | ||
pollCount?: number; | ||
} | ||
export interface CloverWalletAdapterConfig {} | ||
@@ -42,4 +37,2 @@ export class CloverWalletAdapter extends BaseSignerWalletAdapter { | ||
this._publicKey = null; | ||
if (!this.ready) pollUntilReady(this, config.pollInterval || 1000, config.pollCount || 3); | ||
} | ||
@@ -51,6 +44,2 @@ | ||
get ready(): boolean { | ||
return typeof window !== 'undefined' && !!window.clover_solana?.isCloverWallet; | ||
} | ||
get connecting(): boolean { | ||
@@ -60,4 +49,15 @@ return this._connecting; | ||
get connected(): boolean { | ||
return !!this._publicKey; | ||
async ready(): Promise<boolean> { | ||
if (typeof window === 'undefined' || typeof document === 'undefined') return false; | ||
if (document.readyState === 'complete') return !!window.clover_solana?.isCloverWallet; | ||
return new Promise((resolve) => { | ||
function listener() { | ||
window.removeEventListener('load', listener); | ||
resolve(!!window.clover_solana?.isCloverWallet); | ||
} | ||
window.addEventListener('load', listener); | ||
}); | ||
} | ||
@@ -70,6 +70,6 @@ | ||
const wallet = typeof window !== 'undefined' && window.clover_solana; | ||
if (!wallet) throw new WalletNotFoundError(); | ||
if (!wallet.isCloverWallet) throw new WalletNotInstalledError(); | ||
if (!(await this.ready())) throw new WalletNotReadyError(); | ||
const wallet = window!.clover_solana!; | ||
let account: string; | ||
@@ -76,0 +76,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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
29430
15
290
2