@coinbase/cdp-sdk 1.5.0 → 1.7.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 (191) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +101 -3
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +21 -0
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js +35 -0
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/{types.js.map → evm/types.js.map} +1 -1
  8. package/_cjs/accounts/solana/toSolanaAccount.js +41 -0
  9. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -0
  10. package/_cjs/accounts/solana/types.js +3 -0
  11. package/_cjs/accounts/solana/types.js.map +1 -0
  12. package/_cjs/actions/evm/getUserOperation.js +36 -0
  13. package/_cjs/actions/evm/getUserOperation.js.map +1 -0
  14. package/_cjs/actions/evm/listTokenBalances.js +33 -0
  15. package/_cjs/actions/evm/listTokenBalances.js.map +1 -0
  16. package/_cjs/actions/evm/requestFaucet.js +18 -0
  17. package/_cjs/actions/evm/requestFaucet.js.map +1 -0
  18. package/_cjs/actions/evm/sendTransaction.js +29 -0
  19. package/_cjs/actions/evm/sendTransaction.js.map +1 -0
  20. package/_cjs/actions/evm/sendUserOperation.js +5 -6
  21. package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
  22. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +11 -7
  23. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  24. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +13 -8
  25. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  26. package/_cjs/actions/evm/transfer/transfer.js +7 -3
  27. package/_cjs/actions/evm/transfer/transfer.js.map +1 -1
  28. package/_cjs/actions/solana/requestFaucet.js +29 -0
  29. package/_cjs/actions/solana/requestFaucet.js.map +1 -0
  30. package/_cjs/actions/solana/signMessage.js +29 -0
  31. package/_cjs/actions/solana/signMessage.js.map +1 -0
  32. package/_cjs/actions/solana/signTransaction.js +46 -0
  33. package/_cjs/actions/solana/signTransaction.js.map +1 -0
  34. package/_cjs/actions/solana/types.js +3 -0
  35. package/_cjs/actions/solana/types.js.map +1 -0
  36. package/_cjs/client/evm/evm.js +10 -52
  37. package/_cjs/client/evm/evm.js.map +1 -1
  38. package/_cjs/client/solana/solana.js +22 -17
  39. package/_cjs/client/solana/solana.js.map +1 -1
  40. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +59 -1
  41. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  42. package/_cjs/openapi-client/generated/index.msw.js +3 -2
  43. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  44. package/_cjs/openapi-client/generated/policy-engine/policy-engine.js +56 -0
  45. package/_cjs/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
  46. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +284 -0
  47. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
  48. package/_cjs/openapi-client/index.js +1 -0
  49. package/_cjs/openapi-client/index.js.map +1 -1
  50. package/_cjs/version.js +1 -1
  51. package/_esm/accounts/evm/toEvmServerAccount.js +21 -0
  52. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  53. package/_esm/accounts/evm/toEvmSmartAccount.js +35 -0
  54. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  55. package/_esm/accounts/{types.js.map → evm/types.js.map} +1 -1
  56. package/_esm/accounts/solana/toSolanaAccount.js +38 -0
  57. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -0
  58. package/_esm/accounts/solana/types.js +2 -0
  59. package/_esm/accounts/solana/types.js.map +1 -0
  60. package/_esm/actions/evm/getUserOperation.js +33 -0
  61. package/_esm/actions/evm/getUserOperation.js.map +1 -0
  62. package/_esm/actions/evm/listTokenBalances.js +30 -0
  63. package/_esm/actions/evm/listTokenBalances.js.map +1 -0
  64. package/_esm/actions/evm/requestFaucet.js +15 -0
  65. package/_esm/actions/evm/requestFaucet.js.map +1 -0
  66. package/_esm/actions/evm/sendTransaction.js +26 -0
  67. package/_esm/actions/evm/sendTransaction.js.map +1 -0
  68. package/_esm/actions/evm/sendUserOperation.js +5 -6
  69. package/_esm/actions/evm/sendUserOperation.js.map +1 -1
  70. package/_esm/actions/evm/transfer/accountTransferStrategy.js +11 -7
  71. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  72. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +13 -8
  73. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  74. package/_esm/actions/evm/transfer/transfer.js +7 -3
  75. package/_esm/actions/evm/transfer/transfer.js.map +1 -1
  76. package/_esm/actions/solana/requestFaucet.js +26 -0
  77. package/_esm/actions/solana/requestFaucet.js.map +1 -0
  78. package/_esm/actions/solana/signMessage.js +26 -0
  79. package/_esm/actions/solana/signMessage.js.map +1 -0
  80. package/_esm/actions/solana/signTransaction.js +43 -0
  81. package/_esm/actions/solana/signTransaction.js.map +1 -0
  82. package/_esm/actions/solana/types.js +2 -0
  83. package/_esm/actions/solana/types.js.map +1 -0
  84. package/_esm/client/evm/evm.js +10 -52
  85. package/_esm/client/evm/evm.js.map +1 -1
  86. package/_esm/client/solana/solana.js +22 -17
  87. package/_esm/client/solana/solana.js.map +1 -1
  88. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +58 -0
  89. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  90. package/_esm/openapi-client/generated/index.msw.js +3 -2
  91. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  92. package/_esm/openapi-client/generated/policy-engine/policy-engine.js +48 -0
  93. package/_esm/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
  94. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +259 -0
  95. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
  96. package/_esm/openapi-client/index.js +1 -0
  97. package/_esm/openapi-client/index.js.map +1 -1
  98. package/_esm/version.js +1 -1
  99. package/_types/accounts/evm/toEvmServerAccount.d.ts +1 -1
  100. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  101. package/_types/accounts/evm/toEvmSmartAccount.d.ts +1 -1
  102. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  103. package/_types/accounts/{types.d.ts → evm/types.d.ts} +5 -5
  104. package/_types/accounts/evm/types.d.ts.map +1 -0
  105. package/_types/accounts/solana/toSolanaAccount.d.ts +20 -0
  106. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -0
  107. package/_types/accounts/solana/types.d.ts +12 -0
  108. package/_types/accounts/solana/types.d.ts.map +1 -0
  109. package/_types/actions/evm/getUserOperation.d.ts +22 -0
  110. package/_types/actions/evm/getUserOperation.d.ts.map +1 -0
  111. package/_types/actions/evm/listTokenBalances.d.ts +76 -0
  112. package/_types/actions/evm/listTokenBalances.d.ts.map +1 -0
  113. package/_types/actions/evm/requestFaucet.d.ts +34 -0
  114. package/_types/actions/evm/requestFaucet.d.ts.map +1 -0
  115. package/_types/actions/evm/sendTransaction.d.ts +42 -0
  116. package/_types/actions/evm/sendTransaction.d.ts.map +1 -0
  117. package/_types/actions/evm/sendUserOperation.d.ts +4 -3
  118. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
  119. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +1 -1
  120. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
  121. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +1 -1
  122. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
  123. package/_types/actions/evm/transfer/transfer.d.ts +3 -3
  124. package/_types/actions/evm/transfer/transfer.d.ts.map +1 -1
  125. package/_types/actions/evm/transfer/types.d.ts +41 -7
  126. package/_types/actions/evm/transfer/types.d.ts.map +1 -1
  127. package/_types/actions/evm/types.d.ts +168 -3
  128. package/_types/actions/evm/types.d.ts.map +1 -1
  129. package/_types/actions/solana/requestFaucet.d.ts +23 -0
  130. package/_types/actions/solana/requestFaucet.d.ts.map +1 -0
  131. package/_types/actions/solana/signMessage.d.ts +23 -0
  132. package/_types/actions/solana/signMessage.d.ts.map +1 -0
  133. package/_types/actions/solana/signTransaction.d.ts +38 -0
  134. package/_types/actions/solana/signTransaction.d.ts.map +1 -0
  135. package/_types/actions/solana/types.d.ts +80 -0
  136. package/_types/actions/solana/types.d.ts.map +1 -0
  137. package/_types/client/evm/evm.d.ts +6 -3
  138. package/_types/client/evm/evm.d.ts.map +1 -1
  139. package/_types/client/evm/evm.types.d.ts +12 -138
  140. package/_types/client/evm/evm.types.d.ts.map +1 -1
  141. package/_types/client/solana/solana.d.ts +5 -4
  142. package/_types/client/solana/solana.d.ts.map +1 -1
  143. package/_types/client/solana/solana.types.d.ts +8 -11
  144. package/_types/client/solana/solana.types.d.ts.map +1 -1
  145. package/_types/index.d.ts +1 -1
  146. package/_types/index.d.ts.map +1 -1
  147. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +218 -0
  148. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  149. package/_types/openapi-client/generated/index.msw.d.ts +3 -2
  150. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  151. package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts +43 -0
  152. package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts.map +1 -0
  153. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +25 -0
  154. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -0
  155. package/_types/openapi-client/index.d.ts +1 -0
  156. package/_types/openapi-client/index.d.ts.map +1 -1
  157. package/_types/version.d.ts +1 -1
  158. package/accounts/evm/toEvmServerAccount.ts +35 -1
  159. package/accounts/evm/toEvmSmartAccount.ts +63 -1
  160. package/accounts/{types.ts → evm/types.ts} +5 -5
  161. package/accounts/solana/toSolanaAccount.ts +59 -0
  162. package/accounts/solana/types.ts +13 -0
  163. package/actions/evm/getUserOperation.ts +40 -0
  164. package/actions/evm/listTokenBalances.ts +107 -0
  165. package/actions/evm/requestFaucet.ts +46 -0
  166. package/actions/evm/sendTransaction.ts +73 -0
  167. package/actions/evm/sendUserOperation.ts +7 -7
  168. package/actions/evm/transfer/accountTransferStrategy.ts +12 -8
  169. package/actions/evm/transfer/smartAccountTransferStrategy.ts +14 -9
  170. package/actions/evm/transfer/transfer.ts +17 -6
  171. package/actions/evm/transfer/types.ts +55 -12
  172. package/actions/evm/types.ts +191 -3
  173. package/actions/solana/requestFaucet.ts +35 -0
  174. package/actions/solana/signMessage.ts +36 -0
  175. package/actions/solana/signTransaction.ts +53 -0
  176. package/actions/solana/types.ts +87 -0
  177. package/client/evm/evm.ts +28 -77
  178. package/client/evm/evm.types.ts +25 -151
  179. package/client/solana/solana.ts +32 -37
  180. package/client/solana/solana.types.ts +10 -15
  181. package/index.ts +1 -1
  182. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +274 -0
  183. package/openapi-client/generated/index.msw.ts +3 -2
  184. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +404 -0
  185. package/openapi-client/generated/policy-engine/policy-engine.ts +95 -0
  186. package/openapi-client/index.ts +1 -0
  187. package/package.json +1 -1
  188. package/version.ts +1 -1
  189. package/_types/accounts/types.d.ts.map +0 -1
  190. /package/_cjs/accounts/{types.js → evm/types.js} +0 -0
  191. /package/_esm/accounts/{types.js → evm/types.js} +0 -0
