@wirexapp/wpay-baas-sdk 0.1.6 → 0.1.8

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 (343) hide show
  1. package/README.md +32 -2
  2. package/dist/chunk-D2YHFKQI.js +1364 -0
  3. package/dist/chunk-D2YHFKQI.js.map +1 -0
  4. package/dist/chunk-ITBPDXHK.js +5064 -0
  5. package/dist/chunk-ITBPDXHK.js.map +1 -0
  6. package/dist/chunk-YXNNTBO5.js +304 -0
  7. package/dist/chunk-YXNNTBO5.js.map +1 -0
  8. package/dist/core/index.d.ts +32 -8
  9. package/dist/core/index.js +2 -4
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/crypto.module-BsI4pLhf.d.ts +203 -0
  12. package/dist/{core/errors.d.ts → errors-5LpyK95R.d.ts} +10 -9
  13. package/dist/index-3P-X9tLg.d.ts +1715 -0
  14. package/dist/index.d.ts +33 -14
  15. package/dist/index.js +111 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/modules/api/index.d.ts +4 -7
  18. package/dist/modules/api/index.js +3 -4
  19. package/dist/modules/api/index.js.map +1 -1
  20. package/dist/modules/crypto/index.d.ts +214 -9
  21. package/dist/modules/crypto/index.js +4 -7
  22. package/dist/modules/crypto/index.js.map +1 -1
  23. package/dist/types-_RME4STd.d.ts +179 -0
  24. package/dist/{modules/crypto/interfaces/crypto.interface.d.ts → withdrawal.api-CmRHIoyc.d.ts} +20 -11
  25. package/package.json +37 -9
  26. package/dist/abi/accounts.abi.d.ts +0 -405
  27. package/dist/abi/accounts.abi.d.ts.map +0 -1
  28. package/dist/abi/accounts.abi.js +0 -351
  29. package/dist/abi/accounts.abi.js.map +0 -1
  30. package/dist/abi/contractRegistry.abi.d.ts +0 -220
  31. package/dist/abi/contractRegistry.abi.d.ts.map +0 -1
  32. package/dist/abi/contractRegistry.abi.js +0 -287
  33. package/dist/abi/contractRegistry.abi.js.map +0 -1
  34. package/dist/abi/corporateAccounts.abi.d.ts +0 -42
  35. package/dist/abi/corporateAccounts.abi.d.ts.map +0 -1
  36. package/dist/abi/corporateAccounts.abi.js +0 -34
  37. package/dist/abi/corporateAccounts.abi.js.map +0 -1
  38. package/dist/abi/erc20.abi.d.ts +0 -253
  39. package/dist/abi/erc20.abi.d.ts.map +0 -1
  40. package/dist/abi/erc20.abi.js +0 -98
  41. package/dist/abi/erc20.abi.js.map +0 -1
  42. package/dist/abi/executionDelayPolicy.abi.d.ts +0 -378
  43. package/dist/abi/executionDelayPolicy.abi.d.ts.map +0 -1
  44. package/dist/abi/executionDelayPolicy.abi.js +0 -502
  45. package/dist/abi/executionDelayPolicy.abi.js.map +0 -1
  46. package/dist/abi/fundsManagement.abi.d.ts +0 -54
  47. package/dist/abi/fundsManagement.abi.d.ts.map +0 -1
  48. package/dist/abi/fundsManagement.abi.js +0 -361
  49. package/dist/abi/fundsManagement.abi.js.map +0 -1
  50. package/dist/abi/index.d.ts +0 -11
  51. package/dist/abi/index.d.ts.map +0 -1
  52. package/dist/abi/index.js +0 -11
  53. package/dist/abi/index.js.map +0 -1
  54. package/dist/abi/signer.abi.d.ts +0 -20
  55. package/dist/abi/signer.abi.d.ts.map +0 -1
  56. package/dist/abi/signer.abi.js +0 -13
  57. package/dist/abi/signer.abi.js.map +0 -1
  58. package/dist/abi/synthetic.abi.d.ts +0 -2459
  59. package/dist/abi/synthetic.abi.d.ts.map +0 -1
  60. package/dist/abi/synthetic.abi.js +0 -1739
  61. package/dist/abi/synthetic.abi.js.map +0 -1
  62. package/dist/abi/tokenRegistry.abi.d.ts +0 -209
  63. package/dist/abi/tokenRegistry.abi.d.ts.map +0 -1
  64. package/dist/abi/tokenRegistry.abi.js +0 -117
  65. package/dist/abi/tokenRegistry.abi.js.map +0 -1
  66. package/dist/abi/yieldCalculator.abi.d.ts +0 -327
  67. package/dist/abi/yieldCalculator.abi.d.ts.map +0 -1
  68. package/dist/abi/yieldCalculator.abi.js +0 -2
  69. package/dist/abi/yieldCalculator.abi.js.map +0 -1
  70. package/dist/client.d.ts +0 -23
  71. package/dist/client.d.ts.map +0 -1
  72. package/dist/client.js +0 -98
  73. package/dist/client.js.map +0 -1
  74. package/dist/core/config/config.service.d.ts +0 -19
  75. package/dist/core/config/config.service.d.ts.map +0 -1
  76. package/dist/core/config/config.service.js +0 -83
  77. package/dist/core/config/config.service.js.map +0 -1
  78. package/dist/core/config/index.d.ts +0 -4
  79. package/dist/core/config/index.d.ts.map +0 -1
  80. package/dist/core/config/index.js +0 -3
  81. package/dist/core/config/index.js.map +0 -1
  82. package/dist/core/config/types.d.ts +0 -40
  83. package/dist/core/config/types.d.ts.map +0 -1
  84. package/dist/core/config/types.js +0 -5
  85. package/dist/core/config/types.js.map +0 -1
  86. package/dist/core/errors.d.ts.map +0 -1
  87. package/dist/core/errors.js +0 -63
  88. package/dist/core/errors.js.map +0 -1
  89. package/dist/core/index.d.ts.map +0 -1
  90. package/dist/core/internal/http-client.d.ts +0 -40
  91. package/dist/core/internal/http-client.d.ts.map +0 -1
  92. package/dist/core/internal/http-client.js +0 -113
  93. package/dist/core/internal/http-client.js.map +0 -1
  94. package/dist/core/types.d.ts +0 -93
  95. package/dist/core/types.d.ts.map +0 -1
  96. package/dist/core/types.js +0 -13
  97. package/dist/core/types.js.map +0 -1
  98. package/dist/index.d.ts.map +0 -1
  99. package/dist/modules/api/api.module.d.ts +0 -21
  100. package/dist/modules/api/api.module.d.ts.map +0 -1
  101. package/dist/modules/api/api.module.js +0 -47
  102. package/dist/modules/api/api.module.js.map +0 -1
  103. package/dist/modules/api/baas/activity/activity.service.d.ts +0 -34
  104. package/dist/modules/api/baas/activity/activity.service.d.ts.map +0 -1
  105. package/dist/modules/api/baas/activity/activity.service.js +0 -61
  106. package/dist/modules/api/baas/activity/activity.service.js.map +0 -1
  107. package/dist/modules/api/baas/activity/index.d.ts +0 -3
  108. package/dist/modules/api/baas/activity/index.d.ts.map +0 -1
  109. package/dist/modules/api/baas/activity/index.js +0 -2
  110. package/dist/modules/api/baas/activity/index.js.map +0 -1
  111. package/dist/modules/api/baas/activity/types.d.ts +0 -166
  112. package/dist/modules/api/baas/activity/types.d.ts.map +0 -1
  113. package/dist/modules/api/baas/activity/types.js +0 -5
  114. package/dist/modules/api/baas/activity/types.js.map +0 -1
  115. package/dist/modules/api/baas/baas.module.d.ts +0 -44
  116. package/dist/modules/api/baas/baas.module.d.ts.map +0 -1
  117. package/dist/modules/api/baas/baas.module.js +0 -156
  118. package/dist/modules/api/baas/baas.module.js.map +0 -1
  119. package/dist/modules/api/baas/bank/bank.service.d.ts +0 -42
  120. package/dist/modules/api/baas/bank/bank.service.d.ts.map +0 -1
  121. package/dist/modules/api/baas/bank/bank.service.js +0 -75
  122. package/dist/modules/api/baas/bank/bank.service.js.map +0 -1
  123. package/dist/modules/api/baas/bank/index.d.ts +0 -3
  124. package/dist/modules/api/baas/bank/index.d.ts.map +0 -1
  125. package/dist/modules/api/baas/bank/index.js +0 -2
  126. package/dist/modules/api/baas/bank/index.js.map +0 -1
  127. package/dist/modules/api/baas/bank/types.d.ts +0 -116
  128. package/dist/modules/api/baas/bank/types.d.ts.map +0 -1
  129. package/dist/modules/api/baas/bank/types.js +0 -5
  130. package/dist/modules/api/baas/bank/types.js.map +0 -1
  131. package/dist/modules/api/baas/cards/cards.service.d.ts +0 -118
  132. package/dist/modules/api/baas/cards/cards.service.d.ts.map +0 -1
  133. package/dist/modules/api/baas/cards/cards.service.js +0 -254
  134. package/dist/modules/api/baas/cards/cards.service.js.map +0 -1
  135. package/dist/modules/api/baas/cards/index.d.ts +0 -3
  136. package/dist/modules/api/baas/cards/index.d.ts.map +0 -1
  137. package/dist/modules/api/baas/cards/index.js +0 -2
  138. package/dist/modules/api/baas/cards/index.js.map +0 -1
  139. package/dist/modules/api/baas/cards/types.d.ts +0 -249
  140. package/dist/modules/api/baas/cards/types.d.ts.map +0 -1
  141. package/dist/modules/api/baas/cards/types.js +0 -5
  142. package/dist/modules/api/baas/cards/types.js.map +0 -1
  143. package/dist/modules/api/baas/config/config.service.d.ts +0 -21
  144. package/dist/modules/api/baas/config/config.service.d.ts.map +0 -1
  145. package/dist/modules/api/baas/config/config.service.js +0 -22
  146. package/dist/modules/api/baas/config/config.service.js.map +0 -1
  147. package/dist/modules/api/baas/config/index.d.ts +0 -3
  148. package/dist/modules/api/baas/config/index.d.ts.map +0 -1
  149. package/dist/modules/api/baas/config/index.js +0 -2
  150. package/dist/modules/api/baas/config/index.js.map +0 -1
  151. package/dist/modules/api/baas/config/types.d.ts +0 -42
  152. package/dist/modules/api/baas/config/types.d.ts.map +0 -1
  153. package/dist/modules/api/baas/config/types.js +0 -2
  154. package/dist/modules/api/baas/config/types.js.map +0 -1
  155. package/dist/modules/api/baas/confirmation/confirmation.service.d.ts +0 -30
  156. package/dist/modules/api/baas/confirmation/confirmation.service.d.ts.map +0 -1
  157. package/dist/modules/api/baas/confirmation/confirmation.service.js +0 -39
  158. package/dist/modules/api/baas/confirmation/confirmation.service.js.map +0 -1
  159. package/dist/modules/api/baas/confirmation/index.d.ts +0 -3
  160. package/dist/modules/api/baas/confirmation/index.d.ts.map +0 -1
  161. package/dist/modules/api/baas/confirmation/index.js +0 -2
  162. package/dist/modules/api/baas/confirmation/index.js.map +0 -1
  163. package/dist/modules/api/baas/confirmation/types.d.ts +0 -30
  164. package/dist/modules/api/baas/confirmation/types.d.ts.map +0 -1
  165. package/dist/modules/api/baas/confirmation/types.js +0 -5
  166. package/dist/modules/api/baas/confirmation/types.js.map +0 -1
  167. package/dist/modules/api/baas/index.d.ts +0 -13
  168. package/dist/modules/api/baas/index.d.ts.map +0 -1
  169. package/dist/modules/api/baas/index.js +0 -13
  170. package/dist/modules/api/baas/index.js.map +0 -1
  171. package/dist/modules/api/baas/rates/index.d.ts +0 -3
  172. package/dist/modules/api/baas/rates/index.d.ts.map +0 -1
  173. package/dist/modules/api/baas/rates/index.js +0 -2
  174. package/dist/modules/api/baas/rates/index.js.map +0 -1
  175. package/dist/modules/api/baas/rates/rates.service.d.ts +0 -21
  176. package/dist/modules/api/baas/rates/rates.service.d.ts.map +0 -1
  177. package/dist/modules/api/baas/rates/rates.service.js +0 -25
  178. package/dist/modules/api/baas/rates/rates.service.js.map +0 -1
  179. package/dist/modules/api/baas/rates/types.d.ts +0 -12
  180. package/dist/modules/api/baas/rates/types.d.ts.map +0 -1
  181. package/dist/modules/api/baas/rates/types.js +0 -2
  182. package/dist/modules/api/baas/rates/types.js.map +0 -1
  183. package/dist/modules/api/baas/recipients/index.d.ts +0 -3
  184. package/dist/modules/api/baas/recipients/index.d.ts.map +0 -1
  185. package/dist/modules/api/baas/recipients/index.js +0 -2
  186. package/dist/modules/api/baas/recipients/index.js.map +0 -1
  187. package/dist/modules/api/baas/recipients/recipients.service.d.ts +0 -74
  188. package/dist/modules/api/baas/recipients/recipients.service.d.ts.map +0 -1
  189. package/dist/modules/api/baas/recipients/recipients.service.js +0 -190
  190. package/dist/modules/api/baas/recipients/recipients.service.js.map +0 -1
  191. package/dist/modules/api/baas/recipients/types.d.ts +0 -208
  192. package/dist/modules/api/baas/recipients/types.d.ts.map +0 -1
  193. package/dist/modules/api/baas/recipients/types.js +0 -5
  194. package/dist/modules/api/baas/recipients/types.js.map +0 -1
  195. package/dist/modules/api/baas/swap/index.d.ts +0 -3
  196. package/dist/modules/api/baas/swap/index.d.ts.map +0 -1
  197. package/dist/modules/api/baas/swap/index.js +0 -2
  198. package/dist/modules/api/baas/swap/index.js.map +0 -1
  199. package/dist/modules/api/baas/swap/swap.service.d.ts +0 -28
  200. package/dist/modules/api/baas/swap/swap.service.d.ts.map +0 -1
  201. package/dist/modules/api/baas/swap/swap.service.js +0 -32
  202. package/dist/modules/api/baas/swap/swap.service.js.map +0 -1
  203. package/dist/modules/api/baas/swap/types.d.ts +0 -56
  204. package/dist/modules/api/baas/swap/types.d.ts.map +0 -1
  205. package/dist/modules/api/baas/swap/types.js +0 -6
  206. package/dist/modules/api/baas/swap/types.js.map +0 -1
  207. package/dist/modules/api/baas/token/index.d.ts +0 -3
  208. package/dist/modules/api/baas/token/index.d.ts.map +0 -1
  209. package/dist/modules/api/baas/token/index.js +0 -2
  210. package/dist/modules/api/baas/token/index.js.map +0 -1
  211. package/dist/modules/api/baas/token/token.service.d.ts +0 -21
  212. package/dist/modules/api/baas/token/token.service.d.ts.map +0 -1
  213. package/dist/modules/api/baas/token/token.service.js +0 -22
  214. package/dist/modules/api/baas/token/token.service.js.map +0 -1
  215. package/dist/modules/api/baas/token/types.d.ts +0 -12
  216. package/dist/modules/api/baas/token/types.d.ts.map +0 -1
  217. package/dist/modules/api/baas/token/types.js +0 -2
  218. package/dist/modules/api/baas/token/types.js.map +0 -1
  219. package/dist/modules/api/baas/user/index.d.ts +0 -3
  220. package/dist/modules/api/baas/user/index.d.ts.map +0 -1
  221. package/dist/modules/api/baas/user/index.js +0 -2
  222. package/dist/modules/api/baas/user/index.js.map +0 -1
  223. package/dist/modules/api/baas/user/types.d.ts +0 -145
  224. package/dist/modules/api/baas/user/types.d.ts.map +0 -1
  225. package/dist/modules/api/baas/user/types.js +0 -5
  226. package/dist/modules/api/baas/user/types.js.map +0 -1
  227. package/dist/modules/api/baas/user/user.service.d.ts +0 -73
  228. package/dist/modules/api/baas/user/user.service.d.ts.map +0 -1
  229. package/dist/modules/api/baas/user/user.service.js +0 -140
  230. package/dist/modules/api/baas/user/user.service.js.map +0 -1
  231. package/dist/modules/api/baas/wallet/index.d.ts +0 -3
  232. package/dist/modules/api/baas/wallet/index.d.ts.map +0 -1
  233. package/dist/modules/api/baas/wallet/index.js +0 -2
  234. package/dist/modules/api/baas/wallet/index.js.map +0 -1
  235. package/dist/modules/api/baas/wallet/types.d.ts +0 -26
  236. package/dist/modules/api/baas/wallet/types.d.ts.map +0 -1
  237. package/dist/modules/api/baas/wallet/types.js +0 -5
  238. package/dist/modules/api/baas/wallet/types.js.map +0 -1
  239. package/dist/modules/api/baas/wallet/wallet.service.d.ts +0 -30
  240. package/dist/modules/api/baas/wallet/wallet.service.d.ts.map +0 -1
  241. package/dist/modules/api/baas/wallet/wallet.service.js +0 -43
  242. package/dist/modules/api/baas/wallet/wallet.service.js.map +0 -1
  243. package/dist/modules/api/index.d.ts.map +0 -1
  244. package/dist/modules/api/internal/endpoints/wallets.api.d.ts +0 -8
  245. package/dist/modules/api/internal/endpoints/wallets.api.d.ts.map +0 -1
  246. package/dist/modules/api/internal/endpoints/wallets.api.js +0 -9
  247. package/dist/modules/api/internal/endpoints/wallets.api.js.map +0 -1
  248. package/dist/modules/api/internal/endpoints/withdrawal.api.d.ts +0 -8
  249. package/dist/modules/api/internal/endpoints/withdrawal.api.d.ts.map +0 -1
  250. package/dist/modules/api/internal/endpoints/withdrawal.api.js +0 -10
  251. package/dist/modules/api/internal/endpoints/withdrawal.api.js.map +0 -1
  252. package/dist/modules/api/types/common.types.d.ts +0 -19
  253. package/dist/modules/api/types/common.types.d.ts.map +0 -1
  254. package/dist/modules/api/types/common.types.js +0 -2
  255. package/dist/modules/api/types/common.types.js.map +0 -1
  256. package/dist/modules/api/types/wallets.types.d.ts +0 -12
  257. package/dist/modules/api/types/wallets.types.d.ts.map +0 -1
  258. package/dist/modules/api/types/wallets.types.js +0 -2
  259. package/dist/modules/api/types/wallets.types.js.map +0 -1
  260. package/dist/modules/auth/auth.service.d.ts +0 -32
  261. package/dist/modules/auth/auth.service.d.ts.map +0 -1
  262. package/dist/modules/auth/auth.service.js +0 -182
  263. package/dist/modules/auth/auth.service.js.map +0 -1
  264. package/dist/modules/auth/index.d.ts +0 -3
  265. package/dist/modules/auth/index.d.ts.map +0 -1
  266. package/dist/modules/auth/index.js +0 -2
  267. package/dist/modules/auth/index.js.map +0 -1
  268. package/dist/modules/auth/types.d.ts +0 -82
  269. package/dist/modules/auth/types.d.ts.map +0 -1
  270. package/dist/modules/auth/types.js +0 -2
  271. package/dist/modules/auth/types.js.map +0 -1
  272. package/dist/modules/crypto/chains/base/account-abstraction.service.d.ts +0 -28
  273. package/dist/modules/crypto/chains/base/account-abstraction.service.d.ts.map +0 -1
  274. package/dist/modules/crypto/chains/base/account-abstraction.service.js +0 -173
  275. package/dist/modules/crypto/chains/base/account-abstraction.service.js.map +0 -1
  276. package/dist/modules/crypto/chains/base/account.contract.service.d.ts +0 -26
  277. package/dist/modules/crypto/chains/base/account.contract.service.d.ts.map +0 -1
  278. package/dist/modules/crypto/chains/base/account.contract.service.js +0 -109
  279. package/dist/modules/crypto/chains/base/account.contract.service.js.map +0 -1
  280. package/dist/modules/crypto/chains/base/crypto.service.d.ts +0 -34
  281. package/dist/modules/crypto/chains/base/crypto.service.d.ts.map +0 -1
  282. package/dist/modules/crypto/chains/base/crypto.service.js +0 -289
  283. package/dist/modules/crypto/chains/base/crypto.service.js.map +0 -1
  284. package/dist/modules/crypto/chains/base/index.d.ts +0 -6
  285. package/dist/modules/crypto/chains/base/index.d.ts.map +0 -1
  286. package/dist/modules/crypto/chains/base/index.js +0 -55
  287. package/dist/modules/crypto/chains/base/index.js.map +0 -1
  288. package/dist/modules/crypto/chains/base/wallet.service.d.ts +0 -55
  289. package/dist/modules/crypto/chains/base/wallet.service.d.ts.map +0 -1
  290. package/dist/modules/crypto/chains/base/wallet.service.js +0 -149
  291. package/dist/modules/crypto/chains/base/wallet.service.js.map +0 -1
  292. package/dist/modules/crypto/chains/base/yield.service.d.ts +0 -38
  293. package/dist/modules/crypto/chains/base/yield.service.d.ts.map +0 -1
  294. package/dist/modules/crypto/chains/base/yield.service.js +0 -297
  295. package/dist/modules/crypto/chains/base/yield.service.js.map +0 -1
  296. package/dist/modules/crypto/chains/index.d.ts +0 -5
  297. package/dist/modules/crypto/chains/index.d.ts.map +0 -1
  298. package/dist/modules/crypto/chains/index.js +0 -3
  299. package/dist/modules/crypto/chains/index.js.map +0 -1
  300. package/dist/modules/crypto/chains/registry.d.ts +0 -11
  301. package/dist/modules/crypto/chains/registry.d.ts.map +0 -1
  302. package/dist/modules/crypto/chains/registry.js +0 -19
  303. package/dist/modules/crypto/chains/registry.js.map +0 -1
  304. package/dist/modules/crypto/chains/types.d.ts +0 -39
  305. package/dist/modules/crypto/chains/types.d.ts.map +0 -1
  306. package/dist/modules/crypto/chains/types.js +0 -2
  307. package/dist/modules/crypto/chains/types.js.map +0 -1
  308. package/dist/modules/crypto/crypto.module.d.ts +0 -40
  309. package/dist/modules/crypto/crypto.module.d.ts.map +0 -1
  310. package/dist/modules/crypto/crypto.module.js +0 -134
  311. package/dist/modules/crypto/crypto.module.js.map +0 -1
  312. package/dist/modules/crypto/index.d.ts.map +0 -1
  313. package/dist/modules/crypto/interfaces/account-abstraction.interface.d.ts +0 -8
  314. package/dist/modules/crypto/interfaces/account-abstraction.interface.d.ts.map +0 -1
  315. package/dist/modules/crypto/interfaces/account-abstraction.interface.js +0 -2
  316. package/dist/modules/crypto/interfaces/account-abstraction.interface.js.map +0 -1
  317. package/dist/modules/crypto/interfaces/account-contract.interface.d.ts +0 -8
  318. package/dist/modules/crypto/interfaces/account-contract.interface.d.ts.map +0 -1
  319. package/dist/modules/crypto/interfaces/account-contract.interface.js +0 -2
  320. package/dist/modules/crypto/interfaces/account-contract.interface.js.map +0 -1
  321. package/dist/modules/crypto/interfaces/crypto.interface.d.ts.map +0 -1
  322. package/dist/modules/crypto/interfaces/crypto.interface.js +0 -2
  323. package/dist/modules/crypto/interfaces/crypto.interface.js.map +0 -1
  324. package/dist/modules/crypto/interfaces/index.d.ts +0 -5
  325. package/dist/modules/crypto/interfaces/index.d.ts.map +0 -1
  326. package/dist/modules/crypto/interfaces/index.js +0 -2
  327. package/dist/modules/crypto/interfaces/index.js.map +0 -1
  328. package/dist/modules/crypto/interfaces/yield.interface.d.ts +0 -19
  329. package/dist/modules/crypto/interfaces/yield.interface.d.ts.map +0 -1
  330. package/dist/modules/crypto/interfaces/yield.interface.js +0 -2
  331. package/dist/modules/crypto/interfaces/yield.interface.js.map +0 -1
  332. package/dist/modules/crypto/internal/contract-registry.service.d.ts +0 -14
  333. package/dist/modules/crypto/internal/contract-registry.service.d.ts.map +0 -1
  334. package/dist/modules/crypto/internal/contract-registry.service.js +0 -76
  335. package/dist/modules/crypto/internal/contract-registry.service.js.map +0 -1
  336. package/dist/modules/crypto/internal/smartDepositWallet.service.d.ts +0 -39
  337. package/dist/modules/crypto/internal/smartDepositWallet.service.d.ts.map +0 -1
  338. package/dist/modules/crypto/internal/smartDepositWallet.service.js +0 -183
  339. package/dist/modules/crypto/internal/smartDepositWallet.service.js.map +0 -1
  340. package/dist/modules/crypto/types.d.ts +0 -47
  341. package/dist/modules/crypto/types.d.ts.map +0 -1
  342. package/dist/modules/crypto/types.js +0 -2
  343. package/dist/modules/crypto/types.js.map +0 -1
