@coinbase/cdp-sdk 1.36.1 → 1.37.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 (55) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +73 -1
  3. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  4. package/_cjs/openapi-client/generated/onchain-data/onchain-data.js +1 -39
  5. package/_cjs/openapi-client/generated/onchain-data/onchain-data.js.map +1 -1
  6. package/_cjs/openapi-client/generated/onramp/onramp.js +29 -1
  7. package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -1
  8. package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +43 -0
  9. package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -0
  10. package/_cjs/openapi-client/index.js +1 -0
  11. package/_cjs/openapi-client/index.js.map +1 -1
  12. package/_cjs/policies/solanaSchema.js +92 -2
  13. package/_cjs/policies/solanaSchema.js.map +1 -1
  14. package/_cjs/policies/types.js +1 -0
  15. package/_cjs/policies/types.js.map +1 -1
  16. package/_cjs/version.js +1 -1
  17. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +71 -0
  18. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  19. package/_esm/openapi-client/generated/onchain-data/onchain-data.js +0 -37
  20. package/_esm/openapi-client/generated/onchain-data/onchain-data.js.map +1 -1
  21. package/_esm/openapi-client/generated/onramp/onramp.js +27 -0
  22. package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -1
  23. package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +39 -0
  24. package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -0
  25. package/_esm/openapi-client/index.js +1 -0
  26. package/_esm/openapi-client/index.js.map +1 -1
  27. package/_esm/policies/solanaSchema.js +91 -1
  28. package/_esm/policies/solanaSchema.js.map +1 -1
  29. package/_esm/policies/types.js +2 -1
  30. package/_esm/policies/types.js.map +1 -1
  31. package/_esm/version.js +1 -1
  32. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +224 -4
  33. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  34. package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts +1 -32
  35. package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts.map +1 -1
  36. package/_types/openapi-client/generated/onramp/onramp.d.ts +22 -1
  37. package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -1
  38. package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts +43 -0
  39. package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts.map +1 -0
  40. package/_types/openapi-client/index.d.ts +1 -1
  41. package/_types/openapi-client/index.d.ts.map +1 -1
  42. package/_types/policies/solanaSchema.d.ts +325 -3
  43. package/_types/policies/solanaSchema.d.ts.map +1 -1
  44. package/_types/policies/types.d.ts +337 -0
  45. package/_types/policies/types.d.ts.map +1 -1
  46. package/_types/version.d.ts +1 -1
  47. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +291 -3
  48. package/openapi-client/generated/onchain-data/onchain-data.ts +0 -46
  49. package/openapi-client/generated/onramp/onramp.ts +38 -0
  50. package/openapi-client/generated/sql-api-alpha/sql-api-alpha.ts +60 -0
  51. package/openapi-client/index.ts +1 -0
  52. package/package.json +1 -1
  53. package/policies/solanaSchema.ts +124 -3
  54. package/policies/types.ts +6 -1
  55. package/version.ts +1 -1
@@ -376,6 +376,9 @@ export const SpendPermissionNetwork = {
376
376
  polygon: "polygon",
377
377
  } as const;
378
378
 