@@ -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"}
@@ -1,5 +1,5 @@
1
1
  import { EvmUserOperationNetwork, EvmUserOperationStatus, CdpOpenApiClientType } from "../../openapi-client/index.js";
2
- import type { EvmSmartAccount } from "../../accounts/types.js";
2
+ import type { EvmSmartAccount } from "../../accounts/evm/types.js";
3
3
  import type { Calls } from "../../types/calls.js";
4
4
  import type { Address, Hex } from "../../types/misc.js";
5
5
  /**
@@ -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,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,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;;;;;;;;;;;;;;;;;;;;;;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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,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"}
@@ -1,4 +1,4 @@
1
1
  import { TransferExecutionStrategy } from "./types.js";
2
- import { EvmAccount } from "../../../accounts/types.js";
2
+ import { EvmAccount } from "../../../accounts/evm/types.js";
3
3
  export declare const accountTransferStrategy: TransferExecutionStrategy<EvmAccount>;
4
4
  //# sourceMappingURL=accountTransferStrategy.d.ts.map
@@ -1 +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"}
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,gCAAgC,CAAC;AAG5D,eAAO,MAAM,uBAAuB,EAAE,yBAAyB,CAAC,UAAU,CA0EzE,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { TransferExecutionStrategy } from "./types.js";
2
- import { EvmSmartAccount } from "../../../accounts/types.js";
2
+ import { EvmSmartAccount } from "../../../accounts/evm/types.js";
3
3
  export declare const smartAccountTransferStrategy: TransferExecutionStrategy<EvmSmartAccount>;
4
4
  //# sourceMappingURL=smartAccountTransferStrategy.d.ts.map
@@ -1 +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,CA6DnF,CAAC"}
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,gCAAgC,CAAC;AAIjE,eAAO,MAAM,4BAA4B,EAAE,yBAAyB,CAAC,eAAe,CAkEnF,CAAC"}
@@ -1,6 +1,6 @@
1
- import { TransferResult, TransferOptions, TransferExecutionStrategy } from "./types.js";
2
- import { EvmAccount, EvmSmartAccount } from "../../../accounts/types.js";
1
+ import { EvmAccount, EvmSmartAccount } from "../../../accounts/evm/types.js";
3
2
  import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
3
+ import type { TransferResult, TransferExecutionStrategy, SmartAccountTransferOptions, AccountTransferOptions } from "./types.js";
4
4
  /**
5
5
  * Transfer an amount of a token from an account to another account.
6
6
  *
@@ -10,5 +10,5 @@ import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
10
10
  * @param transferStrategy - The strategy to use to execute the transfer.
11
11
  * @returns The result of the transfer.
12
12
  */
