@coinbase/cdp-sdk 1.28.0 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/accounts/evm/networkCapabilities.js +101 -0
  3. package/_cjs/accounts/evm/networkCapabilities.js.map +1 -1
  4. package/_cjs/accounts/evm/toEvmServerAccount.js +12 -1
  5. package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
  6. package/_cjs/accounts/evm/toEvmSmartAccount.js +12 -1
  7. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
  9. package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  10. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +11 -1
  11. package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/solana/toSolanaAccount.js +41 -1
  13. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
  14. package/_cjs/actions/Quote.js +106 -0
  15. package/_cjs/actions/Quote.js.map +1 -0
  16. package/_cjs/actions/evm/fund/fund.js +5 -5
  17. package/_cjs/actions/evm/fund/fund.js.map +1 -1
  18. package/_cjs/actions/evm/fund/quoteFund.js +7 -7
  19. package/_cjs/actions/evm/fund/quoteFund.js.map +1 -1
  20. package/_cjs/actions/evm/getUserOperation.js +1 -0
  21. package/_cjs/actions/evm/getUserOperation.js.map +1 -1
  22. package/_cjs/actions/evm/spend-permissions/account.use.js +33 -0
  23. package/_cjs/actions/evm/spend-permissions/account.use.js.map +1 -0
  24. package/_cjs/actions/evm/spend-permissions/smartAccount.use.js +35 -0
  25. package/_cjs/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
  26. package/_cjs/actions/evm/spend-permissions/types.js.map +1 -0
  27. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +1 -0
  28. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  29. package/_cjs/actions/solana/fund/fund.js +50 -0
  30. package/_cjs/actions/solana/fund/fund.js.map +1 -0
  31. package/_cjs/actions/solana/fund/quoteFund.js +47 -0
  32. package/_cjs/actions/solana/fund/quoteFund.js.map +1 -0
  33. package/_cjs/actions/solana/sendTransaction.js +1 -0
  34. package/_cjs/actions/solana/sendTransaction.js.map +1 -1
  35. package/_cjs/actions/solana/signTransaction.js +1 -0
  36. package/_cjs/actions/solana/signTransaction.js.map +1 -1
  37. package/_cjs/actions/types.js +3 -0
  38. package/{_esm/actions/evm/fund → _cjs/actions}/types.js.map +1 -1
  39. package/_cjs/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
  40. package/_cjs/actions/waitForFundOperationReceipt.js.map +1 -0
  41. package/_cjs/auth/hooks/axios/withAuth.js +3 -0
  42. package/_cjs/auth/hooks/axios/withAuth.js.map +1 -1
  43. package/_cjs/auth/utils/http.js +2 -1
  44. package/_cjs/auth/utils/http.js.map +1 -1
  45. package/_cjs/client/evm/evm.js +51 -1
  46. package/_cjs/client/evm/evm.js.map +1 -1
  47. package/_cjs/client/solana/solana.js.map +1 -1
  48. package/_cjs/index.js +5 -1
  49. package/_cjs/index.js.map +1 -1
  50. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +54 -7
  51. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  52. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
  53. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  54. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +76 -4
  55. package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  56. package/_cjs/openapi-client/generated/index.msw.js +2 -0
  57. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  58. package/_cjs/openapi-client/generated/onramp/onramp.js +30 -0
  59. package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -0
  60. package/_cjs/openapi-client/generated/onramp/onramp.msw.js +98 -0
  61. package/_cjs/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
  62. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +15 -0
  63. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
  64. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +69 -0
  65. package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
  66. package/_cjs/openapi-client/index.js +2 -0
  67. package/_cjs/openapi-client/index.js.map +1 -1
  68. package/_cjs/spend-permissions/constants.js +716 -0
  69. package/_cjs/spend-permissions/constants.js.map +1 -0
  70. package/_cjs/spend-permissions/types.js +3 -0
  71. package/_cjs/{actions/evm/fund → spend-permissions}/types.js.map +1 -1
  72. package/_cjs/version.js +1 -1
  73. package/_esm/accounts/evm/networkCapabilities.js +101 -0
  74. package/_esm/accounts/evm/networkCapabilities.js.map +1 -1
  75. package/_esm/accounts/evm/toEvmServerAccount.js +12 -1
  76. package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
  77. package/_esm/accounts/evm/toEvmSmartAccount.js +12 -1
  78. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  79. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
  80. package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
  81. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +11 -1
  82. package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
  83. package/_esm/accounts/solana/toSolanaAccount.js +41 -1
  84. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
  85. package/_esm/actions/Quote.js +101 -0
  86. package/_esm/actions/Quote.js.map +1 -0
  87. package/_esm/actions/evm/fund/fund.js +5 -5
  88. package/_esm/actions/evm/fund/fund.js.map +1 -1
  89. package/_esm/actions/evm/fund/quoteFund.js +7 -7
  90. package/_esm/actions/evm/fund/quoteFund.js.map +1 -1
  91. package/_esm/actions/evm/getUserOperation.js +1 -0
  92. package/_esm/actions/evm/getUserOperation.js.map +1 -1
  93. package/_esm/actions/evm/spend-permissions/account.use.js +30 -0
  94. package/_esm/actions/evm/spend-permissions/account.use.js.map +1 -0
  95. package/_esm/actions/evm/spend-permissions/smartAccount.use.js +32 -0
  96. package/_esm/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
  97. package/_esm/actions/evm/spend-permissions/types.js.map +1 -0
  98. package/_esm/actions/evm/transfer/accountTransferStrategy.js +1 -0
  99. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  100. package/_esm/actions/solana/fund/fund.js +47 -0
  101. package/_esm/actions/solana/fund/fund.js.map +1 -0
  102. package/_esm/actions/solana/fund/quoteFund.js +44 -0
  103. package/_esm/actions/solana/fund/quoteFund.js.map +1 -0
  104. package/_esm/actions/solana/sendTransaction.js +1 -0
  105. package/_esm/actions/solana/sendTransaction.js.map +1 -1
  106. package/_esm/actions/solana/signTransaction.js +1 -0
  107. package/_esm/actions/solana/signTransaction.js.map +1 -1
  108. package/_esm/actions/types.js +2 -0
  109. package/_esm/actions/types.js.map +1 -0
  110. package/_esm/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
  111. package/_esm/actions/waitForFundOperationReceipt.js.map +1 -0
  112. package/_esm/auth/hooks/axios/withAuth.js +3 -0
  113. package/_esm/auth/hooks/axios/withAuth.js.map +1 -1
  114. package/_esm/auth/utils/http.js +2 -1
  115. package/_esm/auth/utils/http.js.map +1 -1
  116. package/_esm/client/evm/evm.js +51 -1
  117. package/_esm/client/evm/evm.js.map +1 -1
  118. package/_esm/client/solana/solana.js +2 -2
  119. package/_esm/client/solana/solana.js.map +1 -1
  120. package/_esm/index.js +2 -1
  121. package/_esm/index.js.map +1 -1
  122. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +52 -5
  123. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  124. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
  125. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
  126. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +73 -3
  127. package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
  128. package/_esm/openapi-client/generated/index.msw.js +2 -0
  129. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  130. package/_esm/openapi-client/generated/onramp/onramp.js +25 -0
  131. package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -0
  132. package/_esm/openapi-client/generated/onramp/onramp.msw.js +90 -0
  133. package/_esm/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
  134. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +11 -0
  135. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
  136. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +63 -0
  137. package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
  138. package/_esm/openapi-client/index.js +2 -0
  139. package/_esm/openapi-client/index.js.map +1 -1
  140. package/_esm/spend-permissions/constants.js +713 -0
  141. package/_esm/spend-permissions/constants.js.map +1 -0
  142. package/_esm/spend-permissions/types.js +2 -0
  143. package/_esm/spend-permissions/types.js.map +1 -0
  144. package/_esm/version.js +1 -1
  145. package/_types/accounts/evm/networkCapabilities.d.ts +101 -0
  146. package/_types/accounts/evm/networkCapabilities.d.ts.map +1 -1
  147. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  148. package/_types/accounts/evm/toEvmSmartAccount.d.ts +1 -1
  149. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  150. package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
  151. package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
  152. package/_types/accounts/evm/types.d.ts +15 -9
  153. package/_types/accounts/evm/types.d.ts.map +1 -1
  154. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
  155. package/_types/actions/Quote.d.ts +97 -0
  156. package/_types/actions/Quote.d.ts.map +1 -0
  157. package/_types/actions/evm/fund/fund.d.ts +3 -7
  158. package/_types/actions/evm/fund/fund.d.ts.map +1 -1
  159. package/_types/actions/evm/fund/quoteFund.d.ts +4 -7
  160. package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -1
  161. package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
  162. package/_types/actions/evm/spend-permissions/account.use.d.ts +15 -0
  163. package/_types/actions/evm/spend-permissions/account.use.d.ts.map +1 -0
  164. package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts +15 -0
  165. package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts.map +1 -0
  166. package/_types/actions/evm/spend-permissions/types.d.ts +13 -0
  167. package/_types/actions/evm/spend-permissions/types.d.ts.map +1 -0
  168. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
  169. package/_types/actions/evm/types.d.ts +82 -7
  170. package/_types/actions/evm/types.d.ts.map +1 -1
  171. package/_types/actions/solana/fund/fund.d.ts +19 -0
  172. package/_types/actions/solana/fund/fund.d.ts.map +1 -0
  173. package/_types/actions/solana/fund/quoteFund.d.ts +20 -0
  174. package/_types/actions/solana/fund/quoteFund.d.ts.map +1 -0
  175. package/_types/actions/solana/sendTransaction.d.ts +8 -2
  176. package/_types/actions/solana/sendTransaction.d.ts.map +1 -1
  177. package/_types/actions/solana/signTransaction.d.ts +8 -2
  178. package/_types/actions/solana/signTransaction.d.ts.map +1 -1
  179. package/_types/actions/solana/types.d.ts +99 -3
  180. package/_types/actions/solana/types.d.ts.map +1 -1
  181. package/_types/actions/types.d.ts +37 -0
  182. package/_types/actions/types.d.ts.map +1 -0
  183. package/_types/actions/{evm/fund/waitForFundOperationReceipt.d.ts → waitForFundOperationReceipt.d.ts} +2 -2
  184. package/_types/actions/waitForFundOperationReceipt.d.ts.map +1 -0
  185. package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -1
  186. package/_types/auth/utils/http.d.ts.map +1 -1
  187. package/_types/client/evm/evm.d.ts +19 -1
  188. package/_types/client/evm/evm.d.ts.map +1 -1
  189. package/_types/client/evm/evm.types.d.ts +29 -2
  190. package/_types/client/evm/evm.types.d.ts.map +1 -1
  191. package/_types/client/solana/solana.d.ts +5 -3
  192. package/_types/client/solana/solana.d.ts.map +1 -1
  193. package/_types/index.d.ts +3 -1
  194. package/_types/index.d.ts.map +1 -1
  195. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +356 -20
  196. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  197. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
  198. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
  199. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
  200. package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
  201. package/_types/openapi-client/generated/index.msw.d.ts +2 -0
  202. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  203. package/_types/openapi-client/generated/onramp/onramp.d.ts +28 -0
  204. package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -0
  205. package/_types/openapi-client/generated/onramp/onramp.msw.d.ts +8 -0
  206. package/_types/openapi-client/generated/onramp/onramp.msw.d.ts.map +1 -0
  207. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +20 -0
  208. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +1 -0
  209. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +6 -0
  210. package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +1 -0
  211. package/_types/openapi-client/index.d.ts +4 -0
  212. package/_types/openapi-client/index.d.ts.map +1 -1
  213. package/_types/spend-permissions/constants.d.ts +1357 -0
  214. package/_types/spend-permissions/constants.d.ts.map +1 -0
  215. package/_types/spend-permissions/types.d.ts +30 -0
  216. package/_types/spend-permissions/types.d.ts.map +1 -0
  217. package/_types/version.d.ts +1 -1
  218. package/accounts/evm/networkCapabilities.ts +101 -0
  219. package/accounts/evm/toEvmServerAccount.ts +26 -11
  220. package/accounts/evm/toEvmSmartAccount.ts +30 -15
  221. package/accounts/evm/toNetworkScopedEvmServerAccount.ts +20 -5
  222. package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +21 -6
  223. package/accounts/evm/types.ts +34 -12
  224. package/accounts/solana/toSolanaAccount.ts +58 -3
  225. package/actions/Quote.ts +154 -0
  226. package/actions/evm/fund/fund.ts +10 -14
  227. package/actions/evm/fund/quoteFund.ts +13 -16
  228. package/actions/evm/getUserOperation.ts +1 -0
  229. package/actions/evm/spend-permissions/account.use.ts +48 -0
  230. package/actions/evm/spend-permissions/smartAccount.use.ts +49 -0
  231. package/actions/evm/spend-permissions/types.ts +13 -0
  232. package/actions/evm/transfer/accountTransferStrategy.ts +2 -0
  233. package/actions/evm/types.ts +88 -7
  234. package/actions/solana/fund/fund.ts +71 -0
  235. package/actions/solana/fund/quoteFund.ts +77 -0
  236. package/actions/solana/sendTransaction.ts +10 -2
  237. package/actions/solana/signTransaction.ts +10 -2
  238. package/actions/solana/types.ts +113 -2
  239. package/actions/types.ts +39 -0
  240. package/actions/{evm/fund/waitForFundOperationReceipt.ts → waitForFundOperationReceipt.ts} +2 -2
  241. package/auth/hooks/axios/withAuth.ts +3 -0
  242. package/auth/utils/http.ts +2 -1
  243. package/client/evm/evm.ts +61 -1
  244. package/client/evm/evm.types.ts +31 -0
  245. package/client/solana/solana.ts +10 -5
  246. package/index.ts +6 -1
  247. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +400 -26
  248. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +89 -3
  249. package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
  250. package/openapi-client/generated/index.msw.ts +2 -0
  251. package/openapi-client/generated/onramp/onramp.msw.ts +135 -0
  252. package/openapi-client/generated/onramp/onramp.ts +54 -0
  253. package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +85 -0
  254. package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +34 -0
  255. package/openapi-client/index.ts +2 -0
  256. package/package.json +1 -1
  257. package/spend-permissions/constants.ts +713 -0
  258. package/spend-permissions/types.ts +42 -0
  259. package/version.ts +1 -1
  260. package/_cjs/actions/evm/fund/Quote.js +0 -63
  261. package/_cjs/actions/evm/fund/Quote.js.map +0 -1
  262. package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
  263. package/_esm/actions/evm/fund/Quote.js +0 -59
  264. package/_esm/actions/evm/fund/Quote.js.map +0 -1
  265. package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
  266. package/_types/actions/evm/fund/Quote.d.ts +0 -51
  267. package/_types/actions/evm/fund/Quote.d.ts.map +0 -1
  268. package/_types/actions/evm/fund/types.d.ts +0 -16
  269. package/_types/actions/evm/fund/types.d.ts.map +0 -1
  270. package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +0 -1
  271. package/actions/evm/fund/Quote.ts +0 -83
  272. package/actions/evm/fund/types.ts +0 -16
  273. /package/_cjs/actions/evm/{fund → spend-permissions}/types.js +0 -0
  274. /package/_esm/actions/evm/{fund → spend-permissions}/types.js +0 -0
