@coinbase/cdp-sdk 1.5.0 → 1.6.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +39 -3
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +21 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +28 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/actions/evm/listTokenBalances.js +33 -0
  8. package/_cjs/actions/evm/listTokenBalances.js.map +1 -0
  9. package/_cjs/actions/evm/requestFaucet.js +18 -0
  10. package/_cjs/actions/evm/requestFaucet.js.map +1 -0
  11. package/_cjs/actions/evm/sendTransaction.js +29 -0
  12. package/_cjs/actions/evm/sendTransaction.js.map +1 -0
  13. package/_cjs/actions/evm/sendUserOperation.js +5 -6
  14. package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
  15. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +4 -2
  16. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  17. package/_cjs/client/evm/evm.js +8 -40
  18. package/_cjs/client/evm/evm.js.map +1 -1
  19. package/_cjs/version.js +1 -1
  20. package/_esm/accounts/evm/toEvmServerAccount.js +21 -0
  21. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  22. package/_esm/accounts/evm/toEvmSmartAccount.js +28 -0
  23. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  24. package/_esm/actions/evm/listTokenBalances.js +30 -0
  25. package/_esm/actions/evm/listTokenBalances.js.map +1 -0
  26. package/_esm/actions/evm/requestFaucet.js +15 -0
  27. package/_esm/actions/evm/requestFaucet.js.map +1 -0
  28. package/_esm/actions/evm/sendTransaction.js +26 -0
  29. package/_esm/actions/evm/sendTransaction.js.map +1 -0
  30. package/_esm/actions/evm/sendUserOperation.js +5 -6
  31. package/_esm/actions/evm/sendUserOperation.js.map +1 -1
  32. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +4 -2
  33. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  34. package/_esm/client/evm/evm.js +8 -40
  35. package/_esm/client/evm/evm.js.map +1 -1
  36. package/_esm/version.js +1 -1
  37. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  38. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  39. package/_types/accounts/types.d.ts +2 -2
  40. package/_types/accounts/types.d.ts.map +1 -1
  41. package/_types/actions/evm/listTokenBalances.d.ts +76 -0
  42. package/_types/actions/evm/listTokenBalances.d.ts.map +1 -0
  43. package/_types/actions/evm/requestFaucet.d.ts +34 -0
  44. package/_types/actions/evm/requestFaucet.d.ts.map +1 -0
  45. package/_types/actions/evm/sendTransaction.d.ts +42 -0
  46. package/_types/actions/evm/sendTransaction.d.ts.map +1 -0
  47. package/_types/actions/evm/sendUserOperation.d.ts +3 -2
  48. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
  49. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
  50. package/_types/actions/evm/types.d.ts +143 -1
  51. package/_types/actions/evm/types.d.ts.map +1 -1
  52. package/_types/client/evm/evm.d.ts +6 -3
  53. package/_types/client/evm/evm.d.ts.map +1 -1
  54. package/_types/client/evm/evm.types.d.ts +11 -137
  55. package/_types/client/evm/evm.types.d.ts.map +1 -1
  56. package/_types/version.d.ts +1 -1
  57. package/accounts/evm/toEvmServerAccount.ts +34 -0
  58. package/accounts/evm/toEvmSmartAccount.ts +52 -0
  59. package/accounts/types.ts +2 -2
  60. package/actions/evm/listTokenBalances.ts +107 -0
  61. package/actions/evm/requestFaucet.ts +46 -0
  62. package/actions/evm/sendTransaction.ts +73 -0
  63. package/actions/evm/sendUserOperation.ts +6 -6
  64. package/actions/evm/transfer/smartAccountTransferStrategy.ts +4 -2
  65. package/actions/evm/types.ts +157 -1
  66. package/client/evm/evm.ts +25 -61
  67. package/client/evm/evm.types.ts +22 -149
  68. package/package.json +1 -1
  69. package/version.ts +1 -1