13
- export declare function transfer<T extends EvmAccount | EvmSmartAccount>(apiClient: CdpOpenApiClientType, from: T, transferArgs: TransferOptions, transferStrategy: TransferExecutionStrategy<T>): Promise<TransferResult>;
13
+ export declare function transfer<T extends EvmAccount | EvmSmartAccount>(apiClient: CdpOpenApiClientType, from: T, transferArgs: T extends EvmSmartAccount ? SmartAccountTransferOptions : AccountTransferOptions, transferStrategy: TransferExecutionStrategy<T>): Promise<TransferResult>;
14
14
  //# sourceMappingURL=transfer.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/transfer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EACV,cAAc,EACd,yBAAyB,EACzB,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,UAAU,GAAG,eAAe,EACnE,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,CAAC,EACP,YAAY,EAAE,CAAC,SAAS,eAAe,GAAG,2BAA2B,GAAG,sBAAsB,EAC9F,gBAAgB,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC,CAsDzB"}
@@ -1,5 +1,7 @@
1
- import { Hex, TransactionReceipt, Address, PublicClient, Chain, Transport } from "viem";
2
- import { CdpOpenApiClientType, EvmAccount, EvmUserOperationNetwork, SendEvmTransactionBodyNetwork } from "../../../openapi-client/index.js";
1
+ import { Hex, TransactionReceipt, Address, PublicClient, Chain, Transport, WaitForTransactionReceiptParameters } from "viem";
2
+ import { CdpOpenApiClientType, EvmUserOperationNetwork, SendEvmTransactionBodyNetwork } from "../../../openapi-client/index.js";
3
+ import type { EvmAccount, EvmSmartAccount } from "../../../accounts/evm/types.js";
4
+ import type { WaitForUserOperationOptions } from "../waitForUserOperation.js";
3
5
  /**
4
6
  * The network to transfer the token on.
5
7
  */
