@coinbase/cdp-sdk 1.49.2 → 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.
@@ -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(endUser.userId, {
141
- enableSpendPermissions: smartAccountOptions.enableSpendPermissions,
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(endUser.userId, {
192
- address,
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(endUser.userId, {
201
- address,
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(endUser.userId, {
210
- address,
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(endUser.userId, {
223
- address,
224
- transaction: opts.transaction,
225
- network: opts.network,
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(endUser.userId, address, asset, {
234
- to: opts.to,
235
- amount: opts.amount,
236
- network: opts.network,
237
- useCdpPaymaster: opts.useCdpPaymaster,
238
- paymasterUrl: opts.paymasterUrl,
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(endUser.userId, address, {
248
- network: opts.network,
249
- calls: opts.calls,
250
- useCdpPaymaster: opts.useCdpPaymaster,
251
- paymasterUrl: opts.paymasterUrl,
252
- dataSuffix: opts.dataSuffix,
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(endUser.userId, {
264
- address,
265
- network: opts.network,
266
- enableSpendPermissions: opts.enableSpendPermissions,
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(endUser.userId, {
278
- address,
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(endUser.userId, {
289
- address,
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(endUser.userId, {
302
- address,
303
- transaction: opts.transaction,
304
- network: opts.network,
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(endUser.userId, address, asset, {
313
- to: opts.to,
314
- amount: opts.amount,
315
- network: opts.network,
316
- createRecipientAta: opts.createRecipientAta,
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.49.2",
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",
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.49.2";
1
+ export const version = "1.50.0";