@coinbase/cdp-sdk 1.30.0 → 1.31.1

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 (112) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +61 -0
  3. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  4. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +21 -0
  5. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  6. package/_cjs/actions/evm/listSpendPermissions.js +18 -0
  7. package/_cjs/actions/evm/listSpendPermissions.js.map +1 -0
  8. package/_cjs/actions/evm/listTokenBalances.js +2 -0
  9. package/_cjs/actions/evm/listTokenBalances.js.map +1 -1
  10. package/_cjs/client/evm/evm.js +157 -60
  11. package/_cjs/client/evm/evm.js.map +1 -1
  12. package/_cjs/client/solana/solana.js +47 -27
  13. package/_cjs/client/solana/solana.js.map +1 -1
  14. package/_cjs/openapi-client/cdpApiClient.js +37 -0
  15. package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
  16. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +8 -19
  17. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  18. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +22 -1
  19. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  20. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +89 -1
  21. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  22. package/_cjs/openapi-client/generated/index.msw.js +0 -1
  23. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  24. package/_cjs/openapi-client/generated/onramp/onramp.js +2 -2
  25. package/_cjs/openapi-client/generated/onramp/onramp.msw.js +2 -2
  26. package/_cjs/openapi-client/generated/onramp/onramp.msw.js.map +1 -1
  27. package/_cjs/openapi-client/index.js +0 -1
  28. package/_cjs/openapi-client/index.js.map +1 -1
  29. package/_cjs/version.js +1 -1
  30. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +61 -0
  31. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  32. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +21 -0
  33. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  34. package/_esm/actions/evm/listSpendPermissions.js +15 -0
  35. package/_esm/actions/evm/listSpendPermissions.js.map +1 -0
  36. package/_esm/actions/evm/listTokenBalances.js +2 -0
  37. package/_esm/actions/evm/listTokenBalances.js.map +1 -1
  38. package/_esm/client/evm/evm.js +157 -60
  39. package/_esm/client/evm/evm.js.map +1 -1
  40. package/_esm/client/solana/solana.js +47 -27
  41. package/_esm/client/solana/solana.js.map +1 -1
  42. package/_esm/openapi-client/cdpApiClient.js +4 -0
  43. package/_esm/openapi-client/cdpApiClient.js.map +1 -1
  44. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +6 -17
  45. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  46. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +19 -0
  47. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  48. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +84 -0
  49. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  50. package/_esm/openapi-client/generated/index.msw.js +0 -1
  51. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  52. package/_esm/openapi-client/generated/onramp/onramp.js +2 -2
  53. package/_esm/openapi-client/generated/onramp/onramp.msw.js +2 -2
  54. package/_esm/openapi-client/generated/onramp/onramp.msw.js.map +1 -1
  55. package/_esm/openapi-client/index.js +0 -1
  56. package/_esm/openapi-client/index.js.map +1 -1
  57. package/_esm/version.js +1 -1
  58. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  59. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  60. package/_types/actions/evm/listSpendPermissions.d.ts +12 -0
  61. package/_types/actions/evm/listSpendPermissions.d.ts.map +1 -0
  62. package/_types/actions/evm/listTokenBalances.d.ts.map +1 -1
  63. package/_types/client/evm/evm.d.ts +66 -1
  64. package/_types/client/evm/evm.d.ts.map +1 -1
  65. package/_types/client/evm/evm.types.d.ts +23 -2
  66. package/_types/client/evm/evm.types.d.ts.map +1 -1
  67. package/_types/client/solana/solana.d.ts +16 -0
  68. package/_types/client/solana/solana.d.ts.map +1 -1
  69. package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
  70. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +86 -154
  71. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  72. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +13 -1
  73. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  74. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +5 -1
  75. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
  76. package/_types/openapi-client/generated/index.msw.d.ts +0 -1
  77. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  78. package/_types/openapi-client/generated/onramp/onramp.d.ts +2 -2
  79. package/_types/openapi-client/index.d.ts +4 -1
  80. package/_types/openapi-client/index.d.ts.map +1 -1
  81. package/_types/version.d.ts +1 -1
  82. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +69 -0
  83. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +22 -0
  84. package/actions/evm/listSpendPermissions.ts +20 -0
  85. package/actions/evm/listTokenBalances.ts +2 -0
  86. package/client/evm/evm.ts +200 -81
  87. package/client/evm/evm.types.ts +28 -0
  88. package/client/solana/solana.ts +60 -38
  89. package/openapi-client/cdpApiClient.ts +5 -0
  90. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +92 -171
  91. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +118 -0
  92. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +42 -0
  93. package/openapi-client/generated/index.msw.ts +0 -1
  94. package/openapi-client/generated/onramp/onramp.msw.ts +2 -2
  95. package/openapi-client/generated/onramp/onramp.ts +2 -2
  96. package/openapi-client/index.ts +0 -1
  97. package/package.json +2 -1
  98. package/version.ts +1 -1
  99. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +0 -15
  100. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +0 -1
  101. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +0 -69
  102. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +0 -1
  103. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +0 -11
  104. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +0 -1
  105. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +0 -63
  106. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +0 -1
  107. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +0 -20
  108. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +0 -1
  109. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +0 -6
  110. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +0 -1
  111. package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +0 -85
  112. package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +0 -34
