viem 2.57.4 → 2.57.6

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 (372) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/_cjs/actions/public/waitForTransactionReceipt.js +5 -2
  3. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  4. package/_cjs/actions/wallet/waitForCallsStatus.js +25 -2
  5. package/_cjs/actions/wallet/waitForCallsStatus.js.map +1 -1
  6. package/_cjs/chains/definitions/arcTestnet.js +11 -8
  7. package/_cjs/chains/definitions/arcTestnet.js.map +1 -1
  8. package/_cjs/chains/definitions/qmsTestnet.js +30 -0
  9. package/_cjs/chains/definitions/qmsTestnet.js.map +1 -0
  10. package/_cjs/chains/definitions/tempo.js +1 -1
  11. package/_cjs/chains/definitions/tempoModerato.js +2 -2
  12. package/_cjs/chains/index.js +7 -5
  13. package/_cjs/chains/index.js.map +1 -1
  14. package/_cjs/clients/transports/ipc.js +19 -10
  15. package/_cjs/clients/transports/ipc.js.map +1 -1
  16. package/_cjs/clients/transports/webSocket.js +19 -10
  17. package/_cjs/clients/transports/webSocket.js.map +1 -1
  18. package/_cjs/errors/version.js +1 -1
  19. package/_cjs/tempo/Abis.js +297 -1
  20. package/_cjs/tempo/Abis.js.map +1 -1
  21. package/_cjs/tempo/Account.js +40 -40
  22. package/_cjs/tempo/Account.js.map +1 -1
  23. package/_cjs/tempo/Addresses.js +2 -1
  24. package/_cjs/tempo/Addresses.js.map +1 -1
  25. package/_cjs/tempo/Decorator.js +9 -8
  26. package/_cjs/tempo/Decorator.js.map +1 -1
  27. package/_cjs/tempo/ExecutionError.js +95 -4
  28. package/_cjs/tempo/ExecutionError.js.map +1 -1
  29. package/_cjs/tempo/Formatters.js +8 -7
  30. package/_cjs/tempo/Formatters.js.map +1 -1
  31. package/_cjs/tempo/KeyAuthorizationManager.js +25 -16
  32. package/_cjs/tempo/KeyAuthorizationManager.js.map +1 -1
  33. package/_cjs/tempo/Relay.js +9 -4
  34. package/_cjs/tempo/Relay.js.map +1 -1
  35. package/_cjs/tempo/Transaction.js +9 -9
  36. package/_cjs/tempo/Transaction.js.map +1 -1
  37. package/_cjs/tempo/Transport.js +21 -11
  38. package/_cjs/tempo/Transport.js.map +1 -1
  39. package/_cjs/tempo/{multisig → accounts}/Config.js +8 -8
  40. package/_cjs/tempo/{multisig → accounts}/Config.js.map +1 -1
  41. package/_cjs/tempo/{multisig → accounts}/Operation.js +10 -10
  42. package/_cjs/tempo/{multisig → accounts}/Operation.js.map +1 -1
  43. package/_cjs/tempo/{multisig → accounts}/Signature.js +2 -2
  44. package/_cjs/tempo/accounts/Signature.js.map +1 -0
  45. package/_cjs/tempo/actions/accessKey.js +442 -47
  46. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  47. package/_cjs/tempo/actions/{multisig.js → accounts.js} +16 -20
  48. package/_cjs/tempo/actions/accounts.js.map +1 -0
  49. package/_cjs/tempo/actions/amm.js +90 -4
  50. package/_cjs/tempo/actions/amm.js.map +1 -1
  51. package/_cjs/tempo/actions/channel.js +183 -7
  52. package/_cjs/tempo/actions/channel.js.map +1 -1
  53. package/_cjs/tempo/actions/dex.js +507 -14
  54. package/_cjs/tempo/actions/dex.js.map +1 -1
  55. package/_cjs/tempo/actions/earn/deployment.js +4 -3
  56. package/_cjs/tempo/actions/earn/deployment.js.map +1 -1
  57. package/_cjs/tempo/actions/earn.js +22 -21
  58. package/_cjs/tempo/actions/earn.js.map +1 -1
  59. package/_cjs/tempo/actions/fee.js +85 -5
  60. package/_cjs/tempo/actions/fee.js.map +1 -1
  61. package/_cjs/tempo/actions/index.js +2 -2
  62. package/_cjs/tempo/actions/index.js.map +1 -1
  63. package/_cjs/tempo/actions/nonce.js +54 -1
  64. package/_cjs/tempo/actions/nonce.js.map +1 -1
  65. package/_cjs/tempo/actions/policy.js +35 -6
  66. package/_cjs/tempo/actions/policy.js.map +1 -1
  67. package/_cjs/tempo/actions/propAmm.js +18 -8
  68. package/_cjs/tempo/actions/propAmm.js.map +1 -1
  69. package/_cjs/tempo/actions/receivePolicy.js +7 -6
  70. package/_cjs/tempo/actions/receivePolicy.js.map +1 -1
  71. package/_cjs/tempo/actions/reward.js +7 -6
  72. package/_cjs/tempo/actions/reward.js.map +1 -1
  73. package/_cjs/tempo/actions/token.js +433 -22
  74. package/_cjs/tempo/actions/token.js.map +1 -1
  75. package/_cjs/tempo/actions/validator.js +12 -11
  76. package/_cjs/tempo/actions/validator.js.map +1 -1
  77. package/_cjs/tempo/actions/virtualAddress.js +3 -2
  78. package/_cjs/tempo/actions/virtualAddress.js.map +1 -1
  79. package/_cjs/tempo/actions/zone.js +12 -11
  80. package/_cjs/tempo/actions/zone.js.map +1 -1
  81. package/_cjs/tempo/chainConfig.js +37 -37
  82. package/_cjs/tempo/chainConfig.js.map +1 -1
  83. package/_cjs/tempo/errors.js +57 -1
  84. package/_cjs/tempo/errors.js.map +1 -1
  85. package/_cjs/tempo/index.js +3 -3
  86. package/_cjs/tempo/index.js.map +1 -1
  87. package/_cjs/tempo/internal/errors.js +46 -0
  88. package/_cjs/tempo/internal/errors.js.map +1 -0
  89. package/_cjs/tempo/internal/relay/{multisig.js → accounts.js} +90 -93
  90. package/_cjs/tempo/internal/relay/accounts.js.map +1 -0
  91. package/_cjs/tempo/internal/relay/keyAuthorization.js +296 -0
  92. package/_cjs/tempo/internal/relay/keyAuthorization.js.map +1 -0
  93. package/_cjs/tempo/internal/relay/plugin.js +17 -7
  94. package/_cjs/tempo/internal/relay/plugin.js.map +1 -1
  95. package/_cjs/tempo/internal/resolveError.js +128 -0
  96. package/_cjs/tempo/internal/resolveError.js.map +1 -0
  97. package/_cjs/tempo/internal/utils.js +1 -0
  98. package/_cjs/tempo/internal/utils.js.map +1 -1
  99. package/_cjs/utils/hash/normalizeSignature.js +1 -1
  100. package/_cjs/utils/hash/normalizeSignature.js.map +1 -1
  101. package/_cjs/utils/rpc/http.js +66 -31
  102. package/_cjs/utils/rpc/http.js.map +1 -1
  103. package/_cjs/utils/rpc/socket.js +1 -1
  104. package/_cjs/utils/rpc/socket.js.map +1 -1
  105. package/_esm/actions/public/waitForTransactionReceipt.js +5 -2
  106. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  107. package/_esm/actions/wallet/waitForCallsStatus.js +39 -2
  108. package/_esm/actions/wallet/waitForCallsStatus.js.map +1 -1
  109. package/_esm/chains/definitions/arcTestnet.js +11 -8
  110. package/_esm/chains/definitions/arcTestnet.js.map +1 -1
  111. package/_esm/chains/definitions/qmsTestnet.js +27 -0
  112. package/_esm/chains/definitions/qmsTestnet.js.map +1 -0
  113. package/_esm/chains/definitions/tempo.js +1 -1
  114. package/_esm/chains/definitions/tempoModerato.js +2 -2
  115. package/_esm/chains/index.js +1 -0
  116. package/_esm/chains/index.js.map +1 -1
  117. package/_esm/clients/transports/ipc.js +21 -10
  118. package/_esm/clients/transports/ipc.js.map +1 -1
  119. package/_esm/clients/transports/webSocket.js +21 -10
  120. package/_esm/clients/transports/webSocket.js.map +1 -1
  121. package/_esm/errors/version.js +1 -1
  122. package/_esm/tempo/Abis.js +297 -0
  123. package/_esm/tempo/Abis.js.map +1 -1
  124. package/_esm/tempo/Account.js +42 -42
  125. package/_esm/tempo/Account.js.map +1 -1
  126. package/_esm/tempo/Addresses.js +1 -0
  127. package/_esm/tempo/Addresses.js.map +1 -1
  128. package/_esm/tempo/Client.js +3 -3
  129. package/_esm/tempo/Decorator.js +9 -8
  130. package/_esm/tempo/Decorator.js.map +1 -1
  131. package/_esm/tempo/ExecutionError.js +96 -3
  132. package/_esm/tempo/ExecutionError.js.map +1 -1
  133. package/_esm/tempo/Formatters.js +11 -10
  134. package/_esm/tempo/Formatters.js.map +1 -1
  135. package/_esm/tempo/KeyAuthorizationManager.js +58 -16
  136. package/_esm/tempo/KeyAuthorizationManager.js.map +1 -1
  137. package/_esm/tempo/Relay.js +49 -8
  138. package/_esm/tempo/Relay.js.map +1 -1
  139. package/_esm/tempo/Transaction.js +11 -11
  140. package/_esm/tempo/Transaction.js.map +1 -1
  141. package/_esm/tempo/Transport.js +22 -12
  142. package/_esm/tempo/Transport.js.map +1 -1
  143. package/_esm/tempo/{multisig → accounts}/Config.js +14 -14
  144. package/_esm/tempo/{multisig → accounts}/Config.js.map +1 -1
  145. package/_esm/tempo/{multisig → accounts}/Operation.js +17 -17
  146. package/_esm/tempo/{multisig → accounts}/Operation.js.map +1 -1
  147. package/_esm/tempo/accounts/Signature.js +9 -0
  148. package/_esm/tempo/accounts/Signature.js.map +1 -0
  149. package/_esm/tempo/actions/accessKey.js +499 -48
  150. package/_esm/tempo/actions/accessKey.js.map +1 -1
  151. package/_esm/tempo/actions/{multisig.js → accounts.js} +34 -38
  152. package/_esm/tempo/actions/accounts.js.map +1 -0
  153. package/_esm/tempo/actions/amm.js +95 -4
  154. package/_esm/tempo/actions/amm.js.map +1 -1
  155. package/_esm/tempo/actions/channel.js +191 -7
  156. package/_esm/tempo/actions/channel.js.map +1 -1
  157. package/_esm/tempo/actions/dex.js +537 -14
  158. package/_esm/tempo/actions/dex.js.map +1 -1
  159. package/_esm/tempo/actions/earn/deployment.js +4 -3
  160. package/_esm/tempo/actions/earn/deployment.js.map +1 -1
  161. package/_esm/tempo/actions/earn.js +22 -21
  162. package/_esm/tempo/actions/earn.js.map +1 -1
  163. package/_esm/tempo/actions/fee.js +90 -6
  164. package/_esm/tempo/actions/fee.js.map +1 -1
  165. package/_esm/tempo/actions/index.js +1 -1
  166. package/_esm/tempo/actions/index.js.map +1 -1
  167. package/_esm/tempo/actions/nonce.js +57 -1
  168. package/_esm/tempo/actions/nonce.js.map +1 -1
  169. package/_esm/tempo/actions/policy.js +36 -6
  170. package/_esm/tempo/actions/policy.js.map +1 -1
  171. package/_esm/tempo/actions/propAmm.js +18 -8
  172. package/_esm/tempo/actions/propAmm.js.map +1 -1
  173. package/_esm/tempo/actions/receivePolicy.js +7 -6
  174. package/_esm/tempo/actions/receivePolicy.js.map +1 -1
  175. package/_esm/tempo/actions/reward.js +7 -6
  176. package/_esm/tempo/actions/reward.js.map +1 -1
  177. package/_esm/tempo/actions/token.js +461 -22
  178. package/_esm/tempo/actions/token.js.map +1 -1
  179. package/_esm/tempo/actions/validator.js +12 -11
  180. package/_esm/tempo/actions/validator.js.map +1 -1
  181. package/_esm/tempo/actions/virtualAddress.js +3 -2
  182. package/_esm/tempo/actions/virtualAddress.js.map +1 -1
  183. package/_esm/tempo/actions/zone.js +12 -11
  184. package/_esm/tempo/actions/zone.js.map +1 -1
  185. package/_esm/tempo/chainConfig.js +38 -38
  186. package/_esm/tempo/chainConfig.js.map +1 -1
  187. package/_esm/tempo/errors.js +63 -0
  188. package/_esm/tempo/errors.js.map +1 -1
  189. package/_esm/tempo/index.js +2 -1
  190. package/_esm/tempo/index.js.map +1 -1
  191. package/_esm/tempo/internal/errors.js +51 -0
  192. package/_esm/tempo/internal/errors.js.map +1 -0
  193. package/_esm/tempo/internal/relay/{multisig.js → accounts.js} +93 -98
  194. package/_esm/tempo/internal/relay/accounts.js.map +1 -0
  195. package/_esm/tempo/internal/relay/feePayer.js +1 -1
  196. package/_esm/tempo/internal/relay/feePayer.js.map +1 -1
  197. package/_esm/tempo/internal/relay/keyAuthorization.js +334 -0
  198. package/_esm/tempo/internal/relay/keyAuthorization.js.map +1 -0
  199. package/_esm/tempo/internal/relay/plugin.js +15 -6
  200. package/_esm/tempo/internal/relay/plugin.js.map +1 -1
  201. package/_esm/tempo/internal/resolveError.js +130 -0
  202. package/_esm/tempo/internal/resolveError.js.map +1 -0
  203. package/_esm/tempo/internal/utils.js +2 -0
  204. package/_esm/tempo/internal/utils.js.map +1 -1
  205. package/_esm/utils/hash/normalizeSignature.js +3 -2
  206. package/_esm/utils/hash/normalizeSignature.js.map +1 -1
  207. package/_esm/utils/rpc/http.js +74 -31
  208. package/_esm/utils/rpc/http.js.map +1 -1
  209. package/_esm/utils/rpc/socket.js +3 -1
  210. package/_esm/utils/rpc/socket.js.map +1 -1
  211. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  212. package/_types/actions/wallet/waitForCallsStatus.d.ts.map +1 -1
  213. package/_types/chains/definitions/arcTestnet.d.ts +5 -5
  214. package/_types/chains/definitions/arcTestnet.d.ts.map +1 -1
  215. package/_types/chains/definitions/qmsTestnet.d.ts +50 -0
  216. package/_types/chains/definitions/qmsTestnet.d.ts.map +1 -0
  217. package/_types/chains/definitions/tempo.d.ts +2 -2
  218. package/_types/chains/definitions/tempoModerato.d.ts +4 -4
  219. package/_types/chains/index.d.ts +1 -0
  220. package/_types/chains/index.d.ts.map +1 -1
  221. package/_types/clients/transports/ipc.d.ts.map +1 -1
  222. package/_types/clients/transports/webSocket.d.ts.map +1 -1
  223. package/_types/errors/version.d.ts +1 -1
  224. package/_types/tempo/Abis.d.ts +807 -0
  225. package/_types/tempo/Abis.d.ts.map +1 -1
  226. package/_types/tempo/Account.d.ts +28 -28
  227. package/_types/tempo/Account.d.ts.map +1 -1
  228. package/_types/tempo/Addresses.d.ts +1 -0
  229. package/_types/tempo/Addresses.d.ts.map +1 -1
  230. package/_types/tempo/Client.d.ts +3 -3
  231. package/_types/tempo/Decorator.d.ts +64 -38
  232. package/_types/tempo/Decorator.d.ts.map +1 -1
  233. package/_types/tempo/ExecutionError.d.ts +3 -1
  234. package/_types/tempo/ExecutionError.d.ts.map +1 -1
  235. package/_types/tempo/Formatters.d.ts.map +1 -1
  236. package/_types/tempo/KeyAuthorizationManager.d.ts +45 -2
  237. package/_types/tempo/KeyAuthorizationManager.d.ts.map +1 -1
  238. package/_types/tempo/Relay.d.ts +62 -12
  239. package/_types/tempo/Relay.d.ts.map +1 -1
  240. package/_types/tempo/Transaction.d.ts +14 -11
  241. package/_types/tempo/Transaction.d.ts.map +1 -1
  242. package/_types/tempo/Transport.d.ts +20 -7
  243. package/_types/tempo/Transport.d.ts.map +1 -1
  244. package/_types/tempo/{multisig → accounts}/Config.d.ts +7 -7
  245. package/_types/tempo/accounts/Config.d.ts.map +1 -0
  246. package/_types/tempo/{multisig → accounts}/Operation.d.ts +7 -7
  247. package/_types/tempo/accounts/Operation.d.ts.map +1 -0
  248. package/_types/tempo/{multisig → accounts}/Signature.d.ts +1 -1
  249. package/_types/tempo/accounts/Signature.d.ts.map +1 -0
  250. package/_types/tempo/actions/accessKey.d.ts +214 -25
  251. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  252. package/_types/tempo/actions/{multisig.d.ts → accounts.d.ts} +31 -29
  253. package/_types/tempo/actions/accounts.d.ts.map +1 -0
  254. package/_types/tempo/actions/amm.d.ts +39 -0
  255. package/_types/tempo/actions/amm.d.ts.map +1 -1
  256. package/_types/tempo/actions/channel.d.ts +77 -7
  257. package/_types/tempo/actions/channel.d.ts.map +1 -1
  258. package/_types/tempo/actions/dex.d.ts +222 -16
  259. package/_types/tempo/actions/dex.d.ts.map +1 -1
  260. package/_types/tempo/actions/earn/deployment.d.ts +7 -6
  261. package/_types/tempo/actions/earn/deployment.d.ts.map +1 -1
  262. package/_types/tempo/actions/earn.d.ts +15 -14
  263. package/_types/tempo/actions/earn.d.ts.map +1 -1
  264. package/_types/tempo/actions/fee.d.ts +32 -6
  265. package/_types/tempo/actions/fee.d.ts.map +1 -1
  266. package/_types/tempo/actions/index.d.ts +1 -1
  267. package/_types/tempo/actions/index.d.ts.map +1 -1
  268. package/_types/tempo/actions/nonce.d.ts +35 -0
  269. package/_types/tempo/actions/nonce.d.ts.map +1 -1
  270. package/_types/tempo/actions/policy.d.ts +29 -8
  271. package/_types/tempo/actions/policy.d.ts.map +1 -1
  272. package/_types/tempo/actions/propAmm.d.ts +9 -1
  273. package/_types/tempo/actions/propAmm.d.ts.map +1 -1
  274. package/_types/tempo/actions/receivePolicy.d.ts +10 -6
  275. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -1
  276. package/_types/tempo/actions/reward.d.ts +7 -3
  277. package/_types/tempo/actions/reward.d.ts.map +1 -1
  278. package/_types/tempo/actions/token.d.ts +200 -32
  279. package/_types/tempo/actions/token.d.ts.map +1 -1
  280. package/_types/tempo/actions/validator.d.ts +17 -5
  281. package/_types/tempo/actions/validator.d.ts.map +1 -1
  282. package/_types/tempo/actions/virtualAddress.d.ts +4 -3
  283. package/_types/tempo/actions/virtualAddress.d.ts.map +1 -1
  284. package/_types/tempo/actions/zone.d.ts +10 -9
  285. package/_types/tempo/actions/zone.d.ts.map +1 -1
  286. package/_types/tempo/errors.d.ts +63 -1
  287. package/_types/tempo/errors.d.ts.map +1 -1
  288. package/_types/tempo/index.d.ts +3 -2
  289. package/_types/tempo/index.d.ts.map +1 -1
  290. package/_types/tempo/internal/errors.d.ts +59 -0
  291. package/_types/tempo/internal/errors.d.ts.map +1 -0
  292. package/_types/tempo/internal/relay/accounts.d.ts +15 -0
  293. package/_types/tempo/internal/relay/accounts.d.ts.map +1 -0
  294. package/_types/tempo/internal/relay/keyAuthorization.d.ts +25 -0
  295. package/_types/tempo/internal/relay/keyAuthorization.d.ts.map +1 -0
  296. package/_types/tempo/internal/relay/plugin.d.ts +6 -3
  297. package/_types/tempo/internal/relay/plugin.d.ts.map +1 -1
  298. package/_types/tempo/internal/resolveError.d.ts +8 -0
  299. package/_types/tempo/internal/resolveError.d.ts.map +1 -0
  300. package/_types/tempo/internal/utils.d.ts.map +1 -1
  301. package/_types/utils/hash/normalizeSignature.d.ts.map +1 -1
  302. package/_types/utils/rpc/http.d.ts.map +1 -1
  303. package/_types/utils/rpc/socket.d.ts.map +1 -1
  304. package/actions/public/waitForTransactionReceipt.ts +8 -2
  305. package/actions/wallet/waitForCallsStatus.ts +41 -2
  306. package/chains/definitions/arcTestnet.ts +11 -8
  307. package/chains/definitions/qmsTestnet.ts +27 -0
  308. package/chains/definitions/tempo.ts +1 -1
  309. package/chains/definitions/tempoModerato.ts +2 -2
  310. package/chains/index.ts +1 -0
  311. package/clients/transports/ipc.ts +38 -29
  312. package/clients/transports/webSocket.ts +42 -33
  313. package/errors/version.ts +1 -1
  314. package/package.json +2 -2
  315. package/tempo/Abis.ts +298 -0
  316. package/tempo/Account.ts +95 -84
  317. package/tempo/Addresses.ts +1 -0
  318. package/tempo/Client.ts +3 -3
  319. package/tempo/Decorator.ts +91 -60
  320. package/tempo/ExecutionError.ts +102 -4
  321. package/tempo/Formatters.ts +14 -13
  322. package/tempo/KeyAuthorizationManager.ts +71 -19
  323. package/tempo/Relay.ts +70 -14
  324. package/tempo/Transaction.ts +31 -23
  325. package/tempo/Transport.ts +49 -21
  326. package/tempo/{multisig → accounts}/Config.ts +21 -21
  327. package/tempo/{multisig → accounts}/Operation.ts +26 -26
  328. package/tempo/{multisig → accounts}/Signature.ts +5 -3
  329. package/tempo/actions/accessKey.ts +675 -104
  330. package/tempo/actions/{multisig.ts → accounts.ts} +54 -59
  331. package/tempo/actions/amm.ts +126 -4
  332. package/tempo/actions/channel.ts +248 -14
  333. package/tempo/actions/dex.ts +599 -33
  334. package/tempo/actions/earn/deployment.ts +11 -9
  335. package/tempo/actions/earn.ts +40 -35
  336. package/tempo/actions/fee.ts +111 -9
  337. package/tempo/actions/index.ts +1 -1
  338. package/tempo/actions/nonce.ts +86 -1
  339. package/tempo/actions/policy.ts +66 -14
  340. package/tempo/actions/propAmm.ts +36 -9
  341. package/tempo/actions/receivePolicy.ts +26 -15
  342. package/tempo/actions/reward.ts +17 -9
  343. package/tempo/actions/token.ts +519 -54
  344. package/tempo/actions/validator.ts +40 -16
  345. package/tempo/actions/virtualAddress.ts +7 -5
  346. package/tempo/actions/zone.ts +25 -20
  347. package/tempo/chainConfig.ts +52 -52
  348. package/tempo/errors.ts +114 -1
  349. package/tempo/index.ts +5 -4
  350. package/tempo/internal/errors.ts +110 -0
  351. package/tempo/internal/relay/{multisig.ts → accounts.ts} +118 -118
  352. package/tempo/internal/relay/feePayer.ts +1 -1
  353. package/tempo/internal/relay/keyAuthorization.ts +415 -0
  354. package/tempo/internal/relay/plugin.ts +20 -7
  355. package/tempo/internal/resolveError.ts +169 -0
  356. package/tempo/internal/utils.ts +2 -0
  357. package/utils/hash/normalizeSignature.ts +3 -2
  358. package/utils/rpc/http.ts +76 -30
  359. package/utils/rpc/socket.ts +3 -1
  360. package/_cjs/tempo/actions/multisig.js.map +0 -1
  361. package/_cjs/tempo/internal/relay/multisig.js.map +0 -1
  362. package/_cjs/tempo/multisig/Signature.js.map +0 -1
  363. package/_esm/tempo/actions/multisig.js.map +0 -1
  364. package/_esm/tempo/internal/relay/multisig.js.map +0 -1
  365. package/_esm/tempo/multisig/Signature.js +0 -9
  366. package/_esm/tempo/multisig/Signature.js.map +0 -1
  367. package/_types/tempo/actions/multisig.d.ts.map +0 -1
  368. package/_types/tempo/internal/relay/multisig.d.ts +0 -4
  369. package/_types/tempo/internal/relay/multisig.d.ts.map +0 -1
  370. package/_types/tempo/multisig/Config.d.ts.map +0 -1
  371. package/_types/tempo/multisig/Operation.d.ts.map +0 -1
  372. package/_types/tempo/multisig/Signature.d.ts.map +0 -1
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorResolvers = exports.TokenUnauthorizedError = exports.TokenPausedError = exports.TokenPolicyForbidsError = exports.TokenSupplyCapExceededError = exports.TokenInsufficientAllowanceError = exports.TokenInsufficientBalanceError = void 0;
3
4
  exports.approve = approve;
