@dynamic-labs-wallet/node-svm 0.0.354 → 0.1.0-request-signing
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/index.cjs +1130 -235
- package/index.esm.js +1127 -238
- package/package.json +3 -3
- package/src/client/client.d.ts +172 -36
- package/src/client/client.d.ts.map +1 -1
- package/src/client/confidentialCheck.d.ts +27 -0
- package/src/client/confidentialCheck.d.ts.map +1 -0
- package/src/client/earn.client.d.ts +56 -0
- package/src/client/earn.client.d.ts.map +1 -0
- package/src/client/earn.constants.d.ts +9 -0
- package/src/client/earn.constants.d.ts.map +1 -0
- package/src/client/earn.types.d.ts +41 -0
- package/src/client/earn.types.d.ts.map +1 -0
- package/src/client/index.d.ts +3 -0
- package/src/client/index.d.ts.map +1 -1
- package/src/delegatedClient.d.ts +61 -56
- package/src/delegatedClient.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-svm",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-request-signing",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "0.0
|
|
8
|
-
"@solana/web3.js": "
|
|
7
|
+
"@dynamic-labs-wallet/node": "0.1.0-request-signing",
|
|
8
|
+
"@solana/web3.js": "1.99.0"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
package/src/client/client.d.ts
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
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';
|
|
1
|
+
import { type ServerKeyShare, DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type DynamicWalletClientProps, type WalletMetadata, type WalletApiKeyCreationResult, type RawSignPreImage, type SignMessageContext, type ConfidentialAccountState, type ConfidentialTransferOperation } from '@dynamic-labs-wallet/node';
|
|
2
|
+
import { type SendOptions, type Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
import type { ClaimEarnRewardsParams, DepositToEarnVaultParams, EarnTransactionResult, ExecuteEarnTransactionParams, WithdrawFromEarnVaultParams } from './earn.types.js';
|
|
4
|
+
type SvmSignableTransaction = VersionedTransaction | Transaction | string;
|
|
5
|
+
type SignTransactionResult = string | {
|
|
6
|
+
signature: string;
|
|
7
|
+
transaction: Transaction | VersionedTransaction;
|
|
8
|
+
};
|
|
9
|
+
export declare const ERROR_SIGN_TRANSACTION_CONTEXT_REQUIRED = "SVM transaction signing requires a chainId or an explicit context.svmTransaction.";
|
|
10
|
+
export declare const ERROR_SIGN_TRANSACTION_RAW_HEX_CONTEXT_REQUIRED = "SVM transaction signing requires an explicit context.svmTransaction when transaction is a raw hex string.";
|
|
3
11
|
export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
4
12
|
readonly chainName = "SVM";
|
|
5
|
-
accountAddress?: string;
|
|
6
|
-
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, enableMPCAccelerator, logger, debug, }: DynamicWalletClientProps);
|
|
13
|
+
readonly accountAddress?: string;
|
|
14
|
+
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, enableMPCAccelerator, logger, requestSigning, debug, }: DynamicWalletClientProps);
|
|
7
15
|
/**
|
|
8
16
|
* Creates a wallet account on the Solana chain
|
|
9
17
|
*
|
|
10
18
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
11
|
-
* @returns The
|
|
19
|
+
* @returns The walletMetadata, raw public key, and client key shares
|
|
12
20
|
*/
|
|
13
|
-
createWalletAccount({ thresholdSignatureScheme, password, onError,
|
|
21
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToDynamic, }: {
|
|
14
22
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
15
23
|
password?: string;
|
|
16
24
|
onError?: (error: Error) => void;
|
|
17
|
-
|
|
25
|
+
backUpToDynamic?: boolean;
|
|
18
26
|
}): Promise<{
|
|
19
|
-
|
|
27
|
+
walletMetadata: WalletMetadata;
|
|
20
28
|
rawPublicKey: Uint8Array | string;
|
|
21
|
-
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
22
29
|
externalServerKeyShares: ServerKeyShare[];
|
|
23
30
|
externalKeySharesWithBackupStatus: Array<{
|
|
24
31
|
share: ServerKeyShare;
|
|
25
32
|
backedUpToClientKeyShareService: boolean;
|
|
26
33
|
}>;
|
|
27
|
-
}>;
|
|
34
|
+
} & WalletApiKeyCreationResult>;
|
|
28
35
|
deriveAccountAddress(rawPublicKey: string | Uint8Array): Promise<{
|
|
29
36
|
accountAddress: string;
|
|
30
37
|
}>;
|
|
@@ -32,46 +39,53 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
32
39
|
* This function takes a message and returns it after being signed with MPC
|
|
33
40
|
*
|
|
34
41
|
* @param message The message to sign (Uint8Array)
|
|
35
|
-
* @param
|
|
42
|
+
* @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
36
43
|
* @param password The password for encrypted backup shares
|
|
37
44
|
*/
|
|
38
|
-
signMessage({ message,
|
|
45
|
+
signMessage({ message, walletMetadata, password, externalServerKeyShares, context, }: {
|
|
39
46
|
message: string | Uint8Array;
|
|
40
|
-
|
|
47
|
+
walletMetadata: WalletMetadata;
|
|
41
48
|
password?: string;
|
|
42
49
|
externalServerKeyShares?: ServerKeyShare[];
|
|
50
|
+
context?: SignMessageContext;
|
|
43
51
|
}): Promise<string>;
|
|
44
52
|
/**
|
|
45
53
|
* Signs a pre-formatted (raw) message without additional encoding.
|
|
46
54
|
* The message must be a hex string representing already-hashed data.
|
|
47
55
|
*
|
|
48
56
|
* @param message The pre-formatted hex message to sign
|
|
49
|
-
* @param
|
|
57
|
+
* @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
50
58
|
* @param password The password for encrypted backup shares
|
|
59
|
+
* @param rawSign Pre-image the digest is derived from, used to build the policy context
|
|
60
|
+
* @param context Explicit policy context, when the caller builds one itself
|
|
51
61
|
*/
|
|
52
|
-
signRawMessage({ message,
|
|
62
|
+
signRawMessage({ message, walletMetadata, password, externalServerKeyShares, context, rawSign, }: {
|
|
53
63
|
message: string;
|
|
54
|
-
|
|
64
|
+
walletMetadata: WalletMetadata;
|
|
55
65
|
password?: string;
|
|
56
66
|
externalServerKeyShares?: ServerKeyShare[];
|
|
67
|
+
context?: SignMessageContext;
|
|
68
|
+
rawSign?: RawSignPreImage;
|
|
57
69
|
}): Promise<string>;
|
|
58
|
-
signTransaction({
|
|
59
|
-
|
|
60
|
-
transaction:
|
|
70
|
+
signTransaction({ walletMetadata, transaction, password, externalServerKeyShares, sponsor, chainId, context, }: {
|
|
71
|
+
walletMetadata: WalletMetadata;
|
|
72
|
+
transaction: SvmSignableTransaction;
|
|
61
73
|
password?: string;
|
|
62
74
|
externalServerKeyShares?: ServerKeyShare[];
|
|
63
75
|
/** If true, requests gas sponsorship from Dynamic before signing. */
|
|
64
76
|
sponsor?: boolean;
|
|
65
|
-
|
|
77
|
+
chainId?: string;
|
|
78
|
+
context?: SignMessageContext;
|
|
79
|
+
}): Promise<SignTransactionResult>;
|
|
66
80
|
/**
|
|
67
|
-
* Exports the private key for a given
|
|
81
|
+
* Exports the private key for a given wallet
|
|
68
82
|
*
|
|
69
|
-
* @param
|
|
83
|
+
* @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare)
|
|
70
84
|
* @param password The password for encrypted backup shares
|
|
71
85
|
* @returns The private key
|
|
72
86
|
*/
|
|
73
|
-
exportPrivateKey({
|
|
74
|
-
|
|
87
|
+
exportPrivateKey({ walletMetadata, password, externalServerKeyShares, }: {
|
|
88
|
+
walletMetadata: WalletMetadata;
|
|
75
89
|
password?: string;
|
|
76
90
|
externalServerKeyShares?: ServerKeyShare[];
|
|
77
91
|
}): Promise<string>;
|
|
@@ -80,6 +94,11 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
80
94
|
*
|
|
81
95
|
* @param keyShares The key shares to export the private key for
|
|
82
96
|
* @returns The private key
|
|
97
|
+
*
|
|
98
|
+
* `derivationPath` is the JSON-serialized index map that
|
|
99
|
+
* `walletMetadata.derivationPath` carries (e.g. `'{"0":44,"1":60,"2":0,"3":0,"4":0}'`
|
|
100
|
+
* or `'[44,60,0,0,0]'`). BIP-32 strings such as `"m/44'/60'/0'/0/0"` are rejected.
|
|
101
|
+
* Omit it to export without path derivation.
|
|
83
102
|
*/
|
|
84
103
|
offlineExportPrivateKey({ keyShares, derivationPath, }: {
|
|
85
104
|
keyShares: Ed25519KeygenResult[];
|
|
@@ -103,19 +122,18 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
103
122
|
* @param chainName The chain name to import the private key for
|
|
104
123
|
* @param thresholdSignatureScheme The threshold signature scheme to use
|
|
105
124
|
* @param password The password for encrypted backup shares
|
|
106
|
-
* @returns The
|
|
125
|
+
* @returns The walletMetadata, raw public key, and client key shares
|
|
107
126
|
*/
|
|
108
|
-
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError,
|
|
127
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, backUpToDynamic, }: {
|
|
109
128
|
privateKey: string;
|
|
110
129
|
chainName: string;
|
|
111
130
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
112
131
|
password?: string;
|
|
113
132
|
onError?: (error: Error) => void;
|
|
114
|
-
|
|
133
|
+
backUpToDynamic?: boolean;
|
|
115
134
|
}): Promise<{
|
|
116
|
-
|
|
135
|
+
walletMetadata: WalletMetadata;
|
|
117
136
|
rawPublicKey: Uint8Array | string | undefined;
|
|
118
|
-
/** @deprecated Use externalKeySharesWithBackupStatus instead */
|
|
119
137
|
externalServerKeyShares: ServerKeyShare[];
|
|
120
138
|
externalKeySharesWithBackupStatus: Array<{
|
|
121
139
|
share: ServerKeyShare;
|
|
@@ -126,20 +144,138 @@ export declare class DynamicSvmWalletClient extends DynamicWalletClient {
|
|
|
126
144
|
* Sponsors a Solana transaction via the Dynamic gas sponsorship API.
|
|
127
145
|
*
|
|
128
146
|
* Sends the unsigned transaction to Dynamic's sponsorTransaction endpoint,
|
|
129
|
-
* which replaces the fee payer with the sponsor's address. The
|
|
130
|
-
*
|
|
131
|
-
* {@link signTransaction} instead of the
|
|
147
|
+
* which replaces the fee payer with the sponsor's address. The endpoint
|
|
148
|
+
* always returns a v0 versioned transaction, which is deserialized and
|
|
149
|
+
* returned. It should be passed to {@link signTransaction} instead of the
|
|
150
|
+
* original transaction.
|
|
132
151
|
*
|
|
133
152
|
* Gas sponsorship must be enabled for your environment in the Dynamic
|
|
134
153
|
* dashboard before calling this method.
|
|
135
154
|
*
|
|
136
155
|
* @param transaction - Unsigned Solana transaction (legacy or versioned).
|
|
137
|
-
* @
|
|
156
|
+
* @param userId - End user the transaction is for. Required when the signer is
|
|
157
|
+
* that user's wallet rather than one of the caller's own server wallets.
|
|
158
|
+
* @returns The sponsored v0 transaction with the gas sponsor as fee payer.
|
|
138
159
|
*/
|
|
139
|
-
sponsorTransaction({ transaction, traceContext, }: {
|
|
160
|
+
sponsorTransaction({ transaction, userId, traceContext, }: {
|
|
140
161
|
transaction: VersionedTransaction | Transaction;
|
|
162
|
+
userId?: string;
|
|
141
163
|
traceContext?: TraceContext;
|
|
142
|
-
}): Promise<VersionedTransaction
|
|
143
|
-
|
|
164
|
+
}): Promise<VersionedTransaction>;
|
|
165
|
+
/**
|
|
166
|
+
* Reads the address that signs as fee payer for sponsored transactions in
|
|
167
|
+
* this environment. Build transactions that name it as fee payer (for example
|
|
168
|
+
* LI.FI `svmSponsor`) before passing them to {@link sponsorTransaction}.
|
|
169
|
+
*
|
|
170
|
+
* Gas sponsorship must be enabled for your environment in the Dynamic
|
|
171
|
+
* dashboard.
|
|
172
|
+
*/
|
|
173
|
+
getSponsorAddress({ traceContext }?: {
|
|
174
|
+
traceContext?: TraceContext;
|
|
175
|
+
}): Promise<string>;
|
|
176
|
+
private readonly svmAccountState;
|
|
177
|
+
private readonly confidentialBlockhash;
|
|
178
|
+
private readonly broadcastConfidentialTransactions;
|
|
179
|
+
/**
|
|
180
|
+
* Generates a Token-2022 confidential-transfer seed inside the enclave and
|
|
181
|
+
* stores the sealed result in CKS. Returns the ElGamal public key and the
|
|
182
|
+
* derivation version — persist it for later confidential operations.
|
|
183
|
+
*/
|
|
184
|
+
createConfidentialSeed({ walletId, solanaAddress, derivationVersion, traceContext, }: {
|
|
185
|
+
walletId: string;
|
|
186
|
+
solanaAddress: string;
|
|
187
|
+
derivationVersion?: number;
|
|
188
|
+
traceContext?: TraceContext;
|
|
189
|
+
}): Promise<import("@dynamic-labs-wallet/node").CreateConfidentialSeedResponse>;
|
|
190
|
+
/**
|
|
191
|
+
* Decrypts a confidential token account's available and pending balances
|
|
192
|
+
* inside the enclave. Reads the account from `rpcUrl` unless `accountState`
|
|
193
|
+
* is supplied. Balances are decimal strings in base units.
|
|
194
|
+
*/
|
|
195
|
+
getConfidentialBalance({ walletId, solanaAddress, mint, tokenAccount, accountState, derivationVersion, rpcUrl, traceContext, }: {
|
|
196
|
+
walletId: string;
|
|
197
|
+
solanaAddress: string;
|
|
198
|
+
mint: string;
|
|
199
|
+
tokenAccount: string;
|
|
200
|
+
accountState?: ConfidentialAccountState;
|
|
201
|
+
derivationVersion?: number;
|
|
202
|
+
rpcUrl?: string;
|
|
203
|
+
traceContext?: TraceContext;
|
|
204
|
+
}): Promise<import("@dynamic-labs-wallet/node").SvmConfidentialBalanceResponse>;
|
|
205
|
+
/**
|
|
206
|
+
* Builds and signs Token-2022 confidential-transfer transactions.
|
|
207
|
+
*
|
|
208
|
+
* The enclave is offline, so any missing `accountState` /
|
|
209
|
+
* `destinationAccountState` and the latest blockhash are fetched from
|
|
210
|
+
* `rpcUrl` on the caller's behalf. The enclave builds one unsigned v1
|
|
211
|
+
* transaction bound by a `transactionsTag`; `signConfidentialTransactions`
|
|
212
|
+
* provisions one MPC room for the operation and the client share joins it
|
|
213
|
+
* like an ordinary `signTransaction` ceremony. Pass `broadcast: true` to
|
|
214
|
+
* also submit the signed transaction to the cluster.
|
|
215
|
+
*
|
|
216
|
+
* @returns The signed transactions (base64, broadcast order), their
|
|
217
|
+
* signatures, and — when broadcast — the submitted transaction ids.
|
|
218
|
+
*/
|
|
219
|
+
signConfidentialTransfer({ walletId, walletMetadata, operation, solanaAddress, mint, tokenAccount, destinationTokenAccount, amount, decimals, accountState, destinationAccountState, auditorElgamalPubkey, feePayer, derivationVersion, chainId, lamportsPerByte, recentBlockhash, lastValidBlockHeight, rpcUrl, broadcast, broadcastOptions, password, externalServerKeyShares, traceContext, }: {
|
|
220
|
+
walletId: string;
|
|
221
|
+
walletMetadata: WalletMetadata;
|
|
222
|
+
operation: ConfidentialTransferOperation;
|
|
223
|
+
solanaAddress: string;
|
|
224
|
+
mint: string;
|
|
225
|
+
tokenAccount: string;
|
|
226
|
+
destinationTokenAccount?: string;
|
|
227
|
+
amount?: string;
|
|
228
|
+
decimals?: number;
|
|
229
|
+
accountState?: ConfidentialAccountState;
|
|
230
|
+
destinationAccountState?: ConfidentialAccountState;
|
|
231
|
+
auditorElgamalPubkey?: string;
|
|
232
|
+
feePayer?: string;
|
|
233
|
+
derivationVersion?: number;
|
|
234
|
+
chainId?: string;
|
|
235
|
+
lamportsPerByte?: string;
|
|
236
|
+
/** Fetched from `rpcUrl` when omitted. */
|
|
237
|
+
recentBlockhash?: string;
|
|
238
|
+
lastValidBlockHeight?: string;
|
|
239
|
+
/** Solana JSON-RPC endpoint, required to fetch account state / blockhash or to broadcast. */
|
|
240
|
+
rpcUrl?: string;
|
|
241
|
+
broadcast?: boolean;
|
|
242
|
+
broadcastOptions?: SendOptions;
|
|
243
|
+
password?: string;
|
|
244
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
245
|
+
traceContext?: TraceContext;
|
|
246
|
+
}): Promise<{
|
|
247
|
+
serializedTransactions: string[];
|
|
248
|
+
signatures: string[];
|
|
249
|
+
transactionIds: string[] | undefined;
|
|
250
|
+
}>;
|
|
251
|
+
/**
|
|
252
|
+
* Validates `rpcUrl`, fetches missing account states and the latest
|
|
253
|
+
* blockhash, and returns the inputs the enclave request needs.
|
|
254
|
+
*/
|
|
255
|
+
private readonly resolveConfidentialInputs;
|
|
256
|
+
private readonly assertConfidentialRpcUrl;
|
|
257
|
+
/** @deprecated Use getWalletByAddress instead for better performance */
|
|
258
|
+
getSvmWallets(): Promise<{
|
|
259
|
+
walletId: string;
|
|
260
|
+
chainName: string;
|
|
261
|
+
accountAddress: string;
|
|
262
|
+
externalServerKeySharesBackupInfo: import("packages/core/src/types.js").KeyShareBackupInfo;
|
|
263
|
+
externalServerKeyShares: never[];
|
|
264
|
+
derivationPath: string | undefined;
|
|
265
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
266
|
+
}[]>;
|
|
267
|
+
private get svmEarn();
|
|
268
|
+
/**
|
|
269
|
+
* Executes an Earn signing payload returned by the prepare* methods, signing and
|
|
270
|
+
* sending its ordered Solana transaction sequence one transaction at a time.
|
|
271
|
+
*/
|
|
272
|
+
executeEarnTransaction(params: ExecuteEarnTransactionParams): Promise<EarnTransactionResult>;
|
|
273
|
+
/** Prepares and executes a deposit into an Earn vault. */
|
|
274
|
+
depositToEarnVault(params: DepositToEarnVaultParams): Promise<EarnTransactionResult>;
|
|
275
|
+
/** Prepares and executes a withdrawal from an Earn vault. */
|
|
276
|
+
withdrawFromEarnVault(params: WithdrawFromEarnVaultParams): Promise<EarnTransactionResult>;
|
|
277
|
+
/** Prepares and executes a claim of accrued Earn vault rewards. */
|
|
278
|
+
claimEarnRewards(params: ClaimEarnRewardsParams): Promise<EarnTransactionResult>;
|
|
144
279
|
}
|
|
280
|
+
export {};
|
|
145
281
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAGjB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAE/B,KAAK,eAAe,EAGpB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EACnC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,iBAAiB,CAAC;AAKzB,KAAK,sBAAsB,GAAG,oBAAoB,GAAG,WAAW,GAAG,MAAM,CAAC;AAC1E,KAAK,qBAAqB,GAAG,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAA;CAAE,CAAC;AAM7G,eAAO,MAAM,uCAAuC,sFACiC,CAAC;AAEtF,eAAO,MAAM,+CAA+C,8GACiD,CAAC;AAgD9G,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAC3B,QAAQ,CAAC,cAAc,CAAC,E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,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,0CAA0C;QAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,6FAA6F;QAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,gBAAgB,CAAC,EAAE,WAAW,CAAC;QAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,uBAAuB,CAAC,EAAE,cAAc,EAAE,CAAC;QAC3C,YAAY,CAAC,EAAE,YAAY,CAAC;KAC7B;;;;;IA0HD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAkDxC;IAEF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAOvC;IAEF,wEAAwE;IAClE,aAAa;;;;;;;;;IAYnB,OAAO,KAAK,OAAO,GAKlB;IAED;;;OAGG;IACG,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIlG,0DAA0D;IACpD,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1F,6DAA6D;IACvD,qBAAqB,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhG,mEAAmE;IAC7D,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAGvF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ConfidentialTransferOperation } from '@dynamic-labs-wallet/node';
|
|
2
|
+
/** Message bytes an MPC signer signs: a v1 wire is message || 64B signature slots. */
|
|
3
|
+
export declare const confidentialSignedMessageBytes: (wire: Uint8Array, numRequiredSignatures: number) => Uint8Array;
|
|
4
|
+
/** Insert the wallet signature into the sole v1 signature slot (signer index 0). */
|
|
5
|
+
export declare const injectConfidentialSignature: (wire: Uint8Array, signature: Uint8Array) => Uint8Array;
|
|
6
|
+
type ConfidentialCheckParams = {
|
|
7
|
+
serializedTransactions: string[];
|
|
8
|
+
solanaAddress: string;
|
|
9
|
+
operation: ConfidentialTransferOperation;
|
|
10
|
+
mint: string;
|
|
11
|
+
tokenAccount: string;
|
|
12
|
+
destinationTokenAccount?: string;
|
|
13
|
+
amount?: string;
|
|
14
|
+
decimals?: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Structural check on the enclave-built confidential transaction before the
|
|
18
|
+
* client share joins the MPC room: must be one v1 message, the wallet must be
|
|
19
|
+
* fee payer and only signer, only expected programs and instruction kinds may
|
|
20
|
+
* appear, and the confidential instruction must match the requested
|
|
21
|
+
* operation, mint, token accounts and amounts. The enclave's
|
|
22
|
+
* `transactionsTag` binds the build; this only guards against a bad build
|
|
23
|
+
* reaching the ceremony.
|
|
24
|
+
*/
|
|
25
|
+
export declare const checkConfidentialTransactions: (params: ConfidentialCheckParams) => void;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=confidentialCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidentialCheck.d.ts","sourceRoot":"","sources":["../../src/client/confidentialCheck.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAiC/E,sFAAsF;AACtF,eAAO,MAAM,8BAA8B,SAAU,UAAU,yBAAyB,MAAM,KAAG,UACjB,CAAC;AAEjF,oFAAoF;AACpF,eAAO,MAAM,2BAA2B,SAAU,UAAU,aAAa,UAAU,KAAG,UACM,CAAC;AAE7F,KAAK,uBAAuB,GAAG;IAC7B,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,6BAA6B,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAoEF;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,WAAY,uBAAuB,KAAG,IA4B/E,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { EarnClient, ServerKeyShare, SignMessageContext, WalletMetadata } from '@dynamic-labs-wallet/node';
|
|
2
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
+
import type { ClaimEarnRewardsParams, DepositToEarnVaultParams, EarnTransactionResult, ExecuteEarnTransactionParams, WithdrawFromEarnVaultParams } from './earn.types.js';
|
|
4
|
+
type EarnStepErrorCode = 'yield_step_expired' | 'yield_step_failed' | 'yield_step_send_failed' | 'yield_step_confirmation_unknown';
|
|
5
|
+
/**
|
|
6
|
+
* A transaction in the sequence could not land. Transactions before `ordinal` already
|
|
7
|
+
* confirmed on-chain, so the action may be partially applied.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EarnSolanaStepError extends Error {
|
|
10
|
+
readonly code: EarnStepErrorCode;
|
|
11
|
+
readonly ordinal: number;
|
|
12
|
+
readonly signature?: string;
|
|
13
|
+
constructor({ cause, code, ordinal, reason, signature, total, }: {
|
|
14
|
+
cause?: Error;
|
|
15
|
+
code: EarnStepErrorCode;
|
|
16
|
+
ordinal: number;
|
|
17
|
+
reason: string;
|
|
18
|
+
signature?: string;
|
|
19
|
+
total: number;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
type SignEarnTransaction = (args: {
|
|
23
|
+
walletMetadata: WalletMetadata;
|
|
24
|
+
transaction: Transaction | VersionedTransaction;
|
|
25
|
+
password?: string;
|
|
26
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
27
|
+
sponsor?: boolean;
|
|
28
|
+
chainId?: string;
|
|
29
|
+
context?: SignMessageContext;
|
|
30
|
+
}) => Promise<string | {
|
|
31
|
+
signature: string;
|
|
32
|
+
transaction: Transaction | VersionedTransaction;
|
|
33
|
+
}>;
|
|
34
|
+
/** Primitives the Earn client borrows from whoever owns the wallet. */
|
|
35
|
+
export type SvmEarnClientDeps = {
|
|
36
|
+
getEarnClient: () => EarnClient;
|
|
37
|
+
signTransaction: SignEarnTransaction;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Builds a stateless Earn client for Solana vaults: it prepares vault actions through the
|
|
41
|
+
* Dynamic API and executes the returned ordered transaction sequence one transaction at a
|
|
42
|
+
* time — never in parallel, because a later transaction can depend on the state an earlier
|
|
43
|
+
* one wrote. If one fails, the sequence stops and the thrown {@link EarnSolanaStepError}
|
|
44
|
+
* reports how much of the action already landed.
|
|
45
|
+
*
|
|
46
|
+
* Gas sponsorship is opt-in (`sponsored: true`): vault transactions are built with the
|
|
47
|
+
* owner as fee payer, unlike the browser SDK which sponsors automatically.
|
|
48
|
+
*/
|
|
49
|
+
export declare const createSvmEarnClient: ({ getEarnClient, signTransaction }: SvmEarnClientDeps) => {
|
|
50
|
+
executeEarnTransaction: ({ signingPayload, walletMetadata, password, externalServerKeyShares, sponsored, rpcUrl, chainId, context, onStepChange, onTransactionStepChange, }: ExecuteEarnTransactionParams) => Promise<EarnTransactionResult>;
|
|
51
|
+
depositToEarnVault: ({ vaultId, amount, receiverAddress, traceContext, ...walletParams }: DepositToEarnVaultParams) => Promise<EarnTransactionResult>;
|
|
52
|
+
withdrawFromEarnVault: ({ vaultId, amount, receiverAddress, traceContext, ...walletParams }: WithdrawFromEarnVaultParams) => Promise<EarnTransactionResult>;
|
|
53
|
+
claimEarnRewards: ({ vaultId, traceContext, ...walletParams }: ClaimEarnRewardsParams) => Promise<EarnTransactionResult>;
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=earn.client.d.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OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,KAAK,OAAO,CAAC,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,GAAG,oBAAoB,CAAA;CAAE,CAAC,CAAC;AAE/F,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,MAAM,UAAU,CAAC;IAChC,eAAe,EAAE,mBAAmB,CAAC;CACtC,CAAC;AAsJF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,uCAAwC,iBAAiB;iLAmHpF,4BAA4B,KAAG,OAAO,CAAC,qBAAqB,CAAC;8FAsD3D,wBAAwB,KAAG,OAAO,CAAC,qBAAqB,CAAC;iGAiBzD,2BAA2B,KAAG,OAAO,CAAC,qBAAqB,CAAC;mEAe5D,sBAAsB,KAAG,OAAO,CAAC,qBAAqB,CAAC;CAS7D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const ERROR_EARN_NOT_SVM_WALLET = "Wallet metadata is not for an SVM wallet";
|
|
2
|
+
export declare const ERROR_EARN_MISSING_TRANSACTIONS = "Earn signing payload is missing the Solana transaction sequence";
|
|
3
|
+
export declare const ERROR_EARN_NON_CONTIGUOUS_ORDINALS = "Earn signing payload transaction ordinals must be contiguous from zero";
|
|
4
|
+
/** Default RPC per Dynamic Solana chain id (101 mainnet, 103 devnet); `rpcUrl` overrides. */
|
|
5
|
+
export declare const EARN_SOLANA_RPC_BY_CHAIN_ID: Record<string, string>;
|
|
6
|
+
/** Blockhash checks run at `processed`, the commitment that sees new blockhashes first. */
|
|
7
|
+
export declare const EARN_SOLANA_BLOCKHASH_COMMITMENT: "processed";
|
|
8
|
+
export declare const EARN_CONFIRMATION_POLL_INTERVAL_MS = 1000;
|
|
9
|
+
//# sourceMappingURL=earn.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earn.constants.d.ts","sourceRoot":"","sources":["../../src/client/earn.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,6CAA6C,CAAC;AAEpF,eAAO,MAAM,+BAA+B,oEAAoE,CAAC;AAEjH,eAAO,MAAM,kCAAkC,2EAC2B,CAAC;AAE3E,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG9D,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,gCAAgC,aAAuB,CAAC;AAErE,eAAO,MAAM,kCAAkC,OAAO,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { EarnExecutionStep, EarnSigningPayload, ServerKeyShare, SignMessageContext, TraceContext, WalletMetadata } from '@dynamic-labs-wallet/node';
|
|
2
|
+
export type { EarnExecutionStep, EarnTransactionResult } from '@dynamic-labs-wallet/node';
|
|
3
|
+
/** Position of the transaction about to be signed within the ordered sequence. */
|
|
4
|
+
export type EarnTransactionStepProgress = {
|
|
5
|
+
label?: string;
|
|
6
|
+
ordinal: number;
|
|
7
|
+
total: number;
|
|
8
|
+
};
|
|
9
|
+
/** Wallet context and chain access every Earn write action needs. */
|
|
10
|
+
export type SvmEarnWalletParams = {
|
|
11
|
+
walletMetadata: WalletMetadata;
|
|
12
|
+
password?: string;
|
|
13
|
+
externalServerKeyShares?: ServerKeyShare[];
|
|
14
|
+
/** Opt in to Dynamic gas sponsorship for every transaction in the sequence. */
|
|
15
|
+
sponsored?: boolean;
|
|
16
|
+
/** Solana RPC endpoint; defaults to the public cluster for the payload's `chainId` (101 mainnet, 103 devnet). */
|
|
17
|
+
rpcUrl?: string;
|
|
18
|
+
chainId?: string;
|
|
19
|
+
context?: SignMessageContext;
|
|
20
|
+
onStepChange?: (step: EarnExecutionStep) => void;
|
|
21
|
+
/** Invoked as each transaction in the sequence is about to be signed. */
|
|
22
|
+
onTransactionStepChange?: (step: EarnTransactionStepProgress) => void;
|
|
23
|
+
traceContext?: TraceContext;
|
|
24
|
+
};
|
|
25
|
+
export type ExecuteEarnTransactionParams = Omit<SvmEarnWalletParams, 'traceContext'> & {
|
|
26
|
+
signingPayload: EarnSigningPayload;
|
|
27
|
+
};
|
|
28
|
+
export type DepositToEarnVaultParams = SvmEarnWalletParams & {
|
|
29
|
+
vaultId: string;
|
|
30
|
+
amount: string;
|
|
31
|
+
receiverAddress?: string;
|
|
32
|
+
};
|
|
33
|
+
export type WithdrawFromEarnVaultParams = SvmEarnWalletParams & {
|
|
34
|
+
vaultId: string;
|
|
35
|
+
amount: string;
|
|
36
|
+
receiverAddress?: string;
|
|
37
|
+
};
|
|
38
|
+
export type ClaimEarnRewardsParams = SvmEarnWalletParams & {
|
|
39
|
+
vaultId: string;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=earn.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earn.types.d.ts","sourceRoot":"","sources":["../../src/client/earn.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAE1F,kFAAkF;AAClF,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iHAAiH;IACjH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,yEAAyE;IACzE,uBAAuB,CAAC,EAAE,CAAC,IAAI,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACtE,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,mBAAmB,EAAE,cAAc,CAAC,GAAG;IACrF,cAAc,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,mBAAmB,GAAG;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
package/src/client/index.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ export * from './client.js';
|
|
|
2
2
|
export * from './utils.js';
|
|
3
3
|
export * from './base58.js';
|
|
4
4
|
export * from './constants.js';
|
|
5
|
+
export { createSvmEarnClient, EarnSolanaStepError } from './earn.client.js';
|
|
6
|
+
export type { SvmEarnClientDeps } from './earn.client.js';
|
|
7
|
+
export type { ClaimEarnRewardsParams, DepositToEarnVaultParams, EarnTransactionStepProgress, ExecuteEarnTransactionParams, SvmEarnWalletParams, WithdrawFromEarnVaultParams, } from './earn.types.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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"}
|
|
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;AAC/B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|