@coinbase/cdp-sdk 1.7.0 → 1.9.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 (226) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +326 -28
  3. package/_cjs/accounts/evm/toEvmServerAccount.js +4 -2
  4. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  5. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  6. package/_cjs/accounts/solana/toSolanaAccount.js +8 -0
  7. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
  8. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +30 -63
  9. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  10. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +39 -56
  11. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  12. package/_cjs/actions/evm/transfer/transfer.js +2 -39
  13. package/_cjs/actions/evm/transfer/transfer.js.map +1 -1
  14. package/_cjs/actions/evm/transfer/utils.js +0 -12
  15. package/_cjs/actions/evm/transfer/utils.js.map +1 -1
  16. package/_cjs/actions/solana/constants.js +9 -0
  17. package/_cjs/actions/solana/constants.js.map +1 -0
  18. package/_cjs/actions/solana/transfer.js +117 -0
  19. package/_cjs/actions/solana/transfer.js.map +1 -0
  20. package/_cjs/actions/solana/utils.js +66 -0
  21. package/_cjs/actions/solana/utils.js.map +1 -0
  22. package/_cjs/analytics.js +70 -8
  23. package/_cjs/analytics.js.map +1 -1
  24. package/_cjs/client/cdp.js +9 -3
  25. package/_cjs/client/cdp.js.map +1 -1
  26. package/_cjs/client/evm/evm.js +133 -15
  27. package/_cjs/client/evm/evm.js.map +1 -1
  28. package/_cjs/client/policies/index.js +6 -0
  29. package/_cjs/client/policies/index.js.map +1 -0
  30. package/_cjs/client/policies/policies.js +232 -0
  31. package/_cjs/client/policies/policies.js.map +1 -0
  32. package/_cjs/client/policies/policies.types.js +3 -0
  33. package/_cjs/client/policies/policies.types.js.map +1 -0
  34. package/_cjs/client/solana/solana.js +76 -19
  35. package/_cjs/client/solana/solana.js.map +1 -1
  36. package/_cjs/index.js +4 -1
  37. package/_cjs/index.js.map +1 -1
  38. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +35 -4
  39. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  40. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +27 -1
  41. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  42. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +56 -1
  43. package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  44. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
  45. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  46. package/_cjs/openapi-client/generated/index.msw.js +2 -2
  47. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  48. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +121 -36
  49. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  50. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +14 -1
  51. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  52. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +42 -1
  53. package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  54. package/_cjs/openapi-client/index.js +6 -1
  55. package/_cjs/openapi-client/index.js.map +1 -1
  56. package/_cjs/policies/schema.js +245 -0
  57. package/_cjs/policies/schema.js.map +1 -0
  58. package/_cjs/policies/types.js +3 -0
  59. package/_cjs/policies/types.js.map +1 -0
  60. package/_cjs/version.js +1 -1
  61. package/_esm/accounts/evm/toEvmServerAccount.js +4 -2
  62. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  63. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  64. package/_esm/accounts/solana/toSolanaAccount.js +8 -0
  65. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
  66. package/_esm/actions/evm/transfer/accountTransferStrategy.js +31 -64
  67. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  68. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +39 -56
  69. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  70. package/_esm/actions/evm/transfer/transfer.js +2 -39
  71. package/_esm/actions/evm/transfer/transfer.js.map +1 -1
  72. package/_esm/actions/evm/transfer/utils.js +0 -11
  73. package/_esm/actions/evm/transfer/utils.js.map +1 -1
  74. package/_esm/actions/solana/constants.js +6 -0
  75. package/_esm/actions/solana/constants.js.map +1 -0
  76. package/_esm/actions/solana/transfer.js +114 -0
  77. package/_esm/actions/solana/transfer.js.map +1 -0
  78. package/_esm/actions/solana/utils.js +61 -0
  79. package/_esm/actions/solana/utils.js.map +1 -0
  80. package/_esm/analytics.js +70 -7
  81. package/_esm/analytics.js.map +1 -1
  82. package/_esm/client/cdp.js +10 -4
  83. package/_esm/client/cdp.js.map +1 -1
  84. package/_esm/client/evm/evm.js +133 -15
  85. package/_esm/client/evm/evm.js.map +1 -1
  86. package/_esm/client/policies/index.js +2 -0
  87. package/_esm/client/policies/index.js.map +1 -0
  88. package/_esm/client/policies/policies.js +228 -0
  89. package/_esm/client/policies/policies.js.map +1 -0
  90. package/_esm/client/policies/policies.types.js +2 -0
  91. package/_esm/client/policies/policies.types.js.map +1 -0
  92. package/_esm/client/solana/solana.js +76 -19
  93. package/_esm/client/solana/solana.js.map +1 -1
  94. package/_esm/index.js +1 -0
  95. package/_esm/index.js.map +1 -1
  96. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +34 -3
  97. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  98. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +24 -0
  99. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
  100. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +51 -0
  101. package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
  102. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
  103. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  104. package/_esm/openapi-client/generated/index.msw.js +2 -2
  105. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  106. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +116 -35
  107. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
  108. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +12 -0
  109. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
  110. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +39 -0
  111. package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
  112. package/_esm/openapi-client/index.js +5 -0
  113. package/_esm/openapi-client/index.js.map +1 -1
  114. package/_esm/policies/schema.js +242 -0
  115. package/_esm/policies/schema.js.map +1 -0
  116. package/_esm/policies/types.js +2 -0
  117. package/_esm/policies/types.js.map +1 -0
  118. package/_esm/version.js +1 -1
  119. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  120. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  121. package/_types/accounts/evm/types.d.ts +6 -3
  122. package/_types/accounts/evm/types.d.ts.map +1 -1
  123. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
  124. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +2 -2
  125. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
  126. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +2 -2
  127. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
  128. package/_types/actions/evm/transfer/transfer.d.ts +6 -4
  129. package/_types/actions/evm/transfer/transfer.d.ts.map +1 -1
  130. package/_types/actions/evm/transfer/types.d.ts +8 -54
  131. package/_types/actions/evm/transfer/types.d.ts.map +1 -1
  132. package/_types/actions/evm/transfer/utils.d.ts +0 -619
  133. package/_types/actions/evm/transfer/utils.d.ts.map +1 -1
  134. package/_types/actions/evm/types.d.ts +140 -68
  135. package/_types/actions/evm/types.d.ts.map +1 -1
  136. package/_types/actions/solana/constants.d.ts +6 -0
  137. package/_types/actions/solana/constants.d.ts.map +1 -0
  138. package/_types/actions/solana/transfer.d.ts +36 -0
  139. package/_types/actions/solana/transfer.d.ts.map +1 -0
  140. package/_types/actions/solana/types.d.ts +27 -0
  141. package/_types/actions/solana/types.d.ts.map +1 -1
  142. package/_types/actions/solana/utils.d.ts +34 -0
  143. package/_types/actions/solana/utils.d.ts.map +1 -0
  144. package/_types/analytics.d.ts +14 -5
  145. package/_types/analytics.d.ts.map +1 -1
  146. package/_types/client/cdp.d.ts +3 -0
  147. package/_types/client/cdp.d.ts.map +1 -1
  148. package/_types/client/evm/evm.d.ts +89 -1
  149. package/_types/client/evm/evm.d.ts.map +1 -1
  150. package/_types/client/evm/evm.types.d.ts +33 -3
  151. package/_types/client/evm/evm.types.d.ts.map +1 -1
  152. package/_types/client/policies/index.d.ts +2 -0
  153. package/_types/client/policies/index.d.ts.map +1 -0
  154. package/_types/client/policies/policies.d.ts +216 -0
  155. package/_types/client/policies/policies.d.ts.map +1 -0
  156. package/_types/client/policies/policies.types.d.ts +96 -0
  157. package/_types/client/policies/policies.types.d.ts.map +1 -0
  158. package/_types/client/solana/solana.d.ts +43 -1
  159. package/_types/client/solana/solana.d.ts.map +1 -1
  160. package/_types/client/solana/solana.types.d.ts +14 -2
  161. package/_types/client/solana/solana.types.d.ts.map +1 -1
  162. package/_types/index.d.ts +2 -0
  163. package/_types/index.d.ts.map +1 -1
  164. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +176 -17
  165. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  166. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +13 -1
  167. package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
  168. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -1
  169. package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
  170. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +3 -1
  171. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  172. package/_types/openapi-client/generated/index.msw.d.ts +2 -2
  173. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  174. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +5 -1
  175. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
  176. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +7 -1
  177. package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
  178. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
  179. package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
  180. package/_types/openapi-client/index.d.ts +18 -0
  181. package/_types/openapi-client/index.d.ts.map +1 -1
  182. package/_types/policies/schema.d.ts +1552 -0
  183. package/_types/policies/schema.d.ts.map +1 -0
  184. package/_types/policies/types.d.ts +19 -0
  185. package/_types/policies/types.d.ts.map +1 -0
  186. package/_types/types/misc.d.ts +39 -0
  187. package/_types/types/misc.d.ts.map +1 -1
  188. package/_types/version.d.ts +1 -1
  189. package/accounts/evm/toEvmServerAccount.ts +11 -7
  190. package/accounts/evm/toEvmSmartAccount.ts +1 -2
  191. package/accounts/evm/types.ts +6 -8
  192. package/accounts/solana/toSolanaAccount.ts +8 -0
  193. package/actions/evm/transfer/accountTransferStrategy.ts +38 -78
  194. package/actions/evm/transfer/smartAccountTransferStrategy.ts +43 -63
  195. package/actions/evm/transfer/transfer.ts +10 -51
  196. package/actions/evm/transfer/types.ts +9 -67
  197. package/actions/evm/transfer/utils.ts +0 -13
  198. package/actions/evm/types.ts +143 -78
  199. package/actions/solana/constants.ts +6 -0
  200. package/actions/solana/transfer.ts +219 -0
  201. package/actions/solana/types.ts +28 -0
  202. package/actions/solana/utils.ts +79 -0
  203. package/analytics.ts +86 -11
  204. package/client/cdp.ts +11 -4
  205. package/client/evm/evm.ts +159 -17
  206. package/client/evm/evm.types.ts +38 -1
  207. package/client/policies/index.ts +1 -0
  208. package/client/policies/policies.ts +246 -0
  209. package/client/policies/policies.types.ts +109 -0
  210. package/client/solana/solana.ts +94 -20
  211. package/client/solana/solana.types.ts +16 -1
  212. package/index.ts +7 -0
  213. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +220 -18
  214. package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +102 -0
  215. package/openapi-client/generated/evm-accounts/evm-accounts.ts +43 -0
  216. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +3 -1
  217. package/openapi-client/generated/index.msw.ts +2 -2
  218. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +199 -56
  219. package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +75 -0
  220. package/openapi-client/generated/solana-accounts/solana-accounts.ts +23 -0
  221. package/openapi-client/index.ts +6 -0
  222. package/package.json +4 -2
  223. package/policies/schema.ts +349 -0
  224. package/policies/types.ts +19 -0
  225. package/types/misc.ts +41 -0
  226. package/version.ts +1 -1
