@coinbase/cdp-sdk 1.4.0 → 1.6.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 (121) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +123 -2
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +26 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +35 -2
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/actions/evm/listTokenBalances.js +33 -0
  8. package/_cjs/actions/evm/listTokenBalances.js.map +1 -0
  9. package/_cjs/actions/evm/requestFaucet.js +18 -0
  10. package/_cjs/actions/evm/requestFaucet.js.map +1 -0
  11. package/_cjs/actions/evm/sendTransaction.js +29 -0
  12. package/_cjs/actions/evm/sendTransaction.js.map +1 -0
  13. package/_cjs/actions/evm/sendUserOperation.js +5 -6
  14. package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
  15. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +72 -0
  16. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -0
  17. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +67 -0
  18. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -0
  19. package/_cjs/actions/evm/transfer/transfer.js +59 -0
  20. package/_cjs/actions/evm/transfer/transfer.js.map +1 -0
  21. package/_cjs/actions/evm/transfer/types.js +3 -0
  22. package/_cjs/actions/evm/transfer/types.js.map +1 -0
  23. package/_cjs/actions/evm/transfer/utils.js +39 -0
  24. package/_cjs/actions/evm/transfer/utils.js.map +1 -0
  25. package/_cjs/actions/evm/types.js +3 -0
  26. package/_cjs/actions/evm/types.js.map +1 -0
  27. package/_cjs/client/evm/evm.js +52 -42
  28. package/_cjs/client/evm/evm.js.map +1 -1
  29. package/_cjs/client/solana/solana.js +42 -0
  30. package/_cjs/client/solana/solana.js.map +1 -1
  31. package/_cjs/utils/serializeTransaction.js +18 -0
  32. package/_cjs/utils/serializeTransaction.js.map +1 -0
  33. package/_cjs/version.js +1 -1
  34. package/_esm/accounts/evm/toEvmServerAccount.js +26 -0
  35. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  36. package/_esm/accounts/evm/toEvmSmartAccount.js +35 -2
  37. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  38. package/_esm/actions/evm/listTokenBalances.js +30 -0
  39. package/_esm/actions/evm/listTokenBalances.js.map +1 -0
  40. package/_esm/actions/evm/requestFaucet.js +15 -0
  41. package/_esm/actions/evm/requestFaucet.js.map +1 -0
  42. package/_esm/actions/evm/sendTransaction.js +26 -0
  43. package/_esm/actions/evm/sendTransaction.js.map +1 -0
  44. package/_esm/actions/evm/sendUserOperation.js +5 -6
  45. package/_esm/actions/evm/sendUserOperation.js.map +1 -1
  46. package/_esm/actions/evm/transfer/accountTransferStrategy.js +69 -0
  47. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -0
  48. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +64 -0
  49. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -0
  50. package/_esm/actions/evm/transfer/transfer.js +56 -0
  51. package/_esm/actions/evm/transfer/transfer.js.map +1 -0
  52. package/_esm/actions/evm/transfer/types.js +2 -0
  53. package/_esm/actions/evm/transfer/types.js.map +1 -0
  54. package/_esm/actions/evm/transfer/utils.js +35 -0
  55. package/_esm/actions/evm/transfer/utils.js.map +1 -0
  56. package/_esm/actions/evm/types.js +2 -0
  57. package/_esm/actions/evm/types.js.map +1 -0
  58. package/_esm/client/evm/evm.js +52 -42
  59. package/_esm/client/evm/evm.js.map +1 -1
  60. package/_esm/client/solana/solana.js +42 -0
  61. package/_esm/client/solana/solana.js.map +1 -1
  62. package/_esm/utils/serializeTransaction.js +15 -0
  63. package/_esm/utils/serializeTransaction.js.map +1 -0
  64. package/_esm/version.js +1 -1
  65. package/_types/accounts/evm/toEvmServerAccount.d.ts +2 -2
  66. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  67. package/_types/accounts/evm/toEvmSmartAccount.d.ts +4 -4
  68. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  69. package/_types/accounts/types.d.ts +4 -3
  70. package/_types/accounts/types.d.ts.map +1 -1
  71. package/_types/actions/evm/listTokenBalances.d.ts +76 -0
  72. package/_types/actions/evm/listTokenBalances.d.ts.map +1 -0
  73. package/_types/actions/evm/requestFaucet.d.ts +34 -0
  74. package/_types/actions/evm/requestFaucet.d.ts.map +1 -0
  75. package/_types/actions/evm/sendTransaction.d.ts +42 -0
  76. package/_types/actions/evm/sendTransaction.d.ts.map +1 -0
  77. package/_types/actions/evm/sendUserOperation.d.ts +3 -2
  78. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
  79. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +4 -0
  80. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -0
  81. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +4 -0
  82. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -0
  83. package/_types/actions/evm/transfer/transfer.d.ts +14 -0
  84. package/_types/actions/evm/transfer/transfer.d.ts.map +1 -0
  85. package/_types/actions/evm/transfer/types.d.ts +71 -0
  86. package/_types/actions/evm/transfer/types.d.ts.map +1 -0
  87. package/_types/actions/evm/transfer/utils.d.ts +631 -0
  88. package/_types/actions/evm/transfer/utils.d.ts.map +1 -0
  89. package/_types/actions/evm/types.d.ts +230 -0
  90. package/_types/actions/evm/types.d.ts.map +1 -0
  91. package/_types/client/evm/evm.d.ts +22 -3
  92. package/_types/client/evm/evm.d.ts.map +1 -1
  93. package/_types/client/evm/evm.types.d.ts +20 -137
  94. package/_types/client/evm/evm.types.d.ts.map +1 -1
  95. package/_types/client/solana/solana.d.ts +17 -1
  96. package/_types/client/solana/solana.d.ts.map +1 -1
  97. package/_types/client/solana/solana.types.d.ts +8 -0
  98. package/_types/client/solana/solana.types.d.ts.map +1 -1
  99. package/_types/utils/serializeTransaction.d.ts +9 -0
  100. package/_types/utils/serializeTransaction.d.ts.map +1 -0
  101. package/_types/version.d.ts +1 -1
  102. package/accounts/evm/toEvmServerAccount.ts +46 -6
  103. package/accounts/evm/toEvmSmartAccount.ts +68 -4
  104. package/accounts/types.ts +20 -16
  105. package/actions/evm/listTokenBalances.ts +107 -0
  106. package/actions/evm/requestFaucet.ts +46 -0
  107. package/actions/evm/sendTransaction.ts +73 -0
  108. package/actions/evm/sendUserOperation.ts +6 -6
  109. package/actions/evm/transfer/accountTransferStrategy.ts +84 -0
  110. package/actions/evm/transfer/smartAccountTransferStrategy.ts +72 -0
  111. package/actions/evm/transfer/transfer.ts +71 -0
  112. package/actions/evm/transfer/types.ts +81 -0
  113. package/actions/evm/transfer/utils.ts +39 -0
  114. package/actions/evm/types.ts +244 -0
  115. package/client/evm/evm.ts +70 -63
  116. package/client/evm/evm.types.ts +32 -149
  117. package/client/solana/solana.ts +43 -0
  118. package/client/solana/solana.types.ts +9 -0
  119. package/package.json +1 -1
  120. package/utils/serializeTransaction.ts +17 -0
  121. package/version.ts +1 -1
