@coinbase/cdp-sdk 1.10.0 → 1.12.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 (159) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +137 -0
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +32 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +18 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/actions/evm/fund/Quote.js +63 -0
  8. package/_cjs/actions/evm/fund/Quote.js.map +1 -0
  9. package/_cjs/actions/evm/fund/fund.js +49 -0
  10. package/_cjs/actions/evm/fund/fund.js.map +1 -0
  11. package/_cjs/actions/evm/fund/quoteFund.js +46 -0
  12. package/_cjs/actions/evm/fund/quoteFund.js.map +1 -0
  13. package/_cjs/actions/evm/fund/types.js +3 -0
  14. package/_cjs/actions/evm/fund/types.js.map +1 -0
  15. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js +64 -0
  16. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
  17. package/_cjs/actions/evm/swap/createSwapQuote.js +126 -0
  18. package/_cjs/actions/evm/swap/createSwapQuote.js.map +1 -0
  19. package/_cjs/actions/evm/swap/getSwapPrice.js +86 -0
  20. package/_cjs/actions/evm/swap/getSwapPrice.js.map +1 -0
  21. package/_cjs/actions/evm/swap/sendSwapTransaction.js +141 -0
  22. package/_cjs/actions/evm/swap/sendSwapTransaction.js.map +1 -0
  23. package/_cjs/actions/evm/swap/types.js +3 -0
  24. package/_cjs/actions/evm/swap/types.js.map +1 -0
  25. package/_cjs/client/evm/evm.js +47 -1
  26. package/_cjs/client/evm/evm.js.map +1 -1
  27. package/_cjs/client/solana/solana.js +4 -1
  28. package/_cjs/client/solana/solana.js.map +1 -1
  29. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +45 -1
  30. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  31. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.js +26 -0
  32. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.js.map +1 -0
  33. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.msw.js +179 -0
  34. package/_cjs/openapi-client/generated/evm-swaps/evm-swaps.msw.js.map +1 -0
  35. package/_cjs/openapi-client/generated/index.msw.js +5 -3
  36. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  37. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js +50 -0
  38. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
  39. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js +270 -0
  40. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
  41. package/_cjs/openapi-client/index.js +7 -0
  42. package/_cjs/openapi-client/index.js.map +1 -1
  43. package/_cjs/version.js +1 -1
  44. package/_esm/accounts/evm/toEvmServerAccount.js +32 -0
  45. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  46. package/_esm/accounts/evm/toEvmSmartAccount.js +18 -0
  47. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  48. package/_esm/actions/evm/fund/Quote.js +59 -0
  49. package/_esm/actions/evm/fund/Quote.js.map +1 -0
  50. package/_esm/actions/evm/fund/fund.js +46 -0
  51. package/_esm/actions/evm/fund/fund.js.map +1 -0
  52. package/_esm/actions/evm/fund/quoteFund.js +43 -0
  53. package/_esm/actions/evm/fund/quoteFund.js.map +1 -0
  54. package/_esm/actions/evm/fund/types.js +2 -0
  55. package/_esm/actions/evm/fund/types.js.map +1 -0
  56. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js +61 -0
  57. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
  58. package/_esm/actions/evm/swap/createSwapQuote.js +123 -0
  59. package/_esm/actions/evm/swap/createSwapQuote.js.map +1 -0
  60. package/_esm/actions/evm/swap/getSwapPrice.js +83 -0
  61. package/_esm/actions/evm/swap/getSwapPrice.js.map +1 -0
  62. package/_esm/actions/evm/swap/sendSwapTransaction.js +138 -0
  63. package/_esm/actions/evm/swap/sendSwapTransaction.js.map +1 -0
  64. package/_esm/actions/evm/swap/types.js +2 -0
  65. package/_esm/actions/evm/swap/types.js.map +1 -0
  66. package/_esm/client/evm/evm.js +47 -1
  67. package/_esm/client/evm/evm.js.map +1 -1
  68. package/_esm/client/solana/solana.js +4 -1
  69. package/_esm/client/solana/solana.js.map +1 -1
  70. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +44 -0
  71. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  72. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.js +21 -0
  73. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.js.map +1 -0
  74. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.msw.js +167 -0
  75. package/_esm/openapi-client/generated/evm-swaps/evm-swaps.msw.js.map +1 -0
  76. package/_esm/openapi-client/generated/index.msw.js +5 -3
  77. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  78. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js +42 -0
  79. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
  80. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js +250 -0
  81. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
  82. package/_esm/openapi-client/index.js +7 -0
  83. package/_esm/openapi-client/index.js.map +1 -1
  84. package/_esm/version.js +1 -1
  85. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  86. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  87. package/_types/accounts/evm/types.d.ts +1 -2
  88. package/_types/accounts/evm/types.d.ts.map +1 -1
  89. package/_types/actions/evm/fund/Quote.d.ts +51 -0
  90. package/_types/actions/evm/fund/Quote.d.ts.map +1 -0
  91. package/_types/actions/evm/fund/fund.d.ts +25 -0
  92. package/_types/actions/evm/fund/fund.d.ts.map +1 -0
  93. package/_types/actions/evm/fund/quoteFund.d.ts +25 -0
  94. package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -0
  95. package/_types/actions/evm/fund/types.d.ts +16 -0
  96. package/_types/actions/evm/fund/types.d.ts.map +1 -0
  97. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts +68 -0
  98. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +1 -0
  99. package/_types/actions/evm/swap/createSwapQuote.d.ts +23 -0
  100. package/_types/actions/evm/swap/createSwapQuote.d.ts.map +1 -0
  101. package/_types/actions/evm/swap/getSwapPrice.d.ts +23 -0
  102. package/_types/actions/evm/swap/getSwapPrice.d.ts.map +1 -0
  103. package/_types/actions/evm/swap/sendSwapTransaction.d.ts +64 -0
  104. package/_types/actions/evm/swap/sendSwapTransaction.d.ts.map +1 -0
  105. package/_types/actions/evm/swap/types.d.ts +80 -0
  106. package/_types/actions/evm/swap/types.d.ts.map +1 -0
  107. package/_types/actions/evm/types.d.ts +151 -0
  108. package/_types/actions/evm/types.d.ts.map +1 -1
  109. package/_types/client/evm/evm.d.ts +39 -1
  110. package/_types/client/evm/evm.d.ts.map +1 -1
  111. package/_types/client/evm/evm.types.d.ts +209 -3
  112. package/_types/client/evm/evm.types.d.ts.map +1 -1
  113. package/_types/client/solana/solana.d.ts.map +1 -1
  114. package/_types/client/solana/solana.types.d.ts +2 -0
  115. package/_types/client/solana/solana.types.d.ts.map +1 -1
  116. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +547 -3
  117. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  118. package/_types/openapi-client/generated/evm-swaps/evm-swaps.d.ts +24 -0
  119. package/_types/openapi-client/generated/evm-swaps/evm-swaps.d.ts.map +1 -0
  120. package/_types/openapi-client/generated/evm-swaps/evm-swaps.msw.d.ts +12 -0
  121. package/_types/openapi-client/generated/evm-swaps/evm-swaps.msw.d.ts.map +1 -0
  122. package/_types/openapi-client/generated/index.msw.d.ts +5 -3
  123. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  124. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts +42 -0
  125. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts.map +1 -0
  126. package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts +20 -0
  127. package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts.map +1 -0
  128. package/_types/openapi-client/index.d.ts +11 -0
  129. package/_types/openapi-client/index.d.ts.map +1 -1
  130. package/_types/types/misc.d.ts +2 -2
  131. package/_types/types/misc.d.ts.map +1 -1
  132. package/_types/version.d.ts +1 -1
  133. package/accounts/evm/toEvmServerAccount.ts +47 -0
  134. package/accounts/evm/toEvmSmartAccount.ts +26 -0
  135. package/accounts/evm/types.ts +1 -2
  136. package/actions/evm/fund/Quote.ts +83 -0
  137. package/actions/evm/fund/fund.ts +76 -0
  138. package/actions/evm/fund/quoteFund.ts +81 -0
  139. package/actions/evm/fund/types.ts +16 -0
  140. package/actions/evm/fund/waitForFundOperationReceipt.ts +118 -0
  141. package/actions/evm/swap/createSwapQuote.ts +148 -0
  142. package/actions/evm/swap/getSwapPrice.ts +95 -0
  143. package/actions/evm/swap/sendSwapTransaction.ts +173 -0
  144. package/actions/evm/swap/types.ts +94 -0
  145. package/actions/evm/types.ts +161 -0
  146. package/client/evm/evm.ts +59 -1
  147. package/client/evm/evm.types.ts +227 -1
  148. package/client/solana/solana.ts +4 -1
  149. package/client/solana/solana.types.ts +2 -0
  150. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +617 -3
  151. package/openapi-client/generated/evm-swaps/evm-swaps.msw.ts +217 -0
  152. package/openapi-client/generated/evm-swaps/evm-swaps.ts +51 -0
  153. package/openapi-client/generated/index.msw.ts +5 -3
  154. package/openapi-client/generated/payments-alpha/payments-alpha.msw.ts +369 -0
  155. package/openapi-client/generated/payments-alpha/payments-alpha.ts +96 -0
  156. package/openapi-client/index.ts +7 -0
  157. package/package.json +1 -1
  158. package/types/misc.ts +2 -2
  159. package/version.ts +1 -1