@@ -57,6 +57,12 @@ export const ErrorType = {
57
57
  policy_violation: "policy_violation",
58
58
  policy_in_use: "policy_in_use",
59
59
  account_limit_exceeded: "account_limit_exceeded",
60
+ network_not_tradable: "network_not_tradable",
61
+ guest_permission_denied: "guest_permission_denied",
62
+ guest_region_forbidden: "guest_region_forbidden",
63
+ guest_transaction_limit: "guest_transaction_limit",
64
+ guest_transaction_count: "guest_transaction_count",
65
+ phone_number_verification_expired: "phone_number_verification_expired",
60
66
  } as const;
61
67
 
62
68
  /**
@@ -143,6 +149,26 @@ Account names are guaranteed to be unique across all Smart Accounts in the devel
143
149
  updatedAt?: string;
144
150
  }
145
151
 
152
+ /**
153
+ * The network the user operation is for.
154
+ */
155
+ export type EvmUserOperationNetwork =
156
+ (typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];
157
+
158
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
159
+ export const EvmUserOperationNetwork = {
160
+ "base-sepolia": "base-sepolia",
161
+ base: "base",
162
+ arbitrum: "arbitrum",
163
+ optimism: "optimism",
164
+ zora: "zora",
165
+ polygon: "polygon",
166
+ bnb: "bnb",
167
+ avalanche: "avalanche",
168
+ ethereum: "ethereum",
169
+ "ethereum-sepolia": "ethereum-sepolia",
170
+ } as const;
171
+
146
172
  export interface EvmCall {
147
173
  /**
148
174
  * The address the call is directed to.
@@ -159,16 +185,24 @@ export interface EvmCall {
159
185
  }
160
186
 
161
187
  /**
162
- * The network the user operation is for.
188
+ * The revert data if the user operation has reverted.
163
189
  */
164
- export type EvmUserOperationNetwork =
165
- (typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];
190
+ export interface UserOperationReceiptRevert {
191
+ /**
192
+ * The 0x-prefixed raw hex string.
193
+ * @pattern ^0x[0-9a-fA-F]*$
194
+ */
195
+ data: string;
196
+ /** Human-readable revert reason if able to decode. */
197
+ message: string;
198
+ }
166
199
 
167
- // eslint-disable-next-line @typescript-eslint/no-redeclare
168
- export const EvmUserOperationNetwork = {
169
- "base-sepolia": "base-sepolia",
170
- base: "base",
171
- } as const;
200
+ /**
201
+ * The receipt that contains information about the execution of user operation.
202
+ */
203
+ export interface UserOperationReceipt {
204
+ revert?: UserOperationReceiptRevert;
205
+ }
172
206
 
173
207
  /**
174
208
  * The status of the user operation.
@@ -187,7 +221,6 @@ export const EvmUserOperationStatus = {
187
221
  } as const;
188
222
 
189
223
  export interface EvmUserOperation {
190
- /** The network the user operation is for. */
191
224
  network: EvmUserOperationNetwork;
192
225
  /**
193
226
  * The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
@@ -203,6 +236,42 @@ export interface EvmUserOperation {
203
236
  * @pattern ^0x[0-9a-fA-F]{64}$|^$
204
237
  */
205
238
  transactionHash?: string;
239
+ /** The list of receipts associated with the user operation. */
240
+ receipts?: UserOperationReceipt[];
241
+ }
242
+
243
+ export interface CreateSpendPermissionRequest {
244
+ /** The network of the spend permission. */
245
+ network: string;
246
+ /**
247
+ * Smart account this spend permission is valid for.
248
+ * @pattern ^0x[a-fA-F0-9]{40}$
249
+ */
250
+ account: string;
251
+ /**
252
+ * Entity that can spend account's tokens.
253
+ * @pattern ^0x[a-fA-F0-9]{40}$
254
+ */
255
+ spender: string;
256
+ /**
257
+ * Token address (ERC-7528 native token address or ERC-20 contract).
258
+ * @pattern ^0x[a-fA-F0-9]{40}$
259
+ */
260
+ token: string;
261
+ /** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
262
+ allowance: string;
263
+ /** Time duration for resetting used allowance on a recurring basis (seconds). */
264
+ period: string;
265
+ /** The start time for this spend permission, in Unix seconds. */
266
+ start: string;
267
+ /** The expiration time for this spend permission, in Unix seconds. */
268
+ end: string;
269
+ /** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
270
+ salt?: string;
271
+ /** Arbitrary data to include in the permission. */
272
+ extraData?: string;
273
+ /** The paymaster URL of the spend permission. */
274
+ paymasterUrl?: string;
206
275
  }
