@solana/wallet-adapter-clover
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -1,2 +0,2 @@ | ||
import { BaseSignerWalletAdapter, WalletName, WalletReadyState } from '@solana/wallet-adapter-base'; | ||
import { BaseMessageSignerWalletAdapter, WalletName, WalletReadyState } from '@solana/wallet-adapter-base'; | ||
import { PublicKey, Transaction } from '@solana/web3.js'; | ||
@@ -6,3 +6,3 @@ export interface CloverWalletAdapterConfig { | ||
export declare const CloverWalletName: WalletName; | ||
export declare class CloverWalletAdapter extends BaseSignerWalletAdapter { | ||
export declare class CloverWalletAdapter extends BaseMessageSignerWalletAdapter { | ||
name: WalletName; | ||
@@ -23,2 +23,3 @@ url: string; | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>; | ||
signMessage(message: Uint8Array): Promise<Uint8Array>; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
exports.CloverWalletName = 'Clover'; | ||
class CloverWalletAdapter extends wallet_adapter_base_1.BaseSignerWalletAdapter { | ||
class CloverWalletAdapter extends wallet_adapter_base_1.BaseMessageSignerWalletAdapter { | ||
constructor(config = {}) { | ||
@@ -134,4 +134,24 @@ super(); | ||
} | ||
signMessage(message) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const wallet = this._wallet; | ||
if (!wallet) | ||
throw new wallet_adapter_base_1.WalletNotConnectedError(); | ||
try { | ||
const { signature } = yield wallet.signMessage(message); | ||
return Uint8Array.from(signature); | ||
} | ||
catch (error) { | ||
throw new wallet_adapter_base_1.WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error); | ||
} | ||
} | ||
catch (error) { | ||
this.emit('error', error); | ||
throw error; | ||
} | ||
}); | ||
} | ||
} | ||
exports.CloverWalletAdapter = CloverWalletAdapter; | ||
//# sourceMappingURL=adapter.js.map |
@@ -1,2 +0,2 @@ | ||
import { BaseSignerWalletAdapter, WalletName, WalletReadyState } from '@solana/wallet-adapter-base'; | ||
import { BaseMessageSignerWalletAdapter, WalletName, WalletReadyState } from '@solana/wallet-adapter-base'; | ||
import { PublicKey, Transaction } from '@solana/web3.js'; | ||
@@ -6,3 +6,3 @@ export interface CloverWalletAdapterConfig { | ||
export declare const CloverWalletName: WalletName; | ||
export declare class CloverWalletAdapter extends BaseSignerWalletAdapter { | ||
export declare class CloverWalletAdapter extends BaseMessageSignerWalletAdapter { | ||
name: WalletName; | ||
@@ -23,2 +23,3 @@ url: string; | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>; | ||
signMessage(message: Uint8Array): Promise<Uint8Array>; | ||
} |
{ | ||
"name": "@solana/wallet-adapter-clover", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -33,3 +33,3 @@ "repository": "https://github.com/solana-labs/wallet-adapter", | ||
}, | ||
"gitHead": "0373f0da94309cc72d4cdb3c56176ca9355f95cc" | ||
"gitHead": "4dfc650645a259fc9d537fc0a2b46be164eda2d6" | ||
} |
import { | ||
Adapter, | ||
BaseSignerWalletAdapter, | ||
BaseMessageSignerWalletAdapter, | ||
scopePollingDetectionStrategy, | ||
@@ -20,2 +19,3 @@ WalletAccountError, | ||
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>; | ||
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>; | ||
} | ||
@@ -33,3 +33,3 @@ | ||
export class CloverWalletAdapter extends BaseSignerWalletAdapter { | ||
export class CloverWalletAdapter extends BaseMessageSignerWalletAdapter { | ||
name = CloverWalletName; | ||
@@ -153,2 +153,19 @@ url = 'https://clover.finance'; | ||
} | ||
async signMessage(message: Uint8Array): Promise<Uint8Array> { | ||
try { | ||
const wallet = this._wallet; | ||
if (!wallet) throw new WalletNotConnectedError(); | ||
try { | ||
const { signature } = await wallet.signMessage(message); | ||
return Uint8Array.from(signature); | ||
} catch (error: any) { | ||
throw new WalletSignTransactionError(error?.message, error); | ||
} | ||
} catch (error: any) { | ||
this.emit('error', error); | ||
throw 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
43136
505