4
5
  exports.approveSync = approveSync;
5
6
  exports.burnBlocked = burnBlocked;
@@ -59,19 +60,22 @@ const sendTransaction_js_1 = require("../../actions/wallet/sendTransaction.js");
59
60
  const sendTransactionSync_js_1 = require("../../actions/wallet/sendTransactionSync.js");
60
61
  const writeContract_js_1 = require("../../actions/wallet/writeContract.js");
61
62
  const writeContractSync_js_1 = require("../../actions/wallet/writeContractSync.js");
63
+ const address_js_1 = require("../../constants/address.js");
62
64
  const account_js_1 = require("../../errors/account.js");
63
65
  const encodeFunctionData_js_1 = require("../../utils/abi/encodeFunctionData.js");
64
66
  const parseEventLogs_js_1 = require("../../utils/abi/parseEventLogs.js");
65
67
  const formatUnits_js_1 = require("../../utils/unit/formatUnits.js");
66
68
  const Abis = require("../Abis.js");
67
69
  const Addresses = require("../Addresses.js");
70
+ const errors_js_1 = require("../errors.js");
71
+ const errors_js_2 = require("../internal/errors.js");
68
72
  const utils_js_1 = require("../internal/utils.js");
69
73
  async function approve(client, parameters) {
70
74
  return approve.inner(writeContract_js_1.writeContract, client, parameters);
71
75
  }