207
276
 
208
277
  /**
@@ -609,7 +678,7 @@ export const EvmAddressCriterionOperator = {
609
678
  export interface EvmAddressCriterion {
610
679
  /** The type of criterion to use. This should be `evmAddress`. */
611
680
  type: EvmAddressCriterionType;
612
- /** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of 100 addresses per criterion. */
681
+ /** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of 300 addresses per criterion. */
613
682
  addresses: string[];
614
683
  /** The operator to use for the comparison. The transaction's `to` field will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
615
684
  operator: EvmAddressCriterionOperator;
@@ -1009,7 +1078,7 @@ export const EvmTypedAddressConditionOperator = {
1009
1078
  * A schema for specifying criterion for an address field of an EVM typed message. The address can be deeply nested within the typed data's message.
1010
1079
  */
1011
1080
  export interface EvmTypedAddressCondition {
1012
- /** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of 100 addresses per criterion. */
1081
+ /** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of 300 addresses per criterion. */
1013
1082
  addresses: string[];
1014
1083
  /** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
1015
1084
  operator: EvmTypedAddressConditionOperator;
@@ -1135,7 +1204,7 @@ export const SignEvmTypedDataVerifyingContractCriterionOperator = {
1135
1204
  export interface SignEvmTypedDataVerifyingContractCriterion {
1136
1205
  /** The type of criterion to use. This should be `evmTypedDataVerifyingContract`. */
1137
1206
  type: SignEvmTypedDataVerifyingContractCriterionType;
1138
- /** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of 100 addresses per criterion. */
1207
+ /** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of 300 addresses per criterion. */
1139
1208
  addresses: string[];
1140
1209
  /** The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
1141
1210
  operator: SignEvmTypedDataVerifyingContractCriterionOperator;
@@ -1485,6 +1554,147 @@ export interface SolanaTokenBalance {
1485
1554
  token: SolanaToken;
1486
1555
  }
1487
1556
 
1557
+ /**
1558
+ * The version of the x402 protocol.
1559
+ */
1560
+ export type X402Version = (typeof X402Version)[keyof typeof X402Version];
1561
+
1562
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1563
+ export const X402Version = {
1564
+ NUMBER_1: 1,
1565
+ } as const;
1566
+
1567
+ /**
1568
+ * The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
1569
+ */
1570
+ export type X402PaymentRequirementsScheme =
1571
+ (typeof X402PaymentRequirementsScheme)[keyof typeof X402PaymentRequirementsScheme];
1572
+
1573
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1574
+ export const X402PaymentRequirementsScheme = {
1575
+ exact: "exact",
1576
+ } as const;
1577
+
1578
+ /**
1579
+ * The network of the blockchain to send payment on.
1580
+ */
1581
+ export type X402PaymentRequirementsNetwork =
1582
+ (typeof X402PaymentRequirementsNetwork)[keyof typeof X402PaymentRequirementsNetwork];
1583
+
1584
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1585
+ export const X402PaymentRequirementsNetwork = {
1586
+ "base-sepolia": "base-sepolia",
1587
+ base: "base",
1588
+ } as const;
1589
+
1590
+ /**
1591
+ * The optional JSON schema describing the resource output.
1592
+ */
1593
+ export type X402PaymentRequirementsOutputSchema = { [key: string]: unknown };
1594
+
1595
+ /**
1596
+ * The optional additional scheme-specific payment info.
1597
+ */
1598
+ export type X402PaymentRequirementsExtra = { [key: string]: unknown };
1599
+
1600
+ /**
1601
+ * The x402 protocol payment requirements that the resource server expects the client's payment payload to meet.
1602
+ */
1603
+ export interface X402PaymentRequirements {
1604
+ /** The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`. */
1605
+ scheme: X402PaymentRequirementsScheme;
1606
+ /** The network of the blockchain to send payment on. */
1607
+ network: X402PaymentRequirementsNetwork;
1608
+ /** The maximum amount required to pay for the resource in atomic units of the payment asset. */
1609
+ maxAmountRequired: string;
1610
+ /** The URL of the resource to pay for. */
1611
+ resource: string;
1612
+ /** The description of the resource. */
1613
+ description: string;
1614
+ /** The MIME type of the resource response. */
1615
+ mimeType: string;
1616
+ /** The optional JSON schema describing the resource output. */
1617
+ outputSchema?: X402PaymentRequirementsOutputSchema;
1618
+ /**
1619
+ * The destination to pay value to.
1620
+
1621
+ For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.
1622
+
1623
+ For Solana-based networks, payTo will be a base58-encoded Solana address.
1624
+ * @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
1625
+ */
1626
+ payTo: string;
1627
+ /** The maximum time in seconds for the resource server to respond. */
1628
+ maxTimeoutSeconds: number;
1629
+ /**
1630
+ * The asset to pay with.
1631
+
1632
+ For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.
1633
+
1634
+ For Solana-based networks, the asset will be a base58-encoded Solana address.
1635
+ * @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
1636
+ */
1637
+ asset: string;
1638
+ /** The optional additional scheme-specific payment info. */
1639
+ extra?: X402PaymentRequirementsExtra;
1640
+ }
1641
+
1642
+ /**
1643
+ * Communication protocol (e.g., "http", "mcp").
1644
+ */
1645
+ export type X402DiscoveryResourceType =
1646
+ (typeof X402DiscoveryResourceType)[keyof typeof X402DiscoveryResourceType];
1647
+
1648
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1649
+ export const X402DiscoveryResourceType = {
1650
+ http: "http",
1651
+ } as const;
1652
+
1653
+ /**
1654
+ * Additional metadata as a JSON object.
1655
+ */
1656
+ export type X402DiscoveryResourceMetadata = { [key: string]: unknown };
1657
+
1658
+ /**
1659
+ * A single discovered x402 resource.
1660
+ */
1661
+ export interface X402DiscoveryResource {
1662
+ /** The normalized resource identifier. */
1663
+ resource: string;
1664
+ /** Communication protocol (e.g., "http", "mcp"). */
1665
+ type: X402DiscoveryResourceType;
1666
+ x402Version: X402Version;
1667
+ /** Payment requirements as an array of JSON objects. */
1668
+ accepts?: X402PaymentRequirements[];
1669
+ /** Timestamp of the last update. */
1670
+ lastUpdated: string;
1671
+ /** Additional metadata as a JSON object. */
1672
+ metadata?: X402DiscoveryResourceMetadata;
1673
+ }
1674
+
1675
+ /**
1676
+ * Pagination information for the response.
1677
+ */
1678
+ export type X402DiscoveryResourcesResponsePagination = {
1679
+ /** The number of discovered x402 resources to return per page. */
1680
+ limit?: number;
1681
+ /** The offset of the first discovered x402 resource to return. */
1682
+ offset?: number;
1683
+ /** The total number of discovered x402 resources. */
1684
+ total?: number;
1685
+ };
1686
+
1687
+ /**
1688
+ * Response containing discovered x402 resources.
1689
+ */
1690
+ export interface X402DiscoveryResourcesResponse {
1691
+ x402Version: X402Version;
1692
+ /** List of discovered x402 resources. */
1693
+ items: X402DiscoveryResource[];
1694
+ /** Pagination information for the response. */
1695
+ pagination: X402DiscoveryResourcesResponsePagination;
1696
+ }
1697
+
1488
1698
  /**
1489
1699
  * The action of the payment method.
1490
1700
  */
@@ -1715,6 +1925,110 @@ export interface Transfer {
1715
1925
  transactionHash?: string;
1716
1926
  }
1717
1927
 
1928
+ /**
1929
+ * The type of payment method to be used to complete the order.
1930
+ */
1931
+ export type OnrampPaymentMethodTypeId =
1932
+ (typeof OnrampPaymentMethodTypeId)[keyof typeof OnrampPaymentMethodTypeId];
1933
+
1934
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1935
+ export const OnrampPaymentMethodTypeId = {
1936
+ GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
1937
+ } as const;
1938
+
1939
+ /**
1940
+ * The type of fee.
1941
+ */
1942
+ export type OnrampOrderFeeType = (typeof OnrampOrderFeeType)[keyof typeof OnrampOrderFeeType];
1943
+
1944
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1945
+ export const OnrampOrderFeeType = {
1946
+ FEE_TYPE_NETWORK: "FEE_TYPE_NETWORK",
1947
+ FEE_TYPE_EXCHANGE: "FEE_TYPE_EXCHANGE",
1948
+ } as const;
1949
+
1950
+ /**
1951
+ * A fee associated with an order.
1952
+ */
1953
+ export interface OnrampOrderFee {
1954
+ /** The type of fee. */
1955
+ type: OnrampOrderFeeType;
1956
+ /** The amount of the fee. */
1957
+ amount: string;
1958
+ /** The currency of the fee. */
1959
+ currency: string;
1960
+ }
1961
+
1962
+ /**
1963
+ * The status of an onramp order.
1964
+ */
1965
+ export type OnrampOrderStatus = (typeof OnrampOrderStatus)[keyof typeof OnrampOrderStatus];
1966
+
1967
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1968
+ export const OnrampOrderStatus = {
1969
+ ONRAMP_ORDER_STATUS_PENDING_AUTH: "ONRAMP_ORDER_STATUS_PENDING_AUTH",
1970
+ ONRAMP_ORDER_STATUS_PENDING_PAYMENT: "ONRAMP_ORDER_STATUS_PENDING_PAYMENT",
1971
+ ONRAMP_ORDER_STATUS_PROCESSING: "ONRAMP_ORDER_STATUS_PROCESSING",
1972
+ ONRAMP_ORDER_STATUS_COMPLETED: "ONRAMP_ORDER_STATUS_COMPLETED",
1973
+ ONRAMP_ORDER_STATUS_FAILED: "ONRAMP_ORDER_STATUS_FAILED",
1974
+ } as const;
1975
+
1976
+ /**
1977
+ * An Onramp order.
1978
+ */
1979
+ export interface OnrampOrder {
1980
+ /** The ID of the onramp order. */
1981
+ orderId: string;
1982
+ /** The total amount of fiat to be paid. */
1983
+ paymentTotal: string;
1984
+ /** The amount of fiat to be converted to crypto. */
1985
+ paymentSubtotal: unknown;
1986
+ /** The fiat currency to be converted to crypto. */
1987
+ paymentCurrency: string;
1988
+ paymentMethod: OnrampPaymentMethodTypeId;
1989
+ /** The amount of crypto to be purchased. */
1990
+ purchaseAmount: string;
1991
+ /** The crypto currency to be purchased. */
1992
+ purchaseCurrency: string;
1993
+ /** The fees associated with the order. */
1994
+ fees: OnrampOrderFee[];
1995
+ /** The exchange rate used to convert fiat to crypto. */
1996
+ exchangeRate: string;
1997
+ /** The destination address to send the crypto to. */
1998
+ destinationAddress: string;
1999
+ /** The network to send the crypto on. */
2000
+ destinationNetwork: string;
2001
+ status: OnrampOrderStatus;
2002
+ /** The transaction hash of the order (only available once crypto has been sent). */
2003
+ txHash?: string;
2004
+ /** The date and time the order was created. */
2005
+ createdAt: string;
2006
+ /** The date and time the order was last updated. */
2007
+ updatedAt: string;
2008
+ }
2009
+
2010
+ /**
2011
+ * The type of payment link.
2012
+ */
2013
+ export type OnrampPaymentLinkType =
2014
+ (typeof OnrampPaymentLinkType)[keyof typeof OnrampPaymentLinkType];
2015
+
2016
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
2017
+ export const OnrampPaymentLinkType = {
2018
+ PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON: "PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON",
2019
+ } as const;
2020
+
2021
+ /**
2022
+ * A payment link to pay for an order.
2023
+
2024
+ Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for details on how to integrate with the different payment link types.
2025
+ */
2026
+ export interface OnrampPaymentLink {
2027
+ /** The URL to the hosted widget the user should be redirected to, append your own redirect_url query parameter to this URL to ensure the user is redirected back to your app after the widget completes. */
2028
+ url: string;
2029
+ paymentLinkType: OnrampPaymentLinkType;
2030
+ }
2031
+
1718
2032
  /**
1719
2033
  * Internal server error.
1720
2034
  */
@@ -1745,6 +2059,16 @@ export type IdempotencyErrorResponse = Error;
1745
2059
  */
1746
2060
  export type AlreadyExistsErrorResponse = Error;
1747
2061
 
2062
+ /**
2063
+ * Unauthorized.
2064
+ */
2065
+ export type UnauthorizedErrorResponse = Error;
2066
+
2067
+ /**
2068
+ * Rate limit exceeded.
2069
+ */
2070
+ export type RateLimitExceededResponse = Error;
2071
+
1748
2072
  /**
1749
2073
  * A JWT signed using your Wallet Secret, encoded in base64. Refer to the
1750
2074
  [Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
@@ -1947,21 +2271,8 @@ Account names must be unique across all EVM smart accounts in the developer's CD
1947
2271
  name?: string;
1948
2272
  };
1949
2273
 
1950
- /**
1951
- * The network to prepare the user operation for.
1952
- */
1953
- export type PrepareUserOperationBodyNetwork =
1954
- (typeof PrepareUserOperationBodyNetwork)[keyof typeof PrepareUserOperationBodyNetwork];
1955
-
1956
- // eslint-disable-next-line @typescript-eslint/no-redeclare
1957
- export const PrepareUserOperationBodyNetwork = {
1958
- "base-sepolia": "base-sepolia",
1959
- base: "base",
1960
- } as const;
1961
-
1962
2274
  export type PrepareUserOperationBody = {
1963
- /** The network to prepare the user operation for. */
1964
- network: PrepareUserOperationBodyNetwork;
2275
+ network: EvmUserOperationNetwork;
1965
2276
  /** The list of calls to make from the Smart Account. */
1966
2277
  calls: EvmCall[];
1967
2278
  /** The URL of the paymaster to use for the user operation. */
@@ -2321,6 +2632,22 @@ export type ListSolanaTokenBalances200AllOf = {
2321
2632
 
2322
2633
  export type ListSolanaTokenBalances200 = ListSolanaTokenBalances200AllOf & ListResponse;
2323
2634
 
2635
+ export type ListX402DiscoveryResourcesParams = {
2636
+ /**
2637
+ * Filter by protocol type (e.g., "http", "mcp").
2638
+ Currently, the only supported protocol type is "http".
2639
+ */
2640
+ type?: string;
2641
+ /**
2642
+ * The number of discovered x402 resources to return per page.
2643
+ */
2644
+ limit?: number;
2645
+ /**
2646
+ * The offset of the first discovered x402 resource to return.
2647
+ */
2648
+ offset?: number;
2649
+ };
2650
+
2324
2651
  export type GetCryptoRailsParams = {
2325
2652
  /**
2326
2653
  * Comma separated list of networks to filter the rails by.
@@ -2368,3 +2695,50 @@ export type CreatePaymentTransferQuoteBody = {
2368
2695
  export type CreatePaymentTransferQuote201 = {
2369
2696
  transfer: Transfer;
2370
2697
  };
2698
+
2699
+ export type CreateOnrampOrderBody = {
2700
+ /** The timestamp of the time the user acknowledged they are accepting the Coinbase service agreement (https://www.coinbase.com/legal/guest-checkout/us) by using Coinbase Onramp. */
2701
+ agreementAcceptedAt: string;
2702
+ /** The address the purchased crypto will be sent to. */
2703
+ destinationAddress: string;
2704
+ /** The name of the crypto network the purchased currency will be sent on.
2705
+
2706
+ Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported networks for your user's location. */
2707
+ destinationNetwork: string;
2708
+ /** The email address of the user requesting the onramp transaction. */
2709
+ email: string;
2710
+ /** If true, this API will return a quote without creating any transaction. */
2711
+ isQuote?: boolean;
2712
+ /** Optional partner order reference ID. */
2713
+ partnerOrderRef?: string;
2714
+ /** A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with “sandbox-” to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.
2715
+
2716
+ This value can be used with with [Onramp User Transactions API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-onramp-transactions-by-id) to retrieve all transactions created by the user. */
2717
+ partnerUserRef: string;
2718
+ /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency. */
2719
+ paymentAmount?: string;
2720
+ /** The fiat currency to be converted to crypto. */
2721
+ paymentCurrency: string;
2722
+ paymentMethod: OnrampPaymentMethodTypeId;
2723
+ /** The phone number of the user requesting the onramp transaction in E.164 format. This phone number must be verified by your app (via OTP) before being used with the Onramp API.
2724
+
2725
+ Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for more details on phone number verification requirements and best practices. */
2726
+ phoneNumber: string;
2727
+ /** Timestamp of when the user's phone number was verified via OTP. User phone number must be verified every 60 days. If this timestamp is older than 60 days, an error will be returned. */
2728
+ phoneNumberVerifiedAt: string;
2729
+ /** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
2730
+ purchaseAmount?: string;
2731
+ /** The ticker (e.g. `BTC`, `USDC`) or the UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`) of crypto asset to be purchased.
2732
+
2733
+ Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported purchase currencies for your user's location. */
2734
+ purchaseCurrency: string;
2735
+ };
2736
+
2737
+ export type CreateOnrampOrder201 = {
2738
+ order: OnrampOrder;
2739
+ paymentLink?: OnrampPaymentLink;
2740
+ };
2741
+
2742
+ export type GetOnrampOrderById200 = {
2743
+ order: OnrampOrder;
2744
+ };
@@ -9,6 +9,7 @@ import { faker } from "@faker-js/faker";
9
9
 
10
10
  import { HttpResponse, delay, http } from "msw";
11
11
 
12
+ import { EvmUserOperationNetwork } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
12
13
  import type {
13
14
  EvmSmartAccount,
14
15
  EvmUserOperation,
@@ -172,7 +173,7 @@ export const getUpdateEvmSmartAccountResponseMock = (
172
173
  export const getPrepareUserOperationResponseMock = (
173
174
  overrideResponse: Partial<EvmUserOperation> = {},
174
175
  ): EvmUserOperation => ({
175
- network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
176
+ network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
176
177
  userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
177
178
  calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
178
179
  to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
@@ -191,13 +192,22 @@ export const getPrepareUserOperationResponseMock = (
191
192
  faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
192
193
  undefined,
193
194
  ]),
195
+ receipts: faker.helpers.arrayElement([
196
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
197
+ revert: faker.helpers.arrayElement([
198
+ { data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
199
+ undefined,
200
+ ]),
201
+ })),
202
+ undefined,
203
+ ]),
194
204
  ...overrideResponse,
195
205
  });
196
206
 
197
207
  export const getGetUserOperationResponseMock = (
198
208
  overrideResponse: Partial<EvmUserOperation> = {},
199
209
  ): EvmUserOperation => ({
200
- network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
210
+ network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
201
211
  userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
202
212
  calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
203
213
  to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
@@ -216,13 +226,22 @@ export const getGetUserOperationResponseMock = (
216
226
  faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
217
227
  undefined,
218
228
  ]),
229
+ receipts: faker.helpers.arrayElement([
230
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
231
+ revert: faker.helpers.arrayElement([
232
+ { data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
233
+ undefined,
234
+ ]),
235
+ })),
236
+ undefined,
237
+ ]),
219
238
  ...overrideResponse,
220
239
  });
