@coinbase/cdp-sdk 1.28.0 → 1.30.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 (274) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/accounts/evm/networkCapabilities.js +101 -0
  3. package/_cjs/accounts/evm/networkCapabilities.js.map +1 -1
  4. package/_cjs/accounts/evm/toEvmServerAccount.js +12 -1
  5. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js +12 -1
  7. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
  9. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  10. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +11 -1
  11. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/solana/toSolanaAccount.js +41 -1
  13. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
  14. package/_cjs/actions/Quote.js +106 -0
  15. package/_cjs/actions/Quote.js.map +1 -0
  16. package/_cjs/actions/evm/fund/fund.js +5 -5
  17. package/_cjs/actions/evm/fund/fund.js.map +1 -1
  18. package/_cjs/actions/evm/fund/quoteFund.js +7 -7
  19. package/_cjs/actions/evm/fund/quoteFund.js.map +1 -1
  20. package/_cjs/actions/evm/getUserOperation.js +1 -0
  21. package/_cjs/actions/evm/getUserOperation.js.map +1 -1
  22. package/_cjs/actions/evm/spend-permissions/account.use.js +33 -0
  23. package/_cjs/actions/evm/spend-permissions/account.use.js.map +1 -0
  24. package/_cjs/actions/evm/spend-permissions/smartAccount.use.js +35 -0
  25. package/_cjs/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
  26. package/_cjs/actions/evm/spend-permissions/types.js.map +1 -0
  27. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +1 -0
  28. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  29. package/_cjs/actions/solana/fund/fund.js +50 -0
  30. package/_cjs/actions/solana/fund/fund.js.map +1 -0
  31. package/_cjs/actions/solana/fund/quoteFund.js +47 -0
  32. package/_cjs/actions/solana/fund/quoteFund.js.map +1 -0
  33. package/_cjs/actions/solana/sendTransaction.js +1 -0
  34. package/_cjs/actions/solana/sendTransaction.js.map +1 -1
  35. package/_cjs/actions/solana/signTransaction.js +1 -0
  36. package/_cjs/actions/solana/signTransaction.js.map +1 -1
  37. package/_cjs/actions/types.js +3 -0
  38. package/{_esm/actions/evm/fund → _cjs/actions}/types.js.map +1 -1
  39. package/_cjs/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
  40. package/_cjs/actions/waitForFundOperationReceipt.js.map +1 -0
  41. package/_cjs/auth/hooks/axios/withAuth.js +3 -0
  42. package/_cjs/auth/hooks/axios/withAuth.js.map +1 -1
  43. package/_cjs/auth/utils/http.js +2 -1
  44. package/_cjs/auth/utils/http.js.map +1 -1
  45. package/_cjs/client/evm/evm.js +51 -1
  46. package/_cjs/client/evm/evm.js.map +1 -1
  47. package/_cjs/client/solana/solana.js.map +1 -1
  48. package/_cjs/index.js +5 -1
  49. package/_cjs/index.js.map +1 -1
  50. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +54 -7
  51. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  52. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
  53. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  54. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +76 -4
  55. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  56. package/_cjs/openapi-client/generated/index.msw.js +2 -0
  57. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  58. package/_cjs/openapi-client/generated/onramp/onramp.js +30 -0
  59. package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -0
  60. package/_cjs/openapi-client/generated/onramp/onramp.msw.js +98 -0
  61. package/_cjs/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
  62. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +15 -0
  63. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
  64. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +69 -0
  65. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
  66. package/_cjs/openapi-client/index.js +2 -0
  67. package/_cjs/openapi-client/index.js.map +1 -1
  68. package/_cjs/spend-permissions/constants.js +716 -0
  69. package/_cjs/spend-permissions/constants.js.map +1 -0
  70. package/_cjs/spend-permissions/types.js +3 -0
  71. package/_cjs/{actions/evm/fund → spend-permissions}/types.js.map +1 -1
  72. package/_cjs/version.js +1 -1
  73. package/_esm/accounts/evm/networkCapabilities.js +101 -0
  74. package/_esm/accounts/evm/networkCapabilities.js.map +1 -1
  75. package/_esm/accounts/evm/toEvmServerAccount.js +12 -1
  76. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  77. package/_esm/accounts/evm/toEvmSmartAccount.js +12 -1
  78. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  79. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
  80. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  81. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +11 -1
  82. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  83. package/_esm/accounts/solana/toSolanaAccount.js +41 -1
  84. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
  85. package/_esm/actions/Quote.js +101 -0
  86. package/_esm/actions/Quote.js.map +1 -0
  87. package/_esm/actions/evm/fund/fund.js +5 -5
  88. package/_esm/actions/evm/fund/fund.js.map +1 -1
  89. package/_esm/actions/evm/fund/quoteFund.js +7 -7
  90. package/_esm/actions/evm/fund/quoteFund.js.map +1 -1
  91. package/_esm/actions/evm/getUserOperation.js +1 -0
  92. package/_esm/actions/evm/getUserOperation.js.map +1 -1
  93. package/_esm/actions/evm/spend-permissions/account.use.js +30 -0
  94. package/_esm/actions/evm/spend-permissions/account.use.js.map +1 -0
  95. package/_esm/actions/evm/spend-permissions/smartAccount.use.js +32 -0
  96. package/_esm/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
  97. package/_esm/actions/evm/spend-permissions/types.js.map +1 -0
  98. package/_esm/actions/evm/transfer/accountTransferStrategy.js +1 -0
  99. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  100. package/_esm/actions/solana/fund/fund.js +47 -0
  101. package/_esm/actions/solana/fund/fund.js.map +1 -0
  102. package/_esm/actions/solana/fund/quoteFund.js +44 -0
  103. package/_esm/actions/solana/fund/quoteFund.js.map +1 -0
  104. package/_esm/actions/solana/sendTransaction.js +1 -0
  105. package/_esm/actions/solana/sendTransaction.js.map +1 -1
  106. package/_esm/actions/solana/signTransaction.js +1 -0
  107. package/_esm/actions/solana/signTransaction.js.map +1 -1
  108. package/_esm/actions/types.js +2 -0
  109. package/_esm/actions/types.js.map +1 -0
  110. package/_esm/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
  111. package/_esm/actions/waitForFundOperationReceipt.js.map +1 -0
  112. package/_esm/auth/hooks/axios/withAuth.js +3 -0
  113. package/_esm/auth/hooks/axios/withAuth.js.map +1 -1
  114. package/_esm/auth/utils/http.js +2 -1
  115. package/_esm/auth/utils/http.js.map +1 -1
  116. package/_esm/client/evm/evm.js +51 -1
  117. package/_esm/client/evm/evm.js.map +1 -1
  118. package/_esm/client/solana/solana.js +2 -2
  119. package/_esm/client/solana/solana.js.map +1 -1
  120. package/_esm/index.js +2 -1
  121. package/_esm/index.js.map +1 -1
  122. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +52 -5
  123. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  124. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
  125. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  126. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +73 -3
  127. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  128. package/_esm/openapi-client/generated/index.msw.js +2 -0
  129. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  130. package/_esm/openapi-client/generated/onramp/onramp.js +25 -0
  131. package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -0
  132. package/_esm/openapi-client/generated/onramp/onramp.msw.js +90 -0
  133. package/_esm/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
  134. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +11 -0
  135. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
  136. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +63 -0
  137. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
  138. package/_esm/openapi-client/index.js +2 -0
  139. package/_esm/openapi-client/index.js.map +1 -1
  140. package/_esm/spend-permissions/constants.js +713 -0
  141. package/_esm/spend-permissions/constants.js.map +1 -0
  142. package/_esm/spend-permissions/types.js +2 -0
  143. package/_esm/spend-permissions/types.js.map +1 -0
  144. package/_esm/version.js +1 -1
  145. package/_types/accounts/evm/networkCapabilities.d.ts +101 -0
  146. package/_types/accounts/evm/networkCapabilities.d.ts.map +1 -1
  147. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  148. package/_types/accounts/evm/toEvmSmartAccount.d.ts +1 -1
  149. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  150. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  151. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  152. package/_types/accounts/evm/types.d.ts +15 -9
  153. package/_types/accounts/evm/types.d.ts.map +1 -1
  154. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
  155. package/_types/actions/Quote.d.ts +97 -0
  156. package/_types/actions/Quote.d.ts.map +1 -0
  157. package/_types/actions/evm/fund/fund.d.ts +3 -7
  158. package/_types/actions/evm/fund/fund.d.ts.map +1 -1
  159. package/_types/actions/evm/fund/quoteFund.d.ts +4 -7
  160. package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -1
  161. package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
  162. package/_types/actions/evm/spend-permissions/account.use.d.ts +15 -0
  163. package/_types/actions/evm/spend-permissions/account.use.d.ts.map +1 -0
  164. package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts +15 -0
  165. package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts.map +1 -0
  166. package/_types/actions/evm/spend-permissions/types.d.ts +13 -0
  167. package/_types/actions/evm/spend-permissions/types.d.ts.map +1 -0
  168. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
  169. package/_types/actions/evm/types.d.ts +82 -7
  170. package/_types/actions/evm/types.d.ts.map +1 -1
  171. package/_types/actions/solana/fund/fund.d.ts +19 -0
  172. package/_types/actions/solana/fund/fund.d.ts.map +1 -0
  173. package/_types/actions/solana/fund/quoteFund.d.ts +20 -0
  174. package/_types/actions/solana/fund/quoteFund.d.ts.map +1 -0
  175. package/_types/actions/solana/sendTransaction.d.ts +8 -2
  176. package/_types/actions/solana/sendTransaction.d.ts.map +1 -1
  177. package/_types/actions/solana/signTransaction.d.ts +8 -2
  178. package/_types/actions/solana/signTransaction.d.ts.map +1 -1
  179. package/_types/actions/solana/types.d.ts +99 -3
  180. package/_types/actions/solana/types.d.ts.map +1 -1
  181. package/_types/actions/types.d.ts +37 -0
  182. package/_types/actions/types.d.ts.map +1 -0
  183. package/_types/actions/{evm/fund/waitForFundOperationReceipt.d.ts → waitForFundOperationReceipt.d.ts} +2 -2
  184. package/_types/actions/waitForFundOperationReceipt.d.ts.map +1 -0
  185. package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -1
  186. package/_types/auth/utils/http.d.ts.map +1 -1
  187. package/_types/client/evm/evm.d.ts +19 -1
  188. package/_types/client/evm/evm.d.ts.map +1 -1
  189. package/_types/client/evm/evm.types.d.ts +29 -2
  190. package/_types/client/evm/evm.types.d.ts.map +1 -1
  191. package/_types/client/solana/solana.d.ts +5 -3
  192. package/_types/client/solana/solana.d.ts.map +1 -1
  193. package/_types/index.d.ts +3 -1
  194. package/_types/index.d.ts.map +1 -1
  195. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +356 -20
  196. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  197. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
  198. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  199. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
  200. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
  201. package/_types/openapi-client/generated/index.msw.d.ts +2 -0
  202. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  203. package/_types/openapi-client/generated/onramp/onramp.d.ts +28 -0
  204. package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -0
  205. package/_types/openapi-client/generated/onramp/onramp.msw.d.ts +8 -0
  206. package/_types/openapi-client/generated/onramp/onramp.msw.d.ts.map +1 -0
  207. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +20 -0
  208. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +1 -0
  209. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +6 -0
  210. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +1 -0
  211. package/_types/openapi-client/index.d.ts +4 -0
  212. package/_types/openapi-client/index.d.ts.map +1 -1
  213. package/_types/spend-permissions/constants.d.ts +1357 -0
  214. package/_types/spend-permissions/constants.d.ts.map +1 -0
  215. package/_types/spend-permissions/types.d.ts +30 -0
  216. package/_types/spend-permissions/types.d.ts.map +1 -0
  217. package/_types/version.d.ts +1 -1
  218. package/accounts/evm/networkCapabilities.ts +101 -0
  219. package/accounts/evm/toEvmServerAccount.ts +26 -11
  220. package/accounts/evm/toEvmSmartAccount.ts +30 -15
  221. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +20 -5
  222. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +21 -6
  223. package/accounts/evm/types.ts +34 -12
  224. package/accounts/solana/toSolanaAccount.ts +58 -3
  225. package/actions/Quote.ts +154 -0
  226. package/actions/evm/fund/fund.ts +10 -14
  227. package/actions/evm/fund/quoteFund.ts +13 -16
  228. package/actions/evm/getUserOperation.ts +1 -0
  229. package/actions/evm/spend-permissions/account.use.ts +48 -0
  230. package/actions/evm/spend-permissions/smartAccount.use.ts +49 -0
  231. package/actions/evm/spend-permissions/types.ts +13 -0
  232. package/actions/evm/transfer/accountTransferStrategy.ts +2 -0
  233. package/actions/evm/types.ts +88 -7
  234. package/actions/solana/fund/fund.ts +71 -0
  235. package/actions/solana/fund/quoteFund.ts +77 -0
  236. package/actions/solana/sendTransaction.ts +10 -2
  237. package/actions/solana/signTransaction.ts +10 -2
  238. package/actions/solana/types.ts +113 -2
  239. package/actions/types.ts +39 -0
  240. package/actions/{evm/fund/waitForFundOperationReceipt.ts → waitForFundOperationReceipt.ts} +2 -2
  241. package/auth/hooks/axios/withAuth.ts +3 -0
  242. package/auth/utils/http.ts +2 -1
  243. package/client/evm/evm.ts +61 -1
  244. package/client/evm/evm.types.ts +31 -0
  245. package/client/solana/solana.ts +10 -5
  246. package/index.ts +6 -1
  247. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +400 -26
  248. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +89 -3
  249. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
  250. package/openapi-client/generated/index.msw.ts +2 -0
  251. package/openapi-client/generated/onramp/onramp.msw.ts +135 -0
  252. package/openapi-client/generated/onramp/onramp.ts +54 -0
  253. package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +85 -0
  254. package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +34 -0
  255. package/openapi-client/index.ts +2 -0
  256. package/package.json +1 -1
  257. package/spend-permissions/constants.ts +713 -0
  258. package/spend-permissions/types.ts +42 -0
  259. package/version.ts +1 -1
  260. package/_cjs/actions/evm/fund/Quote.js +0 -63
  261. package/_cjs/actions/evm/fund/Quote.js.map +0 -1
  262. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
  263. package/_esm/actions/evm/fund/Quote.js +0 -59
  264. package/_esm/actions/evm/fund/Quote.js.map +0 -1
  265. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
  266. package/_types/actions/evm/fund/Quote.d.ts +0 -51
  267. package/_types/actions/evm/fund/Quote.d.ts.map +0 -1
  268. package/_types/actions/evm/fund/types.d.ts +0 -16
  269. package/_types/actions/evm/fund/types.d.ts.map +0 -1
  270. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +0 -1
  271. package/actions/evm/fund/Quote.ts +0 -83
  272. package/actions/evm/fund/types.ts +0 -16
  273. /package/_cjs/actions/evm/{fund → spend-permissions}/types.js +0 -0
  274. /package/_esm/actions/evm/{fund → spend-permissions}/types.js +0 -0