@@ -0,0 +1,24 @@
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 { CreateEvmSwapQuoteBody, CreateSwapQuoteResponseWrapper, GetEvmSwapPriceParams, GetSwapPriceResponseWrapper } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
9
+ import { cdpApiClient } from "../../cdpApiClient.js";
10
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
11
+ /**
12
+ * Get a price estimate for a swap between two tokens on an EVM network.
13
+ * @summary Get a price estimate for a swap
14
+ */
15
+ export declare const getEvmSwapPrice: (params: GetEvmSwapPriceParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<GetSwapPriceResponseWrapper>;
16
+ /**
17
+ * Create a swap quote, which includes the payload to sign as well as the transaction data needed to execute the swap. The developer is responsible for signing the payload and submitting the transaction to the network in order to execute the swap.
18
+ * @summary Create a swap quote
19
+ */
20
+ export declare const createEvmSwapQuote: (createEvmSwapQuoteBody: CreateEvmSwapQuoteBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<CreateSwapQuoteResponseWrapper>;
21
+ export type GetEvmSwapPriceResult = NonNullable<Awaited<ReturnType<typeof getEvmSwapPrice>>>;
22
+ export type CreateEvmSwapQuoteResult = NonNullable<Awaited<ReturnType<typeof createEvmSwapQuote>>>;
23
+ export {};
24
+ //# sourceMappingURL=evm-swaps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm-swaps.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/evm-swaps/evm-swaps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,sBAAsB,EACtB,8BAA8B,EAC9B,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,qBAAqB,EAC7B,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,yCAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,wBAAwB,sBAAsB,EAC9C,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,4CAW/C,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;AAC7F,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { http } from "msw";
2
+ import type { CreateSwapQuoteResponse, CreateSwapQuoteResponseWrapper, GetSwapPriceResponse, GetSwapPriceResponseWrapper, SwapUnavailableResponse } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
3
+ export declare const getGetEvmSwapPriceResponseGetSwapPriceResponseMock: (overrideResponse?: Partial<GetSwapPriceResponse>) => GetSwapPriceResponse;
4
+ export declare const getGetEvmSwapPriceResponseSwapUnavailableResponseMock: (overrideResponse?: Partial<SwapUnavailableResponse>) => SwapUnavailableResponse;
5
+ export declare const getGetEvmSwapPriceResponseMock: () => GetSwapPriceResponseWrapper;
6
+ export declare const getCreateEvmSwapQuoteResponseCreateSwapQuoteResponseMock: (overrideResponse?: Partial<CreateSwapQuoteResponse>) => CreateSwapQuoteResponse;
7
+ export declare const getCreateEvmSwapQuoteResponseSwapUnavailableResponseMock: (overrideResponse?: Partial<SwapUnavailableResponse>) => SwapUnavailableResponse;
8
+ export declare const getCreateEvmSwapQuoteResponseMock: () => CreateSwapQuoteResponseWrapper;
9
+ export declare const getGetEvmSwapPriceMockHandler: (overrideResponse?: GetSwapPriceResponseWrapper | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<GetSwapPriceResponseWrapper> | GetSwapPriceResponseWrapper)) => import("msw").HttpHandler;
10
+ export declare const getCreateEvmSwapQuoteMockHandler: (overrideResponse?: CreateSwapQuoteResponseWrapper | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<CreateSwapQuoteResponseWrapper> | CreateSwapQuoteResponseWrapper)) => import("msw").HttpHandler;
11
+ export declare const getEvmSwapsMock: () => import("msw").HttpHandler[];
12
+ //# sourceMappingURL=evm-swaps.msw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evm-swaps.msw.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/evm-swaps/evm-swaps.msw.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,KAAK,EACV,uBAAuB,EACvB,8BAA8B,EAC9B,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,6CAA6C,CAAC;AAErD,eAAO,MAAM,kDAAkD,GAC7D,mBAAkB,OAAO,CAAC,oBAAoB,CAAM,KACnD,oBA2CD,CAAC;AAEH,eAAO,MAAM,qDAAqD,GAChE,mBAAkB,OAAO,CAAC,uBAAuB,CAAM,KACtD,uBAGD,CAAC;AAEH,eAAO,MAAM,8BAA8B,QAAO,2BAI9C,CAAC;AAEL,eAAO,MAAM,wDAAwD,GACnE,mBAAkB,OAAO,CAAC,uBAAuB,CAAM,KACtD,uBAwED,CAAC;AAEH,eAAO,MAAM,wDAAwD,GACnE,mBAAkB,OAAO,CAAC,uBAAuB,CAAM,KACtD,uBAGD,CAAC;AAEH,eAAO,MAAM,iCAAiC,QAAO,8BAIjD,CAAC;AAEL,eAAO,MAAM,6BAA6B,GACxC,mBACI,2BAA2B,GAC3B,CAAC,CACC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAChD,OAAO,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC,8BAgB7E,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAC3C,mBACI,8BAA8B,GAC9B,CAAC,CACC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KACjD,OAAO,CAAC,8BAA8B,CAAC,GAAG,8BAA8B,CAAC,8BAgBnF,CAAC;AACF,eAAO,MAAM,eAAe,mCAG3B,CAAC"}
@@ -1,7 +1,9 @@
1
- export * from "./evm-accounts/evm-accounts.msw.js";
1
+ export * from "./payments-alpha/payments-alpha.msw.js";
2
+ export * from "./solana-accounts/solana-accounts.msw.js";
2
3
  export * from "./evm-token-balances/evm-token-balances.msw.js";
