@dynamic-labs-wallet/node-svm 0.0.323 → 0.0.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/client/base58.d.ts +3 -0
- package/src/client/base58.d.ts.map +1 -0
- package/src/client/client.d.ts +145 -0
- package/src/client/client.d.ts.map +1 -0
- package/src/client/constants.d.ts +3 -0
- package/src/client/constants.d.ts.map +1 -0
- package/src/client/index.d.ts +5 -0
- package/src/client/index.d.ts.map +1 -0
- package/src/client/utils.d.ts +29 -0
- package/src/client/utils.d.ts.map +1 -0
- package/src/delegatedClient.d.ts +119 -0
- package/src/delegatedClient.d.ts.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-svm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.324",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/node": "0.0.324",
|
|
8
8
|
"@solana/web3.js": "^1.98.2"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src/client/base58.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAkCvD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAmCpD"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type ServerKeyShare, DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type DynamicWalletClientProps } from '@dynamic-labs-wallet/node';
|
|
2
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
4
|
+
readonly chainName = "SVM";
|
|
5
|
+
accountAddress?: string;
|
|
6
|
+
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, enableMPCAccelerator, logger, debug, }: DynamicWalletClientProps);
|
|
7
|
+
/**
|
|
8
|
+
* Creates a wallet account on the Solana chain
|
|
9
|
+
*
|
|
10
|
+
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
11
|
+
* @returns The account address, public key hex, raw public key, and client key shares
|
|
12
|
+
*/
|
|
13
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToClientShareService, }: {
|
|
14
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
15
|
+
password?: string;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
backUpToClientShareService?: boolean;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
accountAddress: string;
|
|
20
|
+
rawPublicKey: Uint8Array | string;
|
|
21
|
+
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
22
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
23
|
+
externalKeySharesWithBackupStatus: Array<{
|
|
24
|
+
share: ServerKeyShare;
|
|
25
|
+
backedUpToClientKeyShareService: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
deriveAccountAddress(rawPublicKey: string | Uint8Array): Promise<{
|
|
29
|
+
accountAddress: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* This function takes a message and returns it after being signed with MPC
|
|
33
|
+
*
|
|
34
|
+
* @param message The message to sign (Uint8Array)
|
|
35
|
+
* @param accountAddress Solana address (base58 encoded)
|
|
36
|
+
* @param password The password for encrypted backup shares
|
|
37
|
+
*/
|
|
38
|
+
signMessage({ message, accountAddress, password, externalServerKeyShares, }: {
|
|
39
|
+
message: string | Uint8Array;
|
|
40
|
+
accountAddress: string;
|
|
41
|
+
password?: string;
|
|
42
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
43
|
+
}): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Signs a pre-formatted (raw) message without additional encoding.
|
|
46
|
+
* The message must be a hex string representing already-hashed data.
|
|
47
|
+
*
|
|
48
|
+
* @param message The pre-formatted hex message to sign
|
|
49
|
+
* @param accountAddress Solana address (base58 encoded)
|
|
50
|
+
* @param password The password for encrypted backup shares
|
|
51
|
+
*/
|
|
52
|
+
signRawMessage({ message, accountAddress, password, externalServerKeyShares, }: {
|
|
53
|
+
message: string;
|
|
54
|
+
accountAddress: string;
|
|
55
|
+
password?: string;
|
|
56
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
57
|
+
}): Promise<string>;
|
|
58
|
+
signTransaction({ senderAddress, transaction, password, externalServerKeyShares, sponsor, }: {
|
|
59
|
+
senderAddress: string;
|
|
60
|
+
transaction: VersionedTransaction | Transaction | string;
|
|
61
|
+
password?: string;
|
|
62
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
63
|
+
/** If true, requests gas sponsorship from Dynamic before signing. */
|
|
64
|
+
sponsor?: boolean;
|
|
65
|
+
}): Promise<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Exports the private key for a given account address
|
|
68
|
+
*
|
|
69
|
+
* @param accountAddress The account address to export the private key for
|
|
70
|
+
* @param password The password for encrypted backup shares
|
|
71
|
+
* @returns The private key
|
|
72
|
+
*/
|
|
73
|
+
exportPrivateKey({ accountAddress, password, externalServerKeyShares, }: {
|
|
74
|
+
accountAddress: string;
|
|
75
|
+
password?: string;
|
|
76
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
77
|
+
}): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Exports the private key for a given account address
|
|
80
|
+
*
|
|
81
|
+
* @param keyShares The key shares to export the private key for
|
|
82
|
+
* @returns The private key
|
|
83
|
+
*/
|
|
84
|
+
offlineExportPrivateKey({ keyShares, derivationPath, }: {
|
|
85
|
+
keyShares: Ed25519KeygenResult[];
|
|
86
|
+
derivationPath?: string;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
derivedPrivateKey: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Converts the private key to a hex string
|
|
92
|
+
*
|
|
93
|
+
* @param privateKey The private key to convert
|
|
94
|
+
* @returns The hex string
|
|
95
|
+
*/
|
|
96
|
+
decodePrivateKeyForSolana(privateKey: string): string;
|
|
97
|
+
getPublicKeyFromPrivateKey(privateKey: string): string;
|
|
98
|
+
encodePublicKey(publicKey: Uint8Array): string;
|
|
99
|
+
/**
|
|
100
|
+
* Imports the private key for a given account address
|
|
101
|
+
*
|
|
102
|
+
* @param privateKey The private key to import
|
|
103
|
+
* @param chainName The chain name to import the private key for
|
|
104
|
+
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
105
|
+
* @param password The password for encrypted backup shares
|
|
106
|
+
* @returns The account address, raw public key, and client key shares
|
|
107
|
+
*/
|
|
108
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, backUpToClientShareService, }: {
|
|
109
|
+
privateKey: string;
|
|
110
|
+
chainName: string;
|
|
111
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
112
|
+
password?: string;
|
|
113
|
+
onError?: (error: Error) => void;
|
|
114
|
+
backUpToClientShareService?: boolean;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
accountAddress: string;
|
|
117
|
+
rawPublicKey: Uint8Array | string | undefined;
|
|
118
|
+
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
119
|
+
externalServerKeyShares: ServerKeyShare[];
|
|
120
|
+
externalKeySharesWithBackupStatus: Array<{
|
|
121
|
+
share: ServerKeyShare;
|
|
122
|
+
backedUpToClientKeyShareService: boolean;
|
|
123
|
+
}>;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Sponsors a Solana transaction via the Dynamic gas sponsorship API.
|
|
127
|
+
*
|
|
128
|
+
* Sends the unsigned transaction to Dynamic's sponsorTransaction endpoint,
|
|
129
|
+
* which replaces the fee payer with the sponsor's address. The returned
|
|
130
|
+
* transaction object has the sponsor as fee payer and should be passed to
|
|
131
|
+
* {@link signTransaction} instead of the original transaction.
|
|
132
|
+
*
|
|
133
|
+
* Gas sponsorship must be enabled for your environment in the Dynamic
|
|
134
|
+
* dashboard before calling this method.
|
|
135
|
+
*
|
|
136
|
+
* @param transaction - Unsigned Solana transaction (legacy or versioned).
|
|
137
|
+
* @returns The sponsored transaction with the gas sponsor as fee payer.
|
|
138
|
+
*/
|
|
139
|
+
sponsorTransaction({ transaction, traceContext, }: {
|
|
140
|
+
transaction: VersionedTransaction | Transaction;
|
|
141
|
+
traceContext?: TraceContext;
|
|
142
|
+
}): Promise<VersionedTransaction | Transaction>;
|
|
143
|
+
getSvmWallets(): Promise<import("@dynamic-labs-wallet/node").WalletProperties[]>;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAIjB,KAAK,wBAAwB,EAG9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAW,WAAW,EAAE,oBAAoB,EAAa,MAAM,iBAAiB,CAAC;AAUxF,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;gBAEZ,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,EACN,KAAK,GACN,EAAE,wBAAwB;IAW3B;;;;;OAKG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,EACP,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Ac,CAAC;YACtB,+BAA+B,EAAE,OAAO,CAAC;SAC1C,CAAC,CAAC;KACJ,CAAC;IA4DF;;;;;;;;;;;;;OAaG;IACG,kBAAkB,CAAC,EACvB,WAAW,EACX,YAAY,GACb,EAAE;QACD,WAAW,EAAE,oBAAoB,GAAG,WAAW,CAAC;QAChD,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B,GAAG,OAAO,CAAC,oBAAoB,GAAG,WAAW,CAAC;IAuBzC,aAAa;CAKpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,sBAAsB,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PublicKey, Transaction, type VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
export declare function getBalance({ address, rpcUrl }: {
|
|
3
|
+
address: string;
|
|
4
|
+
rpcUrl?: string;
|
|
5
|
+
}): Promise<number>;
|
|
6
|
+
export declare function createSolanaTransaction({ senderSolanaAddress, amount, to, rpcUrl, }: {
|
|
7
|
+
senderSolanaAddress: string;
|
|
8
|
+
amount: number;
|
|
9
|
+
to: string;
|
|
10
|
+
rpcUrl?: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
transaction: Transaction;
|
|
13
|
+
serializedTransaction: Buffer;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const addSignatureToTransaction: ({ transaction, signature, signerPublicKey, }: {
|
|
16
|
+
transaction: Transaction | VersionedTransaction;
|
|
17
|
+
signature: Uint8Array;
|
|
18
|
+
signerPublicKey: PublicKey;
|
|
19
|
+
}) => VersionedTransaction | Transaction;
|
|
20
|
+
export declare function attachSignature({ transaction, signatureBase58, senderAddress, }: {
|
|
21
|
+
transaction: Transaction | VersionedTransaction;
|
|
22
|
+
signatureBase58: string;
|
|
23
|
+
senderAddress: string;
|
|
24
|
+
}): VersionedTransaction | Transaction;
|
|
25
|
+
export declare function sendTransaction({ signedTransaction, rpcUrl, }: {
|
|
26
|
+
signedTransaction: Uint8Array;
|
|
27
|
+
rpcUrl?: string;
|
|
28
|
+
}): Promise<string>;
|
|
29
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/client/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAiB,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG/G,wBAAsB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAuB,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,mBAI1G;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,mBAAmB,EACnB,MAAM,EACN,EAAE,EACF,MAAwC,GACzC,EAAE;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;GAwBA;AAED,eAAO,MAAM,yBAAyB,iDAInC;IACD,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAC;IAChD,SAAS,EAAE,UAAU,CAAC;IACtB,eAAe,EAAE,SAAS,CAAC;CAC5B,KAAG,oBAAoB,GAAG,WAG1B,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,eAAe,EACf,aAAa,GACd,EAAE;IACD,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,oBAAoB,GAAG,WAAW,CAQrC;AAED,wBAAsB,eAAe,CAAC,EACpC,iBAAiB,EACjB,MAAwC,GACzC,EAAE;IACD,iBAAiB,EAAE,UAAU,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,mBAIA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { DelegatedWalletClient, ServerKeyShare } from '@dynamic-labs-wallet/node';
|
|
2
|
+
import type { Transaction } from '@solana/web3.js';
|
|
3
|
+
import { VersionedTransaction } from '@solana/web3.js';
|
|
4
|
+
export type DelegatedSvmClientConfig = {
|
|
5
|
+
environmentId: string;
|
|
6
|
+
baseApiUrl?: string;
|
|
7
|
+
baseMPCRelayApiUrl?: string;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type DelegatedSvmWalletClient = DelegatedWalletClient & {
|
|
12
|
+
readonly chainName: 'SVM';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Creates a delegated SVM wallet client for functional operations
|
|
16
|
+
*/
|
|
17
|
+
export declare const createDelegatedSvmWalletClient: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, apiKey, debug, }: DelegatedSvmClientConfig) => DelegatedSvmWalletClient;
|
|
18
|
+
/**
|
|
19
|
+
* Signs a message using delegated signing for SVM
|
|
20
|
+
*/
|
|
21
|
+
export declare const delegatedSignMessage: (client: DelegatedSvmWalletClient, { walletId, walletApiKey, keyShare, message, isFormatted, }: {
|
|
22
|
+
walletId: string;
|
|
23
|
+
walletApiKey: string;
|
|
24
|
+
keyShare: ServerKeyShare;
|
|
25
|
+
message: string;
|
|
26
|
+
isFormatted?: boolean;
|
|
27
|
+
}) => Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Signs a transaction using delegated signing for SVM
|
|
30
|
+
*
|
|
31
|
+
* @param client - The delegated SVM wallet client
|
|
32
|
+
* @param options - Signing options
|
|
33
|
+
* @param options.walletId - The wallet ID
|
|
34
|
+
* @param options.walletApiKey - The wallet API key
|
|
35
|
+
* @param options.keyShare - The server key share
|
|
36
|
+
* @param options.transaction - The transaction to sign (VersionedTransaction or Transaction)
|
|
37
|
+
* @param options.signerAddress - Optional. The address that should sign the transaction.
|
|
38
|
+
* If not provided, defaults to the first signer (VersionedTransaction)
|
|
39
|
+
* or fee payer (Transaction). Use this for gasless transactions where
|
|
40
|
+
* a separate fee payer pays the fees.
|
|
41
|
+
*
|
|
42
|
+
* @returns The partially signed transaction with the signature attached for the specified signer
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Standard transaction where sender is also fee payer
|
|
46
|
+
* const signedTx = await delegatedSignTransaction(client, {
|
|
47
|
+
* walletId,
|
|
48
|
+
* walletApiKey,
|
|
49
|
+
* keyShare,
|
|
50
|
+
* transaction,
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Gasless transaction with separate fee payer
|
|
55
|
+
* const transaction = new Transaction();
|
|
56
|
+
* transaction.feePayer = feePayerPublicKey; // Set the actual fee payer
|
|
57
|
+
* transaction.add(instruction); // Instruction that requires sender signature
|
|
58
|
+
*
|
|
59
|
+
* const signedTx = await delegatedSignTransaction(client, {
|
|
60
|
+
* walletId,
|
|
61
|
+
* walletApiKey,
|
|
62
|
+
* keyShare,
|
|
63
|
+
* transaction,
|
|
64
|
+
* signerAddress: senderAddress, // Explicitly specify who signs
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient, { walletId, walletApiKey, keyShare, transaction, signerAddress, }: {
|
|
69
|
+
walletId: string;
|
|
70
|
+
walletApiKey: string;
|
|
71
|
+
keyShare: any;
|
|
72
|
+
transaction: VersionedTransaction | Transaction;
|
|
73
|
+
signerAddress?: string;
|
|
74
|
+
}) => Promise<VersionedTransaction | Transaction>;
|
|
75
|
+
/**
|
|
76
|
+
* Signs a pre-formatted (raw) message using delegated signing for SVM.
|
|
77
|
+
* The message must be a hex string representing already-hashed data.
|
|
78
|
+
*
|
|
79
|
+
* @param client - The delegated SVM wallet client
|
|
80
|
+
* @param options - Signing options
|
|
81
|
+
* @param options.walletId - The wallet ID
|
|
82
|
+
* @param options.walletApiKey - The wallet API key
|
|
83
|
+
* @param options.keyShare - The server key share
|
|
84
|
+
* @param options.message - Hex string of the already-hashed data to sign
|
|
85
|
+
*
|
|
86
|
+
* @returns The base58-encoded signature
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Sign a pre-hashed message
|
|
90
|
+
* const signature = await delegatedSignRawMessage(client, {
|
|
91
|
+
* walletId,
|
|
92
|
+
* walletApiKey,
|
|
93
|
+
* keyShare,
|
|
94
|
+
* message: preHashedHex, // hex string of already-hashed data
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* // Sign a SHA-256 hash derived from arbitrary application data
|
|
99
|
+
* import { createHash } from 'crypto';
|
|
100
|
+
* const hash = createHash('sha256').update('my application data').digest('hex');
|
|
101
|
+
* const signature = await delegatedSignRawMessage(client, {
|
|
102
|
+
* walletId,
|
|
103
|
+
* walletApiKey,
|
|
104
|
+
* keyShare,
|
|
105
|
+
* message: hash,
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient, { walletId, walletApiKey, keyShare, message, }: {
|
|
110
|
+
walletId: string;
|
|
111
|
+
walletApiKey: string;
|
|
112
|
+
keyShare: ServerKeyShare;
|
|
113
|
+
message: string;
|
|
114
|
+
}) => Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Revoke delegation - delegates to the node package
|
|
117
|
+
*/
|
|
118
|
+
export declare const revokeDelegation: (client: DelegatedSvmWalletClient, params: any) => Promise<void>;
|
|
119
|
+
//# sourceMappingURL=delegatedClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAa,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAMlE,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,sEAMxC,wBAAwB,KAAG,wBAe7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,WACvB,wBAAwB,+DAO7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,KACA,OAAO,CAAC,MAAM,CAwBhB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,wBAAwB,WAC3B,wBAAwB,qEAO7B;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;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