379
+ /**
380
+ * Request parameters for creating a Spend Permission.
381
+ */
379
382
  export interface CreateSpendPermissionRequest {
380
383
  network: SpendPermissionNetwork;
381
384
  /**
@@ -450,6 +453,9 @@ export interface SpendPermissionResponseObject {
450
453
  network: SpendPermissionNetwork;
451
454
  }
452
455
 
456
+ /**
457
+ * Request parameters for revoking a Spend Permission.
458
+ */
453
459
  export interface RevokeSpendPermissionRequest {
454
460
  network: SpendPermissionNetwork;
455
461
  /** The hash of the spend permission to revoke. */
@@ -1829,13 +1835,49 @@ export interface SolDataCriterion {
1829
1835
  conditions: SolDataCondition[];
1830
1836
  }
1831
1837
 
1838
+ /**
1839
+ * The type of criterion to use. This should be `programId`.
1840
+ */
1841
+ export type ProgramIdCriterionType =
1842
+ (typeof ProgramIdCriterionType)[keyof typeof ProgramIdCriterionType];
1843
+
1844
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1845
+ export const ProgramIdCriterionType = {
1846
+ programId: "programId",
1847
+ } as const;
1848
+
1849
+ /**
1850
+ * The operator to use for the comparison. Each of the program IDs in the transaction's instructions will be on the left-hand side of the operator, and the `programIds` field will be on the right-hand side.
1851
+ */
1852
+ export type ProgramIdCriterionOperator =
1853
+ (typeof ProgramIdCriterionOperator)[keyof typeof ProgramIdCriterionOperator];
1854
+
1855
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1856
+ export const ProgramIdCriterionOperator = {
1857
+ in: "in",
1858
+ not_in: "not in",
1859
+ } as const;
1860
+
1861
+ /**
1862
+ * The criterion for the program IDs of a Solana transaction's instructions.
1863
+ */
1864
+ export interface ProgramIdCriterion {
1865
+ /** The type of criterion to use. This should be `programId`. */
1866
+ type: ProgramIdCriterionType;
1867
+ /** The Solana program IDs that are compared to the list of program IDs in the transaction's instructions. */
1868
+ programIds: string[];
1869
+ /** The operator to use for the comparison. Each of the program IDs in the transaction's instructions will be on the left-hand side of the operator, and the `programIds` field will be on the right-hand side. */
1870
+ operator: ProgramIdCriterionOperator;
1871
+ }
1872
+
1832
1873
  export type SignSolTransactionCriteriaItem =
1833
1874
  | SolAddressCriterion
1834
1875
  | SolValueCriterion
1835
1876
  | SplAddressCriterion
1836
1877
  | SplValueCriterion
1837
1878
  | MintAddressCriterion
1838
- | SolDataCriterion;
1879
+ | SolDataCriterion
1880
+ | ProgramIdCriterion;
1839
1881
 
1840
1882
  /**
1841
1883
  * A schema for specifying criteria for the SignSolTransaction operation.
@@ -1873,13 +1915,62 @@ export interface SignSolTransactionRule {
1873
1915
  criteria: SignSolTransactionCriteria;
1874
1916
  }
1875
1917
 
1918
+ /**
1919
+ * The type of criterion to use. This should be `solNetwork`.
1920
+ */
1921
+ export type SolNetworkCriterionType =
1922
+ (typeof SolNetworkCriterionType)[keyof typeof SolNetworkCriterionType];
1923
+
1924
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1925
+ export const SolNetworkCriterionType = {
1926
+ solNetwork: "solNetwork",
1927
+ } as const;
1928
+
1929
+ /**
1930
+ * The Solana network the transaction is for.
1931
+ */
1932
+ export type SolNetworkCriterionNetworksItem =
1933
+ (typeof SolNetworkCriterionNetworksItem)[keyof typeof SolNetworkCriterionNetworksItem];
1934
+
1935
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1936
+ export const SolNetworkCriterionNetworksItem = {
1937
+ "solana-devnet": "solana-devnet",
1938
+ solana: "solana",
1939
+ } as const;
1940
+
1941
+ /**
1942
+ * The operator to use for the comparison. The transaction's intended network will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side.
1943
+ */
1944
+ export type SolNetworkCriterionOperator =
1945
+ (typeof SolNetworkCriterionOperator)[keyof typeof SolNetworkCriterionOperator];
1946
+
1947
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1948
+ export const SolNetworkCriterionOperator = {
1949
+ in: "in",
1950
+ not_in: "not in",
1951
+ } as const;
1952
+
1953
+ /**
1954
+ * The criterion for the Solana network of a transaction.
1955
+ */
1956
+ export interface SolNetworkCriterion {
1957
+ /** The type of criterion to use. This should be `solNetwork`. */
1958
+ type: SolNetworkCriterionType;
1959
+ /** The Solana networks that the transaction's intended network should be compared to. */
1960
+ networks: SolNetworkCriterionNetworksItem[];
1961
+ /** The operator to use for the comparison. The transaction's intended network will be on the left-hand side of the operator, and the `networks` field will be on the right-hand side. */
1962
+ operator: SolNetworkCriterionOperator;
1963
+ }
1964
+
1876
1965
  export type SendSolTransactionCriteriaItem =
1877
1966
  | SolAddressCriterion
1878
1967
  | SolValueCriterion
1879
1968
  | SplAddressCriterion
1880
1969
  | SplValueCriterion
1881
1970
  | MintAddressCriterion
1882
- | SolDataCriterion;
1971
+ | SolDataCriterion
1972
+ | ProgramIdCriterion
1973
+ | SolNetworkCriterion;
1883
1974
 
1884
1975
  /**
1885
1976
  * A schema for specifying criteria for the SendSolTransaction operation.
@@ -1917,6 +2008,63 @@ export interface SendSolTransactionRule {
1917
2008
  criteria: SendSolTransactionCriteria;
1918
2009
  }
1919
2010
 
2011
+ /**
2012
+ * The type of criterion to use. This should be `solMessage`.
2013
+ */
2014
+ export type SolMessageCriterionType =
2015
+ (typeof SolMessageCriterionType)[keyof typeof SolMessageCriterionType];
2016
+
2017
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2018
+ export const SolMessageCriterionType = {
2019
+ solMessage: "solMessage",
2020
+ } as const;
2021
+
2022
+ /**
2023
+ * The criterion for the message of a Solana transaction.
2024
+ */
2025
+ export interface SolMessageCriterion {
2026
+ /** The type of criterion to use. This should be `solMessage`. */
2027
+ type: SolMessageCriterionType;
2028
+ /** A regular expression the field is matched against. */
2029
+ match: string;
2030
+ }
2031
+
2032
+ /**
2033
+ * A schema for specifying criteria for the SignSolMessage operation.
2034
+ */
2035
+ export type SignSolMessageCriteria = SolMessageCriterion[];
2036
+
2037
+ /**
2038
+ * Whether matching the rule will cause the request to be rejected or accepted.
2039
+ */
2040
+ export type SignSolMessageRuleAction =
2041
+ (typeof SignSolMessageRuleAction)[keyof typeof SignSolMessageRuleAction];
2042
+
2043
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2044
+ export const SignSolMessageRuleAction = {
2045
+ reject: "reject",
2046
+ accept: "accept",
2047
+ } as const;
2048
+
2049
+ /**
2050
+ * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
2051
+ */
2052
+ export type SignSolMessageRuleOperation =
2053
+ (typeof SignSolMessageRuleOperation)[keyof typeof SignSolMessageRuleOperation];
2054
+
2055
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2056
+ export const SignSolMessageRuleOperation = {
2057
+ signSolMessage: "signSolMessage",
2058
+ } as const;
2059
+
2060
+ export interface SignSolMessageRule {
2061
+ /** Whether matching the rule will cause the request to be rejected or accepted. */
2062
+ action: SignSolMessageRuleAction;
2063
+ /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
2064
+ operation: SignSolMessageRuleOperation;
2065
+ criteria: SignSolMessageCriteria;
2066
+ }
2067
+
1920
2068
  /**
1921
2069
  * Whether any attempts to sign a hash will be accepted or rejected. This rule does not accept any criteria.
1922
2070
  */
@@ -2040,6 +2188,7 @@ export type Rule =
2040
2188
  | SignEvmTypedDataRule
2041
2189
  | SignSolTransactionRule
2042
2190
  | SendSolTransactionRule
2191
+ | SignSolMessageRule
2043
2192
  | SignEvmHashRule
2044
2193
  | PrepareUserOperationRule
2045
2194
  | SendUserOperationRule;
@@ -2298,6 +2447,14 @@ export interface X402ExactEvmPayload {
2298
2447
  authorization: X402ExactEvmPayloadAuthorization;
2299
2448
  }
2300
2449
 
2450
+ /**
2451
+ * The x402 protocol exact scheme payload for Solana networks. For more details, please see [Solana Exact Scheme Details](https://github.com/coinbase/x402/blob/main/specs/schemes/exact/scheme_exact_svm.md).
2452
+ */
2453
+ export interface X402ExactSolanaPayload {
2454
+ /** The base64-encoded Solana transaction. */
2455
+ transaction: string;
2456
+ }
2457
+
2301
2458
  /**
2302
2459
  * The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
2303
2460
  */
@@ -2319,8 +2476,15 @@ export type X402PaymentPayloadNetwork =
2319
2476
  export const X402PaymentPayloadNetwork = {
2320
2477
  "base-sepolia": "base-sepolia",
2321
2478
  base: "base",
2479
+ "solana-devnet": "solana-devnet",
2480
+ solana: "solana",
2322
2481
  } as const;
2323
2482
 
2483
+ /**
2484
+ * The payload of the payment depending on the x402Version, scheme, and network.
2485
+ */
2486
+ export type X402PaymentPayloadPayload = X402ExactEvmPayload | X402ExactSolanaPayload;
2487
+
2324
2488
  /**
2325
2489
  * The x402 protocol payment payload that the client attaches to x402-paid API requests to the resource server in the X-PAYMENT header.
2326
2490
  */
@@ -2331,7 +2495,7 @@ export interface X402PaymentPayload {
2331
2495
  /** The network of the blockchain to send payment on. */
2332
2496
  network: X402PaymentPayloadNetwork;
2333
2497
  /** The payload of the payment depending on the x402Version, scheme, and network. */
2334
- payload: X402ExactEvmPayload;
2498
+ payload: X402PaymentPayloadPayload;
2335
2499
  }
2336
2500
 
2337
2501
  /**
@@ -2355,6 +2519,8 @@ export type X402PaymentRequirementsNetwork =
2355
2519
  export const X402PaymentRequirementsNetwork = {
2356
2520
  "base-sepolia": "base-sepolia",
2357
2521
  base: "base",
2522
+ "solana-devnet": "solana-devnet",
2523
+ solana: "solana",
2358
2524
  } as const;
2359
2525
 
2360
2526
  /**
@@ -2436,6 +2602,41 @@ export const X402VerifyInvalidReason = {
2436
2602
  "invalid_exact_evm_payload_authorization_to_address_kyt",
2437
2603
  invalid_exact_evm_payload_signature: "invalid_exact_evm_payload_signature",
2438
2604
  invalid_exact_evm_payload_signature_address: "invalid_exact_evm_payload_signature_address",
2605
+ invalid_exact_svm_payload_transaction: "invalid_exact_svm_payload_transaction",
2606
+ invalid_exact_svm_payload_transaction_amount_mismatch:
2607
+ "invalid_exact_svm_payload_transaction_amount_mismatch",
2608
+ invalid_exact_svm_payload_transaction_create_ata_instruction:
2609
+ "invalid_exact_svm_payload_transaction_create_ata_instruction",
2610
+ invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee:
2611
+ "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_payee",
2612
+ invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset:
2613
+ "invalid_exact_svm_payload_transaction_create_ata_instruction_incorrect_asset",
2614
+ invalid_exact_svm_payload_transaction_instructions:
2615
+ "invalid_exact_svm_payload_transaction_instructions",
2616
+ invalid_exact_svm_payload_transaction_instructions_length:
2617
+ "invalid_exact_svm_payload_transaction_instructions_length",
2618
+ invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction:
2619
+ "invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction",
2620
+ invalid_exact_svm_payload_transaction_instructions_compute_price_instruction:
2621
+ "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction",
2622
+ invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high:
2623
+ "invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high",
2624
+ invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked:
2625
+ "invalid_exact_svm_payload_transaction_instruction_not_spl_token_transfer_checked",
2626
+ invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked:
2627
+ "invalid_exact_svm_payload_transaction_instruction_not_token_2022_transfer_checked",
2628
+ invalid_exact_svm_payload_transaction_not_a_transfer_instruction:
2629
+ "invalid_exact_svm_payload_transaction_not_a_transfer_instruction",
2630
+ invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata:
2631
+ "invalid_exact_svm_payload_transaction_cannot_derive_receiver_ata",
2632
+ invalid_exact_svm_payload_transaction_receiver_ata_not_found:
2633
+ "invalid_exact_svm_payload_transaction_receiver_ata_not_found",
2634
+ invalid_exact_svm_payload_transaction_sender_ata_not_found:
2635
+ "invalid_exact_svm_payload_transaction_sender_ata_not_found",
2636
+ invalid_exact_svm_payload_transaction_simulation_failed:
2637
+ "invalid_exact_svm_payload_transaction_simulation_failed",
2638
+ invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata:
2639
+ "invalid_exact_svm_payload_transaction_transfer_to_incorrect_ata",
2439
2640
  } as const;
2440
2641
 
2441
2642
  /**
@@ -2464,6 +2665,9 @@ export const X402SettleErrorReason = {
2464
2665
  invalid_exact_evm_payload_authorization_to_address_kyt:
2465
2666
  "invalid_exact_evm_payload_authorization_to_address_kyt",
2466
2667
  invalid_exact_evm_payload_signature_address: "invalid_exact_evm_payload_signature_address",
2668
+ settle_exact_svm_block_height_exceeded: "settle_exact_svm_block_height_exceeded",
2669
+ settle_exact_svm_transaction_confirmation_timed_out:
2670
+ "settle_exact_svm_transaction_confirmation_timed_out",
2467
2671
  } as const;
2468
2672
 
2469
2673
  /**
@@ -2487,8 +2691,15 @@ export type X402SupportedPaymentKindNetwork =
2487
2691
  export const X402SupportedPaymentKindNetwork = {
2488
2692
  "base-sepolia": "base-sepolia",
2489
2693
  base: "base",
2694
+ "solana-devnet": "solana-devnet",
2695
+ solana: "solana",
2490
2696
  } as const;
2491
2697
 
2698
+ /**
2699
+ * The optional additional scheme-specific payment info.
2700
+ */
2701
+ export type X402SupportedPaymentKindExtra = { [key: string]: unknown };
2702
+
2492
2703
  /**
2493
2704
  * The supported payment kind for the x402 protocol. A kind is comprised of a scheme and a network, which together uniquely identify a way to move money on the x402 protocol. For more details, please see [x402 Schemes](https://github.com/coinbase/x402?tab=readme-ov-file#schemes).
2494
2705
  */
@@ -2498,6 +2709,8 @@ export interface X402SupportedPaymentKind {
2498
2709
  scheme: X402SupportedPaymentKindScheme;
2499
2710
  /** The network of the blockchain. */
2500
2711
  network: X402SupportedPaymentKindNetwork;
2712
+ /** The optional additional scheme-specific payment info. */
2713
+ extra?: X402SupportedPaymentKindExtra;
2501
2714
  }
2502
2715
 
2503
2716
  /**
@@ -2834,6 +3047,52 @@ export interface OnrampPaymentLink {
2834
3047
  paymentLinkType: OnrampPaymentLinkType;
2835
3048
  }
2836
3049
 
3050
+ /**
3051
+ * The type of payment method used to generate the onramp quote.
3052
+ */
3053
+ export type OnrampQuotePaymentMethodTypeId =
3054
+ (typeof OnrampQuotePaymentMethodTypeId)[keyof typeof OnrampQuotePaymentMethodTypeId];
3055
+
3056
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
3057
+ export const OnrampQuotePaymentMethodTypeId = {
3058
+ CARD: "CARD",
3059
+ ACH: "ACH",
3060
+ APPLE_PAY: "APPLE_PAY",
3061
+ PAYPAL: "PAYPAL",
3062
+ FIAT_WALLET: "FIAT_WALLET",
3063
+ CRYPTO_WALLET: "CRYPTO_WALLET",
3064
+ } as const;
3065
+
3066
+ /**
3067
+ * An onramp session containing a ready-to-use onramp URL.
3068
+ */
3069
+ export interface OnrampSession {
3070
+ /** Ready-to-use onramp URL. */
3071
+ onrampUrl: string;
3072
+ }
3073
+
3074
+ /**
3075
+ * Quote information with pricing details for the crypto purchase.
3076
+ */
3077
+ export interface OnrampQuote {
3078
+ /** The total amount of fiat to be paid, inclusive of any fees. */
3079
+ paymentTotal: string;
3080
+ /** The amount of fiat to be converted to crypto. */
3081
+ paymentSubtotal: string;
3082
+ /** The fiat currency to be converted to crypto. */
3083
+ paymentCurrency: string;
3084
+ /** The amount of crypto to be purchased. */
3085
+ purchaseAmount: string;
3086
+ /** The crypto currency to be purchased. */
3087
+ purchaseCurrency: string;
3088
+ /** The network to send the crypto on. */
3089
+ destinationNetwork: string;
3090
+ /** The fees associated with the quote. */
3091
+ fees: OnrampOrderFee[];
3092
+ /** The exchange rate used to convert fiat to crypto i.e. the crypto value of one fiat. */
3093
+ exchangeRate: string;
3094
+ }
3095
+
2837
3096
  /**
2838
3097
  * Internal server error.
2839
3098
  */
@@ -3645,3 +3904,32 @@ export type CreateOnrampOrder201 = {
3645
3904
  export type GetOnrampOrderById200 = {
3646
3905
  order: OnrampOrder;
3647
3906
  };
3907
+
3908
+ export type CreateOnrampSessionBody = {
3909
+ /** 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.
3910
+
3911
+ 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. */
3912
+ purchaseCurrency: string;
3913
+ /** The name of the crypto network the purchased currency will be sent on.
3914
+
3915
+ 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. */
3916
+ destinationNetwork: string;
3917
+ /** The address the purchased crypto will be sent to. */
3918
+ destinationAddress: string;
3919
+ /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. */
3920
+ paymentAmount?: string;
3921
+ /** The fiat currency to be converted to crypto. */
3922
+ paymentCurrency?: string;
3923
+ paymentMethod?: OnrampQuotePaymentMethodTypeId;
3924
+ /** The ISO 3166-1 two letter country code (e.g. US). */
3925
+ country?: string;
3926
+ /** The ISO 3166-2 two letter state code (e.g. NY). Only required for US. */
3927
+ subdivision?: string;
3928
+ /** URL to redirect the user to when they successfully complete a transaction. This URL will be embedded in the returned onramp URL as a query parameter. */
3929
+ redirectUrl?: string;
3930
+ };
3931
+
3932
+ export type CreateOnrampSession201 = {
3933
+ session: OnrampSession;
3934
+ quote?: OnrampQuote;
3935
+ };
@@ -10,57 +10,12 @@ import type {
10
10
  ListDataTokenBalances200,
11
11
  ListDataTokenBalancesParams,
12
12
  ListEvmTokenBalancesNetwork,
13
- OnchainDataQuery,
14
- OnchainDataResult,
15
13
  } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
16
14
 
17
15
  import { cdpApiClient } from "../../cdpApiClient.js";
18
16
 
19
17
  type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
20
18
 
21
- /**
22
- * Run a read-only SQL query against indexed blockchain data including transactions, events, and decoded logs.
23
-
24
- This endpoint provides direct SQL access to comprehensive blockchain data across supported networks.
25
- Queries are executed against optimized data structures for high-performance analytics.
26
-
27
- ### Allowed Queries
28
-
29
- - Standard SQL syntax (ClickHouse dialect)
30
- - Read-only queries (SELECT statements)
31
- - No DDL or DML operations
32
- - No cartesian products
33
-
34
- ### Supported Tables
35
-
36
- - `base.events` - Base mainnet decoded event logs with parameters, event signature, topics, and more.
37
- - `base.transactions` - Base mainnet transaction data including hash, block number, gas usage.
38
- - `base.blocks` - Base mainnet block information.
39
- - `base.encoded_logs` - Encoded log data of event logs that aren't able to be decoded by our event decoder (ex: log0 opcode).
40
- - `base.transfers` - All event logs with event signature `Transfer(address,address,uint256)`. ERC-20, ERC-721, and ERC-1155 transfers are all included.
41
-
42
- ### Query Limits
43
-
44
- - Maximum result set: 10,000 rows
45
- - Query timeout: 30 seconds
46
- - Maximum JOINs: 5
47
-
48
- * @summary Run SQL Query
49
- */
50
- export const runSQLQuery = (
51
- onchainDataQuery: OnchainDataQuery,
52
- options?: SecondParameter<typeof cdpApiClient>,
53
- ) => {
54
- return cdpApiClient<OnchainDataResult>(
55
- {
56
- url: `/v2/data/query/run`,
57
- method: "POST",
58
- headers: { "Content-Type": "application/json" },
59
- data: onchainDataQuery,
60
- },
61
- options,
62
- );
63
- };
64
19
  /**
65
20
  * Retrieve all ERC-20 token contract addresses that an account has ever received tokens from.
66
21
  Analyzes transaction history to discover token interactions.
@@ -94,7 +49,6 @@ export const listDataTokenBalances = (
94
49
  options,
95
50
  );
96
51
  };
97
- export type RunSQLQueryResult = NonNullable<Awaited<ReturnType<typeof runSQLQuery>>>;
98
52
  export type ListTokensForAccountResult = NonNullable<
99
53
  Awaited<ReturnType<typeof listTokensForAccount>>
100
54
  >;
@@ -8,6 +8,8 @@
8
8
  import type {
9
9
  CreateOnrampOrder201,
10
10
  CreateOnrampOrderBody,
11
+ CreateOnrampSession201,
12
+ CreateOnrampSessionBody,
11
13
  GetOnrampOrderById200,
12
14
  } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
13
15
 
@@ -50,5 +52,41 @@ export const getOnrampOrderById = (
50
52
  options,
51
53
  );
52
54
  };
55
+ /**
56
+ * Returns a single-use URL for an Onramp session. This API provides flexible functionality based on the parameters provided, supporting three cases:
57
+
58
+ **Important**: The returned URL is single-use only. Once a user visits the URL, no one else can access it.
59
+ ## Use Cases
60
+ ### 1. Basic Session (Minimum Parameters)
61
+ **Required**: `destinationAddress`, `purchaseCurrency`, `destinationNetwork`
62
+
63
+ **Returns**: Basic single-use onramp URL. The `quote` object will not be included in the response.
64
+ ### 2. One-Click Onramp URL
65
+ **Required**: Basic parameters + `paymentAmount`, `paymentCurrency`
66
+
67
+ **Returns**: One-click onramp URL for streamlined checkout. The `quote` object will not be included in the response.
68
+ ### 3. One-Click Onramp URL with Quote
69
+ **Required**: One-Click Onramp parameters + `paymentMethod`, `country`, `subdivision`
70
+
71
+ **Returns**: Complete pricing quote and one-click onramp URL. Both `session` and `quote` objects will be included in the response.
72
+ * @summary Create an onramp session
73
+ */
74
+ export const createOnrampSession = (
75
+ createOnrampSessionBody: CreateOnrampSessionBody,
76
+ options?: SecondParameter<typeof cdpApiClient>,
77
+ ) => {
78
+ return cdpApiClient<CreateOnrampSession201>(
79
+ {
80
+ url: `/v2/onramp/sessions`,
81
+ method: "POST",
82
+ headers: { "Content-Type": "application/json" },
83
+ data: createOnrampSessionBody,
84
+ },
85
+ options,
86
+ );
87
+ };
53
88
  export type CreateOnrampOrderResult = NonNullable<Awaited<ReturnType<typeof createOnrampOrder>>>;
54
89
  export type GetOnrampOrderByIdResult = NonNullable<Awaited<ReturnType<typeof getOnrampOrderById>>>;
90
+ export type CreateOnrampSessionResult = NonNullable<
91
+ Awaited<ReturnType<typeof createOnrampSession>>
92
+ >;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Generated by orval v7.6.0 🍺
3
+ * Do not edit manually.
4
+ * Coinbase Developer Platform APIs
5
+ * The Coinbase Developer Platform APIs - leading the world's transition onchain.
6
+ * OpenAPI spec version: 2.0.0
7
+ */
8
+ import type {
9
+ OnchainDataQuery,
10
+ OnchainDataResult,
11
+ } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
12
+
13
+ import { cdpApiClient } from "../../cdpApiClient.js";
14
+
15
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
16
+
17
+ /**
18
+ * Run a read-only SQL query against indexed blockchain data including transactions, events, and decoded logs.
19
+
20
+ This endpoint provides direct SQL access to comprehensive blockchain data across supported networks.
21
+ Queries are executed against optimized data structures for high-performance analytics.
22
+
23
+ ### Allowed Queries
24
+
25
+ - Standard SQL syntax (ClickHouse dialect)
26
+ - Read-only queries (SELECT statements)
27
+ - No DDL or DML operations
28
+ - No cartesian products
29
+
30
+ ### Supported Tables
31
+
32
+ - `base.events` - Base mainnet decoded event logs with parameters, event signature, topics, and more.
33
+ - `base.transactions` - Base mainnet transaction data including hash, block number, gas usage.
34
+ - `base.blocks` - Base mainnet block information.
35
+ - `base.encoded_logs` - Encoded log data of event logs that aren't able to be decoded by our event decoder (ex: log0 opcode).
36
+ - `base.transfers` - All event logs with event signature `Transfer(address,address,uint256)`. ERC-20, ERC-721, and ERC-1155 transfers are all included.
37
+
38
+ ### Query Limits
39
+
40
+ - Maximum result set: 10,000 rows
41
+ - Query timeout: 30 seconds
42
+ - Maximum JOINs: 5
43
+
44
+ * @summary Run SQL Query
45
+ */
46
+ export const runSQLQuery = (
47
+ onchainDataQuery: OnchainDataQuery,
48
+ options?: SecondParameter<typeof cdpApiClient>,
49
+ ) => {
50
+ return cdpApiClient<OnchainDataResult>(
51
+ {
52
+ url: `/v2/data/query/run`,
53
+ method: "POST",
54
+ headers: { "Content-Type": "application/json" },
55
+ data: onchainDataQuery,
56
+ },
57
+ options,
58
+ );
59
+ };
60
+ export type RunSQLQueryResult = NonNullable<Awaited<ReturnType<typeof runSQLQuery>>>;
@@ -12,6 +12,7 @@ export * from "./generated/onramp/onramp.js";
12
12
  export * from "./generated/onchain-data/onchain-data.js";
13
13
  export * from "./generated/end-user-accounts/end-user-accounts.js";
14
14
  export * from "./generated/x402-facilitator/x402-facilitator.js";
15
+ export * from "./generated/sql-api-alpha/sql-api-alpha.js";
15
16
 
16
17
  import { configure } from "./cdpApiClient.js";
17
18
  import * as endUserAccounts from "./generated/end-user-accounts/end-user-accounts.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cdp-sdk",
3
- "version": "1.36.1",
3
+ "version": "1.37.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",