@@ -7,7 +9,7 @@ export type Network = SendEvmTransactionBodyNetwork | EvmUserOperationNetwork;
7
9
  /**
8
10
  * The options for the transfer.
9
11
  */
10
- export type TransferOptions = {
12
+ type TransferOptions = {
11
13
  /** The account to transfer the token to. */
12
14
  to: EvmAccount | Address;
13
15
  /**
@@ -20,6 +22,31 @@ export type TransferOptions = {
20
22
  /** The network to transfer the token on. */
21
23
  network: Network;
22
24
  };
25
+ /**
26
+ * The options for the transfer using an account.
27
+ */
28
+ export type AccountTransferOptions = TransferOptions & {
29
+ /** The options for waiting for the result of the transfer. */
30
+ waitOptions?: {
31
+ /**
32
+ * Polling frequency (in seconds). Defaults to 4 seconds.
33
+ */
34
+ intervalSeconds?: WaitForTransactionReceiptParameters["pollingInterval"];
35
+ /**
36
+ * Optional timeout (in seconds) to wait before stopping polling. Defaults to 180 seconds.
37
+ */
38
+ timeoutSeconds?: WaitForTransactionReceiptParameters["timeout"];
39
+ };
40
+ };
41
+ /**
42
+ * The options for the transfer using a smart account.
43
+ */
44
+ export type SmartAccountTransferOptions = TransferOptions & {
45
+ /** The paymaster URL to use for the transfer. */
46
+ paymasterUrl?: string;
47
+ /** The options for waiting for the result of the transfer. */
48
+ waitOptions?: WaitForUserOperationOptions["waitOptions"];
49
+ };
23
50
  /**
24
51
  * The result of the transfer.
25
52
  */
@@ -32,25 +59,29 @@ export type TransferResult = {
32
59
  /**
33
60
  * A strategy for executing a transfer.
34
61
  */
35
- export interface TransferExecutionStrategy<T> {
62
+ export interface TransferExecutionStrategy<T extends EvmAccount | EvmSmartAccount> {
36
63
  /**
37
64
  * Executes the transfer.
38
65
  *
39
66
  * @param args - The arguments for the transfer.
40
67
  * @param args.apiClient - The API client to use for the transfer.
41
68
  * @param args.from - The account to transfer the token from.
42
- * @param args.transferArgs - The arguments for the transfer.
43
69
  * @param args.to - The account to transfer the token to.
44
70
  * @param args.value - The value of the transfer.
71
+ * @param args.token - The token to transfer.
72
+ * @param args.network - The network to transfer the token on.
45
73
  * @returns The transaction hash of the transfer.
46
74
  */
47
75
  executeTransfer(args: {
48
76
  apiClient: CdpOpenApiClientType;
49
77
  from: T;
50
- transferArgs: TransferOptions;
51
78
  to: Address;
52
79
  value: bigint;
53
- }): Promise<Hex>;
80
+ token: TransferOptions["token"];
81
+ network: TransferOptions["network"];
82
+ } & (T extends EvmSmartAccount ? {
83
+ paymasterUrl?: string;
84
+ } : object)): Promise<Hex>;
54
85
  /**
55
86
  * Waits for the result of the transfer.
56
87
  *
@@ -59,6 +90,7 @@ export interface TransferExecutionStrategy<T> {
59
90
  * @param args.publicClient - The public client to use for the transfer.
60
91
  * @param args.from - The account to transfer the token from.
61
92
  * @param args.hash - The transaction hash of the transfer.
93
+ * @param args.waitOptions - The options for waiting for the result of the transfer.
62
94
  * @returns The result of the transfer.
63
95
  */
64
96
  waitForResult(args: {
@@ -66,6 +98,8 @@ export interface TransferExecutionStrategy<T> {
66
98
  publicClient: PublicClient<Transport, Chain>;
67
99
  from: T;
68
100
  hash: Hex;
101
+ waitOptions?: WaitForUserOperationOptions["waitOptions"];
69
102
  }): Promise<TransferResult>;
70
103
  }
104
+ export {};
71
105
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../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W,CAAC,EAAE,2BAA2B,CAAC,aAAa,CAAC,CAAC;CAC1D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,qCAAqC;IACrC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrC,4CAA4C;IAC5C,eAAe,EAAE,GAAG,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,UAAU,GAAG,eAAe;IAC/E;;;;;;;;;;;OAWG;IACH,eAAe,CACb,IAAI,EAAE;QACJ,SAAS,EAAE,oBAAoB,CAAC;QAChC,IAAI,EAAE,CAAC,CAAC;QACR,EAAE,EAAE,OAAO,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;KACrC,GAAG,CAAC,CAAC,SAAS,eAAe,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,GACnE,OAAO,CAAC,GAAG,CAAC,CAAC;IAEhB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,oBAAoB,CAAC;QAChC,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC;QACR,IAAI,EAAE,GAAG,CAAC;QACV,WAAW,CAAC,EAAE,2BAA2B,CAAC,aAAa,CAAC,CAAC;KAC1D,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7B"}
@@ -1,5 +1,12 @@
1
- import { TransferOptions, TransferResult } from "./transfer/types.js";
2
- export type Actions = {
1
+ import { SendUserOperationOptions, SendUserOperationReturnType } from "./sendUserOperation.js";
2
+ import { GetUserOperationOptions, UserOperation } from "../../client/evm/evm.types.js";
3
+ import { EvmAccount, EvmSmartAccount } from "../../openapi-client/index.js";
4
+ import type { ListTokenBalancesOptions, ListTokenBalancesResult } from "./listTokenBalances.js";
5
+ import type { RequestFaucetOptions, RequestFaucetResult } from "./requestFaucet.js";
6
+ import type { SendTransactionOptions, TransactionResult } from "./sendTransaction.js";
7
+ import type { AccountTransferOptions, SmartAccountTransferOptions, TransferResult } from "./transfer/types.js";
8
+ import type { WaitForUserOperationOptions, WaitForUserOperationReturnType } from "./waitForUserOperation.js";
9
+ type Actions<T extends EvmAccount | EvmSmartAccount> = {
3
10
  /**
4
11
  * Transfer an amount of a token from an account to another account.
5
12
  *
@@ -83,6 +90,164 @@ export type Actions = {
83
90
  * });
84
91
  * ```
85
92
  */
86
- transfer: (options: TransferOptions) => Promise<TransferResult>;
93
+ transfer: (options: T extends EvmSmartAccount ? SmartAccountTransferOptions : AccountTransferOptions) => Promise<TransferResult>;
94
+ /**
95
+ * List the token balances of an account.
96
+ *
97
+ * @param options - The options for the list token balances.
98
+ * @param options.network - The network to list the token balances on.
99
+ *
100
+ * @returns The result of the list token balances.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const balances = await account.listTokenBalances({
105
+ * network: "base-sepolia",
106
+ * });
107
+ * ```
108
+ */
109
+ listTokenBalances: (options: Omit<ListTokenBalancesOptions, "address">) => Promise<ListTokenBalancesResult>;
110
+ /**
111
+ * Requests funds from an EVM faucet.
112
+ *
113
+ * @param {RequestFaucetOptions} options - Parameters for requesting funds from the EVM faucet.
114
+ * @param {string} options.network - The network to request funds from.
115
+ * @param {string} options.token - The token to request funds for.
116
+ * @param {string} [options.idempotencyKey] - An idempotency key.
117
+ *
118
+ * @returns A promise that resolves to the transaction hash.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const result = await account.requestFaucet({
123
+ * network: "base-sepolia",
124
+ * token: "eth",
125
+ * });
126
+ * ```
127
+ */
128
+ requestFaucet: (options: Omit<RequestFaucetOptions, "address">) => Promise<RequestFaucetResult>;
129
+ };
130
+ export type AccountActions = Actions<EvmAccount> & {
131
+ /**
132
+ * Signs an EVM transaction and sends it to the specified network using the Coinbase API.
133
+ * This method handles nonce management and gas estimation automatically.
134
+ *
135
+ * @param {SendTransactionOptions} options - Configuration options for sending the transaction.
136
+ * @returns A promise that resolves to the transaction hash.
137
+ *
138
+ * @example
139
+ * **Sending an RLP-encoded transaction**
140
+ * ```ts
141
+ * import { parseEther, serializeTransaction } from "viem";
142
+ * import { baseSepolia } from "viem/chains";
143
+ *
144
+ * const { transactionHash } = await account.sendTransaction({
145
+ * transaction: serializeTransaction({
146
+ * to: "0x4252e0c9A3da5A2700e7d91cb50aEf522D0C6Fe8",
147
+ * value: parseEther("0.000001"),
148
+ * chainId: baseSepolia.id,
149
+ * // Fields below are optional, CDP API will populate them if omitted.
150
+ * // nonce
151
+ * // maxPriorityFeePerGas
152
+ * // maxFeePerGas
153
+ * // gas
154
+ * }),
155
+ * network: "base-sepolia",
156
+ * });
157
+ * ```
158
+ * @example
159
+ * **Sending an EIP-1559 transaction request object**
160
+ * ```ts
161
+ * const { transactionHash } = await account.sendTransaction({
162
+ * transaction: {
163
+ * to: "0x4252e0c9A3da5A2700e7d91cb50aEf522D0C6Fe8",
164
+ * value: parseEther("0.000001"),
165
+ * // Fields below are optional, CDP API will populate them if omitted.
166
+ * // nonce
167
+ * // maxPriorityFeePerGas
168
+ * // maxFeePerGas
169
+ * // gas
170
+ * },
171
+ * network: "base-sepolia",
172
+ * });
173
+ * ```
174
+ */
175
+ sendTransaction: (options: Omit<SendTransactionOptions, "address">) => Promise<TransactionResult>;
176
+ };
177
+ export type SmartAccountActions = Actions<EvmSmartAccount> & {
178
+ /**
179
+ * Sends a user operation.
180
+ *
181
+ * @param {SendUserOperationOptions} options - Parameters for sending the user operation.
182
+ * @param {string} options.network - The network to send the user operation on.
183
+ * @param {EvmCall[]} options.calls - The calls to include in the user operation.
184
+ * @param {string} [options.paymasterUrl] - The optional paymaster URL to use for the user operation.
185
+ * @param {string} [options.idempotencyKey] - An idempotency key.
186
+ *
187
+ * @returns A promise that resolves to an object containing the smart account address,
188
+ * the user operation hash, and the status of the user operation.
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * const userOp = await smartAccount.sendUserOperation({
193
+ * network: "base-sepolia",
194
+ * calls: [
195
+ * {
196
+ * to: "0x1234567890123456789012345678901234567890",
197
+ * value: parseEther("0.000001"),
198
+ * data: "0x",
199
+ * },
200
+ * ],
201
+ * });
202
+ * ```
203
+ */
204
+ sendUserOperation: (options: Omit<SendUserOperationOptions<unknown[]>, "smartAccount">) => Promise<SendUserOperationReturnType>;
205
+ /**
206
+ * Waits for a user operation to complete or fail.
207
+ *
208
+ * @param {WaitForUserOperationOptions} options - Parameters for waiting for the user operation.
209
+ * @param {string} options.userOpHash - The user operation hash.
210
+ * @param {WaitOptions} [options.waitOptions] - Optional parameters for the wait operation.
211
+ *
212
+ * @returns A promise that resolves to the transaction receipt.
213
+ *
214
+ * @example
215
+ * ```ts
216
+ * // Send a user operation and get the user operation hash
217
+ * const { userOpHash } = await smartAccount.sendUserOperation({
218
+ * network: "base-sepolia",
219
+ * calls: [
220
+ * {
221
+ * to: "0x0000000000000000000000000000000000000000",
222
+ * value: parseEther("0.000001"),
223
+ * data: "0x",
224
+ * },
225
+ * ],
226
+ * });
227
+ *
228
+ * // Wait for the user operation to complete or fail
229
+ * const result = await smartAccount.waitForUserOperation({
230
+ * userOpHash: userOp.userOpHash,
231
+ * });
232
+ * ```
233
+ */
234
+ waitForUserOperation: (options: Omit<WaitForUserOperationOptions, "smartAccountAddress">) => Promise<WaitForUserOperationReturnType>;
235
+ /**
236
+ * Gets a user operation by its hash.
237
+ *
238
+ * @param {GetUserOperationOptions} options - Parameters for getting the user operation.
239
+ * @param {string} options.userOpHash - The user operation hash.
240
+ *
241
+ * @returns A promise that resolves to the user operation.
242
+ *
243
+ * @example
244
+ * ```ts
245
+ * const userOp = await smartAccount.getUserOperation({
246
+ * userOpHash: "0x1234567890123456789012345678901234567890",
247
+ * });
248
+ * ```
249
+ */
250
+ getUserOperation: (options: Omit<GetUserOperationOptions, "smartAccount">) => Promise<UserOperation>;
87
251
  };
252
+ export {};
88
253
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../actions/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkFG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACjE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../actions/evm/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,2BAA2B,EAC3B,8BAA8B,EAC/B,MAAM,2BAA2B,CAAC;AAEnC,KAAK,OAAO,CAAC,CAAC,SAAS,UAAU,GAAG,eAAe,IAAI;IACrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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uB,EAAE,cAAc,CAAC,KACnD,OAAO,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { RequestFaucetOptions, SignatureResult } from "../../client/solana/solana.types.js";
2
+ import { CdpOpenApiClientType } from "../../openapi-client/index.js";
3
+ /**
4
+ * Requests funds from a Solana faucet.
5
+ *
6
+ * @param apiClient - The API client.
7
+ * @param {RequestFaucetOptions} options - Parameters for requesting funds from the Solana faucet.
8
+ * @param {string} options.address - The address to request funds for.
9
+ * @param {string} options.token - The token to request funds for.
10
+ * @param {string} [options.idempotencyKey] - An idempotency key.
11
+ *
12
+ * @returns A promise that resolves to the transaction signature.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const signature = await requestFaucet(cdp.solana, {
17
+ * address: "1234567890123456789012345678901234567890",
18
+ * token: "sol",
19
+ * });
20
+ * ```
21
+ */
22
+ export declare function requestFaucet(apiClient: CdpOpenApiClientType, options: RequestFaucetOptions): Promise<SignatureResult>;
23
+ //# sourceMappingURL=requestFaucet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestFaucet.d.ts","sourceRoot":"","sources":["../../../actions/solana/requestFaucet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAS1B"}
@@ -0,0 +1,23 @@
1
+ import { SignMessageOptions, SignatureResult } from "../../client/solana/solana.types.js";
2
+ import { CdpOpenApiClientType } from "../../openapi-client/index.js";
3
+ /**
4
+ * Sign a message.
5
+ *
6
+ * @param apiClient - The API client.
7
+ * @param {SignMessageOptions} options - Parameters for signing the message.
8
+ * @param {string} options.address - The address to sign the message for.
9
+ * @param {string} options.message - The message to sign.
10
+ * @param {string} [options.idempotencyKey] - An idempotency key.
11
+ *
12
+ * @returns A promise that resolves to the transaction signature.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const signature = await signMessage(cdp.solana, {
17
+ * address: "1234567890123456789012345678901234567890",
18
+ * message: "Hello, world!",
19
+ * });
20
+ * ```
21
+ */
22
+ export declare function signMessage(apiClient: CdpOpenApiClientType, options: SignMessageOptions): Promise<SignatureResult>;
23
+ //# sourceMappingURL=signMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../actions/solana/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAU1B"}
@@ -0,0 +1,38 @@
1
+ import { SignTransactionOptions, SignatureResult } from "../../client/solana/solana.types.js";
2
+ import { CdpOpenApiClientType } from "../../openapi-client/index.js";
3
+ /**
4
+ * Signs a transaction.
5
+ *
6
+ * @param apiClient - The API client.
7
+ * @param {SignTransactionOptions} options - Parameters for signing the transaction.
8
+ * @param {string} options.address - The address to sign the transaction for.
9
+ * @param {string} options.transaction - The transaction to sign.
10
+ * @param {string} [options.idempotencyKey] - An idempotency key.
11
+ *
12
+ * @returns A promise that resolves to the signature.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Create a Solana account
17
+ * const account = await cdp.solana.createAccount();
18
+ *
19
+ * // Add your transaction instructions here
20
+ * const transaction = new Transaction()
21
+ *
22
+ * // Make sure to set requireAllSignatures to false, since signing will be done through the API
23
+ * const serializedTransaction = transaction.serialize({
24
+ * requireAllSignatures: false,
25
+ * });
26
+ *
27
+ * // Base64 encode the serialized transaction
28
+ * const transaction = Buffer.from(serializedTransaction).toString("base64");
29
+ *
30
+ * // When you want to sign a transaction, you can do so by address and base64 encoded transaction
31
+ * const signature = await signTransaction(cdp.solana, {
32
+ * address: account.address,
33
+ * transaction,
34
+ * });
35
+ * ```
36
+ */
37
+ export declare function signTransaction(apiClient: CdpOpenApiClientType, options: SignTransactionOptions): Promise<SignatureResult>;
38
+ //# sourceMappingURL=signTransaction.d.ts.map