4
+ export * from "./policy-engine/policy-engine.msw.js";
5
+ export * from "./evm-accounts/evm-accounts.msw.js";
3
6
  export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
7
+ export * from "./evm-swaps/evm-swaps.msw.js";
4
8
  export * from "./faucets/faucets.msw.js";
5
- export * from "./policy-engine/policy-engine.msw.js";
6
- export * from "./solana-accounts/solana-accounts.msw.js";
7
9
  //# sourceMappingURL=index.msw.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.msw.d.ts","sourceRoot":"","sources":["../../../openapi-client/generated/index.msw.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.msw.d.ts","sourceRoot":"","sources":["../../../openapi-client/generated/index.msw.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,42 @@
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 { CreatePaymentTransferQuote201, CreatePaymentTransferQuoteBody, CryptoRail, GetCryptoRailsParams, PaymentMethod, Transfer } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
9
+ import { cdpApiClient } from "../../cdpApiClient.js";
10
+ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
11
+ /**
12
+ * Gets the fiat payment methods that can be used to send funds or receive funds. This is the list of payment methods configured for your account.
13
+ * @summary Get the fiat payment methods
14
+ */
15
+ export declare const getPaymentMethods: (options?: SecondParameter<typeof cdpApiClient>) => Promise<PaymentMethod[]>;
16
+ /**
17
+ * Gets the crypto rails that can be used to send funds or receive funds.
18
+ * @summary Get the crypto rails
19
+ */
20
+ export declare const getCryptoRails: (params?: GetCryptoRailsParams, options?: SecondParameter<typeof cdpApiClient>) => Promise<CryptoRail[]>;
21
+ /**
22
+ * Creates a new transfer quote, which can then be executed using the Execute a transfer quote endpoint. If you want to automatically execute the transfer without needing to confirm, specify execute as true.
23
+ * @summary Create a transfer quote
24
+ */
25
+ export declare const createPaymentTransferQuote: (createPaymentTransferQuoteBody: CreatePaymentTransferQuoteBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<CreatePaymentTransferQuote201>;
26
+ /**
27
+ * Executes a transfer quote which was created using the Create a transfer quote endpoint.
28
+ * @summary Execute a transfer quote
29
+ */
30
+ export declare const executePaymentTransferQuote: (transferId: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<Transfer>;
31
+ /**
32
+ * Gets a transfer by ID.
33
+ * @summary Get a transfer by ID
34
+ */
35
+ export declare const getPaymentTransfer: (transferId: string, options?: SecondParameter<typeof cdpApiClient>) => Promise<Transfer>;
36
+ export type GetPaymentMethodsResult = NonNullable<Awaited<ReturnType<typeof getPaymentMethods>>>;
37
+ export type GetCryptoRailsResult = NonNullable<Awaited<ReturnType<typeof getCryptoRails>>>;
38
+ export type CreatePaymentTransferQuoteResult = NonNullable<Awaited<ReturnType<typeof createPaymentTransferQuote>>>;
39
+ export type ExecutePaymentTransferQuoteResult = NonNullable<Awaited<ReturnType<typeof executePaymentTransferQuote>>>;
40
+ export type GetPaymentTransferResult = NonNullable<Awaited<ReturnType<typeof getPaymentTransfer>>>;
41
+ export {};
42
+ //# sourceMappingURL=payments-alpha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments-alpha.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/payments-alpha/payments-alpha.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,6BAA6B,EAC7B,8BAA8B,EAC9B,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACT,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,6BAK/E,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,oBAAoB,EAC7B,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,0BAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACrC,gCAAgC,8BAA8B,EAC9D,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2CAW/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,YAAY,MAAM,EAClB,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,sBAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,MAAM,EAClB,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,sBAM/C,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;AACjG,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;AAC3F,MAAM,MAAM,gCAAgC,GAAG,WAAW,CACxD,OAAO,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CACvD,CAAC;AACF,MAAM,MAAM,iCAAiC,GAAG,WAAW,CACzD,OAAO,CAAC,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CACxD,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { http } from "msw";
2
+ import type { CreatePaymentTransferQuote201, CryptoRail, CryptoRailAddress, PaymentMethod, PaymentMethodRequest, Transfer } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
3
+ export declare const getGetPaymentMethodsResponseMock: () => PaymentMethod[];
4
+ export declare const getGetCryptoRailsResponseMock: () => CryptoRail[];
5
+ export declare const getCreatePaymentTransferQuoteResponsePaymentMethodRequestMock: (overrideResponse?: Partial<PaymentMethodRequest>) => PaymentMethodRequest;
6
+ export declare const getCreatePaymentTransferQuoteResponseCryptoRailAddressMock: (overrideResponse?: Partial<CryptoRailAddress>) => CryptoRailAddress;
7
+ export declare const getCreatePaymentTransferQuoteResponseMock: (overrideResponse?: Partial<CreatePaymentTransferQuote201>) => CreatePaymentTransferQuote201;
8
+ export declare const getExecutePaymentTransferQuoteResponsePaymentMethodRequestMock: (overrideResponse?: Partial<PaymentMethodRequest>) => PaymentMethodRequest;
9
+ export declare const getExecutePaymentTransferQuoteResponseCryptoRailAddressMock: (overrideResponse?: Partial<CryptoRailAddress>) => CryptoRailAddress;
10
+ export declare const getExecutePaymentTransferQuoteResponseMock: (overrideResponse?: Partial<Transfer>) => Transfer;
11
+ export declare const getGetPaymentTransferResponsePaymentMethodRequestMock: (overrideResponse?: Partial<PaymentMethodRequest>) => PaymentMethodRequest;
12
+ export declare const getGetPaymentTransferResponseCryptoRailAddressMock: (overrideResponse?: Partial<CryptoRailAddress>) => CryptoRailAddress;
13
+ export declare const getGetPaymentTransferResponseMock: (overrideResponse?: Partial<Transfer>) => Transfer;
14
+ export declare const getGetPaymentMethodsMockHandler: (overrideResponse?: PaymentMethod[] | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<PaymentMethod[]> | PaymentMethod[])) => import("msw").HttpHandler;
15
+ export declare const getGetCryptoRailsMockHandler: (overrideResponse?: CryptoRail[] | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<CryptoRail[]> | CryptoRail[])) => import("msw").HttpHandler;
16
+ export declare const getCreatePaymentTransferQuoteMockHandler: (overrideResponse?: CreatePaymentTransferQuote201 | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<CreatePaymentTransferQuote201> | CreatePaymentTransferQuote201)) => import("msw").HttpHandler;
17
+ export declare const getExecutePaymentTransferQuoteMockHandler: (overrideResponse?: Transfer | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<Transfer> | Transfer)) => import("msw").HttpHandler;
18
+ export declare const getGetPaymentTransferMockHandler: (overrideResponse?: Transfer | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<Transfer> | Transfer)) => import("msw").HttpHandler;
19
+ export declare const getPaymentsAlphaMock: () => import("msw").HttpHandler[];
20
+ //# sourceMappingURL=payments-alpha.msw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments-alpha.msw.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/payments-alpha/payments-alpha.msw.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,IAAI,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,KAAK,EACV,6BAA6B,EAC7B,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACT,MAAM,6CAA6C,CAAC;AAErD,eAAO,MAAM,gCAAgC,QAAO,aAAa,EA2B5D,CAAC;AAEN,eAAO,MAAM,6BAA6B,QAAO,UAAU,EAetD,CAAC;AAEN,eAAO,MAAM,6DAA6D,GACxE,mBAAkB,OAAO,CAAC,oBAAoB,CAAM,KACnD,oBAOD,CAAC;AAEH,eAAO,MAAM,0DAA0D,GACrE,mBAAkB,OAAO,CAAC,iBAAiB,CAAM,KAChD,iBAOD,CAAC;AAEH,eAAO,MAAM,yCAAyC,GACpD,mBAAkB,OAAO,CAAC,6BAA6B,CAAM,KAC5D,6BAuCD,CAAC;AAEH,eAAO,MAAM,8DAA8D,GACzE,mBAAkB,OAAO,CAAC,oBAAoB,CAAM,KACnD,oBAOD,CAAC;AAEH,eAAO,MAAM,2DAA2D,GACtE,mBAAkB,OAAO,CAAC,iBAAiB,CAAM,KAChD,iBAOD,CAAC;AAEH,eAAO,MAAM,0CAA0C,GACrD,mB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,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,8BAgB7F,CAAC;AAEF,eAAO,MAAM,gCAAgC,GAC3C,mBACI,QAAQ,GACR,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,8BAgB5F,CAAC;AACF,eAAO,MAAM,oBAAoB,mCAMhC,CAAC"}
@@ -1,12 +1,19 @@
1
1
  export * from "./generated/coinbaseDeveloperPlatformAPIs.schemas.js";