@@ -274,6 +274,60 @@ export interface CreateSpendPermissionRequest {
274
274
  paymasterUrl?: string;
275
275
  }
276
276
 
277
+ /**
278
+ * The core spend permission.
279
+ */
280
+ export interface SpendPermission {
281
+ /**
282
+ * Smart account this spend permission is valid for.
283
+ * @pattern ^0x[a-fA-F0-9]{40}$
284
+ */
285
+ account: string;
286
+ /**
287
+ * Entity that can spend account's tokens.
288
+ * @pattern ^0x[a-fA-F0-9]{40}$
289
+ */
290
+ spender: string;
291
+ /**
292
+ * Token address (ERC-7528 native token address or ERC-20 contract).
293
+ * @pattern ^0x[a-fA-F0-9]{40}$
294
+ */
295
+ token: string;
296
+ /** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
297
+ allowance: string;
298
+ /** Time duration for resetting used allowance on a recurring basis (seconds). */
299
+ period?: string;
300
+ /** The start time for this spend permission, in Unix seconds. */
301
+ start?: string;
302
+ /** The expiration time for this spend permission, in Unix seconds. */
303
+ end?: string;
304
+ /** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
305
+ salt?: string;
306
+ /** Arbitrary data to include in the permission. */
307
+ extraData?: string;
308
+ }
309
+
310
+ export interface SpendPermissionResponseObject {
311
+ permission?: SpendPermission;
312
+ /** Unique hash identifier for this permission. */
313
+ permissionHash?: string;
314
+ /** Whether this permission has been revoked. */
315
+ revoked?: boolean;
316
+ /** The UTC ISO 8601 timestamp when the permission was revoked (if applicable). */
317
+ revokedAt?: string;
318
+ /** The UTC ISO 8601 timestamp when the permission was created. */
319
+ createdAt?: string;
320
+ }
321
+
322
+ export interface RevokeSpendPermissionRequest {
323
+ /** The network of the spend permission. */
324
+ network: string;
325
+ /** The hash of the spend permission to revoke. */
326
+ permissionHash: string;
327
+ /** The paymaster URL of the spend permission. */
328
+ paymasterUrl?: string;
329
+ }
330
+
277
331
  /**
278
332
  * The network on which to perform the swap.
279
333
  */
