@coinbase/cdp-sdk 1.49.1 → 1.50.0
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/CHANGELOG.md +12 -0
- package/_cjs/client/end-user/endUser.js +21 -42
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/end-user/toEndUserAccount.js +18 -43
- package/_cjs/client/end-user/toEndUserAccount.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/client/end-user/endUser.js +21 -42
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/end-user/toEndUserAccount.js +18 -43
- package/_esm/client/end-user/toEndUserAccount.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +63 -4
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/end-user/toEndUserAccount.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/client/end-user/endUser.ts +113 -69
- package/client/end-user/endUser.types.ts +63 -4
- package/client/end-user/toEndUserAccount.ts +103 -64
- package/package.json +2 -2
- package/version.ts +1 -1
|
@@ -128,23 +128,25 @@ export function toEndUserAccount(
|
|
|
128
128
|
|
|
129
129
|
// ─── Account Management Methods ───
|
|
130
130
|
|
|
131
|
-
async addEvmAccount(): Promise<AddEndUserEvmAccountResult> {
|
|
131
|
+
async addEvmAccount(idempotencyKey?: string): Promise<AddEndUserEvmAccountResult> {
|
|
132
132
|
Analytics.trackAction({ action: "end_user_add_evm_account" });
|
|
133
|
-
return apiClient.addEndUserEvmAccount(endUser.userId, {});
|
|
133
|
+
return apiClient.addEndUserEvmAccount(endUser.userId, {}, idempotencyKey);
|
|
134
134
|
},
|
|
135
135
|
|
|
136
136
|
async addEvmSmartAccount(
|
|
137
137
|
smartAccountOptions: AddEvmSmartAccountOptions,
|
|
138
138
|
): Promise<AddEndUserEvmSmartAccountResult> {
|
|
139
139
|
Analytics.trackAction({ action: "end_user_add_evm_smart_account" });
|
|
140
|
-
return apiClient.addEndUserEvmSmartAccount(
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
return apiClient.addEndUserEvmSmartAccount(
|
|
141
|
+
endUser.userId,
|
|
142
|
+
{ enableSpendPermissions: smartAccountOptions.enableSpendPermissions },
|
|
143
|
+
smartAccountOptions.idempotencyKey,
|
|
144
|
+
);
|
|
143
145
|
},
|
|
144
146
|
|
|
145
|
-
async addSolanaAccount(): Promise<AddEndUserSolanaAccountResult> {
|
|
147
|
+
async addSolanaAccount(idempotencyKey?: string): Promise<AddEndUserSolanaAccountResult> {
|
|
146
148
|
Analytics.trackAction({ action: "end_user_add_solana_account" });
|
|
147
|
-
return apiClient.addEndUserSolanaAccount(endUser.userId, {});
|
|
149
|
+
return apiClient.addEndUserSolanaAccount(endUser.userId, {}, idempotencyKey);
|
|
148
150
|
},
|
|
149
151
|
|
|
150
152
|
async getDelegation(): Promise<GetDelegationForEndUserResult> {
|
|
@@ -152,9 +154,9 @@ export function toEndUserAccount(
|
|
|
152
154
|
return apiClient.getDelegationForEndUser(endUser.userId);
|
|
153
155
|
},
|
|
154
156
|
|
|
155
|
-
async revokeDelegation(): Promise<void> {
|
|
157
|
+
async revokeDelegation(idempotencyKey?: string): Promise<void> {
|
|
156
158
|
Analytics.trackAction({ action: "end_user_revoke_delegation" });
|
|
157
|
-
await apiClient.revokeDelegationForEndUser(endUser.userId, {});
|
|
159
|
+
await apiClient.revokeDelegationForEndUser(endUser.userId, {}, undefined, idempotencyKey);
|
|
158
160
|
},
|
|
159
161
|
|
|
160
162
|
// ─── Account-Scoped Delegation Methods ───
|
|
@@ -188,28 +190,34 @@ export function toEndUserAccount(
|
|
|
188
190
|
): Promise<SignEvmTransactionResult> {
|
|
189
191
|
Analytics.trackAction({ action: "end_user_sign_evm_transaction" });
|
|
190
192
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
191
|
-
return apiClient.signEvmTransactionWithEndUserAccount(
|
|
192
|
-
|
|
193
|
-
transaction: opts.transaction,
|
|
194
|
-
|
|
193
|
+
return apiClient.signEvmTransactionWithEndUserAccount(
|
|
194
|
+
endUser.userId,
|
|
195
|
+
{ address, transaction: opts.transaction },
|
|
196
|
+
undefined,
|
|
197
|
+
opts.idempotencyKey,
|
|
198
|
+
);
|
|
195
199
|
},
|
|
196
200
|
|
|
197
201
|
async signEvmMessage(opts: AccountSignEvmMessageOptions): Promise<SignEvmMessageResult> {
|
|
198
202
|
Analytics.trackAction({ action: "end_user_sign_evm_message" });
|
|
199
203
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
200
|
-
return apiClient.signEvmMessageWithEndUserAccount(
|
|
201
|
-
|
|
202
|
-
message: opts.message,
|
|
203
|
-
|
|
204
|
+
return apiClient.signEvmMessageWithEndUserAccount(
|
|
205
|
+
endUser.userId,
|
|
206
|
+
{ address, message: opts.message },
|
|
207
|
+
undefined,
|
|
208
|
+
opts.idempotencyKey,
|
|
209
|
+
);
|
|
204
210
|
},
|
|
205
211
|
|
|
206
212
|
async signEvmTypedData(opts: AccountSignEvmTypedDataOptions): Promise<SignEvmTypedDataResult> {
|
|
207
213
|
Analytics.trackAction({ action: "end_user_sign_evm_typed_data" });
|
|
208
214
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
209
|
-
return apiClient.signEvmTypedDataWithEndUserAccount(
|
|
210
|
-
|
|
211
|
-
typedData: opts.typedData,
|
|
212
|
-
|
|
215
|
+
return apiClient.signEvmTypedDataWithEndUserAccount(
|
|
216
|
+
endUser.userId,
|
|
217
|
+
{ address, typedData: opts.typedData },
|
|
218
|
+
undefined,
|
|
219
|
+
opts.idempotencyKey,
|
|
220
|
+
);
|
|
213
221
|
},
|
|
214
222
|
|
|
215
223
|
// ─── Delegated EVM Send Methods ───
|
|
@@ -219,24 +227,32 @@ export function toEndUserAccount(
|
|
|
219
227
|
): Promise<SendEvmTransactionResult> {
|
|
220
228
|
Analytics.trackAction({ action: "end_user_send_evm_transaction" });
|
|
221
229
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
222
|
-
return apiClient.sendEvmTransactionWithEndUserAccount(
|
|
223
|
-
|
|
224
|
-
transaction: opts.transaction,
|
|
225
|
-
|
|
226
|
-
|
|
230
|
+
return apiClient.sendEvmTransactionWithEndUserAccount(
|
|
231
|
+
endUser.userId,
|
|
232
|
+
{ address, transaction: opts.transaction, network: opts.network },
|
|
233
|
+
undefined,
|
|
234
|
+
opts.idempotencyKey,
|
|
235
|
+
);
|
|
227
236
|
},
|
|
228
237
|
|
|
229
238
|
async sendEvmAsset(opts: AccountSendEvmAssetOptions): Promise<SendEvmAssetResult> {
|
|
230
239
|
Analytics.trackAction({ action: "end_user_send_evm_asset" });
|
|
231
240
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
232
241
|
const asset = opts.asset ?? "usdc";
|
|
233
|
-
return apiClient.sendEvmAssetWithEndUserAccount(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
242
|
+
return apiClient.sendEvmAssetWithEndUserAccount(
|
|
243
|
+
endUser.userId,
|
|
244
|
+
address,
|
|
245
|
+
asset,
|
|
246
|
+
{
|
|
247
|
+
to: opts.to,
|
|
248
|
+
amount: opts.amount,
|
|
249
|
+
network: opts.network,
|
|
250
|
+
useCdpPaymaster: opts.useCdpPaymaster,
|
|
251
|
+
paymasterUrl: opts.paymasterUrl,
|
|
252
|
+
},
|
|
253
|
+
undefined,
|
|
254
|
+
opts.idempotencyKey,
|
|
255
|
+
);
|
|
240
256
|
},
|
|
241
257
|
|
|
242
258
|
async sendUserOperation(
|
|
@@ -244,13 +260,19 @@ export function toEndUserAccount(
|
|
|
244
260
|
): Promise<SendUserOperationResult> {
|
|
245
261
|
Analytics.trackAction({ action: "end_user_send_user_operation" });
|
|
246
262
|
const address = resolveEvmSmartAccountAddress(endUser, opts.address);
|
|
247
|
-
return apiClient.sendUserOperationWithEndUserAccount(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
263
|
+
return apiClient.sendUserOperationWithEndUserAccount(
|
|
264
|
+
endUser.userId,
|
|
265
|
+
address,
|
|
266
|
+
{
|
|
267
|
+
network: opts.network,
|
|
268
|
+
calls: opts.calls,
|
|
269
|
+
useCdpPaymaster: opts.useCdpPaymaster,
|
|
270
|
+
paymasterUrl: opts.paymasterUrl,
|
|
271
|
+
dataSuffix: opts.dataSuffix,
|
|
272
|
+
},
|
|
273
|
+
undefined,
|
|
274
|
+
opts.idempotencyKey,
|
|
275
|
+
);
|
|
254
276
|
},
|
|
255
277
|
|
|
256
278
|
// ─── Delegated EVM EIP-7702 Delegation Method ───
|
|
@@ -260,11 +282,16 @@ export function toEndUserAccount(
|
|
|
260
282
|
): Promise<CreateEvmEip7702DelegationForEndUserResult> {
|
|
261
283
|
Analytics.trackAction({ action: "end_user_create_evm_eip7702_delegation" });
|
|
262
284
|
const address = resolveEvmAddress(endUser, opts.address);
|
|
263
|
-
return apiClient.createEvmEip7702DelegationWithEndUserAccount(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
285
|
+
return apiClient.createEvmEip7702DelegationWithEndUserAccount(
|
|
286
|
+
endUser.userId,
|
|
287
|
+
{
|
|
288
|
+
address,
|
|
289
|
+
network: opts.network,
|
|
290
|
+
enableSpendPermissions: opts.enableSpendPermissions,
|
|
291
|
+
},
|
|
292
|
+
undefined,
|
|
293
|
+
opts.idempotencyKey,
|
|
294
|
+
);
|
|
268
295
|
},
|
|
269
296
|
|
|
270
297
|
// ─── Delegated Solana Sign Methods ───
|
|
@@ -274,10 +301,12 @@ export function toEndUserAccount(
|
|
|
274
301
|
): Promise<SignSolanaMessageResult> {
|
|
275
302
|
Analytics.trackAction({ action: "end_user_sign_solana_message" });
|
|
276
303
|
const address = resolveSolanaAddress(endUser, opts.address);
|
|
277
|
-
return apiClient.signSolanaMessageWithEndUserAccount(
|
|
278
|
-
|
|
279
|
-
message: opts.message,
|
|
280
|
-
|
|
304
|
+
return apiClient.signSolanaMessageWithEndUserAccount(
|
|
305
|
+
endUser.userId,
|
|
306
|
+
{ address, message: opts.message },
|
|
307
|
+
undefined,
|
|
308
|
+
opts.idempotencyKey,
|
|
309
|
+
);
|
|
281
310
|
},
|
|
282
311
|
|
|
283
312
|
async signSolanaTransaction(
|
|
@@ -285,10 +314,12 @@ export function toEndUserAccount(
|
|
|
285
314
|
): Promise<SignSolanaTransactionResult> {
|
|
286
315
|
Analytics.trackAction({ action: "end_user_sign_solana_transaction" });
|
|
287
316
|
const address = resolveSolanaAddress(endUser, opts.address);
|
|
288
|
-
return apiClient.signSolanaTransactionWithEndUserAccount(
|
|
289
|
-
|
|
290
|
-
transaction: opts.transaction,
|
|
291
|
-
|
|
317
|
+
return apiClient.signSolanaTransactionWithEndUserAccount(
|
|
318
|
+
endUser.userId,
|
|
319
|
+
{ address, transaction: opts.transaction },
|
|
320
|
+
undefined,
|
|
321
|
+
opts.idempotencyKey,
|
|
322
|
+
);
|
|
292
323
|
},
|
|
293
324
|
|
|
294
325
|
// ─── Delegated Solana Send Methods ───
|
|
@@ -298,23 +329,31 @@ export function toEndUserAccount(
|
|
|
298
329
|
): Promise<SendSolanaTransactionResult> {
|
|
299
330
|
Analytics.trackAction({ action: "end_user_send_solana_transaction" });
|
|
300
331
|
const address = resolveSolanaAddress(endUser, opts.address);
|
|
301
|
-
return apiClient.sendSolanaTransactionWithEndUserAccount(
|
|
302
|
-
|
|
303
|
-
transaction: opts.transaction,
|
|
304
|
-
|
|
305
|
-
|
|
332
|
+
return apiClient.sendSolanaTransactionWithEndUserAccount(
|
|
333
|
+
endUser.userId,
|
|
334
|
+
{ address, transaction: opts.transaction, network: opts.network },
|
|
335
|
+
undefined,
|
|
336
|
+
opts.idempotencyKey,
|
|
337
|
+
);
|
|
306
338
|
},
|
|
307
339
|
|
|
308
340
|
async sendSolanaAsset(opts: AccountSendSolanaAssetOptions): Promise<SendSolanaAssetResult> {
|
|
309
341
|
Analytics.trackAction({ action: "end_user_send_solana_asset" });
|
|
310
342
|
const address = resolveSolanaAddress(endUser, opts.address);
|
|
311
343
|
const asset = opts.asset ?? "usdc";
|
|
312
|
-
return apiClient.sendSolanaAssetWithEndUserAccount(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
344
|
+
return apiClient.sendSolanaAssetWithEndUserAccount(
|
|
345
|
+
endUser.userId,
|
|
346
|
+
address,
|
|
347
|
+
asset,
|
|
348
|
+
{
|
|
349
|
+
to: opts.to,
|
|
350
|
+
amount: opts.amount,
|
|
351
|
+
network: opts.network,
|
|
352
|
+
createRecipientAta: opts.createRecipientAta,
|
|
353
|
+
},
|
|
354
|
+
undefined,
|
|
355
|
+
opts.idempotencyKey,
|
|
356
|
+
);
|
|
318
357
|
},
|
|
319
358
|
};
|
|
320
359
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cdp-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"description": "SDK for interacting with the Coinbase Developer Platform Wallet API",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@solana-program/token": "^0.9.0",
|
|
23
23
|
"@solana/kit": "^5.5.1",
|
|
24
24
|
"abitype": "1.0.6",
|
|
25
|
-
"axios": "1.
|
|
25
|
+
"axios": "1.16.0",
|
|
26
26
|
"axios-retry": "^4.5.0",
|
|
27
27
|
"bs58": "^6.0.0",
|
|
28
28
|
"jose": "^6.2.0",
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.50.0";
|