@coinbase/cdp-sdk 1.38.4 → 1.38.6

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 (196) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +24 -0
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +0 -36
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +0 -36
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +0 -42
  8. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  9. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +0 -42
  10. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  11. package/_cjs/accounts/solana/toSolanaAccount.js +0 -30
  12. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
  13. package/_cjs/actions/evm/sendUserOperation.js +2 -0
  14. package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
  15. package/_cjs/analytics.js +164 -2
  16. package/_cjs/analytics.js.map +1 -1
  17. package/_cjs/auth/utils/http.js +5 -2
  18. package/_cjs/auth/utils/http.js.map +1 -1
  19. package/_cjs/auth/utils/jwt.js +1 -1
  20. package/_cjs/auth/utils/jwt.js.map +1 -1
  21. package/_cjs/client/end-user/endUser.js +43 -0
  22. package/_cjs/client/end-user/endUser.js.map +1 -1
  23. package/_cjs/client/evm/evm.js +49 -0
  24. package/_cjs/client/evm/evm.js.map +1 -1
  25. package/_cjs/index.js.map +1 -1
  26. package/_cjs/openapi-client/cdpApiClient.js +4 -0
  27. package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
  28. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +6 -41
  29. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  30. package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js +10 -1
  31. package/_cjs/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
  32. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
  33. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  34. package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +14 -1
  35. package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -1
  36. package/_cjs/openapi-client/index.js +0 -3
  37. package/_cjs/openapi-client/index.js.map +1 -1
  38. package/_cjs/version.js +1 -1
  39. package/_esm/accounts/evm/toEvmServerAccount.js +0 -36
  40. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  41. package/_esm/accounts/evm/toEvmSmartAccount.js +0 -36
  42. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  43. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +0 -42
  44. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  45. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +0 -42
  46. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  47. package/_esm/accounts/solana/toSolanaAccount.js +0 -30
  48. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
  49. package/_esm/actions/evm/sendUserOperation.js +2 -0
  50. package/_esm/actions/evm/sendUserOperation.js.map +1 -1
  51. package/_esm/analytics.js +163 -1
  52. package/_esm/analytics.js.map +1 -1
  53. package/_esm/auth/utils/http.js +5 -2
  54. package/_esm/auth/utils/http.js.map +1 -1
  55. package/_esm/auth/utils/jwt.js +1 -1
  56. package/_esm/auth/utils/jwt.js.map +1 -1
  57. package/_esm/client/end-user/endUser.js +44 -1
  58. package/_esm/client/end-user/endUser.js.map +1 -1
  59. package/_esm/client/evm/evm.js +49 -0
  60. package/_esm/client/evm/evm.js.map +1 -1
  61. package/_esm/index.js.map +1 -1
  62. package/_esm/openapi-client/cdpApiClient.js +4 -0
  63. package/_esm/openapi-client/cdpApiClient.js.map +1 -1
  64. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +5 -39
  65. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  66. package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js +8 -0
  67. package/_esm/openapi-client/generated/end-user-accounts/end-user-accounts.js.map +1 -1
  68. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
  69. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  70. package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +12 -0
  71. package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -1
  72. package/_esm/openapi-client/index.js +0 -3
  73. package/_esm/openapi-client/index.js.map +1 -1
  74. package/_esm/version.js +1 -1
  75. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  76. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  77. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  78. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  79. package/_types/accounts/evm/types.d.ts +3 -18
  80. package/_types/accounts/evm/types.d.ts.map +1 -1
  81. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
  82. package/_types/actions/evm/sendUserOperation.d.ts +11 -0
  83. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
  84. package/_types/actions/evm/types.d.ts +1 -66
  85. package/_types/actions/evm/types.d.ts.map +1 -1
  86. package/_types/actions/solana/types.d.ts +1 -62
  87. package/_types/actions/solana/types.d.ts.map +1 -1
  88. package/_types/analytics.d.ts +27 -0
  89. package/_types/analytics.d.ts.map +1 -1
  90. package/_types/auth/utils/http.d.ts.map +1 -1
  91. package/_types/client/end-user/endUser.d.ts +36 -2
  92. package/_types/client/end-user/endUser.d.ts.map +1 -1
  93. package/_types/client/end-user/endUser.types.d.ts +5 -0
  94. package/_types/client/end-user/endUser.types.d.ts.map +1 -1
  95. package/_types/client/evm/evm.d.ts +29 -2
  96. package/_types/client/evm/evm.d.ts.map +1 -1
  97. package/_types/client/evm/evm.types.d.ts +20 -2
  98. package/_types/client/evm/evm.types.d.ts.map +1 -1
  99. package/_types/index.d.ts +2 -1
  100. package/_types/index.d.ts.map +1 -1
  101. package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
  102. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +44 -246
  103. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  104. package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts +8 -1
  105. package/_types/openapi-client/generated/end-user-accounts/end-user-accounts.d.ts.map +1 -1
  106. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
  107. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  108. package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts +11 -0
  109. package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts.map +1 -1
  110. package/_types/openapi-client/index.d.ts +3 -6
  111. package/_types/openapi-client/index.d.ts.map +1 -1
  112. package/_types/types/calls.d.ts +1 -0
  113. package/_types/types/calls.d.ts.map +1 -1
  114. package/_types/version.d.ts +1 -1
  115. package/accounts/evm/toEvmServerAccount.ts +0 -47
  116. package/accounts/evm/toEvmSmartAccount.ts +0 -47
  117. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +0 -50
  118. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +0 -49
  119. package/accounts/evm/types.ts +5 -49
  120. package/accounts/solana/toSolanaAccount.ts +0 -41
  121. package/actions/evm/sendUserOperation.ts +14 -0
  122. package/actions/evm/types.ts +1 -74
  123. package/actions/solana/types.ts +1 -70
  124. package/analytics.ts +225 -1
  125. package/auth/utils/http.ts +5 -2
  126. package/auth/utils/jwt.ts +1 -1
  127. package/client/end-user/endUser.ts +52 -2
  128. package/client/end-user/endUser.types.ts +7 -0
  129. package/client/evm/evm.ts +61 -0
  130. package/client/evm/evm.types.ts +23 -0
  131. package/index.ts +2 -1
  132. package/openapi-client/cdpApiClient.ts +5 -0
  133. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +53 -289
  134. package/openapi-client/generated/end-user-accounts/end-user-accounts.ts +14 -0
  135. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
  136. package/openapi-client/generated/sql-api-alpha/sql-api-alpha.ts +13 -0
  137. package/openapi-client/index.ts +0 -3
  138. package/package.json +1 -1
  139. package/types/calls.ts +1 -0
  140. package/version.ts +1 -1
  141. package/_cjs/actions/Quote.js +0 -106
  142. package/_cjs/actions/Quote.js.map +0 -1
  143. package/_cjs/actions/evm/fund/fund.js +0 -51
  144. package/_cjs/actions/evm/fund/fund.js.map +0 -1
  145. package/_cjs/actions/evm/fund/quoteFund.js +0 -48
  146. package/_cjs/actions/evm/fund/quoteFund.js.map +0 -1
  147. package/_cjs/actions/solana/fund/fund.js +0 -51
  148. package/_cjs/actions/solana/fund/fund.js.map +0 -1
  149. package/_cjs/actions/solana/fund/quoteFund.js +0 -48
  150. package/_cjs/actions/solana/fund/quoteFund.js.map +0 -1
  151. package/_cjs/actions/types.js +0 -3
  152. package/_cjs/actions/types.js.map +0 -1
  153. package/_cjs/actions/waitForFundOperationReceipt.js +0 -65
  154. package/_cjs/actions/waitForFundOperationReceipt.js.map +0 -1
  155. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js +0 -50
  156. package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js.map +0 -1
  157. package/_esm/actions/Quote.js +0 -101
  158. package/_esm/actions/Quote.js.map +0 -1
  159. package/_esm/actions/evm/fund/fund.js +0 -48
  160. package/_esm/actions/evm/fund/fund.js.map +0 -1
  161. package/_esm/actions/evm/fund/quoteFund.js +0 -45
  162. package/_esm/actions/evm/fund/quoteFund.js.map +0 -1
  163. package/_esm/actions/solana/fund/fund.js +0 -48
  164. package/_esm/actions/solana/fund/fund.js.map +0 -1
  165. package/_esm/actions/solana/fund/quoteFund.js +0 -45
  166. package/_esm/actions/solana/fund/quoteFund.js.map +0 -1
  167. package/_esm/actions/types.js +0 -2
  168. package/_esm/actions/types.js.map +0 -1
  169. package/_esm/actions/waitForFundOperationReceipt.js +0 -62
  170. package/_esm/actions/waitForFundOperationReceipt.js.map +0 -1
  171. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js +0 -42
  172. package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js.map +0 -1
  173. package/_types/actions/Quote.d.ts +0 -97
  174. package/_types/actions/Quote.d.ts.map +0 -1
  175. package/_types/actions/evm/fund/fund.d.ts +0 -22
  176. package/_types/actions/evm/fund/fund.d.ts.map +0 -1
  177. package/_types/actions/evm/fund/quoteFund.d.ts +0 -23
  178. package/_types/actions/evm/fund/quoteFund.d.ts.map +0 -1
  179. package/_types/actions/solana/fund/fund.d.ts +0 -20
  180. package/_types/actions/solana/fund/fund.d.ts.map +0 -1
  181. package/_types/actions/solana/fund/quoteFund.d.ts +0 -21
  182. package/_types/actions/solana/fund/quoteFund.d.ts.map +0 -1
  183. package/_types/actions/types.d.ts +0 -37
  184. package/_types/actions/types.d.ts.map +0 -1
  185. package/_types/actions/waitForFundOperationReceipt.d.ts +0 -69
  186. package/_types/actions/waitForFundOperationReceipt.d.ts.map +0 -1
  187. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts +0 -42
  188. package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts.map +0 -1
  189. package/actions/Quote.ts +0 -154
  190. package/actions/evm/fund/fund.ts +0 -74
  191. package/actions/evm/fund/quoteFund.ts +0 -80
  192. package/actions/solana/fund/fund.ts +0 -72
  193. package/actions/solana/fund/quoteFund.ts +0 -78
  194. package/actions/types.ts +0 -39
  195. package/actions/waitForFundOperationReceipt.ts +0 -119
  196. package/openapi-client/generated/payments-alpha/payments-alpha.ts +0 -96
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SolanaQuote = exports.EvmQuote = void 0;
4
- /**
5
- * Base class representing a funding quote that can be executed.
6
- */
7
- class BaseQuote {
8
- /** Quote for the transfer. */
9
- quoteId;
10
- /** The amount in fiat currency. */
11
- fiatAmount;
12
- /** The fiat currency. */
13
- fiatCurrency;
14
- /** The amount in the token to transfer. */
15
- tokenAmount;
16
- /** The token to transfer. */
17
- token;
18
- /** Fees in the token to transfer. */
19
- fees;
20
- apiClient;
21
- /**
22
- * Creates a new BaseQuote instance.
23
- *
24
- * @param apiClient - The API client.
25
- * @param quoteId - The quote ID.
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, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
33
- this.apiClient = apiClient;
34
- this.quoteId = quoteId;
35
- this.fiatAmount = fiatAmount;
36
- this.fiatCurrency = fiatCurrency;
37
- this.tokenAmount = tokenAmount;
38
- this.token = token;
39
- this.fees = fees;
40
- }
41
- /**
42
- * Executes the quote to perform the actual fund transfer.
43
- *
44
- * @returns A promise that resolves to the result of the executed quote.
45
- */
46
- async execute() {
47
- const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
48
- return {
49
- id: transfer.id,
50
- network: transfer.target.network,
51
- targetAmount: transfer.targetAmount,
52
- targetCurrency: transfer.targetCurrency,
53
- status: transfer.status,
54
- transactionHash: transfer.transactionHash,
55
- };
56
- }
57
- }
58
- /**
59
- * A class representing an EVM funding quote that can be executed.
60
- */
61
- class EvmQuote extends BaseQuote {
62
- /** Network to transfer the funds to (EVM networks). */
63
- network;
64
- /**
65
- * Creates a new EvmQuote instance.
66
- *
67
- * @param apiClient - The API client.
68
- * @param quoteId - The quote ID.
69
- * @param network - The EVM network to transfer funds to.
70
- * @param fiatAmount - The amount in fiat currency.
71
- * @param fiatCurrency - The fiat currency.
72
- * @param tokenAmount - The amount in the token to transfer.
73
- * @param token - The token to transfer.
74
- * @param fees - Fees for the transfer.
75
- */
76
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
77
- super(apiClient, quoteId, fiatAmount, fiatCurrency, tokenAmount, token, fees);
78
- this.network = network;
79
- }
80
- }
81
- exports.EvmQuote = EvmQuote;
82
- /**
83
- * A class representing a Solana funding quote that can be executed.
84
- */
85
- class SolanaQuote extends BaseQuote {
86
- /** Network to transfer the funds to (Solana). */
87
- network;
88
- /**
89
- * Creates a new SolanaQuote instance.
90
- *
91
- * @param apiClient - The API client.
92
- * @param quoteId - The quote ID.
93
- * @param network - The Solana network to transfer funds to.
94
- * @param fiatAmount - The amount in fiat currency.
95
- * @param fiatCurrency - The fiat currency.
96
- * @param tokenAmount - The amount in the token to transfer.
97
- * @param token - The token to transfer.
98
- * @param fees - Fees for the transfer.
99
- */
100
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
101
- super(apiClient, quoteId, fiatAmount, fiatCurrency, tokenAmount, token, fees);
102
- this.network = network;
103
- }
104
- }
105
- exports.SolanaQuote = SolanaQuote;
106
- //# sourceMappingURL=Quote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../actions/Quote.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAe,SAAS;IACtB,8BAA8B;IACvB,OAAO,CAAS;IACvB,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA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9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAjCD,4BAiCC;AAED;;GAEG;AACH,MAAa,WAAY,SAAQ,SAAS;IACxC,iDAAiD;IAC1C,OAAO,CAAW;IAEzB;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAAiB,EACjB,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAjCD,kCAiCC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fund = fund;
4
- const viem_1 = require("viem");
5
- const errors_js_1 = require("../../../errors.js");
6
- const index_js_1 = require("../../../openapi-client/index.js");
7
- /**
8
- * Funds an EVM account.
9
- *
10
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
11
- * @param apiClient - The API client.
12
- * @param options - The options for funding an EVM account.
13
- *
14
- * @returns A promise that resolves to the fund operation result.
15
- */
16
- async function fund(apiClient, options) {
17
- if (options.token !== "eth" && options.token !== "usdc") {
18
- throw new errors_js_1.UserInputValidationError("Invalid token, must be eth or usdc");
19
- }
20
- const decimals = options.token === "eth" ? 18 : 6;
21
- const amount = (0, viem_1.formatUnits)(options.amount, decimals);
22
- const paymentMethods = await apiClient.getPaymentMethods();
23
- const cardPaymentMethod = paymentMethods.find(method => method.type === "card" && method.actions.includes("source"));
24
- if (!cardPaymentMethod) {
25
- throw new Error("No card found to fund account");
26
- }
27
- const response = await apiClient.createPaymentTransferQuote({
28
- sourceType: index_js_1.CreatePaymentTransferQuoteBodySourceType.payment_method,
29
- source: {
30
- id: cardPaymentMethod.id,
31
- },
32
- targetType: index_js_1.CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
33
- target: {
34
- currency: options.token,
35
- network: options.network,
36
- address: options.address,
37
- },
38
- amount,
39
- currency: options.token,
40
- execute: true,
41
- });
42
- return {
43
- id: response.transfer.id,
44
- network: response.transfer.target.network,
45
- status: response.transfer.status,
46
- targetAmount: response.transfer.targetAmount,
47
- targetCurrency: response.transfer.targetCurrency,
48
- transactionHash: response.transfer.transactionHash,
49
- };
50
- }
51
- //# sourceMappingURL=fund.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fund.js","sourceRoot":"","sources":["../../../../actions/evm/fund/fund.ts"],"names":[],"mappings":";;AA6BA,oBA4CC;AAzED,+BAAmC;AAEnC,kDAA8D;AAC9D,+DAI0C;AAa1C;;;;;;;;GAQG;AACI,KAAK,UAAU,IAAI,CACxB,SAA+B,EAC/B,OAAuB;IAEvB,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,MAAM,IAAI,oCAAwB,CAAC,oCAAoC,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,cAAc,CAAC,IAAI,CAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACtE,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,0BAA0B,CAAC;QAC1D,UAAU,EAAE,mDAAwC,CAAC,cAAc;QACnE,MAAM,EAAE;YACN,EAAE,EAAE,iBAAiB,CAAC,EAAE;SACzB;QACD,UAAU,EAAE,mDAAwC,CAAC,WAAW;QAChE,MAAM,EAAE;YACN,QAAQ,EAAE,OAAO,CAAC,KAAK;YACvB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB;QACD,MAAM;QACN,QAAQ,EAAE,OAAO,CAAC,KAAK;QACvB,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACxB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO;QACzC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;QAChC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;QAC5C,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc;QAChD,eAAe,EAAE,QAAQ,CAAC,QAAQ,CAAC,eAAe;KACnD,CAAC;AACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.quoteFund = quoteFund;
4
- const viem_1 = require("viem");
5
- const errors_js_1 = require("../../../errors.js");
6
- const index_js_1 = require("../../../openapi-client/index.js");
7
- const Quote_js_1 = require("../../Quote.js");
8
- /**
9
- * Gets a quote to fund an EVM account.
10
- *
11
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
12
- * @param apiClient - The API client.
13
- * @param options - The options for getting a quote to fund an EVM account.
14
- *
15
- * @returns A promise that resolves to the quote.
16
- */
17
- async function quoteFund(apiClient, options) {
18
- if (options.token !== "eth" && options.token !== "usdc") {
19
- throw new errors_js_1.UserInputValidationError("Invalid token, must be eth or usdc");
20
- }
21
- const decimals = options.token === "eth" ? 18 : 6;
22
- const amount = (0, viem_1.formatUnits)(options.amount, decimals);
23
- const paymentMethods = await apiClient.getPaymentMethods();
24
- const cardPaymentMethod = paymentMethods.find(method => method.type === "card" && method.actions.includes("source"));
25
- if (!cardPaymentMethod) {
26
- throw new Error("No card found to fund account");
27
- }
28
- const response = await apiClient.createPaymentTransferQuote({
29
- sourceType: index_js_1.CreatePaymentTransferQuoteBodySourceType.payment_method,
30
- source: {
31
- id: cardPaymentMethod.id,
32
- },
33
- targetType: index_js_1.CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
34
- target: {
35
- currency: options.token,
36
- network: options.network,
37
- address: options.address,
38
- },
39
- amount,
40
- currency: options.token,
41
- });
42
- return new Quote_js_1.EvmQuote(apiClient, response.transfer.id, options.network, response.transfer.sourceAmount, response.transfer.sourceCurrency, response.transfer.targetAmount, response.transfer.targetCurrency, response.transfer.fees.map(fee => ({
43
- type: fee.type,
44
- amount: fee.amount,
45
- currency: fee.currency,
46
- })));
47
- }
48
- //# sourceMappingURL=quoteFund.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quoteFund.js","sourceRoot":"","sources":["../../../../actions/evm/fund/quoteFund.ts"],"names":[],"mappings":";;AA8BA,8BAiDC;AA/ED,+BAAmC;AAEnC,kDAA8D;AAC9D,+DAI0C;AAC1C,6CAA0C;AAa1C;;;;;;;;GAQG;AACI,KAAK,UAAU,SAAS,CAC7B,SAA+B,EAC/B,OAA4B;IAE5B,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,MAAM,IAAI,oCAAwB,CAAC,oCAAoC,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAA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I;QACd,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACvB,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fund = fund;
4
- const viem_1 = require("viem");
5
- const errors_js_1 = require("../../../errors.js");
6
- const index_js_1 = require("../../../openapi-client/index.js");
7
- /**
8
- * Funds a Solana account.
9
- *
10
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
11
- * @param apiClient - The API client.
12
- * @param options - The options for funding a Solana account.
13
- *
14
- * @returns A promise that resolves to the fund operation result.
15
- */
16
- async function fund(apiClient, options) {
17
- if (options.token !== "sol" && options.token !== "usdc") {
18
- throw new errors_js_1.UserInputValidationError("Invalid token, must be sol or usdc");
19
- }
20
- const decimals = options.token === "sol" ? 9 : 6;
21
- const amount = (0, viem_1.formatUnits)(options.amount, decimals);
22
- const paymentMethods = await apiClient.getPaymentMethods();
23
- const cardPaymentMethod = paymentMethods.find(method => method.type === "card" && method.actions.includes("source"));
24
- if (!cardPaymentMethod) {
25
- throw new Error("No card found to fund account");
26
- }
27
- const response = await apiClient.createPaymentTransferQuote({
28
- sourceType: index_js_1.CreatePaymentTransferQuoteBodySourceType.payment_method,
29
- source: {
30
- id: cardPaymentMethod.id,
31
- },
32
- targetType: index_js_1.CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
33
- target: {
34
- currency: options.token,
35
- network: "solana",
36
- address: options.address,
37
- },
38
- amount,
39
- currency: options.token,
40
- execute: true,
41
- });
42
- return {
43
- id: response.transfer.id,
44
- network: response.transfer.target.network,
45
- status: response.transfer.status,
46
- targetAmount: response.transfer.targetAmount,
47
- targetCurrency: response.transfer.targetCurrency,
48
- transactionHash: response.transfer.transactionHash,
49
- };
50
- }
51
- //# sourceMappingURL=fund.js.map
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B;QACD,MAAM;QACN,QAAQ,EAAE,OAAO,CAAC,KAAK;QACvB,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACxB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO;QACzC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;QAChC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;QAC5C,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc;QAChD,eAAe,EAAE,QAAQ,CAAC,QAAQ,CAAC,eAAe;KACnD,CAAC;AACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.quoteFund = quoteFund;
4
- const viem_1 = require("viem");
5
- const errors_js_1 = require("../../../errors.js");
6
- const index_js_1 = require("../../../openapi-client/index.js");
7
- const Quote_js_1 = require("../../Quote.js");
8
- /**
9
- * Gets a quote to fund a Solana account.
10
- *
11
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
12
- * @param apiClient - The API client.
13
- * @param options - The options for getting a quote to fund a Solana account.
14
- *
15
- * @returns A promise that resolves to the quote.
16
- */
17
- async function quoteFund(apiClient, options) {
18
- if (options.token !== "sol" && options.token !== "usdc") {
19
- throw new errors_js_1.UserInputValidationError("Invalid token, must be sol or usdc");
20
- }
21
- const decimals = options.token === "sol" ? 9 : 6;
22
- const amount = (0, viem_1.formatUnits)(options.amount, decimals);
23
- const paymentMethods = await apiClient.getPaymentMethods();
24
- const cardPaymentMethod = paymentMethods.find(method => method.type === "card" && method.actions.includes("source"));
25
- if (!cardPaymentMethod) {
26
- throw new Error("No card found to fund account");
27
- }
28
- const response = await apiClient.createPaymentTransferQuote({
29
- sourceType: index_js_1.CreatePaymentTransferQuoteBodySourceType.payment_method,
30
- source: {
31
- id: cardPaymentMethod.id,
32
- },
33
- targetType: index_js_1.CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
34
- target: {
35
- currency: options.token,
36
- network: "solana",
37
- address: options.address,
38
- },
39
- amount,
40
- currency: options.token,
41
- });
42
- return new Quote_js_1.SolanaQuote(apiClient, response.transfer.id, "solana", response.transfer.sourceAmount, response.transfer.sourceCurrency, response.transfer.targetAmount, response.transfer.targetCurrency, response.transfer.fees.map(fee => ({
43
- type: fee.type,
44
- amount: fee.amount,
45
- currency: fee.currency,
46
- })));
47
- }
48
- //# sourceMappingURL=quoteFund.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quoteFund.js","sourceRoot":"","sources":["../../../../actions/solana/fund/quoteFund.ts"],"names":[],"mappings":";;AA4BA,8BAiDC;AA7ED,+BAAmC;AAEnC,kDAA8D;AAC9D,+DAI0C;AAC1C,6CAA6C;AAW7C;;;;;;;;GAQG;AACI,KAAK,UAAU,SAAS,CAC7B,SAA+B,EAC/B,OAA+B;IAE/B,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,MAAM,IAAI,oCAAwB,CAAC,oCAAoC,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAA,kBAAW,EAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,cAAc,CAAC,IAAI,CAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACtE,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,0BAA0B,CAAC;QAC1D,UAAU,EAAE,mDAAwC,CAAC,cAAc;QACnE,MAAM,EAAE;YACN,EAAE,EAAE,iBAAiB,CAAC,EAAE;SACzB;QACD,UAAU,EAAE,mDAAwC,CAAC,WAAW;QAChE,MAAM,EAAE;YACN,QAAQ,EAAE,OAAO,CAAC,KAAK;YACvB,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB;QACD,MAAM;QACN,QAAQ,EAAE,OAAO,CAAC,KAAK;KACxB,CAAC,CAAC;IAEH,OAAO,IAAI,sBAAW,CACpB,SAAS,EACT,QAAQ,CAAC,QAAQ,CAAC,EAAE,EACpB,QAAQ,EACR,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAC9B,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAChC,QAAQ,CAAC,QAAQ,CAAC,YAAY,EAC9B,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAChC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACvB,CAAC,CAAC,CACJ,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../actions/types.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.waitForFundOperationReceipt = waitForFundOperationReceipt;
4
- const index_js_1 = require("../openapi-client/index.js");
5
- const wait_js_1 = require("../utils/wait.js");
6
- /**
7
- * Waits for a fund operation to complete or fail.
8
- *
9
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
10
- * @example
11
- * ```ts
12
- * import { waitForFundOperation } from "@coinbase/cdp-sdk";
13
- *
14
- * const result = await waitForFundOperation(client, {
15
- * transferId: "0x1234567890123456789012345678901234567890",
16
- * waitOptions: {
17
- * timeoutSeconds: 30,
18
- * },
19
- * });
20
- * ```
21
- *
22
- * @param {CdpOpenApiClientType} client - The client to use to wait for the fund operation.
23
- * @param {WaitForFundOperationOptions} options - The options for the wait operation.
24
- * @returns {Promise<WaitForFundOperationResult>} The result of the fund operation.
25
- */
26
- async function waitForFundOperationReceipt(client, options) {
27
- const { transferId } = options;
28
- const reload = async () => {
29
- const response = await client.getPaymentTransfer(transferId);
30
- return response;
31
- };
32
- const transform = (operation) => {
33
- if (operation.status === index_js_1.TransferStatus.failed) {
34
- return {
35
- id: operation.id,
36
- network: operation.target.network,
37
- targetAmount: operation.targetAmount,
38
- targetCurrency: operation.targetCurrency,
39
- status: operation.status,
40
- };
41
- }
42
- else if (operation.status === index_js_1.TransferStatus.completed) {
43
- return {
44
- id: operation.id,
45
- network: operation.target.network,
46
- targetAmount: operation.targetAmount,
47
- targetCurrency: operation.targetCurrency,
48
- status: operation.status,
49
- transactionHash: operation.transactionHash,
50
- };
51
- }
52
- else {
53
- throw new Error("Transfer is not terminal");
54
- }
55
- };
56
- const waitOptions = options.waitOptions || {
57
- timeoutSeconds: 900,
58
- intervalSeconds: 1,
59
- };
60
- return await (0, wait_js_1.wait)(reload, isTerminal, transform, waitOptions);
61
- }
62
- const isTerminal = (operation) => {
63
- return (operation.status === index_js_1.TransferStatus.completed || operation.status === index_js_1.TransferStatus.failed);
64
- };
65
- //# sourceMappingURL=waitForFundOperationReceipt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"waitForFundOperationReceipt.js","sourceRoot":"","sources":["../../actions/waitForFundOperationReceipt.ts"],"names":[],"mappings":";;AAwEA,kEAwCC;AAhHD,yDAA4F;AAC5F,8CAAqD;AAmDrD;;;;;;;;;;;;;;;;;;;GAmBG;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,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPaymentTransfer = exports.executePaymentTransferQuote = exports.createPaymentTransferQuote = exports.getCryptoRails = exports.getPaymentMethods = void 0;
4
- const cdpApiClient_js_1 = require("../../cdpApiClient.js");
5
- /**
6
- * 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.
7
- * @summary Get the fiat payment methods
8
- */
9
- const getPaymentMethods = (options) => {
10
- return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/payments/rails/payment-methods`, method: "GET" }, options);
11
- };
12
- exports.getPaymentMethods = getPaymentMethods;
13
- /**
14
- * Gets the crypto rails that can be used to send funds or receive funds.
15
- * @summary Get the crypto rails
16
- */
17
- const getCryptoRails = (params, options) => {
18
- return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/payments/rails/crypto`, method: "GET", params }, options);
19
- };
20
- exports.getCryptoRails = getCryptoRails;
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
- const createPaymentTransferQuote = (createPaymentTransferQuoteBody, options) => {
26
- return (0, cdpApiClient_js_1.cdpApiClient)({
27
- url: `/v2/payments/transfers`,
28
- method: "POST",
29
- headers: { "Content-Type": "application/json" },
30
- data: createPaymentTransferQuoteBody,
31
- }, options);
32
- };
33
- exports.createPaymentTransferQuote = createPaymentTransferQuote;
34
- /**
35
- * Executes a transfer quote which was created using the Create a transfer quote endpoint.
36
- * @summary Execute a transfer quote
37
- */
38
- const executePaymentTransferQuote = (transferId, options) => {
39
- return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/payments/transfers/${transferId}/execute`, method: "POST" }, options);
40
- };
41
- exports.executePaymentTransferQuote = executePaymentTransferQuote;
42
- /**
43
- * Gets a transfer by ID.
44
- * @summary Get a transfer by ID
45
- */
46
- const getPaymentTransfer = (transferId, options) => {
47
- return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/payments/transfers/${transferId}`, method: "GET" }, options);
48
- };
49
- exports.getPaymentTransfer = getPaymentTransfer;
50
- //# sourceMappingURL=payments-alpha.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payments-alpha.js","sourceRoot":"","sources":["../../../../openapi-client/generated/payments-alpha/payments-alpha.ts"],"names":[],"mappings":";;;AAgBA,2DAAqD;AAIrD;;;GAGG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAA8C,EAAE,EAAE;IAClF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,oCAAoC,EAAE,MAAM,EAAE,KAAK,EAAE,EAC5D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,iBAAiB,qBAK5B;AACF;;;GAGG;AACI,MAAM,cAAc,GAAG,CAC5B,MAA6B,EAC7B,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,2BAA2B,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAC3D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AACF;;;GAGG;AACI,MAAM,0BAA0B,GAAG,CACxC,8BAA8D,EAC9D,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB;QACE,GAAG,EAAE,wBAAwB;QAC7B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,8BAA8B;KACrC,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,0BAA0B,8BAarC;AACF;;;GAGG;AACI,MAAM,2BAA2B,GAAG,CACzC,UAAkB,EAClB,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,0BAA0B,UAAU,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EACvE,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,2BAA2B,+BAQtC;AACF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAChC,UAAkB,EAClB,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,0BAA0B,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAC9D,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B"}
@@ -1,101 +0,0 @@
1
- /**
2
- * Base class representing a funding quote that can be executed.
3
- */
4
- class BaseQuote {
5
- /** Quote for the transfer. */
6
- quoteId;
7
- /** The amount in fiat currency. */
8
- fiatAmount;
9
- /** The fiat currency. */
10
- fiatCurrency;
11
- /** The amount in the token to transfer. */
12
- tokenAmount;
13
- /** The token to transfer. */
14
- token;
15
- /** Fees in the token to transfer. */
16
- fees;
17
- apiClient;
18
- /**
19
- * Creates a new BaseQuote instance.
20
- *
21
- * @param apiClient - The API client.
22
- * @param quoteId - The quote ID.
23
- * @param fiatAmount - The amount in fiat currency.
24
- * @param fiatCurrency - The fiat currency.
25
- * @param tokenAmount - The amount in the token to transfer.
26
- * @param token - The token to transfer.
27
- * @param fees - Fees for the transfer.
28
- */
29
- constructor(apiClient, quoteId, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
30
- this.apiClient = apiClient;
31
- this.quoteId = quoteId;
32
- this.fiatAmount = fiatAmount;
33
- this.fiatCurrency = fiatCurrency;
34
- this.tokenAmount = tokenAmount;
35
- this.token = token;
36
- this.fees = fees;
37
- }
38
- /**
39
- * Executes the quote to perform the actual fund transfer.
40
- *
41
- * @returns A promise that resolves to the result of the executed quote.
42
- */
43
- async execute() {
44
- const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
45
- return {
46
- id: transfer.id,
47
- network: transfer.target.network,
48
- targetAmount: transfer.targetAmount,
49
- targetCurrency: transfer.targetCurrency,
50
- status: transfer.status,
51
- transactionHash: transfer.transactionHash,
52
- };
53
- }
54
- }
55
- /**
56
- * A class representing an EVM funding quote that can be executed.
57
- */
58
- export class EvmQuote extends BaseQuote {
59
- /** Network to transfer the funds to (EVM networks). */
60
- network;
61
- /**
62
- * Creates a new EvmQuote instance.
63
- *
64
- * @param apiClient - The API client.
65
- * @param quoteId - The quote ID.
66
- * @param network - The EVM network to transfer funds to.
67
- * @param fiatAmount - The amount in fiat currency.
68
- * @param fiatCurrency - The fiat currency.
69
- * @param tokenAmount - The amount in the token to transfer.
70
- * @param token - The token to transfer.
71
- * @param fees - Fees for the transfer.
72
- */
73
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
74
- super(apiClient, quoteId, fiatAmount, fiatCurrency, tokenAmount, token, fees);
75
- this.network = network;
76
- }
77
- }
78
- /**
79
- * A class representing a Solana funding quote that can be executed.
80
- */
81
- export class SolanaQuote extends BaseQuote {
82
- /** Network to transfer the funds to (Solana). */
83
- network;
84
- /**
85
- * Creates a new SolanaQuote instance.
86
- *
87
- * @param apiClient - The API client.
88
- * @param quoteId - The quote ID.
89
- * @param network - The Solana network to transfer funds to.
90
- * @param fiatAmount - The amount in fiat currency.
91
- * @param fiatCurrency - The fiat currency.
92
- * @param tokenAmount - The amount in the token to transfer.
93
- * @param token - The token to transfer.
94
- * @param fees - Fees for the transfer.
95
- */
96
- constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
97
- super(apiClient, quoteId, fiatAmount, fiatCurrency, tokenAmount, token, fees);
98
- this.network = network;
99
- }
100
- }
101
- //# sourceMappingURL=Quote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../actions/Quote.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAe,SAAS;IACtB,8BAA8B;IACvB,OAAO,CAAS;IACvB,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA6B;IACtB,KAAK,CAAS;IACrB,qCAAqC;IAC9B,IAAI,CAKP;IAEM,SAAS,CAAuB;IAE1C;;;;;;;;;;OAUG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,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,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;AAED;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IACrC,uDAAuD;IAChD,OAAO,CAAsB;IAEpC;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAA4B,EAC5B,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,iDAAiD;IAC1C,OAAO,CAAW;IAEzB;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAAiB,EACjB,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAC9E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
@@ -1,48 +0,0 @@
1
- import { formatUnits } from "viem";
2
- import { UserInputValidationError } from "../../../errors.js";
3
- import { CreatePaymentTransferQuoteBodySourceType, CreatePaymentTransferQuoteBodyTargetType, } from "../../../openapi-client/index.js";
4
- /**
5
- * Funds an EVM account.
6
- *
7
- * @deprecated This method will be removed in a future version. Consider using our Onramp API instead. See https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/create-an-onramp-order.
8
- * @param apiClient - The API client.
9
- * @param options - The options for funding an EVM account.
10
- *
11
- * @returns A promise that resolves to the fund operation result.
12
- */
13
- export async function fund(apiClient, options) {
14
- if (options.token !== "eth" && options.token !== "usdc") {
15
- throw new UserInputValidationError("Invalid token, must be eth or usdc");
16
- }
17
- const decimals = options.token === "eth" ? 18 : 6;
18
- const amount = formatUnits(options.amount, decimals);
19
- const paymentMethods = await apiClient.getPaymentMethods();
20
- const cardPaymentMethod = paymentMethods.find(method => method.type === "card" && method.actions.includes("source"));
21
- if (!cardPaymentMethod) {
22
- throw new Error("No card found to fund account");
23
- }
24
- const response = await apiClient.createPaymentTransferQuote({
25
- sourceType: CreatePaymentTransferQuoteBodySourceType.payment_method,
26
- source: {
27
- id: cardPaymentMethod.id,
28
- },
29
- targetType: CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
30
- target: {
31
- currency: options.token,
32
- network: options.network,
33
- address: options.address,
34
- },
35
- amount,
36
- currency: options.token,
37
- execute: true,
38
- });
39
- return {
40
- id: response.transfer.id,
41
- network: response.transfer.target.network,
42
- status: response.transfer.status,
43
- targetAmount: response.transfer.targetAmount,
44
- targetCurrency: response.transfer.targetCurrency,
45
- transactionHash: response.transfer.transactionHash,
46
- };
47
- }
48
- //# sourceMappingURL=fund.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fund.js","sourceRoot":"","sources":["../../../../actions/evm/fund/fund.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EACL,wCAAwC,EACxC,wCAAwC,GAEzC,MAAM,kCAAkC,CAAC;AAa1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,SAA+B,EAC/B,OAAuB;IAEvB,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACxD,MAAM,IAAI,wBAAwB,CAAC,oCAAoC,CAAC,CAAC;IA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