@@ -10,7 +10,8 @@ export const smartAccountTransferStrategy: TransferExecutionStrategy<EvmSmartAcc
10
10
  executeTransfer: async ({ apiClient, from, transferArgs, to, value }) => {
11
11
  const userOpHash = await (async () => {
12
12
  if (transferArgs.token === "eth") {
13
- const result = await sendUserOperation(apiClient, from, {
13
+ const result = await sendUserOperation(apiClient, {
14
+ smartAccount: from,
14
15
  network: transferArgs.network,
15
16
  calls: [
16
17
  {
@@ -24,7 +25,8 @@ export const smartAccountTransferStrategy: TransferExecutionStrategy<EvmSmartAcc
24
25
  } else {
25
26
  const erc20Address = getErc20Address(transferArgs.token, transferArgs.network);
26
27
 
27
- const result = await sendUserOperation(apiClient, from, {
28
+ const result = await sendUserOperation(apiClient, {
29
+ smartAccount: from,
28
30
  network: transferArgs.network,
29
31
  calls: [
30
32
  {
@@ -1,5 +1,13 @@
1
- import { TransferOptions, TransferResult } from "./transfer/types.js";
1
+ import { SendUserOperationReturnType, SendUserOperationOptions } from "./sendUserOperation.js";
2
2
 
3
+ import type { ListTokenBalancesResult, ListTokenBalancesOptions } from "./listTokenBalances.js";
4
+ import type { RequestFaucetOptions, RequestFaucetResult } from "./requestFaucet.js";
5
+ import type { SendTransactionOptions, TransactionResult } from "./sendTransaction.js";
6
+ import type { TransferOptions, TransferResult } from "./transfer/types.js";
7
+ import type {
8
+ WaitForUserOperationOptions,
9
+ WaitForUserOperationReturnType,
10
+ } from "./waitForUserOperation.js";
3
11
  export type Actions = {
4
12
  /**
5
13
  * Transfer an amount of a token from an account to another account.
@@ -85,4 +93,152 @@ export type Actions = {
85
93
  * ```
86
94
  */
87
95
  transfer: (options: TransferOptions) => Promise<TransferResult>;
96
+
97
+ /**
98
+ * List the token balances of an account.
99
+ *
100
+ * @param options - The options for the list token balances.
101
+ * @param options.network - The network to list the token balances on.
102
+ *
103
+ * @returns The result of the list token balances.
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const balances = await account.listTokenBalances({
108
+ * network: "base-sepolia",
109
+ * });
110
+ * ```
111
+ */
112
+ listTokenBalances: (
113
+ options: Omit<ListTokenBalancesOptions, "address">,
114
+ ) => Promise<ListTokenBalancesResult>;
115
+
116
+ /**
117
+ * Requests funds from an EVM faucet.
118
+ *
119
+ * @param {RequestFaucetOptions} options - Parameters for requesting funds from the EVM faucet.
120
+ * @param {string} options.network - The network to request funds from.
121
+ * @param {string} options.token - The token to request funds for.
122
+ * @param {string} [options.idempotencyKey] - An idempotency key.
123
+ *
124
+ * @returns A promise that resolves to the transaction hash.
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * const result = await account.requestFaucet({
129
+ * network: "base-sepolia",
130
+ * token: "eth",
131
+ * });
132
+ * ```
133
+ */
134
+ requestFaucet: (options: Omit<RequestFaucetOptions, "address">) => Promise<RequestFaucetResult>;
135
+
136
+ /**
137
+ * Signs an EVM transaction and sends it to the specified network using the Coinbase API.
138
+ * This method handles nonce management and gas estimation automatically.
139
+ *
140
+ * @param {SendTransactionOptions} options - Configuration options for sending the transaction.
141
+ * @returns A promise that resolves to the transaction hash.
142
+ *
143
+ * @example
144
+ * **Sending an RLP-encoded transaction**
145
+ * ```ts
146
+ * import { parseEther, serializeTransaction } from "viem";
147
+ * import { baseSepolia } from "viem/chains";
148
+ *
149
+ * const { transactionHash } = await account.sendTransaction({
150
+ * transaction: serializeTransaction({
151
+ * to: "0x4252e0c9A3da5A2700e7d91cb50aEf522D0C6Fe8",
152
+ * value: parseEther("0.000001"),
153
+ * chainId: baseSepolia.id,
154
+ * // Fields below are optional, CDP API will populate them if omitted.
155
+ * // nonce
156
+ * // maxPriorityFeePerGas
157
+ * // maxFeePerGas
158
+ * // gas
159
+ * }),
160
+ * network: "base-sepolia",
161
+ * });
162
+ * ```
163
+ * @example
164
+ * **Sending an EIP-1559 transaction request object**
165
+ * ```ts
166
+ * const { transactionHash } = await account.sendTransaction({
167
+ * transaction: {
168
+ * to: "0x4252e0c9A3da5A2700e7d91cb50aEf522D0C6Fe8",
169
+ * value: parseEther("0.000001"),
170
+ * // Fields below are optional, CDP API will populate them if omitted.
171
+ * // nonce
172
+ * // maxPriorityFeePerGas
173
+ * // maxFeePerGas
174
+ * // gas
175
+ * },
176
+ * network: "base-sepolia",
177
+ * });
178
+ * ```
179
+ */
180
+ sendTransaction: (options: Omit<SendTransactionOptions, "address">) => Promise<TransactionResult>;
181
+
182
+ /**
183
+ * Sends a user operation.
184
+ *
185
+ * @param {SendUserOperationOptions} options - Parameters for sending the user operation.
186
+ * @param {string} options.network - The network to send the user operation on.
187
+ * @param {EvmCall[]} options.calls - The calls to include in the user operation.
188
+ * @param {string} [options.paymasterUrl] - The optional paymaster URL to use for the user operation.
189
+ * @param {string} [options.idempotencyKey] - An idempotency key.
190
+ *
191
+ * @returns A promise that resolves to an object containing the smart account address,
192
+ * the user operation hash, and the status of the user operation.
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * const userOp = await smartAccount.sendUserOperation({
197
+ * network: "base-sepolia",
198
+ * calls: [
199
+ * {
200
+ * to: "0x1234567890123456789012345678901234567890",
201
+ * value: parseEther("0.000001"),
202
+ * data: "0x",
203
+ * },
204
+ * ],
205
+ * });
206
+ * ```
207
+ */
208
+ sendUserOperation: (
209
+ options: Omit<SendUserOperationOptions<unknown[]>, "smartAccount">,
210
+ ) => Promise<SendUserOperationReturnType>;
211
+
212
+ /**
213
+ * Waits for a user operation to complete or fail.
214
+ *
215
+ * @param {WaitForUserOperationOptions} options - Parameters for waiting for the user operation.
216
+ * @param {string} options.userOpHash - The user operation hash.
217
+ * @param {WaitOptions} [options.waitOptions] - Optional parameters for the wait operation.
218
+ *
219
+ * @returns A promise that resolves to the transaction receipt.
220
+ *
221
+ * @example
222
+ * ```ts
223
+ * // Send a user operation and get the user operation hash
224
+ * const { userOpHash } = await smartAccount.sendUserOperation({
225
+ * network: "base-sepolia",
226
+ * calls: [
227
+ * {
228
+ * to: "0x0000000000000000000000000000000000000000",
229
+ * value: parseEther("0.000001"),
230
+ * data: "0x",
231
+ * },
232
+ * ],
233
+ * });
234
+ *
235
+ * // Wait for the user operation to complete or fail
236
+ * const result = await smartAccount.waitForUserOperation({
237
+ * userOpHash: userOp.userOpHash,
238
+ * });
239
+ * ```
240
+ */
241
+ waitForUserOperation: (
242
+ options: Omit<WaitForUserOperationOptions, "smartAccountAddress">,
243
+ ) => Promise<WaitForUserOperationReturnType>;
88
244
  };
package/client/evm/evm.ts CHANGED
@@ -1,14 +1,11 @@
1
- import { Address, serializeTransaction } from "viem";
1
+ import { Address } from "viem";
2
2
 
3
3
  import {
4
4
  CreateServerAccountOptions,
5
5
  GetServerAccountOptions,
6
6
  ListServerAccountsOptions,
7
7
  CreateSmartAccountOptions,
8
- RequestFaucetOptions,
9
- SendUserOperationOptions,
10
8
  WaitForUserOperationOptions,
11
- RequestFaucetResult,
12
9
  SignHashOptions,
13
10
  SignatureResult,
14
11
  SignMessageOptions,
@@ -23,16 +20,24 @@ import {
23
20
  GetUserOperationOptions,
24
21
  ListSmartAccountResult,
25
22
  ListSmartAccountsOptions,
26
- ListTokenBalancesOptions,
27
- ListTokenBalancesResult,
28
- SendTransactionOptions,
29
- TransactionResult,
30
23
  GetOrCreateServerAccountOptions,
31
24
  } from "./evm.types.js";
32
25
  import { toEvmServerAccount } from "../../accounts/evm/toEvmServerAccount.js";
33
26
  import { toEvmSmartAccount } from "../../accounts/evm/toEvmSmartAccount.js";
27
+ import {
28
+ listTokenBalances,
29
+ ListTokenBalancesResult,
30
+ ListTokenBalancesOptions,
31
+ } from "../../actions/evm/listTokenBalances.js";
32
+ import {
33
+ RequestFaucetOptions,
34
+ RequestFaucetResult,
35
+ requestFaucet,
36
+ } from "../../actions/evm/requestFaucet.js";
37
+ import { sendTransaction } from "../../actions/evm/sendTransaction.js";
34
38
  import {
35
39
  sendUserOperation,
40
+ SendUserOperationOptions,
36
41
  SendUserOperationReturnType,
37
42
  } from "../../actions/evm/sendUserOperation.js";
38
43
  import {
@@ -43,6 +48,10 @@ import { APIError } from "../../openapi-client/errors.js";
43
48
  import { CdpOpenApiClient } from "../../openapi-client/index.js";
44
49
  import { Hex } from "../../types/misc.js";
45
50
 
51
+ import type {
52
+ TransactionResult,
53
+ SendTransactionOptions,
54
+ } from "../../actions/evm/sendTransaction.js";
46
55
  /**
47
56
  * The namespace containing all EVM methods.
48
57
  */
@@ -376,28 +385,7 @@ export class EvmClient implements EvmClientInterface {
376
385
  * }
377
386
  */
378
387
  async listTokenBalances(options: ListTokenBalancesOptions): Promise<ListTokenBalancesResult> {
379
- const response = await CdpOpenApiClient.listEvmTokenBalances(options.network, options.address, {
380
- pageSize: options.pageSize,
381
- pageToken: options.pageToken,
382
- });
383
-
384
- const balances = response.balances.map(balance => {
385
- return {
386
- token: {
387
- network: balance.token.network,
388
- contractAddress: balance.token.contractAddress as Address,
389
- },
390
- amount: {
391
- amount: BigInt(balance.amount.amount),
392
- decimals: BigInt(balance.amount.decimals),
393
- },
394
- };
395
- });
396
-
397
- return {
398
- balances,
399
- nextPageToken: response.nextPageToken,
400
- };
388
+ return listTokenBalances(CdpOpenApiClient, options);
401
389
  }
402
390
 
403
391
  /**
@@ -509,14 +497,7 @@ export class EvmClient implements EvmClientInterface {
509
497
  * ```
510
498
  */
511
499
  async requestFaucet(options: RequestFaucetOptions): Promise<RequestFaucetResult> {
512
- const { transactionHash } = await CdpOpenApiClient.requestEvmFaucet(
513
- { address: options.address, network: options.network, token: options.token },
514
- options.idempotencyKey,
515
- );
516
-
517
- return {
518
- transactionHash: transactionHash as Hex,
519
- };
500
+ return requestFaucet(CdpOpenApiClient, options);
520
501
  }
521
502
 
522
503
  /**
@@ -566,27 +547,7 @@ export class EvmClient implements EvmClientInterface {
566
547
  * ```
567
548
  */
568
549
  async sendTransaction(options: SendTransactionOptions): Promise<TransactionResult> {
569
- const { address, network, idempotencyKey } = options;
570
- let transaction = options.transaction;
571
-
572
- if (typeof transaction !== "string") {
573
- transaction = serializeTransaction({
574
- ...transaction,
575
- // chainId is ignored in favor of network
576
- chainId: 1,
577
- type: "eip1559",
578
- });
579
- }
580
-
581
- const result = await CdpOpenApiClient.sendEvmTransaction(
582
- address,
583
- { transaction, network },
584
- idempotencyKey,
585
- );
586
-
587
- return {
588
- transactionHash: result.transactionHash as Hex,
589
- };
550
+ return sendTransaction(CdpOpenApiClient, options);
590
551
  }
591
552
 
592
553
  /**
@@ -617,8 +578,11 @@ export class EvmClient implements EvmClientInterface {
617
578
  * });
618
579
  * ```
619
580
  */
620
- async sendUserOperation(options: SendUserOperationOptions): Promise<SendUserOperationReturnType> {
621
- return sendUserOperation(CdpOpenApiClient, options.smartAccount, {
581
+ async sendUserOperation(
582
+ options: SendUserOperationOptions<unknown[]>,
583
+ ): Promise<SendUserOperationReturnType> {
584
+ return sendUserOperation(CdpOpenApiClient, {
585
+ smartAccount: options.smartAccount,
622
586
  network: options.network,
623
587
  calls: options.calls,
624
588
  paymasterUrl: options.paymasterUrl,
@@ -1,20 +1,30 @@
1
- import {
1
+ import type {
2
2
  EvmAccount as Account,
3
3
  EvmServerAccount as ServerAccount,
4
4
  EvmSmartAccount as SmartAccount,
5
5
  } from "../../accounts/types.js";
6
- import { SendUserOperationReturnType } from "../../actions/evm/sendUserOperation.js";
7
- import { Actions } from "../../actions/evm/types.js";
8
- import {
6
+ import type {
7
+ ListTokenBalancesOptions,
8
+ ListTokenBalancesResult,
9
+ } from "../../actions/evm/listTokenBalances.js";
10
+ import type { RequestFaucetOptions, RequestFaucetResult } from "../../actions/evm/requestFaucet.js";
11
+ import type {
12
+ TransactionResult,
13
+ SendTransactionOptions,
14
+ } from "../../actions/evm/sendTransaction.js";
15
+ import type {
16
+ SendUserOperationOptions,
17
+ SendUserOperationReturnType,
18
+ } from "../../actions/evm/sendUserOperation.js";
19
+ import type { Actions } from "../../actions/evm/types.js";
20
+ import type {
9
21
  EvmUserOperationNetwork,
10
22
  EvmUserOperationStatus,
11
23
  OpenApiEvmMethods,
12
- ListEvmTokenBalancesNetwork,
13
- SendEvmTransactionBodyNetwork,
14
24
  } from "../../openapi-client/index.js";
15
- import { Call, Calls } from "../../types/calls.js";
16
- import { Address, Hex, TransactionRequestEIP1559 } from "../../types/misc.js";
17
- import { WaitOptions } from "../../utils/wait.js";
25
+ import type { Calls } from "../../types/calls.js";
26
+ import type { Address, Hex } from "../../types/misc.js";
27
+ import type { WaitOptions } from "../../utils/wait.js";
18
28
 
19
29
  /**
20
30
  * The EvmClient type, where all OpenApiEvmMethods methods are wrapped.
@@ -50,7 +60,9 @@ export type EvmClientInterface = Omit<
50
60
  prepareUserOperation: (options: PrepareUserOperationOptions) => Promise<UserOperation>;
51
61
  requestFaucet: (options: RequestFaucetOptions) => Promise<RequestFaucetResult>;
52
62
  sendTransaction: (options: SendTransactionOptions) => Promise<TransactionResult>;
53
- sendUserOperation: (options: SendUserOperationOptions) => Promise<SendUserOperationReturnType>;
63
+ sendUserOperation: (
64
+ options: SendUserOperationOptions<unknown[]>,
65
+ ) => Promise<SendUserOperationReturnType>;
54
66
  signHash: (options: SignHashOptions) => Promise<SignatureResult>;
55
67
  signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
56
68
  signTransaction: (options: SignTransactionOptions) => Promise<SignatureResult>;
@@ -222,67 +234,6 @@ export interface CreateSmartAccountOptions {
222
234
  idempotencyKey?: string;
223
235
  }
224
236
 
225
- /**
226
- * Options for requesting funds from an EVM faucet.
227
- */
228
- export interface RequestFaucetOptions {
229
- /** The address of the account. */
230
- address: string;
231
- /** The network to request funds from. */
232
- network: "base-sepolia" | "ethereum-sepolia";
233
- /** The token to request funds for. */
234
- token: "eth" | "usdc" | "eurc" | "cbbtc";
235
- /** The idempotency key. */
236
- idempotencyKey?: string;
237
- }
238
-
239
- /**
240
- * The result of requesting funds from an EVM faucet.
241
- */
242
- export interface RequestFaucetResult {
243
- /** The transaction hash. */
244
- transactionHash: Hex;
245
- }
246
-
247
- /**
248
- * Options for sending an EVM transaction.
249
- */
250
- export interface SendTransactionOptions {
251
- /** The address of the account. */
252
- address: Address;
253
- /**
254
- * The transaction to send. The chainId is ignored in favor of the `network` field.
255
- *
256
- * This can be either:
257
- * - An RLP-encoded transaction to sign and send, as a 0x-prefixed hex string, or
258
- * - An EIP-1559 transaction request object.
259
- */
260
- transaction: Hex | TransactionRequestEIP1559;
261
- /**
262
- * The network to send the transaction to.
263
- * The chainId in the `transaction` field is ignored in favor of this field.
264
- */
265
- network: SendEvmTransactionBodyNetwork;
266
- /** The idempotency key. */
267
- idempotencyKey?: string;
268
- }
269
-
270
- /**
271
- * Options for sending a user operation.
272
- */
273
- export interface SendUserOperationOptions {
274
- /** The smart account. */
275
- smartAccount: SmartAccount;
276
- /** The network. */
277
- network: EvmUserOperationNetwork;
278
- /** The calls. */
279
- calls: Call[];
280
- /** The paymaster URL. */
281
- paymasterUrl?: string;
282
- /** The idempotency key. */
283
- idempotencyKey?: string;
284
- }
285
-
286
237
  /**
287
238
  * Options for signing an EVM hash.
288
239
  */
@@ -327,14 +278,6 @@ export interface SignatureResult {
327
278
  signature: Hex;
328
279
  }
329
280
 
330
- /**
331
- * Result of a transaction
332
- */
333
- export interface TransactionResult {
334
- /** The hash of the transaction. */
335
- transactionHash: Hex;
336
- }
337
-
338
281
  /**
339
282
  * Options for waiting for a user operation.
340
283
  */
@@ -346,73 +289,3 @@ export interface WaitForUserOperationOptions {
346
289
  /** The wait options. */
347
290
  waitOptions?: WaitOptions;
348
291
  }
349
-
350
- /**
351
- * Options for listing EVM token balances.
352
- */
353
- export interface ListTokenBalancesOptions {
354
- /** The address of the account. */
355
- address: Address;
356
- /** The network. */
357
- network: ListEvmTokenBalancesNetwork;
358
- /** The page size to paginate through the token balances. */
359
- pageSize?: number;
360
- /** The page token to paginate through the token balances. */
361
- pageToken?: string;
362
- }
363
-
364
- /**
365
- * A token on an EVM network, which is either an ERC-20 or a native token (i.e. ETH).
366
- */
367
- export interface EvmToken {
368
- /**
369
- * The contract address of the token. For Ether, the contract address is 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
370
- * per EIP-7528. For ERC-20 tokens, this is the contract address where the token is deployed.
371
- */
372
- contractAddress: Address;
373
- /** The network the token is on. */
374
- network: ListEvmTokenBalancesNetwork;
375
- /**
376
- * The symbol of the token, which is optional and non-unique. Note: This field
377
- * may not be present for most tokens while the API is still under development.
378
- */
379
- symbol?: string;
380
- /**
381
- * The name of the token, which is optional and non-unique. Note: This field
382
- * may not be present for most tokens while the API is still under development.
383
- */
384
- name?: string;
385
- }
386
-
387
- /**
388
- * A token amount on an EVM network.
389
- */
390
- export interface EvmTokenAmount {
391
- /** The amount of the token in the smallest indivisible unit of the token. */
392
- amount: bigint;
393
- /** The number of decimals in the token. */
394
- decimals: bigint;
395
- }
396
-
397
- /**
398
- * An EVM token balance.
399
- */
400
- export interface EvmTokenBalance {
401
- /** The token. */
402
- token: EvmToken;
403
- /** The amount of the token. */
404
- amount: EvmTokenAmount;
405
- }
406
-
407
- /**
408
- * The result of listing EVM token balances.
409
- */
410
- export interface ListTokenBalancesResult {
411
- /** The token balances. */
412
- balances: EvmTokenBalance[];
413
- /**
414
- * The next page token to paginate through the token balances.
415
- * If undefined, there are no more token balances to paginate through.
416
- */
417
- nextPageToken?: string;
418
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.5.0",
3
+ "version": "1.6.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.5.0";
1
+ export const version = "1.6.0";