@@ -0,0 +1,76 @@
1
+ import { Address } from "viem";
2
+ import { CdpOpenApiClientType, ListEvmTokenBalancesNetwork } from "../../openapi-client/index.js";
3
+ /**
4
+ * A token on an EVM network, which is either an ERC-20 or a native token (i.e. ETH).
5
+ */
6
+ export interface EvmToken {
7
+ /**
8
+ * The contract address of the token. For Ether, the contract address is 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
9
+ * per EIP-7528. For ERC-20 tokens, this is the contract address where the token is deployed.
10
+ */
11
+ contractAddress: Address;
12
+ /** The network the token is on. */
13
+ network: ListEvmTokenBalancesNetwork;
14
+ /**
15
+ * The symbol of the token, which is optional and non-unique. Note: This field
16
+ * may not be present for most tokens while the API is still under development.
17
+ */
18
+ symbol?: string;
19
+ /**
20
+ * The name of the token, which is optional and non-unique. Note: This field
21
+ * may not be present for most tokens while the API is still under development.
22
+ */
23
+ name?: string;
24
+ }
25
+ /**
26
+ * A token amount on an EVM network.
27
+ */
28
+ export interface EvmTokenAmount {
29
+ /** The amount of the token in the smallest indivisible unit of the token. */
30
+ amount: bigint;
31
+ /** The number of decimals in the token. */
32
+ decimals: bigint;
33
+ }
34
+ /**
35
+ * An EVM token balance.
36
+ */
37
+ export interface EvmTokenBalance {
38
+ /** The token. */
39
+ token: EvmToken;
40
+ /** The amount of the token. */
41
+ amount: EvmTokenAmount;
42
+ }
43
+ /**
44
+ * Options for listing EVM token balances.
45
+ */
46
+ export interface ListTokenBalancesOptions {
47
+ /** The address of the account. */
48
+ address: Address;
49
+ /** The network. */
50
+ network: ListEvmTokenBalancesNetwork;
51
+ /** The page size to paginate through the token balances. */
52
+ pageSize?: number;
53
+ /** The page token to paginate through the token balances. */
54
+ pageToken?: string;
55
+ }
56
+ /**
57
+ * The result of listing EVM token balances.
58
+ */
59
+ export interface ListTokenBalancesResult {
60
+ /** The token balances. */
61
+ balances: EvmTokenBalance[];
62
+ /**
63
+ * The next page token to paginate through the token balances.
64
+ * If undefined, there are no more token balances to paginate through.
65
+ */
66
+ nextPageToken?: string;
67
+ }
68
+ /**
69
+ * List the token balances for an EVM account.
70
+ *
71
+ * @param client - The client to use to list the token balances.
72
+ * @param options - The options for listing the token balances.
73
+ * @returns The result of listing the token balances.
74
+ */
75
+ export declare function listTokenBalances(client: CdpOpenApiClientType, options: ListTokenBalancesOptions): Promise<ListTokenBalancesResult>;
76
+ //# sourceMappingURL=listTokenBalances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listTokenBalances.d.ts","sourceRoot":"","sources":["../../../actions/evm/listTokenBalances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB,mCAAmC;IACnC,OAAO,EAAE,2BAA2B,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,iBAAiB;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,+BAA+B;IAC/B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB;IACnB,OAAO,EAAE,2BAA2B,CAAC;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0BAA0B;IAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAuBlC"}
@@ -0,0 +1,34 @@
1
+ import { type CdpOpenApiClientType } from "../../openapi-client/index.js";
2
+ import { Hex } from "../../types/misc.js";
3
+ /**
4
+ * Options for requesting funds from an EVM faucet.
5
+ */
6
+ export interface RequestFaucetOptions {
7
+ /** The address of the account. */
8
+ address: string;
9
+ /** The network to request funds from. */
10
+ network: "base-sepolia" | "ethereum-sepolia";
11
+ /** The token to request funds for. */
12
+ token: "eth" | "usdc" | "eurc" | "cbbtc";
13
+ /** The idempotency key. */
14
+ idempotencyKey?: string;
15
+ }
16
+ /**
17
+ * The result of requesting funds from an EVM faucet.
18
+ */
19
+ export interface RequestFaucetResult {
20
+ /** The transaction hash. */
21
+ transactionHash: Hex;
22
+ }
23
+ /**
24
+ * Requests funds from an EVM faucet.
25
+ *
26
+ * @param apiClient - The API client.
27
+ * @param options - The options for requesting funds from the EVM faucet.
28
+ *
29
+ * @returns A promise that resolves to the transaction hash.
30
+ */
31
+ export declare function requestFaucet(apiClient: CdpOpenApiClientType, options: RequestFaucetOptions): Promise<{
32
+ transactionHash: Hex;
33
+ }>;
34
+ //# sourceMappingURL=requestFaucet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestFaucet.d.ts","sourceRoot":"","sources":["../../../actions/evm/requestFaucet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC7C,sCAAsC;IACtC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACzC,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4BAA4B;IAC5B,eAAe,EAAE,GAAG,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,oBAAoB;qBAQS,GAAG;GAE1C"}
@@ -0,0 +1,42 @@
1
+ import { TransactionRequestEIP1559 } from "viem";
2
+ import type { CdpOpenApiClientType, SendEvmTransactionBodyNetwork } from "../../openapi-client/index.js";
3
+ import type { Address, Hex } from "../../types/misc.js";
4
+ /**
5
+ * Options for sending an EVM transaction.
6
+ */
7
+ export interface SendTransactionOptions {
8
+ /** The address of the account. */
9
+ address: Address;
10
+ /**
11
+ * The transaction to send. The chainId is ignored in favor of the `network` field.
12
+ *
13
+ * This can be either:
14
+ * - An RLP-encoded transaction to sign and send, as a 0x-prefixed hex string, or
15
+ * - An EIP-1559 transaction request object.
16
+ */
17
+ transaction: Hex | TransactionRequestEIP1559;
18
+ /**
19
+ * The network to send the transaction to.
20
+ * The chainId in the `transaction` field is ignored in favor of this field.
21
+ */
22
+ network: SendEvmTransactionBodyNetwork;
23
+ /** The idempotency key. */
24
+ idempotencyKey?: string;
25
+ }
26
+ /**
27
+ * Result of a transaction
28
+ */
29
+ export interface TransactionResult {
30
+ /** The hash of the transaction. */
31
+ transactionHash: Hex;
32
+ }
33
+ /**
34
+ * Sends an EVM transaction.
35
+ *
36
+ * @param apiClient - The API client.
37
+ * @param options - The options for sending the transaction.
38
+ *
39
+ * @returns The result of the transaction.
40
+ */
41
+ export declare function sendTransaction(apiClient: CdpOpenApiClientType, options: SendTransactionOptions): Promise<TransactionResult>;
42
+ //# sourceMappingURL=sendTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendTransaction.d.ts","sourceRoot":"","sources":["../../../actions/evm/sendTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,yBAAyB,EAAE,MAAM,MAAM,CAAC;AAEvE,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,WAAW,EAAE,GAAG,GAAG,yBAAyB,CAAC;IAC7C;;;OAGG;IACH,OAAO,EAAE,6BAA6B,CAAC;IACvC,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,eAAe,EAAE,GAAG,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAsB5B"}
@@ -8,6 +8,8 @@ import type { Address, Hex } from "../../types/misc.js";
8
8
  * @template T - Array type for the calls parameter.