@@ -283,6 +337,8 @@ export type EvmSwapsNetwork = (typeof EvmSwapsNetwork)[keyof typeof EvmSwapsNetw
283
337
  export const EvmSwapsNetwork = {
284
338
  base: "base",
285
339
  ethereum: "ethereum",
340
+ arbitrum: "arbitrum",
341
+ optimism: "optimism",
286
342
  } as const;
287
343
 
288
344
  /**
@@ -1262,7 +1318,7 @@ export const SolAddressCriterionType = {
1262
1318
  } as const;
1263
1319
 
1264
1320
  /**
1265
- * The operator to use for the comparison. Each of the addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the addresses field will be on the right-hand side.
1321
+ * The operator to use for the comparison. Each of the native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
1266
1322
  */
1267
1323
  export type SolAddressCriterionOperator =
1268
1324
  (typeof SolAddressCriterionOperator)[keyof typeof SolAddressCriterionOperator];
@@ -1274,14 +1330,14 @@ export const SolAddressCriterionOperator = {
1274
1330
  } as const;
1275
1331
 
1276
1332
  /**
1277
- * The criterion for the recipient addresses of a Solana transaction.
1333
+ * The criterion for the recipient addresses of a Solana transaction's native transfer instruction.
1278
1334
  */
1279
1335
  export interface SolAddressCriterion {
1280
1336
  /** The type of criterion to use. This should be `solAddress`. */
1281
1337
  type: SolAddressCriterionType;
1282
- /** The Solana addresses that are compared to the list of addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
1338
+ /** The Solana addresses that are compared to the list of native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
1283
1339
  addresses: string[];
1284
- /** The operator to use for the comparison. Each of the addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the addresses field will be on the right-hand side. */
1340
+ /** The operator to use for the comparison. Each of the native transfer recipient addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
1285
1341
  operator: SolAddressCriterionOperator;
1286
1342
  }
1287
1343
 
@@ -1554,147 +1610,6 @@ export interface SolanaTokenBalance {
1554
1610
  token: SolanaToken;
1555
1611
  }
1556
1612
 
1557
- /**
1558
- * The version of the x402 protocol.
1559
- */
1560
- export type X402Version = (typeof X402Version)[keyof typeof X402Version];
1561
-
1562
- // eslint-disable-next-line @typescript-eslint/no-redeclare
1563
- export const X402Version = {
1564
- NUMBER_1: 1,
1565
- } as const;
1566
-
1567
- /**
1568
- * The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
1569
- */
1570
- export type X402PaymentRequirementsScheme =
1571
- (typeof X402PaymentRequirementsScheme)[keyof typeof X402PaymentRequirementsScheme];
1572
-
1573
- // eslint-disable-next-line @typescript-eslint/no-redeclare
1574
- export const X402PaymentRequirementsScheme = {
1575
- exact: "exact",
1576
- } as const;
1577
-
1578
- /**
1579
- * The network of the blockchain to send payment on.
1580
- */
1581
- export type X402PaymentRequirementsNetwork =
1582
- (typeof X402PaymentRequirementsNetwork)[keyof typeof X402PaymentRequirementsNetwork];
1583
-
1584
- // eslint-disable-next-line @typescript-eslint/no-redeclare
1585
- export const X402PaymentRequirementsNetwork = {
1586
- "base-sepolia": "base-sepolia",
1587
- base: "base",
1588
- } as const;
1589
-
1590
- /**
1591
- * The optional JSON schema describing the resource output.
1592
- */
1593
- export type X402PaymentRequirementsOutputSchema = { [key: string]: unknown };
1594
-
1595
- /**
1596
- * The optional additional scheme-specific payment info.
1597
- */
1598
- export type X402PaymentRequirementsExtra = { [key: string]: unknown };
1599
-
1600
- /**
1601
- * The x402 protocol payment requirements that the resource server expects the client's payment payload to meet.
1602
- */
1603
- export interface X402PaymentRequirements {
1604
- /** The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`. */
1605
- scheme: X402PaymentRequirementsScheme;
1606
- /** The network of the blockchain to send payment on. */
1607
- network: X402PaymentRequirementsNetwork;
1608
- /** The maximum amount required to pay for the resource in atomic units of the payment asset. */
1609
- maxAmountRequired: string;
1610
- /** The URL of the resource to pay for. */
1611
- resource: string;
1612
- /** The description of the resource. */
1613
- description: string;
1614
- /** The MIME type of the resource response. */
1615
- mimeType: string;
1616
- /** The optional JSON schema describing the resource output. */
1617
- outputSchema?: X402PaymentRequirementsOutputSchema;
1618
- /**
1619
- * The destination to pay value to.
1620
-
1621
- For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.
1622
-
1623
- For Solana-based networks, payTo will be a base58-encoded Solana address.
1624
- * @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
1625
- */
1626
- payTo: string;
1627
- /** The maximum time in seconds for the resource server to respond. */
1628
- maxTimeoutSeconds: number;
1629
- /**
1630
- * The asset to pay with.
1631
-
1632
- For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.
1633
-
1634
- For Solana-based networks, the asset will be a base58-encoded Solana address.
1635
- * @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
1636
- */
1637
- asset: string;
1638
- /** The optional additional scheme-specific payment info. */
1639
- extra?: X402PaymentRequirementsExtra;
1640
- }
1641
-
1642
- /**
1643
- * Communication protocol (e.g., "http", "mcp").
1644
- */
1645
- export type X402DiscoveryResourceType =
1646
- (typeof X402DiscoveryResourceType)[keyof typeof X402DiscoveryResourceType];
1647
-
1648
- // eslint-disable-next-line @typescript-eslint/no-redeclare
1649
- export const X402DiscoveryResourceType = {
1650
- http: "http",
1651
- } as const;
1652
-
1653
- /**
1654
- * Additional metadata as a JSON object.
1655
- */
1656
- export type X402DiscoveryResourceMetadata = { [key: string]: unknown };
1657
-
1658
- /**
1659
- * A single discovered x402 resource.
1660
- */
1661
- export interface X402DiscoveryResource {
1662
- /** The normalized resource identifier. */
1663
- resource: string;
1664
- /** Communication protocol (e.g., "http", "mcp"). */
1665
- type: X402DiscoveryResourceType;
1666
- x402Version: X402Version;
1667
- /** Payment requirements as an array of JSON objects. */
1668
- accepts?: X402PaymentRequirements[];
1669
- /** Timestamp of the last update. */
1670
- lastUpdated: string;
1671
- /** Additional metadata as a JSON object. */
1672
- metadata?: X402DiscoveryResourceMetadata;
1673
- }
1674
-
1675
- /**
1676
- * Pagination information for the response.
1677
- */
1678
- export type X402DiscoveryResourcesResponsePagination = {
1679
- /** The number of discovered x402 resources to return per page. */
1680
- limit?: number;
1681
- /** The offset of the first discovered x402 resource to return. */
1682
- offset?: number;
1683
- /** The total number of discovered x402 resources. */
1684
- total?: number;
1685
- };
1686
-
1687
- /**
1688
- * Response containing discovered x402 resources.
1689
- */
1690
- export interface X402DiscoveryResourcesResponse {
1691
- x402Version: X402Version;
1692
- /** List of discovered x402 resources. */
1693
- items: X402DiscoveryResource[];
1694
- /** Pagination information for the response. */
1695
- pagination: X402DiscoveryResourcesResponsePagination;
1696
- }
1697
-
1698
1613
  /**
1699
1614
  * The action of the payment method.
1700
1615
  */
@@ -1979,10 +1894,10 @@ export const OnrampOrderStatus = {
1979
1894
  export interface OnrampOrder {
1980
1895
  /** The ID of the onramp order. */
1981
1896
  orderId: string;
1982
- /** The total amount of fiat to be paid. */
1897
+ /** The total amount of fiat to be paid, inclusive of any fees. */
1983
1898
  paymentTotal: string;
1984
1899
  /** The amount of fiat to be converted to crypto. */
1985
- paymentSubtotal: unknown;
1900
+ paymentSubtotal: string;
1986
1901
  /** The fiat currency to be converted to crypto. */
1987
1902
  paymentCurrency: string;
1988
1903
  paymentMethod: OnrampPaymentMethodTypeId;
@@ -1992,7 +1907,7 @@ export interface OnrampOrder {
1992
1907
  purchaseCurrency: string;
1993
1908
  /** The fees associated with the order. */
1994
1909
  fees: OnrampOrderFee[];
1995
- /** The exchange rate used to convert fiat to crypto. */
1910
+ /** The exchange rate used to convert fiat to crypto i.e. the crypto value of one fiat. */
1996
1911
  exchangeRate: string;
1997
1912
  /** The destination address to send the crypto to. */
1998
1913
  destinationAddress: string;
@@ -2024,7 +1939,7 @@ export const OnrampPaymentLinkType = {
2024
1939
  Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for details on how to integrate with the different payment link types.
2025
1940
  */
2026
1941
  export interface OnrampPaymentLink {
2027
- /** The URL to the hosted widget the user should be redirected to, append your own redirect_url query parameter to this URL to ensure the user is redirected back to your app after the widget completes. */
1942
+ /** The URL to the hosted widget the user should be redirected to. For certain payment link types you can append your own redirect_url query parameter to this URL to ensure the user is redirected back to your app after the widget completes. */
2028
1943
  url: string;
2029
1944
  paymentLinkType: OnrampPaymentLinkType;
2030
1945
  }
@@ -2145,6 +2060,10 @@ export const SendEvmTransactionBodyNetwork = {
2145
2060
  "base-sepolia": "base-sepolia",
2146
2061
  ethereum: "ethereum",
2147
2062
  "ethereum-sepolia": "ethereum-sepolia",
2063
+ avalanche: "avalanche",
2064
+ polygon: "polygon",
2065
+ optimism: "optimism",
2066
+ arbitrum: "arbitrum",
2148
2067
  } as const;
2149
2068
 
2150
2069
  export type SendEvmTransactionBody = {
@@ -2284,6 +2203,24 @@ export type SendUserOperationBody = {
2284
2203
  signature: string;
2285
2204
  };
2286
2205
 
2206
+ export type ListSpendPermissionsParams = {
2207
+ /**
2208
+ * The number of spend permissions to return per page.
2209
+ */
2210
+ pageSize?: number;
2211
+ /**
2212
+ * The token for the next page of spend permissions. Will be empty if there are no more spend permissions to fetch.
2213
+ */
2214
+ pageToken?: string;
2215
+ };
2216
+
2217
+ export type ListSpendPermissions200AllOf = {
2218
+ /** The spend permissions for the smart account. */
2219
+ spendPermissions: SpendPermissionResponseObject[];
2220
+ };
2221
+
2222
+ export type ListSpendPermissions200 = ListSpendPermissions200AllOf & ListResponse;
2223
+
2287
2224
  export type GetEvmSwapPriceParams = {
2288
2225
  network: EvmSwapsNetwork;
2289
2226
  toToken: ToToken;
@@ -2632,22 +2569,6 @@ export type ListSolanaTokenBalances200AllOf = {
2632
2569
 
2633
2570
  export type ListSolanaTokenBalances200 = ListSolanaTokenBalances200AllOf & ListResponse;
2634
2571
 
2635
- export type ListX402DiscoveryResourcesParams = {
2636
- /**
2637
- * Filter by protocol type (e.g., "http", "mcp").
2638
- Currently, the only supported protocol type is "http".
2639
- */
2640
- type?: string;
2641
- /**
2642
- * The number of discovered x402 resources to return per page.
2643
- */
2644
- limit?: number;
2645
- /**
2646
- * The offset of the first discovered x402 resource to return.
2647
- */
2648
- offset?: number;
2649
- };
2650
-
2651
2572
  export type GetCryptoRailsParams = {
2652
2573
  /**
2653
2574
  * Comma separated list of networks to filter the rails by.
@@ -2697,7 +2618,7 @@ export type CreatePaymentTransferQuote201 = {
2697
2618
  };
2698
2619
 
2699
2620
  export type CreateOnrampOrderBody = {
2700
- /** The timestamp of the time the user acknowledged they are accepting the Coinbase service agreement (https://www.coinbase.com/legal/guest-checkout/us) by using Coinbase Onramp. */
2621
+ /** The timestamp of when the user acknowledged that by using Coinbase Onramp they are accepting the Coinbase Terms (https://www.coinbase.com/legal/guest-checkout/us), User Agreement (https://www.coinbase.com/legal/user_agreement), and Privacy Policy (https://www.coinbase.com/legal/privacy). */
2701
2622
  agreementAcceptedAt: string;
2702
2623
  /** The address the purchased crypto will be sent to. */
2703
2624
  destinationAddress: string;
@@ -2705,13 +2626,13 @@ export type CreateOnrampOrderBody = {
2705
2626
 
2706
2627
  Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported networks for your user's location. */
2707
2628
  destinationNetwork: string;
2708
- /** The email address of the user requesting the onramp transaction. */
2629
+ /** The verified email address of the user requesting the onramp transaction. This email must be verified by your app (via OTP) before being used with the Onramp API. */
2709
2630
  email: string;
2710
2631
  /** If true, this API will return a quote without creating any transaction. */
2711
2632
  isQuote?: boolean;
2712
2633
  /** Optional partner order reference ID. */
2713
2634
  partnerOrderRef?: string;
2714
- /** A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with “sandbox-” to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.
2635
+ /** A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with “sandbox-” (e.g. "sandbox-user-1234") to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.
2715
2636
 
2716
2637
  This value can be used with with [Onramp User Transactions API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-onramp-transactions-by-id) to retrieve all transactions created by the user. */
2717
2638
  partnerUserRef: string;
@@ -2722,13 +2643,13 @@ This value can be used with with [Onramp User Transactions API](https://docs.cdp
2722
2643
  paymentMethod: OnrampPaymentMethodTypeId;
2723
2644
  /** The phone number of the user requesting the onramp transaction in E.164 format. This phone number must be verified by your app (via OTP) before being used with the Onramp API.
2724
2645
 
2725
- Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for more details on phone number verification requirements and best practices. */
2646
+ Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api) for more details on phone number verification requirements and best practices. */
2726
2647
  phoneNumber: string;
2727
2648
  /** Timestamp of when the user's phone number was verified via OTP. User phone number must be verified every 60 days. If this timestamp is older than 60 days, an error will be returned. */
2728
2649
  phoneNumberVerifiedAt: string;
2729
- /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
2650
+ /** A string representing the amount of crypto the user wishes to purchase. When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
2730
2651
  purchaseAmount?: string;
2731
- /** The ticker (e.g. `BTC`, `USDC`) or the UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`) of crypto asset to be purchased.
2652
+ /** The ticker (e.g. `BTC`, `USDC`, `SOL`) or the Coinbase UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`) of the crypto asset to be purchased.
2732
2653
 
2733
2654
  Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported purchase currencies for your user's location. */
2734
2655
  purchaseCurrency: string;
@@ -14,6 +14,7 @@ import type {
14
14
  EvmSmartAccount,
15
15
  EvmUserOperation,
16
16
  ListEvmSmartAccounts200,
17
+ ListSpendPermissions200,
17
18
  } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
18
19
 
19
20
  export const getListEvmSmartAccountsResponseMock = (): ListEvmSmartAccounts200 => ({
@@ -306,6 +307,75 @@ export const getCreateSpendPermissionResponseMock = (
306
307
  ...overrideResponse,
307
308
  });
308
309
 
310
+ export const getListSpendPermissionsResponseMock = (): ListSpendPermissions200 => ({
311
+ ...{
312
+ spendPermissions: Array.from(
313
+ { length: faker.number.int({ min: 1, max: 10 }) },
314
+ (_, i) => i + 1,
315
+ ).map(() => ({
316
+ permission: faker.helpers.arrayElement([
317
+ {
318
+ account: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
319
+ spender: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
320
+ token: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
321
+ allowance: faker.string.alpha(20),
322
+ period: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
323
+ start: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
324
+ end: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
325
+ salt: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
326
+ extraData: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
327
+ },
328
+ undefined,
329
+ ]),
330
+ permissionHash: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
331
+ revoked: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
332
+ revokedAt: faker.helpers.arrayElement([
333
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
334
+ undefined,
335
+ ]),
336
+ createdAt: faker.helpers.arrayElement([
337
+ `${faker.date.past().toISOString().split(".")[0]}Z`,
338
+ undefined,
339
+ ]),
340
+ })),
341
+ },
342
+ ...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
343
+ });
344
+
345
+ export const getRevokeSpendPermissionResponseMock = (
346
+ overrideResponse: Partial<EvmUserOperation> = {},
347
+ ): EvmUserOperation => ({
348
+ network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
349
+ userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
350
+ calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
351
+ to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
352
+ value: faker.string.alpha(20),
353
+ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
354
+ })),
355
+ status: faker.helpers.arrayElement([
356
+ "pending",
357
+ "signed",
358
+ "broadcast",
359
+ "complete",
360
+ "dropped",
361
+ "failed",
362
+ ] as const),
363
+ transactionHash: faker.helpers.arrayElement([
364
+ faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
365
+ undefined,
366
+ ]),
367
+ receipts: faker.helpers.arrayElement([
368
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
369
+ revert: faker.helpers.arrayElement([
370
+ { data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
371
+ undefined,
372
+ ]),
373
+ })),
374
+ undefined,
375
+ ]),
376
+ ...overrideResponse,
377
+ });
378
+
309
379
  export const getListEvmSmartAccountsMockHandler = (
310
380
  overrideResponse?:
311
381
  | ListEvmSmartAccounts200
@@ -515,6 +585,52 @@ export const getCreateSpendPermissionMockHandler = (
515
585
  );
516
586
  });
517
587
  };
588
+
589
+ export const getListSpendPermissionsMockHandler = (
590
+ overrideResponse?:
591
+ | ListSpendPermissions200
592
+ | ((
593
+ info: Parameters<Parameters<typeof http.get>[1]>[0],
594
+ ) => Promise<ListSpendPermissions200> | ListSpendPermissions200),
595
+ ) => {
596
+ return http.get("*/v2/evm/smart-accounts/:address/spend-permissions/list", async info => {
597
+ await delay(0);
598
+
599
+ return new HttpResponse(
600
+ JSON.stringify(
601
+ overrideResponse !== undefined
602
+ ? typeof overrideResponse === "function"
603
+ ? await overrideResponse(info)
604
+ : overrideResponse
605
+ : getListSpendPermissionsResponseMock(),
606
+ ),
607
+ { status: 200, headers: { "Content-Type": "application/json" } },
608
+ );
609
+ });
610
+ };
611
+
612
+ export const getRevokeSpendPermissionMockHandler = (
613
+ overrideResponse?:
614
+ | EvmUserOperation
615
+ | ((
616
+ info: Parameters<Parameters<typeof http.post>[1]>[0],
617
+ ) => Promise<EvmUserOperation> | EvmUserOperation),
618
+ ) => {
619
+ return http.post("*/v2/evm/smart-accounts/:address/spend-permissions/revoke", async info => {
620
+ await delay(0);
621
+
622
+ return new HttpResponse(
623
+ JSON.stringify(
624
+ overrideResponse !== undefined
625
+ ? typeof overrideResponse === "function"
626
+ ? await overrideResponse(info)
627
+ : overrideResponse
628
+ : getRevokeSpendPermissionResponseMock(),
629
+ ),
630
+ { status: 200, headers: { "Content-Type": "application/json" } },
631
+ );
632
+ });
633
+ };
518
634
  export const getEvmSmartAccountsMock = () => [
519
635
  getListEvmSmartAccountsMockHandler(),
520
636
  getCreateEvmSmartAccountMockHandler(),
@@ -525,4 +641,6 @@ export const getEvmSmartAccountsMock = () => [
525
641
  getGetUserOperationMockHandler(),
526
642
  getSendUserOperationMockHandler(),
527
643
  getCreateSpendPermissionMockHandler(),
644
+ getListSpendPermissionsMockHandler(),
645
+ getRevokeSpendPermissionMockHandler(),
528
646
  ];
@@ -12,7 +12,10 @@ import type {
12
12
  EvmUserOperation,
13
13
  ListEvmSmartAccounts200,
14
14
  ListEvmSmartAccountsParams,
15
+ ListSpendPermissions200,
16
+ ListSpendPermissionsParams,
15
17
  PrepareUserOperationBody,
18
+ RevokeSpendPermissionRequest,
16
19
  SendUserOperationBody,
17
20
  UpdateEvmSmartAccountBody,
18
21
  } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
@@ -173,6 +176,39 @@ export const createSpendPermission = (
173
176
  options,
174
177
  );
175
178
  };
179
+ /**
180
+ * Lists spend permission for the given smart account address.
181
+ * @summary List spend permissions
182
+ */
183
+ export const listSpendPermissions = (
184
+ address: string,
185
+ params?: ListSpendPermissionsParams,
186
+ options?: SecondParameter<typeof cdpApiClient>,
187
+ ) => {
188
+ return cdpApiClient<ListSpendPermissions200>(
189
+ { url: `/v2/evm/smart-accounts/${address}/spend-permissions/list`, method: "GET", params },
190
+ options,
191
+ );
192
+ };
193
+ /**
194
+ * Revokes an existing spend permission.
195
+ * @summary Revoke a spend permission
196
+ */
197
+ export const revokeSpendPermission = (
198
+ address: string,
199
+ revokeSpendPermissionRequest: RevokeSpendPermissionRequest,
200
+ options?: SecondParameter<typeof cdpApiClient>,
201
+ ) => {
202
+ return cdpApiClient<EvmUserOperation>(
203
+ {
204
+ url: `/v2/evm/smart-accounts/${address}/spend-permissions/revoke`,
205
+ method: "POST",
206
+ headers: { "Content-Type": "application/json" },
207
+ data: revokeSpendPermissionRequest,
208
+ },
209
+ options,
210
+ );
211
+ };
176
212
  export type ListEvmSmartAccountsResult = NonNullable<
177
213
  Awaited<ReturnType<typeof listEvmSmartAccounts>>
178
214
  >;
@@ -194,3 +230,9 @@ export type SendUserOperationResult = NonNullable<Awaited<ReturnType<typeof send
194
230
  export type CreateSpendPermissionResult = NonNullable<
195
231
  Awaited<ReturnType<typeof createSpendPermission>>
196
232
  >;
233
+ export type ListSpendPermissionsResult = NonNullable<
234
+ Awaited<ReturnType<typeof listSpendPermissions>>
235
+ >;
236
+ export type RevokeSpendPermissionResult = NonNullable<
237
+ Awaited<ReturnType<typeof revokeSpendPermission>>
238
+ >;
@@ -8,4 +8,3 @@ export * from "./payments-alpha/payments-alpha.msw.js";
8
8
  export * from "./policy-engine/policy-engine.msw.js";
9
9
  export * from "./solana-accounts/solana-accounts.msw.js";
10
10
  export * from "./solana-token-balances/solana-token-balances.msw.js";
11
- export * from "./x402-facilitator/x402-facilitator.msw.js";
@@ -25,7 +25,7 @@ export const getCreateOnrampOrderResponseMock = (
25
25
  order: {
26
26
  orderId: faker.string.alpha(20),
27
27
  paymentTotal: faker.string.alpha(20),
28
- paymentSubtotal: {},
28
+ paymentSubtotal: faker.string.alpha(20),
29
29
  paymentCurrency: faker.string.alpha(20),
30
30
  paymentMethod: faker.helpers.arrayElement(Object.values(OnrampPaymentMethodTypeId)),
31
31
  purchaseAmount: faker.string.alpha(20),
@@ -61,7 +61,7 @@ export const getGetOnrampOrderByIdResponseMock = (
61
61
  order: {
62
62
  orderId: faker.string.alpha(20),
63
63
  paymentTotal: faker.string.alpha(20),
64
- paymentSubtotal: {},
64
+ paymentSubtotal: faker.string.alpha(20),
65
65
  paymentCurrency: faker.string.alpha(20),
66
66
  paymentMethod: faker.helpers.arrayElement(Object.values(OnrampPaymentMethodTypeId)),
67
67
  purchaseAmount: faker.string.alpha(20),
@@ -18,9 +18,9 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
18
18
  /**
19
19
  * Create a new Onramp order or get a quote for an Onramp order. Either `paymentAmount` or `purchaseAmount` must be provided.
20
20
 
21
- This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`, and the payment link returned will only work in native apps. We do not support web integration via iFrames.
21
+ This API currently only supports the payment method `GUEST_CHECKOUT_APPLE_PAY`, and the `paymentLink` returned will only work in iOS apps. We do not support web integration via iframes at this time.
22
22
 
23
- Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for detailed integration instructions.
23
+ For detailed integration instructions and to get access to this API, refer to the [Apple Pay Onramp API docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api).
24
24
  * @summary Create an onramp order
25
25
  */
26
26
  export const createOnrampOrder = (
@@ -8,7 +8,6 @@ export * from "./generated/solana-token-balances/solana-token-balances.js";
8
8
  export * from "./generated/faucets/faucets.js";
9
9
  export * from "./generated/policy-engine/policy-engine.js";
10
10
  export * from "./generated/payments-alpha/payments-alpha.js";
11
- export * from "./generated/x402-facilitator/x402-facilitator.js";
12
11
  export * from "./generated/onramp/onramp.js";
13
12
 
14
13
  import { configure } from "./cdpApiClient.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.30.0",
3
+ "version": "1.31.1",
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,6 +22,7 @@
22
22
  "@solana/web3.js": "^1.98.1",
23
23
  "abitype": "1.0.6",
24
24
  "axios": "^1.8.2",
25
+ "axios-retry": "^4.5.0",
25
26
  "jose": "^6.0.8",
26
27
  "md5": "^2.3.0",
27
28
  "uncrypto": "^0.1.3",
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.30.0";
1
+ export const version = "1.31.1";
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listX402DiscoveryResources = void 0;
4
- const cdpApiClient_js_1 = require("../../cdpApiClient.js");
5
- /**
6
- * Lists all active discovered x402 resources.
7
- This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
8
- The response is paginated, and by default, returns 100 items per page.
9
- * @summary List discovered x402 resources
10
- */
11
- const listX402DiscoveryResources = (params, options) => {
12
- return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/discovery/resources`, method: "GET", params }, options);
13
- };
14
- exports.listX402DiscoveryResources = listX402DiscoveryResources;
15
- //# sourceMappingURL=x402-facilitator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"x402-facilitator.js","sourceRoot":"","sources":["../../../../openapi-client/generated/x402-facilitator/x402-facilitator.ts"],"names":[],"mappings":";;;AAYA,2DAAqD;AAIrD;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CACxC,MAAyC,EACzC,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,8BAA8B,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAC9D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,0BAA0B,8BAQrC"}