2
2
  export * from "./generated/evm-accounts/evm-accounts.js";
3
3
  export * from "./generated/evm-smart-accounts/evm-smart-accounts.js";
4
+ export * from "./generated/evm-swaps/evm-swaps.js";
4
5
  export * from "./generated/evm-token-balances/evm-token-balances.js";
5
6
  export * from "./generated/solana-accounts/solana-accounts.js";
6
7
  export * from "./generated/faucets/faucets.js";
7
8
  export * from "./generated/policy-engine/policy-engine.js";
9
+ export * from "./generated/payments-alpha/payments-alpha.js";
8
10
  export declare const CdpOpenApiClient: {
9
11
  configure: (options: import("./cdpApiClient.js").CdpOptions) => void;
12
+ getPaymentMethods: (options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").PaymentMethod[]>;
13
+ getCryptoRails: (params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetCryptoRailsParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CryptoRail[]>;
14
+ createPaymentTransferQuote: (createPaymentTransferQuoteBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreatePaymentTransferQuoteBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreatePaymentTransferQuote201>;
15
+ executePaymentTransferQuote: (transferId: string, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").Transfer>;
16
+ getPaymentTransfer: (transferId: string, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").Transfer>;
10
17
  listPolicies: (params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListPoliciesParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListPolicies200>;
11
18
  createPolicy: (createPolicyBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreatePolicyBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").Policy>;
12
19
  getPolicyById: (policyId: string, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").Policy>;
@@ -22,6 +29,8 @@ export declare const CdpOpenApiClient: {
22
29
  signSolanaTransaction: (address: string, signSolanaTransactionBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransactionBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransaction200>;
23
30
  signSolanaMessage: (address: string, signSolanaMessageBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessageBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessage200>;
24
31
  listEvmTokenBalances: (network: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesNetwork, address: string, params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalances200>;
32
+ getEvmSwapPrice: (params: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetEvmSwapPriceParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetSwapPriceResponseWrapper>;
33
+ createEvmSwapQuote: (createEvmSwapQuoteBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateEvmSwapQuoteBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateSwapQuoteResponseWrapper>;
25
34
  listEvmSmartAccounts: (params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmSmartAccountsParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmSmartAccounts200>;
26
35
  createEvmSmartAccount: (createEvmSmartAccountBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateEvmSmartAccountBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").EvmSmartAccount>;
27
36
  getEvmSmartAccount: (address: string, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").EvmSmartAccount>;
@@ -43,6 +52,8 @@ export declare const CdpOpenApiClient: {
43
52
  export declare const OpenApiEvmMethods: {
44
53
  requestEvmFaucet: (requestEvmFaucetBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").RequestEvmFaucetBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").RequestEvmFaucet200>;
45
54
  listEvmTokenBalances: (network: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesNetwork, address: string, params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalances200>;
55
+ getEvmSwapPrice: (params: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetEvmSwapPriceParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetSwapPriceResponseWrapper>;
56
+ createEvmSwapQuote: (createEvmSwapQuoteBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateEvmSwapQuoteBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateSwapQuoteResponseWrapper>;
46
57
  listEvmSmartAccounts: (params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmSmartAccountsParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmSmartAccounts200>;
47
58
  createEvmSmartAccount: (createEvmSmartAccountBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateEvmSmartAccountBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").EvmSmartAccount>;
48
59
  getEvmSmartAccount: (address: string, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").EvmSmartAccount>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../openapi-client/index.ts"],"names":[],"mappings":"AAAA,cAAc,sDAAsD,CAAC;AACrE,cAAc,0CAA0C,CAAC;AACzD,cAAc,sDAAsD,CAAC;AACrE,cAAc,sDAAsD,CAAC;AACrE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4CAA4C,CAAC;AAU3D,eAAO,MAAM,gBAAgB;;mBAJO,0FAC7B,EAAE,4BAAgD;mBAcvD,iGAEC,EAAC,4BAC0B;oBAa0C,gBAAgB,EAAC,4BAA+C;mBAAgU,gBAAgB,EAAC,4BAA+C;mBAAwU,gBAAmB,EAAC,iGAAqC,EAAC,4BAAiD;uBAA91B,yGAA6C,EAAC,4BAAiD;0BAA2gC,+GAAmD,EAAC,4BAAiD;yBA3BtxC,gGAER,EAAC,4BAGV;0BAcU,gHAGJ,EAAE,4BAIX;uBACuS,eAAkB,EAAC,4BAAiD;0BAAwT,eAAkB,EAAC,+GAAmD,EAAC,4BAAiD;6BAA6W,YAAe,EAAC,4BAAiD;4BAAwvB,eAAkB,EAAC,mHAAuD,EAAC,4BAAiD;wBAAijB,eAAkB,EAAC,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F,eAAO,MAAM,sBAAsB;mBAhCvB,0FAA8B,EAAC,4BACf;mBAIrB,iGAAoC,EAAC,4BAE1B;oBAoBjB,gBAAgB,EAAC,4BAEJ;mBAQiJ,gBAAgB,EAAC,4BAA+C;mBAAwU,gBAAmB,EAAC,iGAAqC,EAAC,4BAAiD;CAHjpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC"}
@@ -49,9 +49,9 @@ export interface EIP712Domain {
49
49
  /** The chain ID of the EVM network. */
50
50
  chainId?: number;
51
51
  /** The 0x-prefixed EVM address of the verifying smart contract. */
52
- verifyingContract?: string;
52
+ verifyingContract?: Hex;
53
53
  /** The optional 32-byte 0x-prefixed hex salt for domain separation. */
54
- salt?: string;
54
+ salt?: Hex;
55
55
  }
56
56
  /**
57
57
  * A mapping of struct names to an array of type objects (name + type).
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../types/misc.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAChC,MAAM,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;AACjC,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG,SAAS;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,SAAS,GAAG,EAAE,CAAC;CAC7B,EAAE,CAAC;AAEJ,MAAM,MAAM,yBAAyB,GAAG;IACtC,yEAAyE;IACzE,EAAE,EAAE,OAAO,CAAC;IACZ,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC;IACvB,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS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AG,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,WAAW,CAAC;IACnB,6HAA6H;IAC7H,WAAW,EAAE,MAAM,CAAC;IACpB,oHAAoH;IACpH,OAAO,EAAE,oBAAoB,CAAC;CAC/B"}
@@ -1,2 +1,2 @@
1
- export declare const version = "1.10.0";
1
+ export declare const version = "1.12.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,14 @@
1
1
  import { type TransactionSerializable, serializeTransaction } from "viem";
2
2
 
3
+ import { FundOptions, fund } from "../../actions/evm/fund/fund.js";
4
+ import { Quote } from "../../actions/evm/fund/Quote.js";
5
+ import { QuoteFundOptions, quoteFund } from "../../actions/evm/fund/quoteFund.js";
6
+ import { FundOperationResult } from "../../actions/evm/fund/types.js";
7
+ import {
8
+ WaitForFundOperationOptions,
9
+ WaitForFundOperationResult,
10
+ waitForFundOperationReceipt,
11
+ } from "../../actions/evm/fund/waitForFundOperationReceipt.js";
3
12
  import {
4
13
  listTokenBalances,
5
14
  type ListTokenBalancesResult,
@@ -11,6 +20,8 @@ import {
11
20
  type RequestFaucetResult,
12
21
  } from "../../actions/evm/requestFaucet.js";
13
22
  import { sendTransaction } from "../../actions/evm/sendTransaction.js";
23
+ import { createSwapQuote } from "../../actions/evm/swap/createSwapQuote.js";
24
+ import { sendSwapTransaction } from "../../actions/evm/swap/sendSwapTransaction.js";
14
25
  import { accountTransferStrategy } from "../../actions/evm/transfer/accountTransferStrategy.js";
15
26
  import { transfer } from "../../actions/evm/transfer/transfer.js";
16
27
 
@@ -19,6 +30,13 @@ import type {
19
30
  SendTransactionOptions,
20
31
  TransactionResult,
21
32
  } from "../../actions/evm/sendTransaction.js";
33
+ import type {
34
+ SendSwapTransactionOptions,
35
+ SwapOptions,
36
+ SwapResult,
37
+ QuoteSwapOptions,
38
+ QuoteSwapResult,
39
+ } from "../../actions/evm/swap/types.js";
22
40
  import type { CdpOpenApiClientType, EvmAccount } from "../../openapi-client/index.js";
23
41
  import type { Address, EIP712Message, Hash, Hex } from "../../types/misc.js";
24
42
 
@@ -95,6 +113,35 @@ export function toEvmServerAccount(
95
113
  address: this.address,
96
114
  });
97
115
  },
116
+ async quoteFund(options: Omit<QuoteFundOptions, "address">): Promise<Quote> {
117
+ return quoteFund(apiClient, {
118
+ ...options,
119
+ address: this.address,
120
+ });
121
+ },
122
+ async fund(options: Omit<FundOptions, "address">): Promise<FundOperationResult> {
123
+ return fund(apiClient, {
124
+ ...options,
125
+ address: this.address,
126
+ });
127
+ },
128
+ async waitForFundOperationReceipt(
129
+ options: WaitForFundOperationOptions,
130
+ ): Promise<WaitForFundOperationResult> {
131
+ return waitForFundOperationReceipt(apiClient, options);
132
+ },
133
+ async quoteSwap(options: QuoteSwapOptions): Promise<QuoteSwapResult> {
134
+ return createSwapQuote(apiClient, {
135
+ ...options,
136
+ taker: this.address,
137
+ });
138
+ },
139
+ async swap(options: SwapOptions): Promise<SwapResult> {
140
+ return sendSwapTransaction(apiClient, {
141
+ ...options,
142
+ address: this.address,
143
+ } as SendSwapTransactionOptions);
144
+ },
98
145
  name: options.account.name,
99
146
  type: "evm-server",
100
147
  policies: options.account.policies,
@@ -1,3 +1,12 @@
1
+ import { fund, FundOptions } from "../../actions/evm/fund/fund.js";
2
+ import { Quote } from "../../actions/evm/fund/Quote.js";
3
+ import { quoteFund, QuoteFundOptions } from "../../actions/evm/fund/quoteFund.js";
4
+ import { FundOperationResult } from "../../actions/evm/fund/types.js";
5
+ import {
6
+ WaitForFundOperationResult,
7
+ waitForFundOperationReceipt,
8
+ WaitForFundOperationOptions,
9
+ } from "../../actions/evm/fund/waitForFundOperationReceipt.js";
1
10
  import { getUserOperation } from "../../actions/evm/getUserOperation.js";
2
11
  import {
3
12
  listTokenBalances,
@@ -102,6 +111,23 @@ export function toEvmSmartAccount(
102
111
  address: account.address,
103
112
  });
104
113
  },
114
+ async quoteFund(options: Omit<QuoteFundOptions, "address">): Promise<Quote> {
115
+ return quoteFund(apiClient, {
116
+ ...options,
117
+ address: this.address,
118
+ });
119
+ },
120
+ async fund(options: Omit<FundOptions, "address">): Promise<FundOperationResult> {
121
+ return fund(apiClient, {
122
+ ...options,
123
+ address: this.address,
124
+ });
125
+ },
126
+ async waitForFundOperationReceipt(
127
+ options: WaitForFundOperationOptions,
128
+ ): Promise<WaitForFundOperationResult> {
129
+ return waitForFundOperationReceipt(apiClient, options);
130
+ },
105
131
  name: options.smartAccount.name,
106
132
  type: "evm-smart",
107
133
  };
@@ -3,8 +3,7 @@ import { SignableMessage, TransactionSerializable } from "viem";
3
3
  import { Prettify } from "../../types/utils.js";
4
4
 
5
5
  import type { AccountActions, SmartAccountActions } from "../../actions/evm/types.js";
6
- import type { EIP712Message } from "../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js";
7
- import type { Address, Hash, Hex } from "../../types/misc.js";
6
+ import type { Address, EIP712Message, Hash, Hex } from "../../types/misc.js";
8
7
 
9
8
  /**
10
9
  * Base type for any Ethereum account with signing capabilities.
@@ -0,0 +1,83 @@
1
+ import { FundOperationResult } from "./types.js";
2
+ import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
3
+
4
+ /**
5
+ * A class representing a funding quote that can be executed.
6
+ */
7
+ export class Quote {
8
+ /** Quote for the transfer. */
9
+ public quoteId: string;
10
+ /** Network to transfer the funds to. */
11
+ public network: "base" | "ethereum";
12
+ /** The amount in fiat currency. */
13
+ public fiatAmount: string;
14
+ /** The fiat currency. */
15
+ public fiatCurrency: string;
16
+ /** The amount in the token to transfer. */
17
+ public tokenAmount: string;
18
+ /** The token to transfer. */
19
+ public token: string;
20
+ /** Fees in the token to transfer. */
21
+ public fees: {
22
+ /** The type of fee. */
23
+ type: "exchange_fee" | "network_fee";
24
+ amount: string;
25
+ currency: string;
26
+ }[];
27
+
28
+ private apiClient: CdpOpenApiClientType;
29
+
30
+ /**
31
+ * Creates a new Quote instance.
32
+ *
33
+ * @param apiClient - The API client.
34
+ * @param quoteId - The quote ID.
35
+ * @param network - The network to transfer funds to.
36
+ * @param fiatAmount - The amount in fiat currency.
37
+ * @param fiatCurrency - The fiat currency.
38
+ * @param tokenAmount - The amount in the token to transfer.
39
+ * @param token - The token to transfer.
40
+ * @param fees - Fees for the transfer.
41
+ */
42
+ constructor(
43
+ apiClient: CdpOpenApiClientType,
44
+ quoteId: string,
45
+ network: "base" | "ethereum",
46
+ fiatAmount: string,
47
+ fiatCurrency: string,
48
+ tokenAmount: string,
49
+ token: string,
50
+ fees: {
51
+ type: "exchange_fee" | "network_fee";
52
+ amount: string;
53
+ currency: string;
54
+ }[],
55
+ ) {
56
+ this.apiClient = apiClient;
57
+ this.quoteId = quoteId;
58
+ this.network = network;
59
+ this.fiatAmount = fiatAmount;
60
+ this.fiatCurrency = fiatCurrency;
61
+ this.tokenAmount = tokenAmount;
62
+ this.token = token;
63
+ this.fees = fees;
64
+ }
65
+
66
+ /**
67
+ * Executes the quote to perform the actual fund transfer.
68
+ *
69
+ * @returns A promise that resolves to the result of the executed quote.
70
+ */
71
+ async execute(): Promise<FundOperationResult> {
72
+ const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
73
+
74
+ return {
75
+ id: transfer.id,
76
+ network: transfer.target.network,
77
+ targetAmount: transfer.targetAmount,
78
+ targetCurrency: transfer.targetCurrency,
79
+ status: transfer.status,
80
+ transactionHash: transfer.transactionHash,
81
+ };
82
+ }
83
+ }
@@ -0,0 +1,76 @@
1
+ import { formatUnits } from "viem";
2
+
3
+ import { FundOperationResult } from "./types.js";
4
+ import {
5
+ CreatePaymentTransferQuoteBodySourceType,
6
+ CreatePaymentTransferQuoteBodyTargetType,
7
+ type CdpOpenApiClientType,
8
+ } from "../../../openapi-client/index.js";
9
+
10
+ /**
11
+ * Options for funding an EVM account.
12
+ */
13
+ export interface FundOptions {
14
+ /** The address of the account. */
15
+ address: string;
16
+ /** The network to request funds from. */
17
+ network: "base";
18
+ /** The amount to fund the account with, in atomic units (wei) of the token. */
19
+ amount: bigint;
20
+ /** The token to request funds for. */
21
+ token: "eth" | "usdc";
22
+ }
23
+
24
+ /**
25
+ * Funds an EVM account.
26
+ *
27
+ * @param apiClient - The API client.
28
+ * @param options - The options for funding an EVM account.
29
+ *
30
+ * @returns A promise that resolves to the fund operation result.
31
+ */
32
+ export async function fund(
33
+ apiClient: CdpOpenApiClientType,
34
+ options: FundOptions,
35
+ ): Promise<FundOperationResult> {
36
+ const paymentMethods = await apiClient.getPaymentMethods();
37
+ const cardPaymentMethod = paymentMethods.find(
38
+ method => method.type === "card" && method.actions.includes("source"),
39
+ );
40
+
41
+ if (!cardPaymentMethod) {
42
+ throw new Error("No card found to fund account");
43
+ }
44
+
45
+ if (options.token.toLowerCase() !== "eth" && options.token.toLowerCase() !== "usdc") {
46
+ throw new Error("Invalid currency, must be eth or usdc");
47
+ }
48
+
49
+ const decimals = options.token === "eth" ? 18 : 6;
50
+ const amount = formatUnits(options.amount, decimals);
51
+
52
+ const response = await apiClient.createPaymentTransferQuote({
53
+ sourceType: CreatePaymentTransferQuoteBodySourceType.payment_method,
54
+ source: {
55
+ id: cardPaymentMethod.id,
56
+ },
57
+ targetType: CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
58
+ target: {
59
+ currency: options.token,
60
+ network: options.network,
61
+ address: options.address,
62
+ },
63
+ amount,
64
+ currency: options.token,
65
+ execute: true,
66
+ });
67
+
68
+ return {
69
+ id: response.transfer.id,
70
+ network: response.transfer.target.network,
71
+ status: response.transfer.status,
72
+ targetAmount: response.transfer.targetAmount,
73
+ targetCurrency: response.transfer.targetCurrency,
74
+ transactionHash: response.transfer.transactionHash,
75
+ };
76
+ }
@@ -0,0 +1,81 @@
1
+ import { formatUnits } from "viem";
2
+
3
+ import { Quote } from "./Quote.js";
4
+ import {
5
+ CreatePaymentTransferQuoteBodySourceType,
6
+ CreatePaymentTransferQuoteBodyTargetType,
7
+ type CdpOpenApiClientType,
8
+ } from "../../../openapi-client/index.js";
9
+
10
+ /**
11
+ * Options for getting a quote to fund an EVM account.
12
+ */
13
+ export interface QuoteFundOptions {
14
+ /** The address of the account. */
15
+ address: string;
16
+ /** The network to request funds from. */
17
+ network: "base";
18
+ /** The amount to fund the account with, in atomic units (wei) of the token. */
19
+ amount: bigint;
20
+ /** The token to request funds for. */
21
+ token: "eth" | "usdc";
22
+ }
23
+
24
+ /**
25
+ * Gets a quote to fund an EVM account.
26
+ *
27
+ * @param apiClient - The API client.
28
+ * @param options - The options for getting a quote to fund an EVM account.
29
+ *
30
+ * @returns A promise that resolves to the quote.
31
+ */
32
+ export async function quoteFund(
33
+ apiClient: CdpOpenApiClientType,
34
+ options: QuoteFundOptions,
35
+ ): Promise<Quote> {
36
+ const paymentMethods = await apiClient.getPaymentMethods();
37
+ const cardPaymentMethod = paymentMethods.find(
38
+ method => method.type === "card" && method.actions.includes("source"),
39
+ );
40
+
41
+ if (!cardPaymentMethod) {
42
+ throw new Error("No card found to fund account");
43
+ }
44
+
45
+ if (options.token.toLowerCase() !== "eth" && options.token.toLowerCase() !== "usdc") {
46
+ throw new Error("Invalid currency, must be eth or usdc");
47
+ }
48
+
49
+ const decimals = options.token === "eth" ? 18 : 6;
50
+ const amount = formatUnits(options.amount, decimals);
51
+
52
+ const response = await apiClient.createPaymentTransferQuote({
53
+ sourceType: CreatePaymentTransferQuoteBodySourceType.payment_method,
54
+ source: {
55
+ id: cardPaymentMethod.id,
56
+ },
57
+ targetType: CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
58
+ target: {
59
+ currency: options.token,
60
+ network: options.network,
61
+ address: options.address,
62
+ },
63
+ amount,
64
+ currency: options.token,
65
+ });
66
+
67
+ return new Quote(
68
+ apiClient,
69
+ response.transfer.id,
70
+ options.network,
71
+ response.transfer.sourceAmount,
72
+ response.transfer.sourceCurrency,
73
+ response.transfer.targetAmount,
74
+ response.transfer.targetCurrency,
75
+ response.transfer.fees.map(fee => ({
76
+ type: fee.type,
77
+ amount: fee.amount,
78
+ currency: fee.currency,
79
+ })),
80
+ );
81
+ }
@@ -0,0 +1,16 @@
1
+ import { TransferStatus } from "../../../openapi-client/index.js";
2
+
3
+ export type FundOperationResult = {
4
+ /** The transfer that was created to fund the account. */
5
+ id: string;
6
+ /** The network that the transfer was created on. */
7
+ network: string;
8
+ /** The target amount that will be received. */
9
+ targetAmount: string;
10
+ /** The currency that will be received. */
11
+ targetCurrency: string;
12
+ /** The status of the fund operation. */
13
+ status: TransferStatus;
14
+ /** The transaction hash of the transfer. */
15
+ transactionHash?: string;
16
+ };