72
76
  (function (approve) {
73
77
  async function inner(action, client, parameters) {
74
- return (await action(client, {
78
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
75
79
  ...parameters,
76
80
  ...approve.call(client, parameters),
77
81
  }));
@@ -141,7 +145,7 @@ async function burnBlocked(client, parameters) {
141
145
  async function inner(action, client, parameters) {
142
146
  const { amount, from, token, ...rest } = parameters;
143
147
  const call = burnBlocked.call(client, { amount, from, token });
144
- return (await action(client, {
148
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
145
149
  ...rest,
146
150
  ...call,
147
151
  }));
@@ -192,7 +196,7 @@ async function burn(client, parameters) {
192
196
  async function inner(action, client, parameters) {
193
197
  const { amount, from, memo, token, ...rest } = parameters;
194
198
  const call = burn.call(client, { amount, from, memo, token });
195
- return (await action(client, {
199
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
196
200
  ...rest,
197
201
  ...call,
198
202
  }));
@@ -259,7 +263,7 @@ async function changeTransferPolicy(client, parameters) {
259
263
  async function inner(action, client, parameters) {
260
264
  const { policyId, token, ...rest } = parameters;
261
265
  const call = changeTransferPolicy.call(client, { policyId, token });
262
- return (await action(client, {
266
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
263
267
  ...rest,
264
268
  ...call,
265
269
  }));
@@ -312,7 +316,7 @@ async function create(client, parameters) {
312
316
  if (!admin)
313
317
  throw new Error('admin is required.');
314
318
  const call = create.call(client, { ...rest, admin: admin.address });
315
- return (await action(client, {
319
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
316
320
  ...parameters,
317
321
  account,
318
322
  chain,
@@ -380,7 +384,7 @@ async function createSync(client, parameters) {
380
384
  async function getAllowance(client, parameters) {
381
385
  const { account, decimals, spender, token, ...rest } = parameters;
382
386
  const [amount, { decimals: resolved }] = await Promise.all([
383
- (0, readContract_js_1.readContract)(client, {
387
+ (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
384
388
  ...rest,
385
389
  ...getAllowance.call(client, { account, spender, token }),
386
390
  }),
@@ -409,7 +413,7 @@ async function getBalance(client, parameters) {
409
413
  throw new account_js_1.AccountNotFoundError();
410
414
  const account = (0, parseAccount_js_1.parseAccount)(account_).address;
411
415
  const [amount, { decimals: resolved }] = await Promise.all([
412
- (0, readContract_js_1.readContract)(client, {
416
+ (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
413
417
  ...rest,
414
418
  ...getBalance.call(client, { account, token }),
415
419
  }),
@@ -566,7 +570,7 @@ async function readMetadataContracts(client, parameters) {
566
570
  deployless: true,
567
571
  });
568
572
  const { contracts, ...rest } = parameters;
569
- const results = await Promise.allSettled(contracts.map((contract) => (0, readContract_js_1.readContract)(client, {
573
+ const results = await Promise.allSettled(contracts.map((contract) => (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
570
574
  ...rest,
571
575
  ...contract,
572
576
  })));
@@ -585,7 +589,7 @@ function unwrapMulticallResult(response, ...fallback) {
585
589
  async function getTotalSupply(client, parameters) {
586
590
  const { decimals, token, ...rest } = parameters;
587
591
  const [amount, { decimals: resolved }] = await Promise.all([
588
- (0, readContract_js_1.readContract)(client, {
592
+ (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
589
593
  ...rest,
590
594
  ...getTotalSupply.call(client, { token }),
591
595
  }),
@@ -609,7 +613,7 @@ async function getTotalSupply(client, parameters) {
609
613
  getTotalSupply.call = call;
610
614
  })(getTotalSupply || (exports.getTotalSupply = getTotalSupply = {}));
611
615
  async function getRoleAdmin(client, parameters) {
612
- return (0, readContract_js_1.readContract)(client, {
616
+ return (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
613
617
  ...parameters,
614
618
  ...getRoleAdmin.call(client, parameters),
615
619
  });
@@ -632,7 +636,7 @@ async function hasRole(client, parameters) {
632
636
  const address = account ? (0, parseAccount_js_1.parseAccount)(account).address : undefined;
633
637
  if (!address)
634
638
  throw new Error('account is required.');
635
- return (0, readContract_js_1.readContract)(client, {
639
+ return (0, errors_js_2.withExecutionError)(readContract_js_1.readContract)(client, {
636
640
  ...parameters,
637
641
  ...hasRole.call(client, { ...parameters, account: address }),
638
642
  });
@@ -655,7 +659,7 @@ async function grantRoles(client, parameters) {
655
659
  }
656
660
  (function (grantRoles) {
657
661
  async function inner(action, client, parameters) {
658
- return (await action(client, {
662
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
659
663
  ...parameters,
660
664
  calls: parameters.roles.map((role) => {
661
665
  const call = grantRoles.call(client, { ...parameters, role });
@@ -713,7 +717,13 @@ async function mint(client, parameters) {
713
717
  async function inner(action, client, parameters) {
714
718
  const { amount, memo, to, token, ...rest } = parameters;
715
719
  const call = mint.call(client, { amount, memo, to, token });
716
- return (await action(client, {
720
+ return (await (0, errors_js_2.withExecutionError)(action, {
721
+ hints: {
722
+ Unauthorized: [
723
+ 'Minting requires the issuer role. Grant it to this account first.',
724
+ ],
725
+ },
726
+ })(client, {
717
727
  ...rest,
718
728
  ...call,
719
729
  }));
@@ -773,7 +783,7 @@ async function pause(client, parameters) {
773
783
  async function inner(action, client, parameters) {
774
784
  const { token, ...rest } = parameters;
775
785
  const call = pause.call(client, { token });
776
- return (await action(client, {
786
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
777
787
  ...rest,
778
788
  ...call,
779
789
  }));
@@ -821,7 +831,7 @@ async function renounceRoles(client, parameters) {
821
831
  }
822
832
  (function (renounceRoles) {
823
833
  async function inner(action, client, parameters) {
824
- return (await action(client, {
834
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
825
835
  ...parameters,
826
836
  calls: parameters.roles.map((role) => {
827
837
  const call = renounceRoles.call(client, { ...parameters, role });
@@ -878,7 +888,7 @@ async function revokeRoles(client, parameters) {
878
888
  (function (revokeRoles) {
879
889
  async function inner(action, client, parameters) {
880
890
  const { from: _, ...rest } = parameters;
881
- return (await action(client, {
891
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
882
892
  ...rest,
883
893
  calls: parameters.roles.map((role) => {
884
894
  const call = revokeRoles.call(client, { ...parameters, role });
@@ -936,7 +946,7 @@ async function setSupplyCap(client, parameters) {
936
946
  async function inner(action, client, parameters) {
937
947
  const { supplyCap, token, ...rest } = parameters;
938
948
  const call = setSupplyCap.call(client, { supplyCap, token });
939
- return (await action(client, {
949
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
940
950
  ...rest,
941
951
  ...call,
942
952
  }));
@@ -986,7 +996,7 @@ async function setRoleAdmin(client, parameters) {
986
996
  async function inner(action, client, parameters) {
987
997
  const { adminRole, role, token, ...rest } = parameters;
988
998
  const call = setRoleAdmin.call(client, { adminRole, role, token });
989
- return (await action(client, {
999
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
990
1000
  ...rest,
991
1001
  ...call,
992
1002
  }));
@@ -1036,7 +1046,7 @@ async function transfer(client, parameters) {
1036
1046
  }
1037
1047
  (function (transfer) {
1038
1048
  async function inner(action, client, parameters) {
1039
- return (await action(client, {
1049
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
1040
1050
  ...parameters,
1041
1051
  ...transfer.call(client, parameters),
1042
1052
  }));
@@ -1127,7 +1137,7 @@ async function unpause(client, parameters) {
1127
1137
  async function inner(action, client, parameters) {
1128
1138
  const { token, ...rest } = parameters;
1129
1139
  const call = unpause.call(client, { token });
1130
- return (await action(client, {
1140
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
1131
1141
  ...rest,
1132
1142
  ...call,
1133
1143
  }));
@@ -1177,7 +1187,7 @@ async function prepareUpdateQuoteToken(client, parameters) {
1177
1187
  async function inner(action, client, parameters) {
1178
1188
  const { quoteToken, token, ...rest } = parameters;
1179
1189
  const call = prepareUpdateQuoteToken.call(client, { quoteToken, token });
1180
- return (await action(client, {
1190
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
1181
1191
  ...rest,
1182
1192
  ...call,
1183
1193
  }));
@@ -1223,7 +1233,7 @@ async function updateQuoteToken(client, parameters) {
1223
1233
  async function inner(action, client, parameters) {
1224
1234
  const { token, ...rest } = parameters;
1225
1235
  const call = updateQuoteToken.call(client, { token });
1226
- return (await action(client, {
1236
+ return (await (0, errors_js_2.withExecutionError)(action)(client, {
1227
1237
  ...rest,
1228
1238
  ...call,
1229
1239
  }));
@@ -1383,4 +1393,405 @@ function watchUpdateQuoteToken(client, parameters) {
1383
1393
  strict: true,
1384
1394
  });
1385
1395
  }
1396
+ class TokenInsufficientBalanceError extends errors_js_1.TempoExecutionError {
1397
+ constructor(parameters) {
1398
+ const { decimals } = parameters;
1399
+ const [available, required, token] = parameters.error.args;
1400
+ super(parameters, {
1401
+ details: {
1402
+ token,
1403
+ available: (0, errors_js_2.formatAmount)(available, decimals),
1404
+ required: (0, errors_js_2.formatAmount)(required, decimals),
1405
+ shortfall: (0, errors_js_2.formatAmount)(required - available, decimals),
1406
+ },
1407
+ name: 'TokenInsufficientBalanceError',
1408
+ shortMessage: `Insufficient balance of token "${token}".`,
1409
+ });
1410
+ Object.defineProperty(this, "available", {
1411
+ enumerable: true,
1412
+ configurable: true,
1413
+ writable: true,
1414
+ value: void 0
1415
+ });
1416
+ Object.defineProperty(this, "decimals", {
1417
+ enumerable: true,
1418
+ configurable: true,
1419
+ writable: true,
1420
+ value: void 0
1421
+ });
1422
+ Object.defineProperty(this, "required", {
1423
+ enumerable: true,
1424
+ configurable: true,
1425
+ writable: true,
1426
+ value: void 0
1427
+ });
1428
+ Object.defineProperty(this, "token", {
1429
+ enumerable: true,
1430
+ configurable: true,
1431
+ writable: true,
1432
+ value: void 0
1433
+ });
1434
+ this.available = available;
1435
+ this.decimals = decimals;
1436
+ this.required = required;
1437
+ this.token = token;
1438
+ }
1439
+ }
1440
+ exports.TokenInsufficientBalanceError = TokenInsufficientBalanceError;
1441
+ class TokenInsufficientAllowanceError extends errors_js_1.TempoExecutionError {
1442
+ constructor(parameters) {
1443
+ const { allowance, amount, decimals, owner, spender, token } = parameters;
1444
+ super(parameters, {
1445
+ details: {
1446
+ token,
1447
+ owner,
1448
+ spender,
1449
+ allowance: (0, errors_js_2.formatAmount)(allowance, decimals),
1450
+ amount: (0, errors_js_2.formatAmount)(amount, decimals),
1451
+ },
1452
+ name: 'TokenInsufficientAllowanceError',
1453
+ shortMessage: `Spender "${spender}" has an insufficient allowance from "${owner}" for token "${token}".`,
1454
+ });
1455
+ Object.defineProperty(this, "allowance", {
1456
+ enumerable: true,
1457
+ configurable: true,
1458
+ writable: true,
1459
+ value: void 0
1460
+ });
1461
+ Object.defineProperty(this, "amount", {
1462
+ enumerable: true,
1463
+ configurable: true,
1464
+ writable: true,
1465
+ value: void 0
1466
+ });
1467
+ Object.defineProperty(this, "decimals", {
1468
+ enumerable: true,
1469
+ configurable: true,
1470
+ writable: true,
1471
+ value: void 0
1472
+ });
1473
+ Object.defineProperty(this, "owner", {
1474
+ enumerable: true,
1475
+ configurable: true,
1476
+ writable: true,
1477
+ value: void 0
1478
+ });
1479
+ Object.defineProperty(this, "spender", {
1480
+ enumerable: true,
1481
+ configurable: true,
1482
+ writable: true,
1483
+ value: void 0
1484
+ });
1485
+ Object.defineProperty(this, "token", {
1486
+ enumerable: true,
1487
+ configurable: true,
1488
+ writable: true,
1489
+ value: void 0
1490
+ });
1491
+ this.allowance = allowance;
1492
+ this.amount = amount;
1493
+ this.decimals = decimals;
1494
+ this.owner = owner;
1495
+ this.spender = spender;
1496
+ this.token = token;
1497
+ }
1498
+ }
1499
+ exports.TokenInsufficientAllowanceError = TokenInsufficientAllowanceError;
1500
+ class TokenSupplyCapExceededError extends errors_js_1.TempoExecutionError {
1501
+ constructor(parameters) {
1502
+ const { amount, decimals, supplyCap, token, totalSupply } = parameters;
1503
+ super(parameters, {
1504
+ details: {
1505
+ token,
1506
+ amount: (0, errors_js_2.formatAmount)(amount, decimals),
1507
+ 'total supply': (0, errors_js_2.formatAmount)(totalSupply, decimals),
1508
+ 'supply cap': (0, errors_js_2.formatAmount)(supplyCap, decimals),
1509
+ 'mintable amount': supplyCap !== undefined && totalSupply !== undefined
1510
+ ? (0, errors_js_2.formatAmount)(supplyCap - totalSupply, decimals)
1511
+ : undefined,
1512
+ },
1513
+ name: 'TokenSupplyCapExceededError',
1514
+ shortMessage: `Minting exceeds the supply cap of token "${token}".`,
1515
+ });
1516
+ Object.defineProperty(this, "amount", {
1517
+ enumerable: true,
1518
+ configurable: true,
1519
+ writable: true,
1520
+ value: void 0
1521
+ });
1522
+ Object.defineProperty(this, "decimals", {
1523
+ enumerable: true,
1524
+ configurable: true,
1525
+ writable: true,
1526
+ value: void 0
1527
+ });
1528
+ Object.defineProperty(this, "supplyCap", {
1529
+ enumerable: true,
1530
+ configurable: true,
1531
+ writable: true,
1532
+ value: void 0
1533
+ });
1534
+ Object.defineProperty(this, "token", {
1535
+ enumerable: true,
1536
+ configurable: true,
1537
+ writable: true,
1538
+ value: void 0
1539
+ });
1540
+ Object.defineProperty(this, "totalSupply", {
1541
+ enumerable: true,
1542
+ configurable: true,
1543
+ writable: true,
1544
+ value: void 0
1545
+ });
1546
+ this.amount = amount;
1547
+ this.decimals = decimals;
1548
+ this.supplyCap = supplyCap;
1549
+ this.token = token;
1550
+ this.totalSupply = totalSupply;
1551
+ }
1552
+ }
1553
+ exports.TokenSupplyCapExceededError = TokenSupplyCapExceededError;
1554
+ class TokenPolicyForbidsError extends errors_js_1.TempoExecutionError {
1555
+ constructor(parameters) {
1556
+ const { from, policyId, recipientAuthorized, senderAuthorized, to, token } = parameters;
1557
+ const party = senderAuthorized === false
1558
+ ? `sender "${from}"`
1559
+ : recipientAuthorized === false
1560
+ ? `recipient "${to}"`
1561
+ : 'this transfer';
1562
+ super(parameters, {
1563
+ details: {
1564
+ token,
1565
+ policy: policyId,
1566
+ from,
1567
+ to,
1568
+ 'sender authorized': senderAuthorized?.toString(),
1569
+ 'recipient authorized': recipientAuthorized?.toString(),
1570
+ },
1571
+ name: 'TokenPolicyForbidsError',
1572
+ shortMessage: `The transfer policy of token "${token}" forbids ${party}.`,
1573
+ });
1574
+ Object.defineProperty(this, "from", {
1575
+ enumerable: true,
1576
+ configurable: true,
1577
+ writable: true,
1578
+ value: void 0
1579
+ });
1580
+ Object.defineProperty(this, "policyId", {
1581
+ enumerable: true,
1582
+ configurable: true,
1583
+ writable: true,
1584
+ value: void 0
1585
+ });
1586
+ Object.defineProperty(this, "recipientAuthorized", {
1587
+ enumerable: true,
1588
+ configurable: true,
1589
+ writable: true,
1590
+ value: void 0
1591
+ });
1592
+ Object.defineProperty(this, "senderAuthorized", {
1593
+ enumerable: true,
1594
+ configurable: true,
1595
+ writable: true,
1596
+ value: void 0
1597
+ });
1598
+ Object.defineProperty(this, "to", {
1599
+ enumerable: true,
1600
+ configurable: true,
1601
+ writable: true,
1602
+ value: void 0
1603
+ });
1604
+ Object.defineProperty(this, "token", {
1605
+ enumerable: true,
1606
+ configurable: true,
1607
+ writable: true,
1608
+ value: void 0
1609
+ });
1610
+ this.from = from;
1611
+ this.policyId = policyId;
1612
+ this.recipientAuthorized = recipientAuthorized;
1613
+ this.senderAuthorized = senderAuthorized;
1614
+ this.to = to;
1615
+ this.token = token;
1616
+ }
1617
+ }
1618
+ exports.TokenPolicyForbidsError = TokenPolicyForbidsError;
1619
+ class TokenPausedError extends errors_js_1.TempoExecutionError {
1620
+ constructor(parameters) {
1621
+ super(parameters, {
1622
+ name: 'TokenPausedError',
1623
+ shortMessage: `Token "${parameters.token}" is paused.`,
1624
+ });
1625
+ Object.defineProperty(this, "token", {
1626
+ enumerable: true,
1627
+ configurable: true,
1628
+ writable: true,
1629
+ value: void 0
1630
+ });
1631
+ this.token = parameters.token;
1632
+ }
1633
+ }
1634
+ exports.TokenPausedError = TokenPausedError;
1635
+ class TokenUnauthorizedError extends errors_js_1.TempoExecutionError {
1636
+ constructor(parameters) {
1637
+ const { account, role, token } = parameters;
1638
+ super(parameters, {
1639
+ details: { token, account, role },
1640
+ name: 'TokenUnauthorizedError',
1641
+ shortMessage: `Account "${account}" does not have the "${role}" role on token "${token}".`,
1642
+ });
1643
+ Object.defineProperty(this, "account", {
1644
+ enumerable: true,
1645
+ configurable: true,
1646
+ writable: true,
1647
+ value: void 0
1648
+ });
1649
+ Object.defineProperty(this, "role", {
1650
+ enumerable: true,
1651
+ configurable: true,
1652
+ writable: true,
1653
+ value: void 0
1654
+ });
1655
+ Object.defineProperty(this, "token", {
1656
+ enumerable: true,
1657
+ configurable: true,
1658
+ writable: true,
1659
+ value: void 0
1660
+ });
1661
+ this.account = account;
1662
+ this.role = role;
1663
+ this.token = token;
1664
+ }
1665
+ }
1666
+ exports.TokenUnauthorizedError = TokenUnauthorizedError;
1667
+ const requiredRoles = {
1668
+ burn: 'issuer',
1669
+ burnAt: 'burnAt',
1670
+ burnBlocked: 'burnBlocked',
1671
+ burnWithMemo: 'issuer',
1672
+ changeTransferPolicyId: 'defaultAdmin',
1673
+ completeQuoteTokenUpdate: 'defaultAdmin',
1674
+ mint: 'issuer',
1675
+ mintWithMemo: 'issuer',
1676
+ pause: 'pause',
1677
+ setLogoURI: 'defaultAdmin',
1678
+ setNextQuoteToken: 'defaultAdmin',
1679
+ setSupplyCap: 'defaultAdmin',
1680
+ unpause: 'unpause',
1681
+ };
1682
+ exports.errorResolvers = {
1683
+ 'ContractPaused()': ({ base, call }) => (0, errors_js_2.isTip20)(call?.address)
1684
+ ? new TokenPausedError({ ...base, token: call.address })
1685
+ : undefined,
1686
+ 'InsufficientAllowance()': async (context) => {
1687
+ const { base, call, signer } = context;
1688
+ const owner = call?.arg('from');
1689
+ if (!(0, errors_js_2.isTip20)(call?.address) || !owner || !signer)
1690
+ return undefined;
1691
+ const token = call.address;
1692
+ const [allowance, decimals] = await context.read([
1693
+ {
1694
+ address: token,
1695
+ abi: Abis.tip20,
1696
+ functionName: 'allowance',
1697
+ args: [owner, signer.address],
1698
+ },
1699
+ { address: token, abi: Abis.tip20, functionName: 'decimals' },
1700
+ ]);
1701
+ return new TokenInsufficientAllowanceError({
1702
+ ...base,
1703
+ allowance: allowance?.result,
1704
+ amount: call.arg('amount'),
1705
+ decimals: decimals?.result,
1706
+ owner,
1707
+ spender: signer.address,
1708
+ token,
1709
+ });
1710
+ },
1711
+ 'InsufficientBalance(uint256,uint256,address)': async (context) => {
1712
+ const token = context.base.error.args?.[2];
1713
+ if (!token)
1714
+ return undefined;
1715
+ const [decimals] = await context.read([
1716
+ { address: token, abi: Abis.tip20, functionName: 'decimals' },
1717
+ ]);
1718
+ return new TokenInsufficientBalanceError({
1719
+ ...context.base,
1720
+ decimals: decimals?.result,
1721
+ });
1722
+ },
1723
+ 'PolicyForbids()': async (context) => {
1724
+ const { base, call, signer } = context;
1725
+ if (!(0, errors_js_2.isTip20)(call?.address))
1726
+ return undefined;
1727
+ const token = call.address;
1728
+ const mint = call.functionName.startsWith('mint');
1729
+ const from = mint
1730
+ ? undefined
1731
+ : (call.arg('from') ?? signer?.address);
1732
+ const to = call.arg('to');
1733
+ const [policyId] = await context.read([
1734
+ { address: token, abi: Abis.tip20, functionName: 'transferPolicyId' },
1735
+ ]);
1736
+ const registry = {
1737
+ address: Addresses.tip403Registry,
1738
+ abi: Abis.tip403Registry,
1739
+ };
1740
+ const [sender, recipient] = policyId?.result === undefined
1741
+ ? []
1742
+ : await context.read([
1743
+ {
1744
+ ...registry,
1745
+ functionName: 'isAuthorizedSender',
1746
+ args: [policyId.result, from ?? address_js_1.zeroAddress],
1747
+ },
1748
+ {
1749
+ ...registry,
1750
+ functionName: mint
1751
+ ? 'isAuthorizedMintRecipient'
1752
+ : 'isAuthorizedRecipient',
1753
+ args: [policyId.result, to ?? address_js_1.zeroAddress],
1754
+ },
1755
+ ]);
1756
+ return new TokenPolicyForbidsError({
1757
+ ...base,
1758
+ from,
1759
+ policyId: policyId?.result,
1760
+ recipientAuthorized: to ? recipient?.result : undefined,
1761
+ senderAuthorized: from ? sender?.result : undefined,
1762
+ to,
1763
+ token,
1764
+ });
1765
+ },
1766
+ 'SupplyCapExceeded()': async (context) => {
1767
+ const { base, call } = context;
1768
+ if (!(0, errors_js_2.isTip20)(call?.address))
1769
+ return undefined;
1770
+ const token = call.address;
1771
+ const [supplyCap, totalSupply, decimals] = await context.read([
1772
+ { address: token, abi: Abis.tip20, functionName: 'supplyCap' },
1773
+ { address: token, abi: Abis.tip20, functionName: 'totalSupply' },
1774
+ { address: token, abi: Abis.tip20, functionName: 'decimals' },
1775
+ ]);
1776
+ return new TokenSupplyCapExceededError({
1777
+ ...base,
1778
+ amount: call.arg('amount'),
1779
+ decimals: decimals?.result,
1780
+ supplyCap: supplyCap?.result,
1781
+ token,
1782
+ totalSupply: totalSupply?.result,
1783
+ });
1784
+ },
1785
+ 'Unauthorized()': ({ base, call, signer }) => {
1786
+ const role = call && requiredRoles[call.functionName];
1787
+ if (!(0, errors_js_2.isTip20)(call?.address) || !role || !signer)
1788
+ return undefined;
1789
+ return new TokenUnauthorizedError({
1790
+ ...base,
1791
+ account: signer.address,
1792
+ role,
1793
+ token: call.address,
1794
+ });
1795
+ },
1796
+ };
1386
1797
  //# sourceMappingURL=token.js.map