9
9
  */
10
10
  export type SendUserOperationOptions<T extends readonly unknown[]> = {
11
+ /** The smart account. */
12
+ smartAccount: EvmSmartAccount;
11
13
  /**
12
14
  * Array of contract calls to execute in the user operation.
13
15
  * Each call can either be:
@@ -87,9 +89,8 @@ export type SendUserOperationReturnType = {
87
89
  * ```
88
90
  *
89
91
  * @param {CdpOpenApiClientType} client - The client to use to send the user operation.
90
- * @param {EvmSmartAccount} smartAccount - The smart account to send the user operation from.
91
92
  * @param {SendUserOperationOptions<T>} options - The options for the user operation.
92
93
  * @returns {Promise<SendUserOperationReturnType>} The result of the user operation.
93
94
  */
94
- export declare function sendUserOperation<T extends readonly unknown[]>(client: CdpOpenApiClientType, smartAccount: EvmSmartAccount, options: SendUserOperationOptions<T>): Promise<SendUserOperationReturnType>;
95
+ export declare function sendUserOperation<T extends readonly unknown[]>(client: CdpOpenApiClientType, options: SendUserOperationOptions<T>): Promise<SendUserOperationReturnType>;
95
96
  //# sourceMappingURL=sendUserOperation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sendUserOperation.d.ts","sourceRoot":"","sources":["../../../actions/evm/sendUserOperation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,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,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAAI;IACnE,yBAAyB;IACzB,YAAY,EAAE,eAAe,CAAC;IAC9B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,uBAAuB,CAAC;IACjC,oGAAoG;IACpG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,uCAAuC;IACvC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,wCAAwC;IACxC,MAAM,EAAE,OAAO,sBAAsB,CAAC,SAAS,CAAC;IAChD,gIAAgI;IAChI,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAClE,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,2BAA2B,CAAC,CAuDtC"}
@@ -0,0 +1,4 @@
1
+ import { TransferExecutionStrategy } from "./types.js";
2
+ import { EvmAccount } from "../../../accounts/types.js";
3
+ export declare const accountTransferStrategy: TransferExecutionStrategy<EvmAccount>;
4
+ //# sourceMappingURL=accountTransferStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accountTransferStrategy.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/accountTransferStrategy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,eAAO,MAAM,uBAAuB,EAAE,yBAAyB,CAAC,UAAU,CAsEzE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { TransferExecutionStrategy } from "./types.js";
2
+ import { EvmSmartAccount } from "../../../accounts/types.js";
3
+ export declare const smartAccountTransferStrategy: TransferExecutionStrategy<EvmSmartAccount>;
4
+ //# sourceMappingURL=smartAccountTransferStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartAccountTransferStrategy.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/smartAccountTransferStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,eAAO,MAAM,4BAA4B,EAAE,yBAAyB,CAAC,eAAe,CA+DnF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { TransferResult, TransferOptions, TransferExecutionStrategy } from "./types.js";
2
+ import { EvmAccount, EvmSmartAccount } from "../../../accounts/types.js";
3
+ import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
4
+ /**
5
+ * Transfer an amount of a token from an account to another account.
6
+ *
7
+ * @param apiClient - The client to use to send the transaction.
8
+ * @param from - The account to send the transaction from.
9
+ * @param transferArgs - The options for the transfer.
10
+ * @param transferStrategy - The strategy to use to execute the transfer.
11
+ * @returns The result of the transfer.
12
+ */
13
+ export declare function transfer<T extends EvmAccount | EvmSmartAccount>(apiClient: CdpOpenApiClientType, from: T, transferArgs: TransferOptions, transferStrategy: TransferExecutionStrategy<T>): Promise<TransferResult>;
14
+ //# sourceMappingURL=transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/transfer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,UAAU,GAAG,eAAe,EACnE,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,CAAC,EACP,YAAY,EAAE,eAAe,EAC7B,gBAAgB,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC,CAiDzB"}
@@ -0,0 +1,71 @@
1
+ import { Hex, TransactionReceipt, Address, PublicClient, Chain, Transport } from "viem";
2
+ import { CdpOpenApiClientType, EvmAccount, EvmUserOperationNetwork, SendEvmTransactionBodyNetwork } from "../../../openapi-client/index.js";
3
+ /**
4
+ * The network to transfer the token on.
5
+ */
6
+ export type Network = SendEvmTransactionBodyNetwork | EvmUserOperationNetwork;
7
+ /**
8
+ * The options for the transfer.
9
+ */
10
+ export type TransferOptions = {
11
+ /** The account to transfer the token to. */
12
+ to: EvmAccount | Address;
13
+ /**
14
+ * The amount of the token to transfer.
15
+ * If a string is provided, it will be parsed into a bigint based on the token's decimals.
16
+ */
17
+ amount: bigint | string;
18
+ /** The token to transfer. Can be a contract address or a predefined token name. */
19
+ token: "eth" | "usdc" | Hex;
20
+ /** The network to transfer the token on. */
21
+ network: Network;
22
+ };
23
+ /**
24
+ * The result of the transfer.
25
+ */
26
+ export type TransferResult = {
27
+ /** The status of the transaction. */
28
+ status: TransactionReceipt["status"];
29
+ /** The transaction hash of the transfer. */
30
+ transactionHash: Hex;
31
+ };
32
+ /**
33
+ * A strategy for executing a transfer.
34
+ */
35
+ export interface TransferExecutionStrategy<T> {
36
+ /**
37
+ * Executes the transfer.
38
+ *
39
+ * @param args - The arguments for the transfer.
40
+ * @param args.apiClient - The API client to use for the transfer.
41
+ * @param args.from - The account to transfer the token from.
42
+ * @param args.transferArgs - The arguments for the transfer.
43
+ * @param args.to - The account to transfer the token to.
44
+ * @param args.value - The value of the transfer.
45
+ * @returns The transaction hash of the transfer.
46
+ */
47
+ executeTransfer(args: {
48
+ apiClient: CdpOpenApiClientType;
49
+ from: T;
50
+ transferArgs: TransferOptions;
51
+ to: Address;
52
+ value: bigint;
53
+ }): Promise<Hex>;
54
+ /**
55
+ * Waits for the result of the transfer.
56
+ *
57
+ * @param args - The arguments for the transfer.
58
+ * @param args.apiClient - The API client to use for the transfer.
59
+ * @param args.publicClient - The public client to use for the transfer.
60
+ * @param args.from - The account to transfer the token from.
61
+ * @param args.hash - The transaction hash of the transfer.
62
+ * @returns The result of the transfer.
63
+ */
64
+ waitForResult(args: {
65
+ apiClient: CdpOpenApiClientType;
66
+ publicClient: PublicClient<Transport, Chain>;
67
+ from: T;
68
+ hash: Hex;
69
+ }): Promise<TransferResult>;
70
+ }
71
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExF,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,6BAA6B,GAAG,uBAAuB,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,4CAA4C;IAC5C,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,mFAAmF;IACnF,KAAK,EAAE,KAAK,GA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