@@ -1,173 +0,0 @@
1
- import { toPermissionValidator } from '@zerodev/permissions';
2
- import { toSudoPolicy } from '@zerodev/permissions/policies';
3
- import { toECDSASigner } from '@zerodev/permissions/signers';
4
- import { KernelV3_1AccountAbi } from '@zerodev/sdk';
5
- import { getEntryPoint, KERNEL_V3_1, VALIDATOR_TYPE } from '@zerodev/sdk/constants';
6
- import { concatHex, encodeFunctionData, pad, zeroAddress, zeroHash } from 'viem';
7
- import { signerAbi } from '../../../../abi/index.js';
8
- export class BaseAccountAbstractionService {
9
- constructor(config) {
10
- this.publicRpcClient = config.publicRpcClient;
11
- this.kernelPublicClient = config.kernelPublicClient;
12
- this.contracts = config.contracts;
13
- this.walletService = config.walletService;
14
- this.logger = config.logger;
15
- }
16
- async isExecutorInstalled() {
17
- const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
18
- try {
19
- const fundsManagementContract = this.contracts.fundsManagement;
20
- const res = await this.publicRpcClient.readContract({
21
- address: smartWalletClient.account.address,
22
- abi: KernelV3_1AccountAbi,
23
- functionName: 'isModuleInstalled',
24
- args: [BigInt(2), fundsManagementContract, '0x'],
25
- });
26
- return res;
27
- }
28
- catch (e) {
29
- console.error('Error checking if executor is installed:', e);
30
- return false;
31
- }
32
- }
33
- async isPolicyInstalled() {
34
- const mainWalletClient = await this.walletService.getMainWalletClient();
35
- const mainWalletAddress = mainWalletClient?.address;
36
- const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
37
- try {
38
- const bytecode = await this.publicRpcClient.getCode({
39
- address: smartWalletClient.account.address,
40
- });
41
- if (!bytecode || bytecode === '0x') {
42
- return false;
43
- }
44
- const rootValidatorId = (await this.publicRpcClient.readContract({
45
- address: smartWalletClient.account.address,
46
- abi: KernelV3_1AccountAbi,
47
- functionName: 'rootValidator',
48
- }));
49
- if (!rootValidatorId || rootValidatorId === '0x') {
50
- this.logger?.info('Policy not installed');
51
- return false;
52
- }
53
- const permissionId = ('0x' +
54
- rootValidatorId.replace('0x', '').slice(2, 10));
55
- const permissionConfig = await this.publicRpcClient.readContract({
56
- address: smartWalletClient.account.address,
57
- abi: KernelV3_1AccountAbi,
58
- functionName: 'permissionConfig',
59
- args: [permissionId],
60
- });
61
- const { policyData, signer } = permissionConfig;
62
- if (policyData.length !== 1) {
63
- this.logger?.info('Policy not installed');
64
- return false;
65
- }
66
- const data = policyData[0];
67
- const policyAddress = '0x' + data.replace('0x', '').slice(4, 44);
68
- const paddedPermissionId = pad(permissionId, {
69
- size: 32,
70
- dir: 'right',
71
- });
72
- const ownerAddress = await this.publicRpcClient.readContract({
73
- address: signer,
74
- abi: signerAbi,
75
- functionName: 'signer',
76
- args: [paddedPermissionId, smartWalletClient.account.address],
77
- });
78
- const executionDelayPolicyContract = await this.contracts.executionDelayPolicy;
79
- return (policyAddress.toLowerCase() === executionDelayPolicyContract?.toLowerCase() &&
80
- ownerAddress.toLowerCase() === mainWalletAddress.toLowerCase());
81
- }
82
- catch (e) {
83
- this.logger?.error('Error checking if policy is installed:', e);
84
- return false;
85
- }
86
- }
87
- async signInPolicyAndExecutor() {
88
- const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
89
- const executorCallData = await this.getExecutorCallData();
90
- const policyCallData = await this.getPolicyCallData();
91
- const calls = await smartWalletClient.account.encodeCalls([
92
- {
93
- to: smartWalletClient.account.address,
94
- value: BigInt(0),
95
- data: executorCallData,
96
- },
97
- {
98
- to: smartWalletClient.account.address,
99
- value: BigInt(0),
100
- data: policyCallData,
101
- },
102
- ]);
103
- return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
104
- }
105
- async signInPolicy() {
106
- const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
107
- const policyCallData = await this.getPolicyCallData();
108
- const calls = await smartWalletClient.account.encodeCalls([
109
- {
110
- to: smartWalletClient.account.address,
111
- value: BigInt(0),
112
- data: policyCallData,
113
- },
114
- ]);
115
- return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
116
- }
117
- async signInExecutor() {
118
- const smartWalletClient = await this.walletService.getSmartWalletClientWithoutPolicy();
119
- const policyCallData = await this.getExecutorCallData();
120
- const calls = await smartWalletClient.account.encodeCalls([
121
- {
122
- to: smartWalletClient.account.address,
123
- value: BigInt(0),
124
- data: policyCallData,
125
- },
126
- ]);
127
- return await this.walletService.sendUserOperationsAndWaitReceipt(calls, smartWalletClient);
128
- }
129
- async createExecutionDelayValidator() {
130
- const executionDelayPolicyContract = this.contracts.executionDelayPolicy;
131
- const rootPolicy = toSudoPolicy({ policyAddress: executionDelayPolicyContract });
132
- const smartAccountSigner = await this.walletService.getSmartAccountSigner();
133
- const res = await toPermissionValidator(this.kernelPublicClient, {
134
- entryPoint: getEntryPoint('0.7'),
135
- signer: await toECDSASigner({ signer: smartAccountSigner }),
136
- kernelVersion: KERNEL_V3_1,
137
- policies: [rootPolicy],
138
- });
139
- res.address = executionDelayPolicyContract;
140
- return res;
141
- }
142
- async getExecutorCallData() {
143
- const initData = concatHex([zeroAddress, zeroHash]);
144
- const fundsManagementContract = this.contracts.fundsManagement;
145
- return encodeFunctionData({
146
- abi: KernelV3_1AccountAbi,
147
- functionName: 'installModule',
148
- args: [BigInt(2), fundsManagementContract, initData],
149
- });
150
- }
151
- async getPolicyCallData() {
152
- const validator = await this.createExecutionDelayValidator();
153
- const smartWallet = await this.walletService.getSmartWalletClientWithoutPolicy();
154
- const rootValidatorId = concatHex([
155
- VALIDATOR_TYPE[validator.validatorType],
156
- pad(validator.getIdentifier(), {
157
- size: 20,
158
- dir: 'right',
159
- }),
160
- ]);
161
- return encodeFunctionData({
162
- abi: KernelV3_1AccountAbi,
163
- functionName: 'changeRootValidator',
164
- args: [
165
- rootValidatorId,
166
- zeroAddress,
167
- await validator.getEnableData(smartWallet.account.address),
168
- '0x',
169
- ],
170
- });
171
- }
172
- }
173
- //# sourceMappingURL=account-abstraction.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account-abstraction.service.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/chains/base/account-abstraction.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAuB,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEpF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,EAAgB,WAAW,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAQrD,MAAM,OAAO,6BAA6B;IAOxC,YAAY,MAMX;QACC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAA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AAC,aAAa,CAAC,WAAW,CAAC,OAAQ,CAAC,OAAO,CAAC;gBAC3D,IAAI;aACL;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,26 +0,0 @@
1
- import { PublicClient } from 'viem';
2
- import { WaitForUserOperationReceiptReturnType } from 'viem/account-abstraction';
3
- import { IWalletService } from '../types.js';
4
- import type { IAccountContractService } from '../../interfaces/index.js';
5
- import { ContractAddresses, Logger } from '../../../../core/index.js';
6
- export declare class BaseAccountContractService implements IAccountContractService {
7
- private readonly walletService;
8
- private readonly logger?;
9
- private readonly companyId;
10
- private readonly publicRpcClient;
11
- private readonly contracts;
12
- constructor(config: {
13
- publicRpcClient: PublicClient;
14
- walletService: IWalletService;
15
- companyId: string;
16
- logger?: Logger;
17
- contracts: ContractAddresses;
18
- });
19
- isWalletInAccounts(): Promise<boolean>;
20
- isWalletInCorporateAccounts(): Promise<boolean>;
21
- registerInAccounts(): Promise<WaitForUserOperationReceiptReturnType>;
22
- registerInCorporateAccounts(): Promise<WaitForUserOperationReceiptReturnType>;
23
- private getCorporateCallData;
24
- private getCallData;
25
- }
26
- //# sourceMappingURL=account.contract.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account.contract.service.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/chains/base/account.contract.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,YAAY,EAAE,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEtE,qBAAa,0BAA2B,YAAW,uBAAuB;IACxE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAe;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;gBAElC,MAAM,EAAE;QAClB,eAAe,EAAE,YAAY,CAAC;QAC9B,aAAa,EAAE,cAAc,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,iBAAiB,CAAC;KAC9B;IAQY,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IA+BtC,2BAA2B,IAAI,OAAO,CAAC,OAAO,CAAC;IAkC/C,kBAAkB,IAAI,OAAO,CAAC,qCAAqC,CAAC;IAqBpE,2BAA2B,IAAI,OAAO,CAAC,qCAAqC,CAAC;YAoB5E,oBAAoB;YAQpB,WAAW;CAO1B"}
@@ -1,109 +0,0 @@
1
- import { decodeFunctionResult, encodeFunctionData } from 'viem';
2
- import { accountsAbi, corporateAccountsAbi } from '../../../../abi/index.js';
3
- export class BaseAccountContractService {
4
- constructor(config) {
5
- this.walletService = config.walletService;
6
- this.logger = config.logger;
7
- this.companyId = config.companyId;
8
- this.publicRpcClient = config.publicRpcClient;
9
- this.contracts = config.contracts;
10
- }
11
- async isWalletInAccounts() {
12
- const mainWalletClient = await this.walletService.getMainWalletClient();
13
- try {
14
- const data = encodeFunctionData({
15
- abi: accountsAbi,
16
- functionName: 'getUserAccount',
17
- args: [mainWalletClient?.address, this.companyId],
18
- });
19
- const result = await this.publicRpcClient.call({
20
- to: this.contracts.accounts,
21
- data: data,
22
- });
23
- const decodedResult = decodeFunctionResult({
24
- abi: accountsAbi,
25
- functionName: 'getUserAccount',
26
- data: result.data,
27
- });
28
- return decodedResult && decodedResult.status !== 0;
29
- }
30
- catch (e) {
31
- this.logger?.warn('Error checking wallet in accounts contract:', e);
32
- return false;
33
- }
34
- }
35
- async isWalletInCorporateAccounts() {
36
- const smartWalletClient = await this.walletService.getSmartWalletClient();
37
- try {
38
- const data = encodeFunctionData({
39
- abi: corporateAccountsAbi,
40
- functionName: 'getCorporation',
41
- args: [
42
- this.companyId,
43
- smartWalletClient.account?.address,
44
- ],
45
- });
46
- const result = await this.publicRpcClient.call({
47
- to: this.contracts.corporateAccounts,
48
- data: data,
49
- });
50
- const decodedResult = decodeFunctionResult({
51
- abi: corporateAccountsAbi,
52
- functionName: 'getCorporation',
53
- data: result.data,
54
- });
55
- return decodedResult && decodedResult.status !== 0;
56
- }
57
- catch (e) {
58
- this.logger?.warn('Error checking wallet in corporate accounts contract:', e);
59
- return false;
60
- }
61
- }
62
- async registerInAccounts() {
63
- const callData = await this.getCallData();
64
- const smartWalletClient = await this.walletService.getSmartWalletClient();
65
- const encodedCallData = await smartWalletClient.account.encodeCalls([
66
- {
67
- to: this.contracts.accounts,
68
- value: BigInt(0),
69
- data: callData,
70
- },
71
- ]);
72
- const receipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedCallData);
73
- if (!receipt) {
74
- throw new Error('Unable to register in accounts contract');
75
- }
76
- return receipt;
77
- }
78
- async registerInCorporateAccounts() {
79
- const callData = await this.getCorporateCallData();
80
- const smartWalletClient = await this.walletService.getSmartWalletClient();
81
- const encodedCallData = await smartWalletClient.account.encodeCalls([
82
- {
83
- to: this.contracts.corporateAccounts,
84
- value: BigInt(0),
85
- data: callData,
86
- },
87
- ]);
88
- const receipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedCallData);
89
- if (!receipt) {
90
- throw new Error('Unable to register in corporate accounts contract');
91
- }
92
- return receipt;
93
- }
94
- async getCorporateCallData() {
95
- return encodeFunctionData({
96
- abi: corporateAccountsAbi,
97
- functionName: 'createCorporation',
98
- args: [this.companyId],
99
- });
100
- }
101
- async getCallData() {
102
- return encodeFunctionData({
103
- abi: accountsAbi,
104
- functionName: 'createUserAccountWithWallet',
105
- args: [this.companyId],
106
- });
107
- }
108
- }
109
- //# sourceMappingURL=account.contract.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account.contract.service.js","sourceRoot":"","sources":["../../../../../src/modules/crypto/chains/base/account.contract.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAgB,MAAM,MAAM,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAO7E,MAAM,OAAO,0BAA0B;IAOrC,YAAY,MAMX;QACC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,kBAAkB;QAC7B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,CAAC;QAExE,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,kBAAkB,CAAC;gBAC9B,GAAG,EAAE,WAAW;gBAChB,YAAY,EAAE,gBAAgB;gBAC9B,IAAI,EAAE,CAAC,gBAAgB,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;aAClD,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;gBAC7C,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ;gBAC3B,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,MAAM,aAAa,GAAG,oBAAoB,CAAC;gBACzC,GAAG,EAAE,WAAW;gBAChB,YAAY,EAAE,gBAAgB;gBAC9B,IAAI,EAAE,MAAM,CAAC,IAAK;aACnB,CAKA,CAAC;YACF,OAAO,aAAa,IAAI,aAAa,CAAC,M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AW;QACvB,OAAO,kBAAkB,CAAC;YACxB,GAAG,EAAE,WAAW;YAChB,YAAY,EAAE,6BAA6B;YAC3C,IAAI,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;SACvB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,34 +0,0 @@
1
- import { Hex } from 'viem';
2
- import { IWalletService } from '../types.js';
3
- import type { WithdrawalApi } from '../../../api/index.js';
4
- import type { ICryptoService, Erc20TransferParams, SyntheticTransferParams, FullTransferParams, FullTransferResult, BatchTransferParams, SwapTransferParams } from '../../interfaces/index.js';
5
- import { ContractAddresses, Logger, TokenInfo } from '../../../../core/index.js';
6
- export declare class BaseCryptoService implements ICryptoService {
7
- private readonly walletService;
8
- private readonly tokens;
9
- private readonly contracts?;
10
- private readonly logger?;
11
- private readonly withdrawalApi?;
12
- constructor(config: {
13
- contracts: ContractAddresses;
14
- walletService: IWalletService;
15
- tokens: TokenInfo[];
16
- logger?: Logger;
17
- withdrawalApi?: WithdrawalApi;
18
- });
19
- makeErc20TransferFirstPart(params: Erc20TransferParams): Promise<Hex>;
20
- makeErc20TransferFinal(withdrawalCallData: string): Promise<any>;
21
- makeErc20TransferFull(params: Erc20TransferParams): Promise<Hex>;
22
- makeErc20TransferSynthetic(params: SyntheticTransferParams): Promise<Hex>;
23
- makeFullErc20Transfer(params: FullTransferParams): Promise<FullTransferResult>;
24
- makeTransferWithoutDelayPolicy(params: SwapTransferParams): Promise<Hex>;
25
- private delay;
26
- batchTransfer({ responses, tokenAddress }: BatchTransferParams): Promise<Hex[]>;
27
- private getCustomNonceToFinishRequest;
28
- private convertGuidToBytes16;
29
- private ercTransferCall;
30
- private operationRequestCall;
31
- private generateUnwrapCallData;
32
- private generateBatchTransferCallData;
33
- }
34
- //# sourceMappingURL=crypto.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.service.d.ts","sourceRoot":"","sources":["../../../../../src/modules/crypto/chains/base/crypto.service.ts"],"names":[],"mappings":"AACA,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G,OAAO,CAAC,GAAG,CAAC;IA+CrF,OAAO,CAAC,KAAK;IAIA,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAgD9E,6BAA6B;IAQ3C,OAAO,CAAC,oBAAoB;YAKd,eAAe;YAiBf,oBAAoB;YAsBpB,sBAAsB;YAatB,6BAA6B;CAoB5C"}
@@ -1,289 +0,0 @@
1
- import { getCustomNonceKeyFromString } from '@zerodev/sdk';
2
- import { encodeFunctionData, erc20Abi, keccak256, pad, parseUnits } from 'viem';
3
- import { executionDelayPolicyAbi, fundsManagementAbi, syntheticAbi } from '../../../../abi/index.js';
4
- import { AuthService } from '../../../auth/index.js';
5
- export class BaseCryptoService {
6
- constructor(config) {
7
- this.walletService = config.walletService;
8
- this.contracts = config.contracts;
9
- this.logger = config.logger;
10
- this.tokens = config.tokens;
11
- this.withdrawalApi = config.withdrawalApi;
12
- }
13
- async makeErc20TransferFirstPart(params) {
14
- const smartWalletClient = await this.walletService?.getSmartWalletClient();
15
- const tokenData = this.tokens.find(token => token.address === params.tokenAddress);
16
- if (!tokenData) {
17
- throw new Error('Token not found in token registry. Please check token address');
18
- }
19
- const baseToken = this.tokens.find(token => token.address === tokenData?.baseToken?.address);
20
- if (!baseToken) {
21
- throw new Error('Base token not found in token registry. Please check token address');
22
- }
23
- const callDataArray = [];
24
- const unwrapCallData = await this.generateUnwrapCallData(params.tokenAddress, parseUnits(String(params.amount), tokenData?.decimals ?? 18));
25
- callDataArray.push(unwrapCallData);
26
- const erc20TransferCallDetails = await this.ercTransferCall(baseToken?.address, params.recipientAddress, parseUnits(String(params.amount), baseToken?.decimals ?? 18));
27
- callDataArray.push(erc20TransferCallDetails);
28
- if (!smartWalletClient.account) {
29
- throw new Error('Smart wallet client account is not available.');
30
- }
31
- const encodedExecutionCalls = await smartWalletClient.account.encodeCalls(callDataArray);
32
- const requestCallData = await this.operationRequestCall(encodedExecutionCalls);
33
- const requestCalls = await smartWalletClient.account.encodeCalls([requestCallData.call]);
34
- const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(requestCalls);
35
- if (!userOpReceipt.success) {
36
- throw new Error(`ERC20 Transfer Execution UserOperation failed: ` +
37
- `userOpHash=${userOpReceipt.userOpHash}, ` +
38
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
39
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
40
- }
41
- return userOpReceipt.receipt.transactionHash;
42
- }
43
- async makeErc20TransferFinal(withdrawalCallData) {
44
- const callData = ('0x' + withdrawalCallData);
45
- const nonce = await this.getCustomNonceToFinishRequest(callData);
46
- const userOpReceipt = await this.walletService.sendUserOperationsWithNonceAndWaitReceipt(callData, nonce);
47
- if (!userOpReceipt.success) {
48
- throw new Error(`ERC20 Transfer Execution UserOperation failed: ` +
49
- `userOpHash=${userOpReceipt.userOpHash}, ` +
50
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
51
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
52
- }
53
- return userOpReceipt.receipt.transactionHash;
54
- }
55
- async makeErc20TransferFull(params) {
56
- const smartWalletClient = await this.walletService.getSmartWalletClient();
57
- const tokenData = this.tokens.find(token => token.address === params.tokenAddress);
58
- if (!tokenData) {
59
- throw new Error('Token not found in token registry. Please check token address');
60
- }
61
- const baseToken = this.tokens.find(token => token.address === tokenData?.baseToken?.address);
62
- if (!baseToken) {
63
- throw new Error('Base token not found in token registry. Please check token address');
64
- }
65
- if (!smartWalletClient.account) {
66
- throw new Error('Smart wallet client account is not available.');
67
- }
68
- const unwrapCallData = await this.generateUnwrapCallData(params.tokenAddress, parseUnits(String(params.amount), tokenData?.decimals ?? 18));
69
- const erc20TransferCallDetails = await this.ercTransferCall(baseToken.address, params.recipientAddress, parseUnits(String(params.amount), baseToken?.decimals ?? 18));
70
- const encodedExecutionCalls = await smartWalletClient.account.encodeCalls([
71
- unwrapCallData,
72
- erc20TransferCallDetails,
73
- ]);
74
- const requestCallData = await this.operationRequestCall(encodedExecutionCalls);
75
- const requestCalls = await smartWalletClient.account.encodeCalls([requestCallData.call]);
76
- const requestUserOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(requestCalls, undefined, { waitOnChainBlocks: 4 });
77
- if (!requestUserOpReceipt.success) {
78
- throw new Error(`ERC20 Transfer Request UserOperation failed: ` +
79
- `userOpHash=${requestUserOpReceipt.userOpHash}, ` +
80
- `tx=${requestUserOpReceipt.receipt.transactionHash}, ` +
81
- `reason=${requestUserOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
82
- }
83
- const nonce = await this.getCustomNonceToFinishRequest(encodedExecutionCalls);
84
- const userOpReceipt = await this.walletService.sendUserOperationsWithNonceAndWaitReceipt(encodedExecutionCalls, nonce);
85
- if (!userOpReceipt.success) {
86
- throw new Error(`ERC20 Transfer Execution UserOperation failed: ` +
87
- `userOpHash=${userOpReceipt.userOpHash}, ` +
88
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
89
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
90
- }
91
- return userOpReceipt.receipt.transactionHash;
92
- }
93
- async makeErc20TransferSynthetic(params) {
94
- const smartWalletClient = await this.walletService.getSmartWalletClient();
95
- const tokenData = this.tokens.find(token => token.address === params.tokenAddress);
96
- if (!smartWalletClient.account) {
97
- throw new Error('Smart wallet client account is not available.');
98
- }
99
- const erc20TransferCallDetails = await this.ercTransferCall(params.tokenAddress, params.recipientAddress, parseUnits(String(params.amount), tokenData?.decimals ?? 18));
100
- const encodedExecutionCalls = await smartWalletClient.account.encodeCalls([
101
- erc20TransferCallDetails,
102
- ]);
103
- const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
104
- if (!userOpReceipt.success) {
105
- throw new Error(`ERC20 Transfer Execution UserOperation failed: ` +
106
- `userOpHash=${userOpReceipt.userOpHash}, ` +
107
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
108
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
109
- }
110
- return new Promise(resolve => {
111
- setTimeout(() => {
112
- resolve(userOpReceipt.receipt.transactionHash);
113
- }, 2000);
114
- });
115
- }
116
- async makeFullErc20Transfer(params) {
117
- if (!this.withdrawalApi) {
118
- throw new Error('Withdrawal API is required for full ERC20 transfer');
119
- }
120
- const authService = AuthService.getInstance();
121
- authService.ensureAuthenticated();
122
- const firstPartTxHash = await this.makeErc20TransferFirstPart({
123
- tokenAddress: params.tokenAddress,
124
- recipientAddress: params.recipientAddress,
125
- amount: params.amount,
126
- });
127
- this.logger?.info('First part of ERC20 transfer completed', { txHash: firstPartTxHash });
128
- await this.delay(6000);
129
- const withdrawalRequests = await this.withdrawalApi.getWithdrawalRequests();
130
- if (!withdrawalRequests || withdrawalRequests.length === 0) {
131
- throw new Error('No withdrawal requests found after first part of transfer');
132
- }
133
- const tokenData = this.tokens.find(token => token.address === params.tokenAddress);
134
- if (!tokenData) {
135
- throw new Error('Token not found in token registry');
136
- }
137
- const baseToken = this.tokens.find(token => token.address === tokenData.baseToken?.address);
138
- if (!baseToken) {
139
- throw new Error('Base token not found in token registry');
140
- }
141
- const withdrawalRequest = withdrawalRequests.find(req => req.to_address === params.recipientAddress &&
142
- req.token_address === baseToken.address &&
143
- req.amount === params.amount);
144
- if (!withdrawalRequest) {
145
- throw new Error('No pending withdrawal request found');
146
- }
147
- const now = new Date();
148
- const validAfterDate = new Date(withdrawalRequest.valid_after);
149
- if (validAfterDate > now) {
150
- const waitTime = validAfterDate.getTime() - now.getTime();
151
- this.logger?.info(`Waiting ${waitTime}ms until valid_after time`, {
152
- validAfter: withdrawalRequest.valid_after,
153
- now: now.toISOString(),
154
- });
155
- await this.delay(waitTime + 1000);
156
- }
157
- const finalReceipt = await this.makeErc20TransferFinal(withdrawalRequest.call_data);
158
- this.logger?.info('Full ERC20 transfer completed successfully');
159
- return {
160
- firstPartTxHash,
161
- finalTxHash: finalReceipt,
162
- success: true,
163
- };
164
- }
165
- async makeTransferWithoutDelayPolicy(params) {
166
- const smartWalletClient = await this.walletService.getSmartWalletClient();
167
- const tokenData = this.tokens.find(token => token.address === params.tokenAddress);
168
- if (!tokenData) {
169
- throw new Error('Token not found in token registry. Please check token address');
170
- }
171
- const baseToken = this.tokens.find(token => token.address === tokenData.baseToken?.address);
172
- if (!baseToken) {
173
- throw new Error('Base token not found in token registry. Please check token address');
174
- }
175
- if (!smartWalletClient.account) {
176
- throw new Error('Smart wallet client account is not available.');
177
- }
178
- const unwrapCallData = await this.generateUnwrapCallData(params.tokenAddress, parseUnits(params.amount, tokenData.decimals ?? 18));
179
- const erc20TransferCallDetails = await this.ercTransferCall(baseToken.address, params.recipientAddress, parseUnits(params.amount, baseToken.decimals ?? 18));
180
- const encodedExecutionCalls = await smartWalletClient.account.encodeCalls([
181
- unwrapCallData,
182
- erc20TransferCallDetails,
183
- ]);
184
- const userOpReceipt = await this.walletService.sendUserOperationsAndWaitReceipt(encodedExecutionCalls);
185
- if (!userOpReceipt.success) {
186
- throw new Error(`ERC20 Unwrap Transfer UserOperation failed: ` +
187
- `userOpHash=${userOpReceipt.userOpHash}, ` +
188
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
189
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
190
- }
191
- return userOpReceipt.receipt.transactionHash;
192
- }
193
- delay(ms) {
194
- return new Promise(resolve => setTimeout(resolve, ms));
195
- }
196
- async batchTransfer({ responses, tokenAddress }) {
197
- const smartWalletClient = await this.walletService.getSmartWalletClient();
198
- const transactionHashes = [];
199
- for (const response of responses) {
200
- const transactionIdBytes16 = this.convertGuidToBytes16(response.transaction_id);
201
- const operationIdBytes16 = this.convertGuidToBytes16(response.operation_id);
202
- const recipients = response.crypto_transfers.map(transfer => transfer.address);
203
- const amounts = response.crypto_transfers.map(transfer => BigInt(transfer.precise_amount));
204
- const callData = await this.generateBatchTransferCallData(transactionIdBytes16, operationIdBytes16, tokenAddress, recipients, amounts);
205
- if (!smartWalletClient.account) {
206
- throw new Error('Smart wallet client account is not available.');
207
- }
208
- const encodedCall = await smartWalletClient.account.encodeCalls([callData]);
209
- const nonce = await this.getCustomNonceToFinishRequest(encodedCall);
210
- const userOpReceipt = await this.walletService.sendUserOperationsWithNonceAndWaitReceipt(encodedCall, nonce);
211
- if (!userOpReceipt.success) {
212
- throw new Error(`Bulk transfer execution failed for transaction ${response.transaction_id}: ` +
213
- `userOpHash=${userOpReceipt.userOpHash}, ` +
214
- `tx=${userOpReceipt.receipt.transactionHash}, ` +
215
- `reason=${userOpReceipt.reason ?? 'unknown (likely out of gas)'}`);
216
- }
217
- transactionHashes.push(userOpReceipt.receipt.transactionHash);
218
- }
219
- return transactionHashes;
220
- }
221
- async getCustomNonceToFinishRequest(callData) {
222
- const smartWalletClient = await this.walletService.getSmartWalletClient();
223
- const nonceKey = keccak256(callData);
224
- const customNonce = getCustomNonceKeyFromString(nonceKey, '0.7');
225
- return await smartWalletClient.account.getNonce({ key: customNonce });
226
- }
227
- convertGuidToBytes16(guid) {
228
- const guidHex = `0x${guid.replace(/-/g, '')}`;
229
- return pad(guidHex, { size: 16 });
230
- }
231
- async ercTransferCall(token, recipientAddress, amount) {
232
- const callData = encodeFunctionData({
233
- abi: erc20Abi,
234
- functionName: 'transfer',
235
- args: [recipientAddress, amount],
236
- });
237
- return {
238
- to: token,
239
- value: BigInt(0),
240
- data: callData,
241
- };
242
- }
243
- async operationRequestCall(callData) {
244
- const smartWalletClient = await this.walletService.getSmartWalletClient();
245
- const executionDelayPolicyContract = this.contracts?.executionDelayPolicy;
246
- const nonceKey = keccak256(callData);
247
- const customNonce = getCustomNonceKeyFromString(nonceKey, '0.7');
248
- const nonce = await smartWalletClient.account.getNonce({ key: customNonce });
249
- const requestCallData = encodeFunctionData({
250
- abi: executionDelayPolicyAbi,
251
- functionName: 'request',
252
- args: [smartWalletClient.account?.address, nonce, callData],
253
- });
254
- return {
255
- call: {
256
- to: executionDelayPolicyContract,
257
- value: BigInt(0),
258
- data: requestCallData,
259
- },
260
- hasCustomNonce: true,
261
- };
262
- }
263
- async generateUnwrapCallData(token, amount) {
264
- const callData = encodeFunctionData({
265
- abi: syntheticAbi,
266
- functionName: 'withdraw',
267
- args: [amount],
268
- });
269
- return {
270
- to: token,
271
- value: BigInt(0),
272
- data: callData,
273
- };
274
- }
275
- async generateBatchTransferCallData(transactionId, operationId, tokenAddress, recipients, amounts) {
276
- const fundsManagementContract = this.contracts?.fundsManagement;
277
- const callData = encodeFunctionData({
278
- abi: fundsManagementAbi,
279
- functionName: 'executeOutgoingBatchTransaction',
280
- args: [transactionId, operationId, tokenAddress, recipients, amounts],
281
- });
282
- return {
283
- to: fundsManagementContract,
284
- value: BigInt(0),
285
- data: callData,
286
- };
287
- }
288
- }
289
- //# sourceMappingURL=crypto.service.js.map