@coinbase/cdp-sdk 1.46.1 → 1.48.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 +14 -0
- package/README.md +332 -0
- package/_cjs/actions/solana/sendTransaction.js +3 -0
- package/_cjs/actions/solana/sendTransaction.js.map +1 -1
- package/_cjs/actions/webhooks/createWebhookSubscription.js +48 -0
- package/_cjs/actions/webhooks/createWebhookSubscription.js.map +1 -0
- package/_cjs/actions/webhooks/index.js +6 -0
- package/_cjs/actions/webhooks/index.js.map +1 -0
- package/_cjs/client/cdp.js +5 -4
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/end-user/endUser.js +19 -89
- package/_cjs/client/end-user/endUser.js.map +1 -1
- package/_cjs/client/end-user/toEndUserAccount.js +13 -43
- package/_cjs/client/end-user/toEndUserAccount.js.map +1 -1
- package/_cjs/client/solana/solana.js +2 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/client/webhooks/webhooks.js +58 -0
- package/_cjs/client/webhooks/webhooks.js.map +1 -0
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/cdpApiClient.js +0 -32
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +51 -11
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.js → embedded-wallets/embedded-wallets.js} +37 -65
- package/_cjs/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +2 -2
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/sql-api/sql-api.js +12 -1
- package/_cjs/openapi-client/generated/sql-api/sql-api.js.map +1 -1
- package/_cjs/openapi-client/generated/webhooks/webhooks.js +32 -5
- package/_cjs/openapi-client/generated/webhooks/webhooks.js.map +1 -1
- package/_cjs/openapi-client/index.js +2 -2
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/actions/solana/sendTransaction.js +3 -0
- package/_esm/actions/solana/sendTransaction.js.map +1 -1
- package/_esm/actions/webhooks/createWebhookSubscription.js +45 -0
- package/_esm/actions/webhooks/createWebhookSubscription.js.map +1 -0
- package/_esm/actions/webhooks/index.js +2 -0
- package/_esm/actions/webhooks/index.js.map +1 -0
- package/_esm/client/cdp.js +6 -5
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/end-user/endUser.js +17 -87
- package/_esm/client/end-user/endUser.js.map +1 -1
- package/_esm/client/end-user/toEndUserAccount.js +13 -43
- package/_esm/client/end-user/toEndUserAccount.js.map +1 -1
- package/_esm/client/solana/solana.js +2 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/client/webhooks/webhooks.js +54 -0
- package/_esm/client/webhooks/webhooks.js.map +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/cdpApiClient.js +0 -32
- package/_esm/openapi-client/cdpApiClient.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +48 -8
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.js → embedded-wallets/embedded-wallets.js} +36 -61
- package/_esm/openapi-client/generated/embedded-wallets/embedded-wallets.js.map +1 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +2 -2
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/sql-api/sql-api.js +10 -0
- package/_esm/openapi-client/generated/sql-api/sql-api.js.map +1 -1
- package/_esm/openapi-client/generated/webhooks/webhooks.js +30 -4
- package/_esm/openapi-client/generated/webhooks/webhooks.js.map +1 -1
- package/_esm/openapi-client/index.js +2 -2
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/actions/solana/sendTransaction.d.ts +2 -0
- package/_types/actions/solana/sendTransaction.d.ts.map +1 -1
- package/_types/actions/webhooks/createWebhookSubscription.d.ts +68 -0
- package/_types/actions/webhooks/createWebhookSubscription.d.ts.map +1 -0
- package/_types/actions/webhooks/index.d.ts +2 -0
- package/_types/actions/webhooks/index.d.ts.map +1 -0
- package/_types/client/cdp.d.ts +5 -6
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/end-user/endUser.d.ts +2 -52
- package/_types/client/end-user/endUser.d.ts.map +1 -1
- package/_types/client/end-user/endUser.types.d.ts +1 -63
- package/_types/client/end-user/endUser.types.d.ts.map +1 -1
- package/_types/client/end-user/toEndUserAccount.d.ts +0 -2
- package/_types/client/end-user/toEndUserAccount.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +2 -0
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +2 -0
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/client/webhooks/webhooks.d.ts +41 -0
- package/_types/client/webhooks/webhooks.d.ts.map +1 -0
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +285 -85
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.d.ts → embedded-wallets/embedded-wallets.d.ts} +14 -32
- package/_types/openapi-client/generated/embedded-wallets/embedded-wallets.d.ts.map +1 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +2 -2
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/sql-api/sql-api.d.ts +10 -1
- package/_types/openapi-client/generated/sql-api/sql-api.d.ts.map +1 -1
- package/_types/openapi-client/generated/webhooks/webhooks.d.ts +30 -5
- package/_types/openapi-client/generated/webhooks/webhooks.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +16 -18
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/actions/solana/sendTransaction.ts +3 -0
- package/actions/webhooks/createWebhookSubscription.ts +104 -0
- package/actions/webhooks/index.ts +6 -0
- package/client/cdp.ts +8 -8
- package/client/end-user/endUser.ts +55 -187
- package/client/end-user/endUser.types.ts +0 -72
- package/client/end-user/toEndUserAccount.ts +57 -152
- package/client/solana/solana.ts +2 -0
- package/client/solana/solana.types.ts +2 -0
- package/client/webhooks/webhooks.ts +61 -0
- package/index.ts +6 -4
- package/openapi-client/cdpApiClient.ts +0 -34
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +331 -93
- package/openapi-client/generated/{embedded-wallets-core-functionality/embedded-wallets-core-functionality.ts → embedded-wallets/embedded-wallets.ts} +45 -99
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +3 -3
- package/openapi-client/generated/sql-api/sql-api.ts +19 -0
- package/openapi-client/generated/webhooks/webhooks.ts +42 -4
- package/openapi-client/index.ts +2 -2
- package/package.json +1 -1
- package/version.ts +1 -1
- package/_cjs/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.js.map +0 -1
- package/_esm/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.js.map +0 -1
- package/_types/openapi-client/generated/embedded-wallets-core-functionality/embedded-wallets-core-functionality.d.ts.map +0 -1
|
@@ -15,8 +15,6 @@ import {
|
|
|
15
15
|
type AddEndUserSolanaAccountOptions,
|
|
16
16
|
type AddEndUserSolanaAccountResult,
|
|
17
17
|
type RevokeDelegationForEndUserOptions,
|
|
18
|
-
type SignEvmHashOptions,
|
|
19
|
-
type SignEvmHashResult,
|
|
20
18
|
type SignEvmTransactionOptions,
|
|
21
19
|
type SignEvmTransactionResult,
|
|
22
20
|
type SignEvmMessageOptions,
|
|
@@ -31,8 +29,6 @@ import {
|
|
|
31
29
|
type SendUserOperationResult,
|
|
32
30
|
type CreateEvmEip7702DelegationOptions,
|
|
33
31
|
type CreateEvmEip7702DelegationForEndUserResult,
|
|
34
|
-
type SignSolanaHashOptions,
|
|
35
|
-
type SignSolanaHashResult,
|
|
36
32
|
type SignSolanaMessageOptions,
|
|
37
33
|
type SignSolanaMessageResult,
|
|
38
34
|
type SignSolanaTransactionOptions,
|
|
@@ -52,18 +48,7 @@ import { CdpOpenApiClient, type ListEndUsers200 } from "../../openapi-client/ind
|
|
|
52
48
|
/**
|
|
53
49
|
* The CDP end user client.
|
|
54
50
|
*/
|
|
55
|
-
export class
|
|
56
|
-
private projectId?: string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new CDPEndUserClient.
|
|
60
|
-
*
|
|
61
|
-
* @param projectId - The CDP project ID. Required for delegation operations (signing, sending).
|
|
62
|
-
*/
|
|
63
|
-
constructor(projectId?: string) {
|
|
64
|
-
this.projectId = projectId;
|
|
65
|
-
}
|
|
66
|
-
|
|
51
|
+
export class EndUserClient {
|
|
67
52
|
/**
|
|
68
53
|
* Creates an end user. An end user is an entity that can own CDP EVM accounts,
|
|
69
54
|
* EVM smart accounts, and/or Solana accounts.
|
|
@@ -104,7 +89,7 @@ export class CDPEndUserClient {
|
|
|
104
89
|
userId,
|
|
105
90
|
});
|
|
106
91
|
|
|
107
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
92
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
108
93
|
}
|
|
109
94
|
|
|
110
95
|
/**
|
|
@@ -177,7 +162,7 @@ export class CDPEndUserClient {
|
|
|
177
162
|
|
|
178
163
|
const endUser = await CdpOpenApiClient.getEndUser(userId);
|
|
179
164
|
|
|
180
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
165
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
181
166
|
}
|
|
182
167
|
|
|
183
168
|
/**
|
|
@@ -295,38 +280,11 @@ export class CDPEndUserClient {
|
|
|
295
280
|
|
|
296
281
|
const { userId } = options;
|
|
297
282
|
|
|
298
|
-
await CdpOpenApiClient.revokeDelegationForEndUser(
|
|
283
|
+
await CdpOpenApiClient.revokeDelegationForEndUser(userId, {});
|
|
299
284
|
}
|
|
300
285
|
|
|
301
286
|
// ─── Delegated EVM Sign Methods ───
|
|
302
287
|
|
|
303
|
-
/**
|
|
304
|
-
* Signs an EVM hash on behalf of an end user using a delegation.
|
|
305
|
-
* The end user must have previously created a delegation granting signing permissions.
|
|
306
|
-
*
|
|
307
|
-
* @param options - The options for signing an EVM hash.
|
|
308
|
-
*
|
|
309
|
-
* @returns A promise that resolves to the signature.
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* ```ts
|
|
313
|
-
* const result = await cdp.endUser.signEvmHash({
|
|
314
|
-
* userId: "user-123",
|
|
315
|
-
* hash: "0xabcdef...",
|
|
316
|
-
* address: "0x1234..."
|
|
317
|
-
* });
|
|
318
|
-
* console.log(result.signature);
|
|
319
|
-
* ```
|
|
320
|
-
*/
|
|
321
|
-
async signEvmHash(options: SignEvmHashOptions): Promise<SignEvmHashResult> {
|
|
322
|
-
Analytics.trackAction({ action: "end_user_sign_evm_hash" });
|
|
323
|
-
|
|
324
|
-
return CdpOpenApiClient.signEvmHashWithEndUserAccount(this.requireProjectId(), options.userId, {
|
|
325
|
-
hash: options.hash,
|
|
326
|
-
address: options.address,
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
288
|
/**
|
|
331
289
|
* Signs an EVM transaction on behalf of an end user using a delegation.
|
|
332
290
|
*
|
|
@@ -347,14 +305,10 @@ export class CDPEndUserClient {
|
|
|
347
305
|
async signEvmTransaction(options: SignEvmTransactionOptions): Promise<SignEvmTransactionResult> {
|
|
348
306
|
Analytics.trackAction({ action: "end_user_sign_evm_transaction" });
|
|
349
307
|
|
|
350
|
-
return CdpOpenApiClient.signEvmTransactionWithEndUserAccount(
|
|
351
|
-
|
|
352
|
-
options.
|
|
353
|
-
|
|
354
|
-
address: options.address,
|
|
355
|
-
transaction: options.transaction,
|
|
356
|
-
},
|
|
357
|
-
);
|
|
308
|
+
return CdpOpenApiClient.signEvmTransactionWithEndUserAccount(options.userId, {
|
|
309
|
+
address: options.address,
|
|
310
|
+
transaction: options.transaction,
|
|
311
|
+
});
|
|
358
312
|
}
|
|
359
313
|
|
|
360
314
|
/**
|
|
@@ -377,14 +331,10 @@ export class CDPEndUserClient {
|
|
|
377
331
|
async signEvmMessage(options: SignEvmMessageOptions): Promise<SignEvmMessageResult> {
|
|
378
332
|
Analytics.trackAction({ action: "end_user_sign_evm_message" });
|
|
379
333
|
|
|
380
|
-
return CdpOpenApiClient.signEvmMessageWithEndUserAccount(
|
|
381
|
-
|
|
382
|
-
options.
|
|
383
|
-
|
|
384
|
-
address: options.address,
|
|
385
|
-
message: options.message,
|
|
386
|
-
},
|
|
387
|
-
);
|
|
334
|
+
return CdpOpenApiClient.signEvmMessageWithEndUserAccount(options.userId, {
|
|
335
|
+
address: options.address,
|
|
336
|
+
message: options.message,
|
|
337
|
+
});
|
|
388
338
|
}
|
|
389
339
|
|
|
390
340
|
/**
|
|
@@ -407,14 +357,10 @@ export class CDPEndUserClient {
|
|
|
407
357
|
async signEvmTypedData(options: SignEvmTypedDataOptions): Promise<SignEvmTypedDataResult> {
|
|
408
358
|
Analytics.trackAction({ action: "end_user_sign_evm_typed_data" });
|
|
409
359
|
|
|
410
|
-
return CdpOpenApiClient.signEvmTypedDataWithEndUserAccount(
|
|
411
|
-
|
|
412
|
-
options.
|
|
413
|
-
|
|
414
|
-
address: options.address,
|
|
415
|
-
typedData: options.typedData,
|
|
416
|
-
},
|
|
417
|
-
);
|
|
360
|
+
return CdpOpenApiClient.signEvmTypedDataWithEndUserAccount(options.userId, {
|
|
361
|
+
address: options.address,
|
|
362
|
+
typedData: options.typedData,
|
|
363
|
+
});
|
|
418
364
|
}
|
|
419
365
|
|
|
420
366
|
// ─── Delegated EVM Send Methods ───
|
|
@@ -440,15 +386,11 @@ export class CDPEndUserClient {
|
|
|
440
386
|
async sendEvmTransaction(options: SendEvmTransactionOptions): Promise<SendEvmTransactionResult> {
|
|
441
387
|
Analytics.trackAction({ action: "end_user_send_evm_transaction" });
|
|
442
388
|
|
|
443
|
-
return CdpOpenApiClient.sendEvmTransactionWithEndUserAccount(
|
|
444
|
-
|
|
445
|
-
options.
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
transaction: options.transaction,
|
|
449
|
-
network: options.network,
|
|
450
|
-
},
|
|
451
|
-
);
|
|
389
|
+
return CdpOpenApiClient.sendEvmTransactionWithEndUserAccount(options.userId, {
|
|
390
|
+
address: options.address,
|
|
391
|
+
transaction: options.transaction,
|
|
392
|
+
network: options.network,
|
|
393
|
+
});
|
|
452
394
|
}
|
|
453
395
|
|
|
454
396
|
/**
|
|
@@ -475,19 +417,13 @@ export class CDPEndUserClient {
|
|
|
475
417
|
|
|
476
418
|
const asset = options.asset ?? "usdc";
|
|
477
419
|
|
|
478
|
-
return CdpOpenApiClient.sendEvmAssetWithEndUserAccount(
|
|
479
|
-
|
|
480
|
-
options.
|
|
481
|
-
options.
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
amount: options.amount,
|
|
486
|
-
network: options.network,
|
|
487
|
-
useCdpPaymaster: options.useCdpPaymaster,
|
|
488
|
-
paymasterUrl: options.paymasterUrl,
|
|
489
|
-
},
|
|
490
|
-
);
|
|
420
|
+
return CdpOpenApiClient.sendEvmAssetWithEndUserAccount(options.userId, options.address, asset, {
|
|
421
|
+
to: options.to,
|
|
422
|
+
amount: options.amount,
|
|
423
|
+
network: options.network,
|
|
424
|
+
useCdpPaymaster: options.useCdpPaymaster,
|
|
425
|
+
paymasterUrl: options.paymasterUrl,
|
|
426
|
+
});
|
|
491
427
|
}
|
|
492
428
|
|
|
493
429
|
/**
|
|
@@ -511,18 +447,13 @@ export class CDPEndUserClient {
|
|
|
511
447
|
async sendUserOperation(options: SendUserOperationOptions): Promise<SendUserOperationResult> {
|
|
512
448
|
Analytics.trackAction({ action: "end_user_send_user_operation" });
|
|
513
449
|
|
|
514
|
-
return CdpOpenApiClient.sendUserOperationWithEndUserAccount(
|
|
515
|
-
|
|
516
|
-
options.
|
|
517
|
-
options.
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
useCdpPaymaster: options.useCdpPaymaster,
|
|
522
|
-
paymasterUrl: options.paymasterUrl,
|
|
523
|
-
dataSuffix: options.dataSuffix,
|
|
524
|
-
},
|
|
525
|
-
);
|
|
450
|
+
return CdpOpenApiClient.sendUserOperationWithEndUserAccount(options.userId, options.address, {
|
|
451
|
+
network: options.network,
|
|
452
|
+
calls: options.calls,
|
|
453
|
+
useCdpPaymaster: options.useCdpPaymaster,
|
|
454
|
+
paymasterUrl: options.paymasterUrl,
|
|
455
|
+
dataSuffix: options.dataSuffix,
|
|
456
|
+
});
|
|
526
457
|
}
|
|
527
458
|
|
|
528
459
|
// ─── Delegated EVM EIP-7702 Delegation Method ───
|
|
@@ -549,49 +480,15 @@ export class CDPEndUserClient {
|
|
|
549
480
|
): Promise<CreateEvmEip7702DelegationForEndUserResult> {
|
|
550
481
|
Analytics.trackAction({ action: "end_user_create_evm_eip7702_delegation" });
|
|
551
482
|
|
|
552
|
-
return CdpOpenApiClient.createEvmEip7702DelegationWithEndUserAccount(
|
|
553
|
-
|
|
554
|
-
options.
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
network: options.network,
|
|
558
|
-
enableSpendPermissions: options.enableSpendPermissions,
|
|
559
|
-
},
|
|
560
|
-
);
|
|
483
|
+
return CdpOpenApiClient.createEvmEip7702DelegationWithEndUserAccount(options.userId, {
|
|
484
|
+
address: options.address,
|
|
485
|
+
network: options.network,
|
|
486
|
+
enableSpendPermissions: options.enableSpendPermissions,
|
|
487
|
+
});
|
|
561
488
|
}
|
|
562
489
|
|
|
563
490
|
// ─── Delegated Solana Sign Methods ───
|
|
564
491
|
|
|
565
|
-
/**
|
|
566
|
-
* Signs a Solana hash on behalf of an end user using a delegation.
|
|
567
|
-
*
|
|
568
|
-
* @param options - The options for signing a Solana hash.
|
|
569
|
-
*
|
|
570
|
-
* @returns A promise that resolves to the signature.
|
|
571
|
-
*
|
|
572
|
-
* @example
|
|
573
|
-
* ```ts
|
|
574
|
-
* const result = await cdp.endUser.signSolanaHash({
|
|
575
|
-
* userId: "user-123",
|
|
576
|
-
* hash: "base64hash...",
|
|
577
|
-
* address: "So1ana..."
|
|
578
|
-
* });
|
|
579
|
-
* console.log(result.signature);
|
|
580
|
-
* ```
|
|
581
|
-
*/
|
|
582
|
-
async signSolanaHash(options: SignSolanaHashOptions): Promise<SignSolanaHashResult> {
|
|
583
|
-
Analytics.trackAction({ action: "end_user_sign_solana_hash" });
|
|
584
|
-
|
|
585
|
-
return CdpOpenApiClient.signSolanaHashWithEndUserAccount(
|
|
586
|
-
this.requireProjectId(),
|
|
587
|
-
options.userId,
|
|
588
|
-
{
|
|
589
|
-
hash: options.hash,
|
|
590
|
-
address: options.address,
|
|
591
|
-
},
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
492
|
/**
|
|
596
493
|
* Signs a Solana message on behalf of an end user using a delegation.
|
|
597
494
|
*
|
|
@@ -612,14 +509,10 @@ export class CDPEndUserClient {
|
|
|
612
509
|
async signSolanaMessage(options: SignSolanaMessageOptions): Promise<SignSolanaMessageResult> {
|
|
613
510
|
Analytics.trackAction({ action: "end_user_sign_solana_message" });
|
|
614
511
|
|
|
615
|
-
return CdpOpenApiClient.signSolanaMessageWithEndUserAccount(
|
|
616
|
-
|
|
617
|
-
options.
|
|
618
|
-
|
|
619
|
-
address: options.address,
|
|
620
|
-
message: options.message,
|
|
621
|
-
},
|
|
622
|
-
);
|
|
512
|
+
return CdpOpenApiClient.signSolanaMessageWithEndUserAccount(options.userId, {
|
|
513
|
+
address: options.address,
|
|
514
|
+
message: options.message,
|
|
515
|
+
});
|
|
623
516
|
}
|
|
624
517
|
|
|
625
518
|
/**
|
|
@@ -644,14 +537,10 @@ export class CDPEndUserClient {
|
|
|
644
537
|
): Promise<SignSolanaTransactionResult> {
|
|
645
538
|
Analytics.trackAction({ action: "end_user_sign_solana_transaction" });
|
|
646
539
|
|
|
647
|
-
return CdpOpenApiClient.signSolanaTransactionWithEndUserAccount(
|
|
648
|
-
|
|
649
|
-
options.
|
|
650
|
-
|
|
651
|
-
address: options.address,
|
|
652
|
-
transaction: options.transaction,
|
|
653
|
-
},
|
|
654
|
-
);
|
|
540
|
+
return CdpOpenApiClient.signSolanaTransactionWithEndUserAccount(options.userId, {
|
|
541
|
+
address: options.address,
|
|
542
|
+
transaction: options.transaction,
|
|
543
|
+
});
|
|
655
544
|
}
|
|
656
545
|
|
|
657
546
|
// ─── Delegated Solana Send Methods ───
|
|
@@ -679,15 +568,11 @@ export class CDPEndUserClient {
|
|
|
679
568
|
): Promise<SendSolanaTransactionResult> {
|
|
680
569
|
Analytics.trackAction({ action: "end_user_send_solana_transaction" });
|
|
681
570
|
|
|
682
|
-
return CdpOpenApiClient.sendSolanaTransactionWithEndUserAccount(
|
|
683
|
-
|
|
684
|
-
options.
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
transaction: options.transaction,
|
|
688
|
-
network: options.network,
|
|
689
|
-
},
|
|
690
|
-
);
|
|
571
|
+
return CdpOpenApiClient.sendSolanaTransactionWithEndUserAccount(options.userId, {
|
|
572
|
+
address: options.address,
|
|
573
|
+
transaction: options.transaction,
|
|
574
|
+
network: options.network,
|
|
575
|
+
});
|
|
691
576
|
}
|
|
692
577
|
|
|
693
578
|
/**
|
|
@@ -715,7 +600,6 @@ export class CDPEndUserClient {
|
|
|
715
600
|
const asset = options.asset ?? "usdc";
|
|
716
601
|
|
|
717
602
|
return CdpOpenApiClient.sendSolanaAssetWithEndUserAccount(
|
|
718
|
-
this.requireProjectId(),
|
|
719
603
|
options.userId,
|
|
720
604
|
options.address,
|
|
721
605
|
asset,
|
|
@@ -746,7 +630,7 @@ export class CDPEndUserClient {
|
|
|
746
630
|
accessToken,
|
|
747
631
|
});
|
|
748
632
|
|
|
749
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
633
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
750
634
|
}
|
|
751
635
|
|
|
752
636
|
/**
|
|
@@ -835,22 +719,6 @@ export class CDPEndUserClient {
|
|
|
835
719
|
keyType: options.keyType,
|
|
836
720
|
});
|
|
837
721
|
|
|
838
|
-
return toEndUserAccount(CdpOpenApiClient, { endUser
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Returns the configured project ID or throws if not configured.
|
|
843
|
-
*
|
|
844
|
-
* @returns The project ID.
|
|
845
|
-
*/
|
|
846
|
-
private requireProjectId(): string {
|
|
847
|
-
if (!this.projectId) {
|
|
848
|
-
throw new UserInputValidationError(
|
|
849
|
-
"Missing required project ID for delegation operation. " +
|
|
850
|
-
"Set the CDP_PROJECT_ID environment variable or pass projectId to the CdpClient constructor.",
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
return this.projectId;
|
|
722
|
+
return toEndUserAccount(CdpOpenApiClient, { endUser });
|
|
855
723
|
}
|
|
856
724
|
}
|
|
@@ -7,7 +7,6 @@ import type {
|
|
|
7
7
|
AddEndUserEvmSmartAccount201,
|
|
8
8
|
AddEndUserSolanaAccount201,
|
|
9
9
|
EndUser as OpenAPIEndUser,
|
|
10
|
-
SignEvmHashWithEndUserAccount200,
|
|
11
10
|
SignEvmTransactionWithEndUserAccount200,
|
|
12
11
|
SignEvmMessageWithEndUserAccount200,
|
|
13
12
|
SignEvmTypedDataWithEndUserAccount200,
|
|
@@ -20,7 +19,6 @@ import type {
|
|
|
20
19
|
EvmCall,
|
|
21
20
|
CreateEvmEip7702DelegationWithEndUserAccount201,
|
|
22
21
|
EvmEip7702DelegationNetwork,
|
|
23
|
-
SignSolanaHashWithEndUserAccount200,
|
|
24
22
|
SignSolanaMessageWithEndUserAccount200,
|
|
25
23
|
SignSolanaTransactionWithEndUserAccount200,
|
|
26
24
|
SendSolanaTransactionWithEndUserAccount200,
|
|
@@ -153,23 +151,6 @@ export interface RevokeDelegationForEndUserOptions {
|
|
|
153
151
|
|
|
154
152
|
// ─── EVM Sign Options/Results ───
|
|
155
153
|
|
|
156
|
-
/**
|
|
157
|
-
* The options for signing an EVM hash on behalf of an end user.
|
|
158
|
-
*/
|
|
159
|
-
export interface SignEvmHashOptions {
|
|
160
|
-
/** The unique identifier of the end user. */
|
|
161
|
-
userId: string;
|
|
162
|
-
/** The 32-byte hash to sign, hex-encoded. */
|
|
163
|
-
hash: string;
|
|
164
|
-
/** The EVM address to sign with. */
|
|
165
|
-
address: string;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The result of signing an EVM hash on behalf of an end user.
|
|
170
|
-
*/
|
|
171
|
-
export type SignEvmHashResult = SignEvmHashWithEndUserAccount200;
|
|
172
|
-
|
|
173
154
|
/**
|
|
174
155
|
* The options for signing an EVM transaction on behalf of an end user.
|
|
175
156
|
*/
|
|
@@ -318,23 +299,6 @@ export type CreateEvmEip7702DelegationForEndUserResult =
|
|
|
318
299
|
|
|
319
300
|
// ─── Solana Sign Options/Results ───
|
|
320
301
|
|
|
321
|
-
/**
|
|
322
|
-
* The options for signing a Solana hash on behalf of an end user.
|
|
323
|
-
*/
|
|
324
|
-
export interface SignSolanaHashOptions {
|
|
325
|
-
/** The unique identifier of the end user. */
|
|
326
|
-
userId: string;
|
|
327
|
-
/** The 32-byte hash to sign. */
|
|
328
|
-
hash: string;
|
|
329
|
-
/** The Solana address to sign with. */
|
|
330
|
-
address: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* The result of signing a Solana hash on behalf of an end user.
|
|
335
|
-
*/
|
|
336
|
-
export type SignSolanaHashResult = SignSolanaHashWithEndUserAccount200;
|
|
337
|
-
|
|
338
302
|
/**
|
|
339
303
|
* The options for signing a Solana message on behalf of an end user.
|
|
340
304
|
*/
|
|
@@ -417,16 +381,6 @@ export type SendSolanaAssetResult = SendSolanaAssetWithEndUserAccount200;
|
|
|
417
381
|
|
|
418
382
|
// ─── EndUserAccount Action Method Options (address optional, userId auto-bound) ───
|
|
419
383
|
|
|
420
|
-
/**
|
|
421
|
-
* The options for signing an EVM hash on an EndUser object.
|
|
422
|
-
*/
|
|
423
|
-
export interface AccountSignEvmHashOptions {
|
|
424
|
-
/** The 32-byte hash to sign, hex-encoded. */
|
|
425
|
-
hash: string;
|
|
426
|
-
/** The EVM address to sign with. Uses the first EVM account if not provided. */
|
|
427
|
-
address?: string;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
384
|
/**
|
|
431
385
|
* The options for signing an EVM transaction on an EndUser object.
|
|
432
386
|
*/
|
|
@@ -519,16 +473,6 @@ export interface AccountCreateEvmEip7702DelegationOptions {
|
|
|
519
473
|
enableSpendPermissions?: boolean;
|
|
520
474
|
}
|
|
521
475
|
|
|
522
|
-
/**
|
|
523
|
-
* The options for signing a Solana hash on an EndUser object.
|
|
524
|
-
*/
|
|
525
|
-
export interface AccountSignSolanaHashOptions {
|
|
526
|
-
/** The 32-byte hash to sign. */
|
|
527
|
-
hash: string;
|
|
528
|
-
/** The Solana address to sign with. Uses the first Solana account if not provided. */
|
|
529
|
-
address?: string;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
476
|
/**
|
|
533
477
|
* The options for signing a Solana message on an EndUser object.
|
|
534
478
|
*/
|
|
@@ -668,14 +612,6 @@ export type EndUserAccountActions = {
|
|
|
668
612
|
|
|
669
613
|
// ─── Delegated EVM Sign Methods ───
|
|
670
614
|
|
|
671
|
-
/**
|
|
672
|
-
* Signs an EVM hash on behalf of this end user using a delegation.
|
|
673
|
-
*
|
|
674
|
-
* @param options - The signing options.
|
|
675
|
-
* @returns A promise that resolves to the signature.
|
|
676
|
-
*/
|
|
677
|
-
signEvmHash: (options: AccountSignEvmHashOptions) => Promise<SignEvmHashResult>;
|
|
678
|
-
|
|
679
615
|
/**
|
|
680
616
|
* Signs an EVM transaction on behalf of this end user using a delegation.
|
|
681
617
|
*
|
|
@@ -744,14 +680,6 @@ export type EndUserAccountActions = {
|
|
|
744
680
|
|
|
745
681
|
// ─── Delegated Solana Sign Methods ───
|
|
746
682
|
|
|
747
|
-
/**
|
|
748
|
-
* Signs a Solana hash on behalf of this end user using a delegation.
|
|
749
|
-
*
|
|
750
|
-
* @param options - The signing options.
|
|
751
|
-
* @returns A promise that resolves to the signature.
|
|
752
|
-
*/
|
|
753
|
-
signSolanaHash: (options: AccountSignSolanaHashOptions) => Promise<SignSolanaHashResult>;
|
|
754
|
-
|
|
755
683
|
/**
|
|
756
684
|
* Signs a Solana message on behalf of this end user using a delegation.
|
|
757
685
|
*
|