221
240
 
222
241
  export const getSendUserOperationResponseMock = (
223
242
  overrideResponse: Partial<EvmUserOperation> = {},
224
243
  ): EvmUserOperation => ({
225
- network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
244
+ network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
226
245
  userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
227
246
  calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
228
247
  to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
@@ -241,6 +260,49 @@ export const getSendUserOperationResponseMock = (
241
260
  faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
242
261
  undefined,
243
262
  ]),
263
+ receipts: faker.helpers.arrayElement([
264
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
265
+ revert: faker.helpers.arrayElement([
266
+ { data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
267
+ undefined,
268
+ ]),
269
+ })),
270
+ undefined,
271
+ ]),
272
+ ...overrideResponse,
273
+ });
274
+
275
+ export const getCreateSpendPermissionResponseMock = (
276
+ overrideResponse: Partial<EvmUserOperation> = {},
277
+ ): EvmUserOperation => ({
278
+ network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
279
+ userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
280
+ calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
281
+ to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
282
+ value: faker.string.alpha(20),
283
+ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
284
+ })),
285
+ status: faker.helpers.arrayElement([
286
+ "pending",
287
+ "signed",
288
+ "broadcast",
289
+ "complete",
290
+ "dropped",
291
+ "failed",
292
+ ] as const),
293
+ transactionHash: faker.helpers.arrayElement([
294
+ faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
295
+ undefined,
296
+ ]),
297
+ receipts: faker.helpers.arrayElement([
298
+ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
299
+ revert: faker.helpers.arrayElement([
300
+ { data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
301
+ undefined,
302
+ ]),
303
+ })),
304
+ undefined,
305
+ ]),
244
306
  ...overrideResponse,