@@ -0,0 +1,242 @@
1
+ import { Address } from "abitype/zod";
2
+ import { z } from "zod";
3
+ /**
4
+ * Enum for EthValueOperator values
5
+ */
6
+ export const EthValueOperatorEnum = z.enum([">", ">=", "<", "<=", "=="]);
7
+ /**
8
+ * Enum for EvmAddressOperator values
9
+ */
10
+ export const EvmAddressOperatorEnum = z.enum(["in", "not in"]);
11
+ /**
12
+ * Enum for EvmNetworkOperator values
13
+ */
14
+ export const EvmNetworkOperatorEnum = z.enum(["in", "not in"]);
15
+ /**
16
+ * Enum for SolAddressOperator values
17
+ */
18
+ export const SolAddressOperatorEnum = z.enum(["in", "not in"]);
19
+ /**
20
+ * Schema for ETH value criterions
21
+ */
22
+ export const EthValueCriterionSchema = z.object({
23
+ /** The type of criterion, must be "ethValue" for Ethereum value-based rules. */
24
+ type: z.literal("ethValue"),
25
+ /**
26
+ * The ETH value amount in wei to compare against, as a string.
27
+ * Must contain only digits.
28
+ */
29
+ ethValue: z.string().regex(/^[0-9]+$/),
30
+ /** The comparison operator to use for evaluating transaction values against the threshold. */
31
+ operator: EthValueOperatorEnum,
32
+ });
33
+ /**
34
+ * Schema for EVM address criterions
35
+ */
36
+ export const EvmAddressCriterionSchema = z.object({
37
+ /** The type of criterion, must be "evmAddress" for EVM address-based rules. */
38
+ type: z.literal("evmAddress"),
39
+ /**
40
+ * Array of EVM addresses to compare against.
41
+ * Each address must be a 0x-prefixed 40-character hexadecimal string.
42
+ * Limited to a maximum of 100 addresses per criterion.
43
+ */
44
+ addresses: z.array(Address).max(100),
45
+ /**
46
+ * The operator to use for evaluating transaction addresses.
47
+ * "in" checks if an address is in the provided list.
48
+ * "not in" checks if an address is not in the provided list.
49
+ */
50
+ operator: EvmAddressOperatorEnum,
51
+ });
52
+ /**
53
+ * Enum for EVM Network values
54
+ */
55
+ export const EvmNetworkEnum = z.enum(["base", "base-sepolia"]);
56
+ /**
57
+ * Schema for EVM network criterions
58
+ */
59
+ export const EvmNetworkCriterionSchema = z.object({
60
+ /** The type of criterion, must be "evmAddress" for EVM address-based rules. */
61
+ type: z.literal("evmNetwork"),
62
+ /**
63
+ * Array of EVM network identifiers to compare against.
64
+ * Either "base" or "base-sepolia"
65
+ */
66
+ networks: z.array(EvmNetworkEnum),
67
+ /**
68
+ * The operator to use for evaluating transaction network.
69
+ * "in" checks if a network is in the provided list.
70
+ * "not in" checks if a network is not in the provided list.
71
+ */
72
+ operator: EvmNetworkOperatorEnum,
73
+ });
74
+ /**
75
+ * Schema for Solana address criterions
76
+ */
77
+ export const SolAddressCriterionSchema = z.object({
78
+ /** The type of criterion, must be "solAddress" for Solana address-based rules. */
79
+ type: z.literal("solAddress"),
80
+ /**
81
+ * Array of Solana addresses to compare against.
82
+ * Each address must be a valid Base58-encoded Solana address (32-44 characters).
83
+ */
84
+ addresses: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
85
+ /**
86
+ * The operator to use for evaluating transaction addresses.
87
+ * "in" checks if an address is in the provided list.
88
+ * "not in" checks if an address is not in the provided list.
89
+ */
90
+ operator: SolAddressOperatorEnum,
91
+ });
92
+ /**
93
+ * Schema for criteria used in SignEvmTransaction operations
94
+ */
95
+ export const SignEvmTransactionCriteriaSchema = z
96
+ .array(z.discriminatedUnion("type", [EthValueCriterionSchema, EvmAddressCriterionSchema]))
97
+ .max(10)
98
+ .min(1);
99
+ /**
100
+ * Schema for criteria used in SendEvmTransaction operations
101
+ */
102
+ export const SendEvmTransactionCriteriaSchema = z
103
+ .array(z.discriminatedUnion("type", [
104
+ EthValueCriterionSchema,
105
+ EvmAddressCriterionSchema,
106
+ EvmNetworkCriterionSchema,
107
+ ]))
108
+ .max(10)
109
+ .min(1);
110
+ /**
111
+ * Schema for criteria used in SignSolTransaction operations
112
+ */
113
+ export const SignSolTransactionCriteriaSchema = z
114
+ .array(z.discriminatedUnion("type", [SolAddressCriterionSchema]))
115
+ .max(10)
116
+ .min(1);
117
+ /**
118
+ * Enum for Solana Operation types
119
+ */
120
+ export const SolOperationEnum = z.enum(["signSolTransaction"]);
121
+ /**
122
+ * Enum for Evm Operation types
123
+ */
124
+ export const EvmOperationEnum = z.enum(["signEvmTransaction"]);
125
+ /**
126
+ * Enum for Action types
127
+ */
128
+ export const ActionEnum = z.enum(["reject", "accept"]);
129
+ /**
130
+ * Type representing a 'signEvmTransaction' policy rule that can accept or reject specific operations
131
+ * based on a set of criteria.
132
+ */
133
+ export const SignEvmTransactionRuleSchema = z.object({
134
+ /**
135
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
136
+ * "accept" will allow the transaction, "reject" will block it.
137
+ */
138
+ action: ActionEnum,
139
+ /**
140
+ * The operation to which this rule applies.
141
+ * Must be "signEvmTransaction".
142
+ */
143
+ operation: z.literal("signEvmTransaction"),
144
+ /**
145
+ * The set of criteria that must be matched for this rule to apply.
146
+ * Must be compatible with the specified operation type.
147
+ */
148
+ criteria: SignEvmTransactionCriteriaSchema,
149
+ });
150
+ /**
151
+ * Type representing a 'sendEvmTransaction' policy rule that can accept or reject specific operations
152
+ * based on a set of criteria.
153
+ */
154
+ export const SendEvmTransactionRuleSchema = z.object({
155
+ /**
156
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
157
+ * "accept" will allow the transaction, "reject" will block it.
158
+ */
159
+ action: ActionEnum,
160
+ /**
161
+ * The operation to which this rule applies.
162
+ * Must be "sendEvmTransaction".
163
+ */
164
+ operation: z.literal("sendEvmTransaction"),
165
+ /**
166
+ * The set of criteria that must be matched for this rule to apply.
167
+ * Must be compatible with the specified operation type.
168
+ */
169
+ criteria: SendEvmTransactionCriteriaSchema,
170
+ });
171
+ /**
172
+ * Type representing a 'signSolTransaction' policy rule that can accept or reject specific operations
173
+ * based on a set of criteria.
174
+ */
175
+ export const SignSolTransactionRuleSchema = z.object({
176
+ /**
177
+ * Determines whether matching the rule will cause a request to be rejected or accepted.
178
+ * "accept" will allow the transaction, "reject" will block it.
179
+ */
180
+ action: ActionEnum,
181
+ /**
182
+ * The operation to which this rule applies.
183
+ * Must be "signSolTransaction".
184
+ */
185
+ operation: z.literal("signSolTransaction"),
186
+ /**
187
+ * The set of criteria that must be matched for this rule to apply.
188
+ * Must be compatible with the specified operation type.
189
+ */
190
+ criteria: SignSolTransactionCriteriaSchema,
191
+ });
192
+ /**
193
+ * Schema for policy rules
194
+ */
195
+ export const RuleSchema = z.discriminatedUnion("operation", [
196
+ SignEvmTransactionRuleSchema,
197
+ SendEvmTransactionRuleSchema,
198
+ SignSolTransactionRuleSchema,
199
+ ]);
200
+ /**
201
+ * Enum for policy scopes
202
+ */
203
+ export const PolicyScopeEnum = z.enum(["project", "account"]);
204
+ /**
205
+ * Schema for creating or updating a Policy.
206
+ */
207
+ export const CreatePolicyBodySchema = z.object({
208
+ /**
209
+ * The scope of the policy.
210
+ * "project" applies to the entire project, "account" applies to specific accounts.
211
+ */
212
+ scope: PolicyScopeEnum,
213
+ /**
214
+ * An optional human-readable description for the policy.
215
+ * Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
216
+ */
217
+ description: z
218
+ .string()
219
+ .regex(/^[A-Za-z0-9 ,.]{1,50}$/)
220
+ .optional(),
221
+ /**
222
+ * Array of rules that comprise the policy.
223
+ * Limited to a maximum of 10 rules per policy.
224
+ */
225
+ rules: z.array(RuleSchema).max(10).min(1),
226
+ });
227
+ export const UpdatePolicyBodySchema = z.object({
228
+ /**
229
+ * An optional human-readable description for the policy.
230
+ * Limited to 50 characters of alphanumeric characters, spaces, commas, and periods.
231
+ */
232
+ description: z
233
+ .string()
234
+ .regex(/^[A-Za-z0-9 ,.]{1,50}$/)
235
+ .optional(),
236
+ /**
237
+ * Array of rules that comprise the policy.
238
+ * Limited to a maximum of 10 rules per policy.
239
+ */
240
+ rules: z.array(RuleSchema).max(10).min(1),
241
+ });
242
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../policies/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,IA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C,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAO9D;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C;;;OAGG;IACH,KAAK,EAAE,eAAe;IACtB;;;OAGG;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,KAAK,CAAC,wBAAwB,CAAC;SAC/B,QAAQ,EAAE;IACb;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1C,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C;;;OAGG;IACH,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,KAAK,CAAC,wBAAwB,CAAC;SAC/B,QAAQ,EAAE;IACb;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1C,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../policies/types.ts"],"names":[],"mappings":""}
package/_esm/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const version = "1.7.0";
1
+ export const version = "1.9.0";
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toEvmServerAccount.d.ts","sourceRoot":"","sources":["../../../accounts/evm/toEvmServerAccount.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGtF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,kDAAkD;IAClD,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,yBAAyB,GACjC,gBAAgB,CAyDlB"}
1
+ {"version":3,"file":"toEvmServerAccount.d.ts","sourceRoot":"","sources":["../../../accounts/evm/toEvmServerAccount.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGtF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,kDAAkD;IAClD,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,yBAAyB,GACjC,gBAAgB,CA2DlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"toEvmSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/evm/toEvmSmartAccount.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,IAAI,oBAAoB,EACxC,MAAM,+BAA+B,CAAC;AAGvC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,wCAAwC;IACxC,YAAY,EAAE,oBAAoB,CAAC;IACnC,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,wBAAwB,GAChC,eAAe,CAoDjB"}
1
+ {"version":3,"file":"toEvmSmartAccount.d.ts","sourceRoot":"","sources":["../../../accounts/evm/toEvmSmartAccount.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,IAAI,oBAAoB,EACxC,MAAM,+BAA+B,CAAC;AAGvC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,wCAAwC;IACxC,YAAY,EAAE,oBAAoB,CAAC;IACnC,sCAAsC;IACtC,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,wBAAwB,GAChC,eAAe,CAoDjB"}
@@ -1,7 +1,8 @@
1
- import { SignableMessage, TransactionSerializable, TypedData, TypedDataDefinition } from "viem";
1
+ import { SignableMessage, TransactionSerializable } from "viem";
2
2
  import { Prettify } from "../../types/utils.js";
3
3
  import type { AccountActions, SmartAccountActions } from "../../actions/evm/types.js";
4
- import type { Hash, Hex, Address } from "../../types/misc.js";
4
+ import type { EIP712Message } from "../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js";
5
+ import type { Address, Hash, Hex } from "../../types/misc.js";
5
6
  /**
6
7
  * Base type for any Ethereum account with signing capabilities.
7
8
  * For example, this could be an EVM ServerAccount, or a viem LocalAccount.
@@ -20,7 +21,9 @@ export type EvmAccount = {
20
21
  /** Signs a transaction and returns the signed transaction as a hex string. */
21
22
  signTransaction: (transaction: TransactionSerializable) => Promise<Hex>;
22
23
  /** Signs a typed data and returns the signature as a hex string. */
23
- signTypedData: <const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
24
+ signTypedData: (message: EIP712Message) => Promise<Hex>;
25
+ /** A list of Policy ID's that apply to the account. */
26
+ policies?: string[];
24
27
  };
25
28
  /**
26
29
  * Server-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AAO,CAAC,GAAG,CAAC,CAAC;IACxD,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,UAAU,GACR,cAAc,GAAG;IACf,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,YAAY,CAAC;CACpB,CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,CACpC;IACE,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uKAAuK;IACvK,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,6CAA6C;IAC7C,IAAI,EAAE,WAAW,CAAC;CACnB,GAAG,mBAAmB,CACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toSolanaAccount.d.ts","sourceRoot":"","sources":["../../../accounts/solana/toSolanaAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,sBAAsB,GAC9B,aAAa,CA2Bf"}
1
+ {"version":3,"file":"toSolanaAccount.d.ts","sourceRoot":"","sources":["../../../accounts/solana/toSolanaAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAWpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,sBAAsB,GAC9B,aAAa,CAkCf"}
@@ -1,4 +1,4 @@
1
- import { TransferExecutionStrategy } from "./types.js";
2
- import { EvmAccount } from "../../../accounts/evm/types.js";
1
+ import type { TransferExecutionStrategy } from "./types.js";
2
+ import type { 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,gCAAgC,CAAC;AAG5D,eAAO,MAAM,uBAAuB,EAAE,yBAAyB,CAAC,UAAU,CA0EzE,CAAC"}
1
+ {"version":3,"file":"accountTransferStrategy.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/accountTransferStrategy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAGjE,eAAO,MAAM,uBAAuB,EAAE,yBAAyB,CAAC,UAAU,CAsCzE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { TransferExecutionStrategy } from "./types.js";
2
- import { EvmSmartAccount } from "../../../accounts/evm/types.js";
1
+ import type { TransferExecutionStrategy } from "./types.js";
2
+ import type { 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,gCAAgC,CAAC;AAIjE,eAAO,MAAM,4BAA4B,EAAE,yBAAyB,CAAC,eAAe,CAkEnF,CAAC"}
1
+ {"version":3,"file":"smartAccountTransferStrategy.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/smartAccountTransferStrategy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,4BAA4B,EAAE,yBAAyB,CAAC,eAAe,CA8CnF,CAAC"}
@@ -1,6 +1,8 @@
1
- import { EvmAccount, EvmSmartAccount } from "../../../accounts/evm/types.js";
2
- import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
3
- import type { TransferResult, TransferExecutionStrategy, SmartAccountTransferOptions, AccountTransferOptions } from "./types.js";
1
+ import type { TransferExecutionStrategy, SmartAccountTransferOptions, TransferOptions } from "./types.js";
2
+ import type { EvmAccount, EvmSmartAccount } from "../../../accounts/evm/types.js";
3
+ import type { CdpOpenApiClientType } from "../../../openapi-client/index.js";
4
+ import type { TransactionResult } from "../sendTransaction.js";
5
+ import type { SendUserOperationReturnType } from "../sendUserOperation.js";
4
6
  /**
5
7
  * Transfer an amount of a token from an account to another account.
6
8
  *
@@ -10,5 +12,5 @@ import type { TransferResult, TransferExecutionStrategy, SmartAccountTransferOpt
10
12
  * @param transferStrategy - The strategy to use to execute the transfer.
11
13
  * @returns The result of the transfer.
12
14
  */
13
- export declare function transfer<T extends EvmAccount | EvmSmartAccount>(apiClient: CdpOpenApiClientType, from: T, transferArgs: T extends EvmSmartAccount ? SmartAccountTransferOptions : AccountTransferOptions, transferStrategy: TransferExecutionStrategy<T>): Promise<TransferResult>;
15
+ export declare function transfer<T extends EvmAccount | EvmSmartAccount>(apiClient: CdpOpenApiClientType, from: T, transferArgs: T extends EvmSmartAccount ? SmartAccountTransferOptions : TransferOptions, transferStrategy: TransferExecutionStrategy<T>): Promise<T extends EvmSmartAccount ? SendUserOperationReturnType : TransactionResult>;
14
16
  //# sourceMappingURL=transfer.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/transfer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E;;;;;;;;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,eAAe,EACvF,gBAAgB,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAC7C,OAAO,CAAC,CAAC,SAAS,eAAe,GAAG,2BAA2B,GAAG,iBAAiB,CAAC,CAetF"}
@@ -1,7 +1,8 @@
1
- import { Hex, TransactionReceipt, Address, PublicClient, Chain, Transport, WaitForTransactionReceiptParameters } from "viem";
2
- import { CdpOpenApiClientType, EvmUserOperationNetwork, SendEvmTransactionBodyNetwork } from "../../../openapi-client/index.js";
3
1
  import type { EvmAccount, EvmSmartAccount } from "../../../accounts/evm/types.js";
4
- import type { WaitForUserOperationOptions } from "../waitForUserOperation.js";
2
+ import type { CdpOpenApiClientType, EvmUserOperationNetwork, SendEvmTransactionBodyNetwork } from "../../../openapi-client/index.js";
3
+ import type { TransactionResult } from "../sendTransaction.js";
4
+ import type { SendUserOperationReturnType } from "../sendUserOperation.js";
5
+ import type { Hex, Address } from "viem";
5
6
  /**
6
7
  * The network to transfer the token on.
7
8
  */
@@ -9,52 +10,24 @@ export type Network = SendEvmTransactionBodyNetwork | EvmUserOperationNetwork;
9
10
  /**
10
11
  * The options for the transfer.
11
12
  */
12
- type TransferOptions = {
13
+ export type TransferOptions = {
13
14
  /** The account to transfer the token to. */
14
15
  to: EvmAccount | Address;
15
16
  /**
16
- * The amount of the token to transfer.
17
- * If a string is provided, it will be parsed into a bigint based on the token's decimals.
17
+ * The amount of the token to transfer, represented as an atomic value.
18
18
  */
19
- amount: bigint | string;
19
+ amount: bigint;
20
20
  /** The token to transfer. Can be a contract address or a predefined token name. */
21
21
  token: "eth" | "usdc" | Hex;
22
22
  /** The network to transfer the token on. */
23
23
  network: Network;
24
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
25
  /**
42
26
  * The options for the transfer using a smart account.
43
27
  */
44
28
  export type SmartAccountTransferOptions = TransferOptions & {
45
29
  /** The paymaster URL to use for the transfer. */
46
30
  paymasterUrl?: string;
47
- /** The options for waiting for the result of the transfer. */
48
- waitOptions?: WaitForUserOperationOptions["waitOptions"];
49
- };
50
- /**
51
- * The result of the transfer.
52
- */
53
- export type TransferResult = {
54
- /** The status of the transaction. */
55
- status: TransactionReceipt["status"];
56
- /** The transaction hash of the transfer. */
57
- transactionHash: Hex;
58
31
  };
59
32
  /**
60
33
  * A strategy for executing a transfer.
@@ -81,25 +54,6 @@ export interface TransferExecutionStrategy<T extends EvmAccount | EvmSmartAccoun
81
54
  network: TransferOptions["network"];
82
55
  } & (T extends EvmSmartAccount ? {
83
56
  paymasterUrl?: string;
84
- } : object)): Promise<Hex>;
85
- /**
86
- * Waits for the result of the transfer.
87
- *
88
- * @param args - The arguments for the transfer.
89
- * @param args.apiClient - The API client to use for the transfer.
90
- * @param args.publicClient - The public client to use for the transfer.
91
- * @param args.from - The account to transfer the token from.
92
- * @param args.hash - The transaction hash of the transfer.
93
- * @param args.waitOptions - The options for waiting for the result of the transfer.
94
- * @returns The result of the transfer.
95
- */
96
- waitForResult(args: {
97
- apiClient: CdpOpenApiClientType;
98
- publicClient: PublicClient<Transport, Chain>;
99
- from: T;
100
- hash: Hex;
101
- waitOptions?: WaitForUserOperationOptions["waitOptions"];
102
- }): Promise<TransferResult>;
57
+ } : object)): Promise<T extends EvmSmartAccount ? SendUserOperationReturnType : TransactionResult>;
103
58
  }
104
- export {};
105
59
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../actions/evm/transfer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,KAAK,EACL,SAAS,EACT,mCAAmC,EACpC,MAAM,MAAM,CAAC;AAEd,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,6BAA6B,GAAG,uBAAuB,CAAC;AAE9E;;GAEG;AACH,KAAK,eAAe,GAAG;IACrB,4CAA4C;IAC5C,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC;IACzB;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,mFAAmF;IACnF,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,8DAA8D;IAC9D,WAAW,CAAC,EAAE;QACZ;;WAEG;QACH,eAAe,CAAC,EAAE,mCAAmC,CAAC,iBAAiB,CAAC,CAAC;QACzE;;WAEG;QACH,cAAc,CAAC,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC;KACjE,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAA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