@@ -0,0 +1,42 @@
1
+ import type { Address, Hex } from "../types/misc.js";
2
+
3
+ /**
4
+ * A spend permission structure that defines authorization for spending tokens
5
+ */
6
+ export type SpendPermission = {
7
+ /** The account address that owns the tokens */
8
+ account: Address;
9
+ /** The address that is authorized to spend the tokens */
10
+ spender: Address;
11
+ /** The token contract address (use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for ETH) */
12
+ token: Address;
13
+ /** The maximum amount that can be spent (in wei for ETH, or token's smallest unit) */
14
+ allowance: bigint;
15
+ /** Time period in seconds for the spending allowance */
16
+ period: number;
17
+ /** Start timestamp for when the permission becomes valid */
18
+ start: number;
19
+ /** End timestamp for when the permission expires */
20
+ end: number;
21
+ /** Unique salt to prevent replay attacks */
22
+ salt: bigint;
23
+ /** Additional data for the permission */
24
+ extraData: Hex;
25
+ };
26
+
27
+ /**
28
+ * Networks that the SpendPermissionManager contract supports.
29
+ * From https://github.com/coinbase/spend-permissions/blob/main/README.md#deployments
30
+ */
31
+ export type SpendPermissionNetworks =
32
+ | "base"
33
+ | "base-sepolia"
34
+ | "ethereum"
35
+ | "ethereum-sepolia"
36
+ | "optimism"
37
+ | "optimism-sepolia"
38
+ | "arbitrum"
39
+ | "avalanche"
40
+ | "binance"
41
+ | "polygon"
42
+ | "zora";
package/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "1.28.0";
1
+ export const version = "1.30.0";
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Quote = void 0;
4
- /**
5
- * A class representing a funding quote that can be executed.
6
- */
7
- class Quote {
8
- /** Quote for the transfer. */
9
- quoteId;
10
- /** Network to transfer the funds to. */
11
- network;
12
- /** The amount in fiat currency. */
13
- fiatAmount;
14
- /** The fiat currency. */
15
- fiatCurrency;
16
- /** The amount in the token to transfer. */
17
- tokenAmount;
18
- /** The token to transfer. */
19
- token;
20
- /** Fees in the token to transfer. */
21
- fees;
22
- apiClient;
23
- /**
24
- * Creates a new Quote instance.
25
- *
26
- * @param apiClient - The API client.
27
- * @param quoteId - The quote ID.
28
- * @param network - The network to transfer funds to.
29
- * @param fiatAmount - The amount in fiat currency.
30
- * @param fiatCurrency - The fiat currency.
31
- * @param tokenAmount - The amount in the token to transfer.
32
- * @param token - The token to transfer.
33
- * @param fees - Fees for the transfer.
34
- */
35
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
36
- this.apiClient = apiClient;
37
- this.quoteId = quoteId;
38
- this.network = network;
39
- this.fiatAmount = fiatAmount;
40
- this.fiatCurrency = fiatCurrency;
41
- this.tokenAmount = tokenAmount;
42
- this.token = token;
43
- this.fees = fees;
44
- }
45
- /**
46
- * Executes the quote to perform the actual fund transfer.
47
- *
48
- * @returns A promise that resolves to the result of the executed quote.
49
- */
50
- async execute() {
51
- const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
52
- return {
53
- id: transfer.id,
54
- network: transfer.target.network,
55
- targetAmount: transfer.targetAmount,
56
- targetCurrency: transfer.targetCurrency,
57
- status: transfer.status,
58
- transactionHash: transfer.transactionHash,
59
- };
60
- }
61
- }
62
- exports.Quote = Quote;
63
- //# sourceMappingURL=Quote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,KAAK;IAChB,8BAA8B;IACvB,OAAO,CAAS;IACvB,wCAAwC;IACjC,OAAO,CAAsB;IACpC,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA6B;IACtB,KAAK,CAAS;IACrB,qCAAqC;IAC9B,IAAI,CAKP;IAEI,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAA4B,EAC5B,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhF,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO;YAChC,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC1C,CAAC;IACJ,CAAC;CACF;AA5ED,sBA4EC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"waitForFundOperationReceipt.js","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":";;AAuEA,kEAwCC;AA/GD,+DAAkG;AAClG,oDAA2D;AAmD3D;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,2BAA2B,CAC/C,MAA4B,EAC5B,OAAoC;IAEpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,SAAmB,EAA8B,EAAE;QACpE,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;aACK,CAAC;QAClC,CAAC;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,SAAS,EAAE,CAAC;YACzD,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,eAAe,EAAE,SAAS,CAAC,eAAgB;aACX,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI;QACzC,cAAc,EAAE,GAAG;QACnB,eAAe,EAAE,CAAC;KACnB,CAAC;IAEF,OAAO,MAAM,IAAA,cAAI,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,SAAmB,EAAW,EAAE;IAClD,OAAO,CACL,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,MAAM,CAC5F,CAAC;AACJ,CAAC,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * A class representing a funding quote that can be executed.
3
- */
4
- export class Quote {
5
- /** Quote for the transfer. */
6
- quoteId;
7
- /** Network to transfer the funds to. */
8
- network;
9
- /** The amount in fiat currency. */
10
- fiatAmount;
11
- /** The fiat currency. */
12
- fiatCurrency;
13
- /** The amount in the token to transfer. */
14
- tokenAmount;
15
- /** The token to transfer. */
16
- token;
17
- /** Fees in the token to transfer. */
18
- fees;
19
- apiClient;
20
- /**
21
- * Creates a new Quote instance.
22
- *
23
- * @param apiClient - The API client.
24
- * @param quoteId - The quote ID.
25
- * @param network - The network to transfer funds to.
26
- * @param fiatAmount - The amount in fiat currency.
27
- * @param fiatCurrency - The fiat currency.
28
- * @param tokenAmount - The amount in the token to transfer.
29
- * @param token - The token to transfer.
30
- * @param fees - Fees for the transfer.
31
- */
32
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
33
- this.apiClient = apiClient;
34
- this.quoteId = quoteId;
35
- this.network = network;
36
- this.fiatAmount = fiatAmount;
37
- this.fiatCurrency = fiatCurrency;
38
- this.tokenAmount = tokenAmount;
39
- this.token = token;
40
- this.fees = fees;
41
- }
42
- /**
43
- * Executes the quote to perform the actual fund transfer.
44
- *
45
- * @returns A promise that resolves to the result of the executed quote.
46
- */
47
- async execute() {
48
- const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
49
- return {
50
- id: transfer.id,
51
- network: transfer.target.network,
52
- targetAmount: transfer.targetAmount,
53
- targetCurrency: transfer.targetCurrency,
54
- status: transfer.status,
55
- transactionHash: transfer.transactionHash,
56
- };
57
- }
58
- }
59
- //# sourceMappingURL=Quote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,KAAK;IAChB,8BAA8B;IACvB,OAAO,CAAS;IACvB,wCAAwC;IACjC,OAAO,CAAsB;IACpC,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA6B;IACtB,KAAK,CAAS;IACrB,qCAAqC;IAC9B,IAAI,CAKP;IAEI,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAA4B,EAC5B,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhF,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO;YAChC,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC1C,CAAC;IACJ,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"waitForFundOperationReceipt.js","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,IAAI,EAAe,MAAM,wBAAwB,CAAC;AAmD3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAA4B,EAC5B,OAAoC;IAEpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,SAAmB,EAA8B,EAAE;QACpE,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;aACK,CAAC;QAClC,CAAC;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,SAAS,EAAE,CAAC;YACzD,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,eAAe,EAAE,SAAS,CAAC,eAAgB;aACX,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI;QACzC,cAAc,EAAE,GAAG;QACnB,eAAe,EAAE,CAAC;KACnB,CAAC;IAEF,OAAO,MAAM,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,SAAmB,EAAW,EAAE;IAClD,OAAO,CACL,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,CAC5F,CAAC;AACJ,CAAC,CAAC"}
@@ -1,51 +0,0 @@
1
- import { FundOperationResult } from "./types.js";
2
- import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
3
- /**
4
- * A class representing a funding quote that can be executed.
5
- */
6
- export declare class Quote {
7
- /** Quote for the transfer. */
8
- quoteId: string;
9
- /** Network to transfer the funds to. */
10
- network: "base" | "ethereum";
11
- /** The amount in fiat currency. */
12
- fiatAmount: string;
13
- /** The fiat currency. */
14
- fiatCurrency: string;
15
- /** The amount in the token to transfer. */
16
- tokenAmount: string;
17
- /** The token to transfer. */
18
- token: string;
19
- /** Fees in the token to transfer. */
20
- fees: {
21
- /** The type of fee. */
22
- type: "exchange_fee" | "network_fee";
23
- amount: string;
24
- currency: string;
25
- }[];
26
- private apiClient;
27
- /**
28
- * Creates a new Quote instance.
29
- *
30
- * @param apiClient - The API client.
31
- * @param quoteId - The quote ID.
32
- * @param network - The network to transfer funds to.
33
- * @param fiatAmount - The amount in fiat currency.
34
- * @param fiatCurrency - The fiat currency.
35
- * @param tokenAmount - The amount in the token to transfer.
36
- * @param token - The token to transfer.
37
- * @param fees - Fees for the transfer.
38
- */
39
- constructor(apiClient: CdpOpenApiClientType, quoteId: string, network: "base" | "ethereum", fiatAmount: string, fiatCurrency: string, tokenAmount: string, token: string, fees: {
40
- type: "exchange_fee" | "network_fee";
41
- amount: string;
42
- currency: string;
43
- }[]);
44
- /**
45
- * Executes the quote to perform the actual fund transfer.
46
- *
47
- * @returns A promise that resolves to the result of the executed quote.
48
- */
49
- execute(): Promise<FundOperationResult>;
50
- }
51
- //# sourceMappingURL=Quote.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;GAEG;AACH,qBAAa,KAAK;IAChB,8BAA8B;IACvB,OAAO,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACjC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IACpC,mCAAmC;IAC5B,UAAU,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IAClB,YAAY,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IACpC,WAAW,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IACtB,KAAK,EAAE,MAAM,CAAC;IACrB,qCAAqC;IAC9B,IAAI,EAAE;QACX,uBAAuB;QACvB,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IAEJ,OAAO,CAAC,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;gBAED,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;QACJ,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE;IAYL;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAY9C"}
@@ -1,16 +0,0 @@
1
- import { TransferStatus } from "../../../openapi-client/index.js";
2
- export type FundOperationResult = {
3
- /** The transfer that was created to fund the account. */
4
- id: string;
5
- /** The network that the transfer was created on. */
6
- network: string;
7
- /** The target amount that will be received. */
8
- targetAmount: string;
9
- /** The currency that will be received. */
10
- targetCurrency: string;
11
- /** The status of the fund operation. */
12
- status: TransferStatus;
13
- /** The transaction hash of the transfer. */
14
- transactionHash?: string;
15
- };
16
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG;IAChC,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,MAAM,EAAE,cAAc,CAAC;IACvB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"waitForFundOperationReceipt.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAY,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAQ,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,OAAO,cAAc,CAAC,SAAS,CAAC;IACxC,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CAqCrC"}
@@ -1,83 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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
- };