245
307
  });
246
308
 
@@ -430,6 +492,29 @@ export const getSendUserOperationMockHandler = (
430
492
  },
431
493
  );
432
494
  };
495
+
496
+ export const getCreateSpendPermissionMockHandler = (
497
+ overrideResponse?:
498
+ | EvmUserOperation
499
+ | ((
500
+ info: Parameters<Parameters<typeof http.post>[1]>[0],
501
+ ) => Promise<EvmUserOperation> | EvmUserOperation),
502
+ ) => {
503
+ return http.post("*/v2/evm/smart-accounts/:address/spend-permissions", async info => {
504
+ await delay(0);
505
+
506
+ return new HttpResponse(
507
+ JSON.stringify(
508
+ overrideResponse !== undefined
509
+ ? typeof overrideResponse === "function"
510
+ ? await overrideResponse(info)
511
+ : overrideResponse
512
+ : getCreateSpendPermissionResponseMock(),
513
+ ),
514
+ { status: 200, headers: { "Content-Type": "application/json" } },
515
+ );
516
+ });
517
+ };
433
518
  export const getEvmSmartAccountsMock = () => [
434
519
  getListEvmSmartAccountsMockHandler(),
435
520
  getCreateEvmSmartAccountMockHandler(),
@@ -439,4 +524,5 @@ export const getEvmSmartAccountsMock = () => [
439
524
  getPrepareUserOperationMockHandler(),
440
525
  getGetUserOperationMockHandler(),
441
526
  getSendUserOperationMockHandler(),
527
+ getCreateSpendPermissionMockHandler(),
442
528
  ];