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,9 +1,9 @@
1
1
  import type { Address } from 'abitype'
2
2
  import type * as RpcSchema from 'ox/RpcSchema'
3
3
  import {
4
+ AccountConfig,
5
+ AccountOperation,
4
6
  KeyAuthorization,
5
- MultisigConfig,
6
- MultisigOperation,
7
7
  type RpcSchemaTempo,
8
8
  SignatureEnvelope,
9
9
  } from 'ox/tempo'
@@ -21,36 +21,52 @@ import { writeContractSync } from '../../actions/wallet/writeContractSync.js'
21
21
  import type { Client } from '../../clients/createClient.js'
22
22
  import type { Transport } from '../../clients/transports/createTransport.js'
23
23
  import type { BaseErrorType } from '../../errors/base.js'
24
+ import {
25
+ MethodNotFoundRpcError,
26
+ MethodNotSupportedRpcError,
27
+ } from '../../errors/rpc.js'
24
28
  import type { Chain } from '../../types/chain.js'
25
29
  import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js'
26
30
  import type { Log, Log as viem_Log } from '../../types/log.js'
27
31
  import type { Hex } from '../../types/misc.js'
28
32
  import type { Compute, OneOf, UnionOmit } from '../../types/utils.js'
33
+ import { formatAbiItem } from '../../utils/abi/formatAbiItem.js'
29
34
  import { parseEventLogs } from '../../utils/abi/parseEventLogs.js'
30
35
  import { isAddressEqual } from '../../utils/address/isAddressEqual.js'
31
36
  import * as Abis from '../Abis.js'
32
37
  import type {
33
38
  AccessKeyAccount,
34
- MultisigAccount,
39
+ ConfigurableAccount,
35
40
  RootAccount,
36
41
  } from '../Account.js'
37
42
  import {
38
- fromMultisig,
43
+ fromConfig,
39
44
  getKeyAuthorizationSignPayload,
40
45
  resolveAccessKey,
41
46
  signKeyAuthorization,
42
47
  } from '../Account.js'
43
48
  import * as Addresses from '../Addresses.js'
49
+ import { parseApproval } from '../accounts/Signature.js'
50
+ import type * as Errors from '../errors.js'
51
+ import { TempoExecutionError } from '../errors.js'
44
52
  import * as Hardfork from '../Hardfork.js'
53
+ import {
54
+ type Context,
55
+ formatAmount,
56
+ formatTime,
57
+ getFeeToken,
58
+ isTip20,
59
+ type Resolvers,
60
+ withExecutionError,
61
+ } from '../internal/errors.js'
45
62
  import type {
46
63
  GetAccountParameter,
47
64
  ReadParameters,
48
65
  WriteParameters,
49
66
  } from '../internal/types.js'
50
67
  import { defineCall } from '../internal/utils.js'
51
- import { parseApproval } from '../multisig/Signature.js'
52
68
  import type { TransactionReceipt } from '../Transaction.js'
53
- import { getConfig } from './multisig.js'
69
+ import { getConfig } from './accounts.js'
54
70
 
55
71
  /** @internal */
56
72
  const signatureTypes = {
@@ -149,7 +165,7 @@ export namespace authorize {
149
165
  export type ReturnValue = WriteContractReturnType
150
166
 
151
167
  // TODO: exhaustive error type
152
- export type ErrorType = BaseErrorType
168
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
153
169
 
154
170
  /** @internal */
155
171
  export async function inner<
@@ -174,7 +190,7 @@ export namespace authorize {
174
190
  const account_ = rest.account ?? client.account
175
191
  if (!account_) throw new Error('account is required.')
176
192
  if (!chainId) throw new Error('chainId is required.')
177
- const keyAuthorization = await signAuthorization(client, {
193
+ const keyAuthorization = await signLocal(client, {
178
194
  account: account_,
179
195
  accessKey,
180
196
  chainId,
@@ -184,7 +200,13 @@ export namespace authorize {
184
200
  scopes,
185
201
  witness,
186
202
  })
187
- return (await action(client, {
203
+ return (await withExecutionError(action, {
204
+ hints: {
205
+ KeyAlreadyExists: [
206
+ 'This access key is already authorized. Update its spending limits instead.',
207
+ ],
208
+ },
209
+ })(client, {
188
210
  ...rest,
189
211
  keyAuthorization,
190
212
  } as never)) as never
@@ -273,7 +295,7 @@ export namespace authorizeSync {
273
295
  >
274
296
 
275
297
  // TODO: exhaustive error type
276
- export type ErrorType = BaseErrorType
298
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
277
299
  }
278
300
 
279
301
  /**
@@ -332,7 +354,7 @@ export namespace burnWitness {
332
354
  export type ReturnValue = WriteContractReturnType
333
355
 
334
356
  // TODO: exhaustive error type
335
- export type ErrorType = BaseErrorType
357
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
336
358
 
337
359
  /** @internal */
338
360
  export async function inner<
@@ -346,7 +368,7 @@ export namespace burnWitness {
346
368
  ): Promise<ReturnType<action>> {
347
369
  const { witness, ...rest } = parameters
348
370
  const call = burnWitness.call({ witness })
349
- return (await action(client, {
371
+ return (await withExecutionError(action)(client, {
350
372
  ...rest,
351
373
  ...call,
352
374
  } as never)) as never
@@ -469,7 +491,7 @@ export namespace burnWitnessSync {
469
491
  >
470
492
 
471
493
  // TODO: exhaustive error type
472
- export type ErrorType = BaseErrorType
494
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
473
495
  }
474
496
 
475
497
  /**
@@ -506,7 +528,7 @@ export async function getMetadata<
506
528
  const { account: account_ = client.account, accessKey, ...rest } = parameters
507
529
  if (!account_) throw new Error('account is required.')
508
530
  const account = parseAccount(account_)
509
- const result = await readContract(client, {
531
+ const result = await withExecutionError(readContract)(client, {
510
532
  ...rest,
511
533
  account: null as never,
512
534
  ...getMetadata.call({ account: account.address, accessKey }),
@@ -562,6 +584,8 @@ export namespace getMetadata {
562
584
  args: [account, resolveAccessKeyAddress(accessKey)],
563
585
  })
564
586
  }
587
+
588
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
565
589
  }
566
590
 
567
591
  /**
@@ -610,21 +634,24 @@ export async function getRemainingLimit<
610
634
  // TODO: remove pre-t3 branch once mainnet is on t3.
611
635
  const hardfork = (client.chain as { hardfork?: string } | undefined)?.hardfork
612
636
  if (hardfork && Hardfork.lt(hardfork, 't3')) {
613
- const remaining = await readContract(client, {
637
+ const remaining = await withExecutionError(readContract)(client, {
614
638
  ...rest,
615
639
  ...getRemainingLimit.call({ account: account.address, accessKey, token }),
616
640
  })
617
641
  return { remaining, periodEnd: undefined }
618
642
  }
619
643
 
620
- const [remaining, periodEnd] = await readContract(client, {
621
- ...rest,
622
- ...getRemainingLimit.callWithPeriod({
623
- account: account.address,
624
- accessKey,
625
- token,
626
- }),
627
- })
644
+ const [remaining, periodEnd] = await withExecutionError(readContract)(
645
+ client,
646
+ {
647
+ ...rest,
648
+ ...getRemainingLimit.callWithPeriod({
649
+ account: account.address,
650
+ accessKey,
651
+ token,
652
+ }),
653
+ },
654
+ )
628
655
  return { remaining, periodEnd }
629
656
  }
630
657
 
@@ -680,6 +707,8 @@ export namespace getRemainingLimit {
680
707
  args: [account, resolveAccessKeyAddress(accessKey), token],
681
708
  })
682
709
  }
710
+
711
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
683
712
  }
684
713
 
685
714
  /**
@@ -721,7 +750,7 @@ export async function isAdmin<
721
750
  const { account: account_ = client.account, accessKey, ...rest } = parameters
722
751
  if (!account_) throw new Error('account is required.')
723
752
  const account = parseAccount(account_)
724
- return readContract(client, {
753
+ return withExecutionError(readContract)(client, {
725
754
  ...rest,
726
755
  account: null as never,
727
756
  ...isAdmin.call({ account: account.address, accessKey }),
@@ -761,6 +790,8 @@ export namespace isAdmin {
761
790
  args: [account, resolveAccessKeyAddress(accessKey)],
762
791
  })
763
792
  }
793
+
794
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
764
795
  }
765
796
 
766
797
  /**
@@ -797,7 +828,7 @@ export async function isWitnessBurned<
797
828
  const { account: account_ = client.account, witness, ...rest } = parameters
798
829
  if (!account_) throw new Error('account is required.')
799
830
  const account = parseAccount(account_)
800
- return readContract(client, {
831
+ return withExecutionError(readContract)(client, {
801
832
  ...rest,
802
833
  account: null as never,
803
834
  ...isWitnessBurned.call({ account: account.address, witness }),
@@ -837,6 +868,8 @@ export namespace isWitnessBurned {
837
868
  args: [account, witness],
838
869
  })
839
870
  }
871
+
872
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
840
873
  }
841
874
 
842
875
  /**
@@ -888,7 +921,7 @@ export namespace revoke {
888
921
  export type ReturnValue = WriteContractReturnType
889
922
 
890
923
  // TODO: exhaustive error type
891
- export type ErrorType = BaseErrorType
924
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
892
925
 
893
926
  /** @internal */
894
927
  export async function inner<
@@ -902,7 +935,7 @@ export namespace revoke {
902
935
  ): Promise<ReturnType<action>> {
903
936
  const { accessKey, ...rest } = parameters
904
937
  const call = revoke.call({ accessKey })
905
- return (await action(client, {
938
+ return (await withExecutionError(action)(client, {
906
939
  ...rest,
907
940
  ...call,
908
941
  } as never)) as never
@@ -1024,7 +1057,7 @@ export namespace revokeSync {
1024
1057
  >
1025
1058
 
1026
1059
  // TODO: exhaustive error type
1027
- export type ErrorType = BaseErrorType
1060
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
1028
1061
  }
1029
1062
 
1030
1063
  /**
@@ -1058,13 +1091,13 @@ export async function prepareAuthorization<
1058
1091
  if (!account_) throw new Error('account is required.')
1059
1092
  if (!chainId) throw new Error('chainId is required.')
1060
1093
  const parsed = parseAccount(account_)
1061
- const multisigState = await (async () => {
1062
- if ('multisig' in parameters) return parameters.multisig
1063
- if (parsed.source !== 'multisig') return undefined
1064
- const account = parsed as MultisigAccount
1094
+ const configurableState = await (async () => {
1095
+ if ('configurable' in parameters) return parameters.configurable
1096
+ if (parsed.source !== 'configurable') return undefined
1097
+ const account = parsed as ConfigurableAccount
1065
1098
  if (!account.config)
1066
1099
  throw new Error(
1067
- 'A multisig config is required to prepare a key authorization.',
1100
+ 'An account config is required to prepare a key authorization.',
1068
1101
  )
1069
1102
  return { config: account.config }
1070
1103
  })()
@@ -1077,10 +1110,10 @@ export async function prepareAuthorization<
1077
1110
  },
1078
1111
  )
1079
1112
  const signPayload =
1080
- parsed.source === 'multisig' && multisigState
1081
- ? MultisigConfig.getSignPayload({
1113
+ parsed.source === 'configurable' && configurableState
1114
+ ? AccountConfig.getSignPayload({
1082
1115
  account: parsed.address,
1083
- config: multisigState.config,
1116
+ config: configurableState.config,
1084
1117
  payload: authorizationSignPayload,
1085
1118
  })
1086
1119
  : authorizationSignPayload
@@ -1088,7 +1121,7 @@ export async function prepareAuthorization<
1088
1121
  ...parameters,
1089
1122
  account: parsed,
1090
1123
  chainId,
1091
- multisig: multisigState,
1124
+ configurable: configurableState,
1092
1125
  signPayload,
1093
1126
  } as never
1094
1127
  }
@@ -1115,8 +1148,8 @@ export namespace prepareAuthorization {
1115
1148
  limits?:
1116
1149
  | { token: Address; limit: bigint; period?: number | undefined }[]
1117
1150
  | undefined
1118
- /** @internal Prepared multisig state. */
1119
- multisig?: signKeyAuthorization.Parameters['multisig']
1151
+ /** @internal Prepared configurable account state. */
1152
+ configurable?: signKeyAuthorization.Parameters['configurable']
1120
1153
  /** Call scopes restricting which contracts/selectors this key can call. */
1121
1154
  scopes?: KeyAuthorization.Scope[] | undefined
1122
1155
  /**
@@ -1136,22 +1169,81 @@ export namespace prepareAuthorization {
1136
1169
  Omit<Parameters<Account | undefined>, 'account' | 'chainId'> & {
1137
1170
  account: Account
1138
1171
  chainId: number
1139
- multisig: signKeyAuthorization.Parameters['multisig']
1140
- /** Payload that the authorizing account or multisig owners sign. */
1172
+ configurable: signKeyAuthorization.Parameters['configurable']
1173
+ /** Payload that the authorizing account or owners sign. */
1141
1174
  signPayload: Hex
1142
1175
  }
1143
1176
  >
1144
1177
  }
1145
1178
 
1179
+ /**
1180
+ * Saves a signed key authorization to a relay with key authorization storage.
1181
+ *
1182
+ * The relay attaches the authorization to the access key's next transaction until
1183
+ * the key is active onchain. Use this for authorizations signed outside
1184
+ * {@link signAuthorization}, such as on another device. Requires a relay running the
1185
+ * `Relay.keyAuthorization` plugin.
1186
+ *
1187
+ * @example
1188
+ * ```ts
1189
+ * import { createClient, http } from 'viem'
1190
+ * import { tempo } from 'viem/chains'
1191
+ * import { Actions, withRelay } from 'viem/tempo'
1192
+ *
1193
+ * const client = createClient({
1194
+ * chain: tempo,
1195
+ * transport: withRelay(http(), http('https://relay.example.com'), {
1196
+ * keyAuthorization: true,
1197
+ * }),
1198
+ * })
1199
+ *
1200
+ * await Actions.accessKey.saveAuthorization(client, {
1201
+ * keyAuthorization,
1202
+ * })
1203
+ * ```
1204
+ *
1205
+ * @param client - Client.
1206
+ * @param parameters - Parameters.
1207
+ */
1208
+ export async function saveAuthorization<
1209
+ chain extends Chain | undefined,
1210
+ account extends Account | undefined,
1211
+ >(
1212
+ client: Client<Transport, chain, account>,
1213
+ parameters: saveAuthorization.Parameters,
1214
+ ): Promise<saveAuthorization.ReturnValue> {
1215
+ const { keyAuthorization } = parameters
1216
+ await client.request<relay_saveKeyAuthorization>({
1217
+ method: 'relay_saveKeyAuthorization',
1218
+ params: [KeyAuthorization.toRpc(keyAuthorization)],
1219
+ })
1220
+ }
1221
+
1222
+ export namespace saveAuthorization {
1223
+ export type Parameters = {
1224
+ /** Signed key authorization to save. */
1225
+ keyAuthorization: KeyAuthorization.Signed
1226
+ }
1227
+
1228
+ export type ReturnValue = void
1229
+
1230
+ // TODO: exhaustive error type
1231
+ export type ErrorType = BaseErrorType
1232
+ }
1233
+
1146
1234
  /**
1147
1235
  * Signs a key authorization for an access key.
1148
1236
  *
1149
1237
  * Use {@link prepareAuthorization} before this action when signing requires
1150
1238
  * transient user activation.
1151
1239
  *
1240
+ * When the client transport is a relay with the `Relay.keyAuthorization` plugin,
1241
+ * an authorization signed by the account is saved to the relay, which attaches it
1242
+ * to the access key's next transaction.
1243
+ *
1152
1244
  * @param client - Client.
1153
1245
  * @param parameters - Authorization fields, or a stored operation hash.
1154
- * @returns A signed key authorization with multisig operation metadata when coordinated.
1246
+ * @returns A signed key authorization with account operation metadata when coordinated.
1155
1247
  */
1156
1248
  export function signAuthorization<
1157
1249
  chain extends Chain | undefined,
@@ -1185,13 +1277,13 @@ export async function signAuthorization<
1185
1277
  const owner_ = parameters_.owner
1186
1278
  if (!owner_ || typeof owner_ === 'string')
1187
1279
  throw new Error(
1188
- 'A local owner account is required to approve a multisig key authorization.',
1280
+ 'A local owner account is required to approve a configurable account key authorization.',
1189
1281
  )
1190
1282
  const owner = parseAccount(owner_)
1191
1283
  const sign = owner.sign
1192
1284
  if (!sign)
1193
1285
  throw new Error(
1194
- 'A local owner account is required to approve a multisig key authorization.',
1286
+ 'A local owner account is required to approve a configurable account key authorization.',
1195
1287
  )
1196
1288
 
1197
1289
  const request = await (async () => {
@@ -1214,16 +1306,16 @@ export async function signAuthorization<
1214
1306
  const config = await getConfig(client, { address })
1215
1307
  if (config) return config
1216
1308
  throw new Error(
1217
- `No current multisig config is cached for account ${address}. Provide the current config.`,
1309
+ `No current account config is cached for account ${address}. Provide the current config.`,
1218
1310
  )
1219
1311
  })()
1220
1312
  const account = (() => {
1221
- if (config.version !== 0n) return fromMultisig({ address, ...config })
1313
+ if (config.version !== 0n) return fromConfig({ address, ...config })
1222
1314
  const { version: _, ...initialConfig } = config
1223
- return fromMultisig({ address: 'infer', ...initialConfig })
1315
+ return fromConfig({ address: 'infer', ...initialConfig })
1224
1316
  })()
1225
1317
  if (!isAddressEqual(account.address, address))
1226
- throw new Error('Initial multisig config does not match the account.')
1318
+ throw new Error('Initial account config does not match the account.')
1227
1319
  const prepared = await prepareAuthorization(client, {
1228
1320
  ...authorization,
1229
1321
  account,
@@ -1250,79 +1342,81 @@ export async function signAuthorization<
1250
1342
  return { keyAuthorization: KeyAuthorization.toRpc(keyAuthorization) }
1251
1343
  })()
1252
1344
 
1253
- type multisig_approveKeyAuthorization = Extract<
1254
- RpcSchema.ToViem<RpcSchemaTempo.Multisig>[number],
1255
- { Method: 'multisig_approveKeyAuthorization' }
1345
+ type account_approveKeyAuthorization = Extract<
1346
+ RpcSchema.ToViem<RpcSchemaTempo.Account>[number],
1347
+ { Method: 'account_approveKeyAuthorization' }
1256
1348
  >
1257
- const operation = await client.request<multisig_approveKeyAuthorization>({
1258
- method: 'multisig_approveKeyAuthorization',
1349
+ const operation = await client.request<account_approveKeyAuthorization>({
1350
+ method: 'account_approveKeyAuthorization',
1259
1351
  params: [request],
1260
1352
  })
1261
- const multisig = MultisigOperation.fromRpc(operation)
1353
+ const operation_ = AccountOperation.fromRpc(operation)
1262
1354
  const keyAuthorization = KeyAuthorization.deserialize(
1263
1355
  await (async () => {
1264
- if (multisig.status === 'success') return multisig.keyAuthorization
1265
- const approvals = await MultisigOperation.selectApprovals({
1266
- account: multisig.account,
1267
- approvals: multisig.approvals,
1268
- config: multisig.config,
1269
- hash: multisig.hash,
1356
+ if (operation_.status === 'success') return operation_.keyAuthorization
1357
+ const approvals = await AccountOperation.selectApprovals({
1358
+ account: operation_.account,
1359
+ approvals: operation_.approvals,
1360
+ config: operation_.config,
1361
+ hash: operation_.hash,
1270
1362
  })
1271
- return MultisigOperation.serializeKeyAuthorization(
1272
- multisig.keyAuthorization,
1363
+ return AccountOperation.serializeKeyAuthorization(
1364
+ operation_.keyAuthorization,
1273
1365
  {
1274
- account: multisig.account,
1366
+ account: operation_.account,
1275
1367
  approvals:
1276
1368
  approvals.selectedApprovals.length > 0
1277
1369
  ? approvals.selectedApprovals
1278
1370
  : approvals.approvals.slice(0, 1),
1279
- config: multisig.config,
1371
+ config: operation_.config,
1280
1372
  },
1281
1373
  )
1282
1374
  })(),
1283
1375
  )
1284
1376
  if (!keyAuthorization.signature)
1285
- throw new Error('Expected a signed multisig key authorization.')
1377
+ throw new Error(
1378
+ 'Expected a signed configurable account key authorization.',
1379
+ )
1286
1380
  return {
1287
1381
  ...keyAuthorization,
1288
- hash: multisig.hash,
1289
- multisig,
1290
- status: multisig.status,
1382
+ hash: operation_.hash,
1383
+ operation: operation_,
1384
+ status: operation_.status,
1291
1385
  } as never
1292
1386
  }
1293
1387
 
1294
- const prepared = (
1295
- 'signPayload' in parameters
1296
- ? parameters
1297
- : await prepareAuthorization(
1298
- client,
1299
- parameters as signAuthorization.LocalParameters<account>,
1300
- )
1301
- ) as prepareAuthorization.ReturnValue
1302
- const {
1303
- accessKey,
1304
- account: account_,
1305
- chainId,
1306
- multisig: multisigState,
1307
- signPayload: _,
1308
- ...rest
1309
- } = prepared
1310
- return signKeyAuthorization(account_ as never, {
1311
- chainId: BigInt(chainId),
1312
- key: accessKey,
1313
- multisig: multisigState,
1314
- ...rest,
1315
- }) as never
1388
+ const keyAuthorization = await signLocal(
1389
+ client,
1390
+ parameters as signAuthorization.LocalParameters<account>,
1391
+ )
1392
+ const signer = parameters.account ?? client.account
1393
+ // Relays with key authorization storage attach it to the access key's next
1394
+ // transaction. Admin-signed authorizations can only be submitted by the admin key.
1395
+ if (
1396
+ (client.transport as { keyAuthorization?: boolean }).keyAuthorization &&
1397
+ signer &&
1398
+ parseAccount(signer).source !== 'accessKey'
1399
+ )
1400
+ await saveAuthorization(client, { keyAuthorization }).catch((error) => {
1401
+ // Remote relays without key authorization storage do not expose this method.
1402
+ if (
1403
+ error instanceof MethodNotFoundRpcError ||
1404
+ error instanceof MethodNotSupportedRpcError
1405
+ )
1406
+ return
1407
+ throw error
1408
+ })
1409
+ return keyAuthorization
1316
1410
  }
1317
1411
 
1318
1412
  export namespace signAuthorization {
1319
1413
  /** Initial coordinated key authorization parameters. */
1320
1414
  export type CoordinatedInitialParameters = Omit<
1321
1415
  prepareAuthorization.Parameters<Account>,
1322
- 'account' | 'multisig'
1416
+ 'account' | 'configurable'
1323
1417
  > & {
1324
- /** Multisig account being authorized. */
1325
- account: Address | MultisigAccount
1418
+ /** Configurable account being authorized. */
1419
+ account: Address | ConfigurableAccount
1326
1420
  /** Local owner that approves the authorization. */
1327
1421
  owner: RootAccount
1328
1422
  }
@@ -1331,7 +1425,7 @@ export namespace signAuthorization {
1331
1425
  export type CoordinatedParameters = OneOf<
1332
1426
  | CoordinatedInitialParameters
1333
1427
  | {
1334
- /** Stored multisig operation hash. */
1428
+ /** Stored account operation hash. */
1335
1429
  hash: Hex
1336
1430
  /** Local owner that approves the authorization. */
1337
1431
  owner: RootAccount
@@ -1342,7 +1436,7 @@ export namespace signAuthorization {
1342
1436
  export type LocalParameters<
1343
1437
  account extends Account | undefined = Account | undefined,
1344
1438
  > = prepareAuthorization.Parameters<account> & {
1345
- /** Serialized approvals from external multisig owners. */
1439
+ /** Serialized approvals from external owners. */
1346
1440
  signatures?: readonly SignatureEnvelope.Serialized[] | undefined
1347
1441
  }
1348
1442
 
@@ -1357,12 +1451,12 @@ export namespace signAuthorization {
1357
1451
  /** Coordinated return value for {@link signAuthorization}. */
1358
1452
  export type CoordinatedReturnValue = Compute<
1359
1453
  ReturnValue & {
1360
- /** Deterministic multisig operation hash. */
1454
+ /** Deterministic account operation hash. */
1361
1455
  hash: Hex
1362
- /** Current multisig operation. */
1363
- multisig: MultisigOperation.KeyAuthorizationOperation
1364
- /** Current multisig operation status. */
1365
- status: MultisigOperation.KeyAuthorizationOperation['status']
1456
+ /** Current account operation. */
1457
+ operation: AccountOperation.KeyAuthorizationOperation
1458
+ /** Current account operation status. */
1459
+ status: AccountOperation.KeyAuthorizationOperation['status']
1366
1460
  }
1367
1461
  >
1368
1462
 
@@ -1370,6 +1464,41 @@ export namespace signAuthorization {
1370
1464
  export type ErrorType = BaseErrorType
1371
1465
  }
1372
1466
 
1467
+ /** Signs a key authorization locally without saving it to a relay. */
1468
+ async function signLocal<
1469
+ chain extends Chain | undefined,
1470
+ account extends Account | undefined,
1471
+ >(
1472
+ client: Client<Transport, chain, account>,
1473
+ parameters: signAuthorization.LocalParameters<account>,
1474
+ ): Promise<signAuthorization.ReturnValue> {
1475
+ const prepared = (
1476
+ 'signPayload' in parameters
1477
+ ? parameters
1478
+ : await prepareAuthorization(client, parameters)
1479
+ ) as prepareAuthorization.ReturnValue
1480
+ const {
1481
+ accessKey,
1482
+ account: account_,
1483
+ chainId,
1484
+ configurable: configurableState,
1485
+ signPayload: _,
1486
+ ...rest
1487
+ } = prepared
1488
+ return signKeyAuthorization(account_ as never, {
1489
+ chainId: BigInt(chainId),
1490
+ key: accessKey,
1491
+ configurable: configurableState,
1492
+ ...rest,
1493
+ })
1494
+ }
1495
+
1496
+ type relay_saveKeyAuthorization = {
1497
+ Method: 'relay_saveKeyAuthorization'
1498
+ Parameters: [KeyAuthorization.Rpc]
1499
+ ReturnType: null
1500
+ }
1501
+
1373
1502
  /**
1374
1503
  * Updates the spending limit for a specific token on an authorized access key.
1375
1504
  *
@@ -1425,7 +1554,7 @@ export namespace updateLimit {
1425
1554
  export type ReturnValue = WriteContractReturnType
1426
1555
 
1427
1556
  // TODO: exhaustive error type
1428
- export type ErrorType = BaseErrorType
1557
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
1429
1558
 
1430
1559
  /** @internal */
1431
1560
  export async function inner<
@@ -1439,7 +1568,7 @@ export namespace updateLimit {
1439
1568
  ): Promise<ReturnType<action>> {
1440
1569
  const { accessKey, token, limit, ...rest } = parameters
1441
1570
  const call = updateLimit.call({ accessKey, token, limit })
1442
- return (await action(client, {
1571
+ return (await withExecutionError(action)(client, {
1443
1572
  ...rest,
1444
1573
  ...call,
1445
1574
  } as never)) as never
@@ -1573,7 +1702,7 @@ export namespace updateLimitSync {
1573
1702
  }
1574
1703
 
1575
1704
  // TODO: exhaustive error type
1576
- export type ErrorType = BaseErrorType
1705
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
1577
1706
  }
1578
1707
 
1579
1708
  /**
@@ -1854,7 +1983,7 @@ export async function verifyHash<
1854
1983
  parameters: verifyHash.Parameters,
1855
1984
  ): Promise<verifyHash.ReturnValue> {
1856
1985
  const { account, admin, hash, signature, ...rest } = parameters
1857
- return readContract(client, {
1986
+ return withExecutionError(readContract)(client, {
1858
1987
  ...rest,
1859
1988
  ...verifyHash.call({ account, admin, hash, signature }),
1860
1989
  })
@@ -1900,6 +2029,8 @@ export namespace verifyHash {
1900
2029
  args: [account, hash, signature],
1901
2030
  })
1902
2031
  }
2032
+
2033
+ export type ErrorType = Errors.ExecutionErrorType | BaseErrorType
1903
2034
  }
1904
2035
 
1905
2036
  /** @internal */
@@ -1909,3 +2040,443 @@ function resolveAccessKeyAddress(
1909
2040
  if (typeof accessKey === 'string') return accessKey
1910
2041
  return accessKey.accessKeyAddress
1911
2042
  }
2043
+
2044
+ // Errors
2045
+
2046
+ /** Errors this module throws for decoded Tempo errors. Narrow with `error.name`. */
2047
+ export type ExecutionErrorType =
2048
+ | AccessKeyAlreadyExistsErrorType
2049
+ | AccessKeyCallNotAllowedErrorType
2050
+ | AccessKeyErrorType
2051
+ | AccessKeyExpiredErrorType
2052
+ | AccessKeyExpiryInPastErrorType
2053
+ | AccessKeySignatureTypeMismatchErrorType
2054
+ | AccessKeySpendingLimitExceededErrorType
2055
+
2056
+ /** `AccessKeyError` with a literal `name`, for narrowing. */
2057
+ export type AccessKeyErrorType = AccessKeyError & { name: 'AccessKeyError' }
2058
+
2059
+ /** Thrown when an access key fails an `AccountKeychain` check. */
2060
+ export class AccessKeyError<
2061
+ decoded extends
2062
+ Errors.TempoExecutionError.Decoded = Errors.TempoExecutionError.Decoded,
2063
+ > extends TempoExecutionError<decoded> {
2064
+ /** Root account that owns the access key. */
2065
+ account: Address
2066
+ /** Access key address. */
2067
+ accessKey: Address
2068
+
2069
+ constructor(
2070
+ parameters: AccessKeyError.Parameters,
2071
+ options: Errors.TempoExecutionError.Options = {},
2072
+ ) {
2073
+ const { account, accessKey } = parameters
2074
+ super(parameters, {
2075
+ shortMessage: `Access key "${accessKey}" failed: ${parameters.error.message}`,
2076
+ ...options,
2077
+ details: { account, 'access key': accessKey, ...options.details },
2078
+ docsPath: '/tempo/guides/access-keys/manage',
2079
+ name: options.name ?? 'AccessKeyError',
2080
+ })
2081
+ this.account = account
2082
+ this.accessKey = accessKey
2083
+ }
2084
+ }
2085
+
2086
+ export declare namespace AccessKeyError {
2087
+ /** Constructor parameters. */
2088
+ type Parameters = Errors.TempoExecutionError.Parameters & {
2089
+ /** Root account that owns the access key. */
2090
+ account: Address
2091
+ /** Access key address. */
2092
+ accessKey: Address
2093
+ }
2094
+ }
2095
+
2096
+ /** `AccessKeySpendingLimitExceededError` with a literal `name`, for narrowing. */
2097
+ export type AccessKeySpendingLimitExceededErrorType =
2098
+ AccessKeySpendingLimitExceededError & {
2099
+ name: 'AccessKeySpendingLimitExceededError'
2100
+ }
2101
+
2102
+ /** Thrown when a transfer, approval, or fee payment exceeds an access key's spending limit. */
2103
+ export class AccessKeySpendingLimitExceededError extends AccessKeyError<
2104
+ Errors.TempoExecutionError.Decoded<'SpendingLimitExceeded'>
2105
+ > {
2106
+ /** Amount the call tried to spend, when known. */
2107
+ amount: bigint | undefined
2108
+ /** Token decimals, when known. */
2109
+ decimals: number | undefined
2110
+ /** Whether the fee payment, rather than the call, exceeded the limit. */
2111
+ fee: boolean
2112
+ /** End of the current period (Unix seconds) for periodic limits, when known. */
2113
+ periodEnd: bigint | undefined
2114
+ /** Remaining limit for `token`, when known. */
2115
+ remaining: bigint | undefined
2116
+ /** Token the limit applies to, when known. */
2117
+ token: Address | undefined
2118
+
2119
+ constructor(parameters: AccessKeySpendingLimitExceededError.Parameters) {
2120
+ const { amount, decimals, fee, periodEnd, remaining, token } = parameters
2121
+ super(parameters, {
2122
+ details: {
2123
+ token,
2124
+ amount: formatAmount(amount, decimals),
2125
+ remaining: formatAmount(remaining, decimals),
2126
+ 'exceeded by':
2127
+ amount !== undefined && remaining !== undefined
2128
+ ? formatAmount(amount - remaining, decimals)
2129
+ : undefined,
2130
+ 'resets at': formatTime(periodEnd),
2131
+ },
2132
+ name: 'AccessKeySpendingLimitExceededError',
2133
+ shortMessage: `Access key "${parameters.accessKey}" exceeded its spending limit${token ? ` for token "${token}"` : ''}${fee ? ' while paying fees' : ''}.`,
2134
+ })
2135
+ this.amount = amount
2136
+ this.decimals = decimals
2137
+ this.fee = fee
2138
+ this.periodEnd = periodEnd
2139
+ this.remaining = remaining
2140
+ this.token = token
2141
+ }
2142
+ }
2143
+
2144
+ export declare namespace AccessKeySpendingLimitExceededError {
2145
+ /** Constructor parameters. */
2146
+ type Parameters = AccessKeyError.Parameters & {
2147
+ /** Amount the call tried to spend, when known. */
2148
+ amount?: bigint | undefined
2149
+ /** Token decimals, when known. */
2150
+ decimals?: number | undefined
2151
+ /** Whether the fee payment, rather than the call, exceeded the limit. */
2152
+ fee: boolean
2153
+ /** End of the current period (Unix seconds) for periodic limits, when known. */
2154
+ periodEnd?: bigint | undefined
2155
+ /** Remaining limit for `token`, when known. */
2156
+ remaining?: bigint | undefined
2157
+ /** Token the limit applies to, when known. */
2158
+ token?: Address | undefined
2159
+ }
2160
+ }
2161
+
2162
+ /** `AccessKeyExpiredError` with a literal `name`, for narrowing. */
2163
+ export type AccessKeyExpiredErrorType = AccessKeyExpiredError & {
2164
+ name: 'AccessKeyExpiredError'
2165
+ }
2166
+
2167
+ /** Thrown when a transaction is signed with an expired access key. */
2168
+ export class AccessKeyExpiredError extends AccessKeyError<
2169
+ Errors.TempoExecutionError.Decoded<'KeyExpired'>
2170
+ > {
2171
+ /** Expiry (Unix seconds), when known. */
2172
+ expiry: bigint | undefined
2173
+
2174
+ constructor(
2175
+ parameters: AccessKeyError.Parameters & { expiry?: bigint | undefined },
2176
+ ) {
2177
+ super(parameters, {
2178
+ details: { 'expired at': formatTime(parameters.expiry) },
2179
+ name: 'AccessKeyExpiredError',
2180
+ shortMessage: `Access key "${parameters.accessKey}" has expired.`,
2181
+ })
2182
+ this.expiry = parameters.expiry
2183
+ }
2184
+ }
2185
+
2186
+ /** `AccessKeyCallNotAllowedError` with a literal `name`, for narrowing. */
2187
+ export type AccessKeyCallNotAllowedErrorType = AccessKeyCallNotAllowedError & {
2188
+ name: 'AccessKeyCallNotAllowedError'
2189
+ }
2190
+
2191
+ /** Thrown when an access key's scopes do not allow a call. */
2192
+ export class AccessKeyCallNotAllowedError extends AccessKeyError<
2193
+ Errors.TempoExecutionError.Decoded<'CallNotAllowed'>
2194
+ > {
2195
+ /** Function selector of the rejected call, when known. */
2196
+ selector: Hex | undefined
2197
+ /** Target of the rejected call, when known. */
2198
+ target: Address | undefined
2199
+
2200
+ constructor(
2201
+ parameters: AccessKeyError.Parameters & {
2202
+ selector?: Hex | undefined
2203
+ target?: Address | undefined
2204
+ },
2205
+ ) {
2206
+ const { selector, target } = parameters
2207
+ super(parameters, {
2208
+ details: { target, selector },
2209
+ name: 'AccessKeyCallNotAllowedError',
2210
+ shortMessage: `Access key "${parameters.accessKey}" is not allowed to make this call.`,
2211
+ })
2212
+ this.selector = selector
2213
+ this.target = target
2214
+ }
2215
+ }
2216
+
2217
+ /** `AccessKeyAlreadyExistsError` with a literal `name`, for narrowing. */
2218
+ export type AccessKeyAlreadyExistsErrorType = AccessKeyAlreadyExistsError & {
2219
+ name: 'AccessKeyAlreadyExistsError'
2220
+ }
2221
+
2222
+ /** Thrown when authorizing an access key that is already authorized. */
2223
+ export class AccessKeyAlreadyExistsError extends AccessKeyError<
2224
+ Errors.TempoExecutionError.Decoded<'KeyAlreadyExists'>
2225
+ > {
2226
+ /** Expiry (Unix seconds) of the existing key, when known. */
2227
+ expiry: bigint | undefined
2228
+ /** Whether the existing key enforces spending limits, when known. */
2229
+ limited: boolean | undefined
2230
+
2231
+ constructor(
2232
+ parameters: AccessKeyError.Parameters & {
2233
+ expiry?: bigint | undefined
2234
+ limited?: boolean | undefined
2235
+ },
2236
+ ) {
2237
+ const { expiry, limited } = parameters
2238
+ super(parameters, {
2239
+ details: {
2240
+ expires: formatTime(expiry),
2241
+ 'spending limits':
2242
+ limited === undefined ? undefined : limited ? 'enforced' : 'none',
2243
+ },
2244
+ name: 'AccessKeyAlreadyExistsError',
2245
+ shortMessage: `Access key "${parameters.accessKey}" is already authorized on account "${parameters.account}".`,
2246
+ })
2247
+ this.expiry = expiry
2248
+ this.limited = limited
2249
+ }
2250
+ }
2251
+
2252
+ /** `AccessKeySignatureTypeMismatchError` with a literal `name`, for narrowing. */
2253
+ export type AccessKeySignatureTypeMismatchErrorType =
2254
+ AccessKeySignatureTypeMismatchError & {
2255
+ name: 'AccessKeySignatureTypeMismatchError'
2256
+ }
2257
+
2258
+ /** Thrown when an access key signs with a different key type than it was authorized with. */
2259
+ export class AccessKeySignatureTypeMismatchError extends AccessKeyError<
2260
+ Errors.TempoExecutionError.Decoded<'SignatureTypeMismatch'>
2261
+ > {
2262
+ /** Key type the access key was authorized with. */
2263
+ expected: KeyType | undefined
2264
+ /** Key type of the signature. */
2265
+ actual: KeyType | undefined
2266
+
2267
+ constructor(parameters: AccessKeyError.Parameters) {
2268
+ const [expected, actual] = (parameters.error.args ?? []).map(
2269
+ (type) => signatureTypes[Number(type) as keyof typeof signatureTypes],
2270
+ )
2271
+ super(parameters, {
2272
+ details: { expected, actual },
2273
+ name: 'AccessKeySignatureTypeMismatchError',
2274
+ shortMessage: `Access key "${parameters.accessKey}" signed with a ${actual ?? 'different'} key, but was authorized as a ${expected ?? 'different'} key.`,
2275
+ })
2276
+ this.expected = expected
2277
+ this.actual = actual
2278
+ }
2279
+ }
2280
+
2281
+ /** `AccessKeyExpiryInPastError` with a literal `name`, for narrowing. */
2282
+ export type AccessKeyExpiryInPastErrorType = AccessKeyExpiryInPastError & {
2283
+ name: 'AccessKeyExpiryInPastError'
2284
+ }
2285
+
2286
+ /** Thrown when authorizing an access key with an expiry that has passed or is too soon. */
2287
+ export class AccessKeyExpiryInPastError extends AccessKeyError<
2288
+ Errors.TempoExecutionError.Decoded<'ExpiryInPast'>
2289
+ > {
2290
+ /** Requested expiry (Unix seconds), when known. */
2291
+ expiry: bigint | undefined
2292
+ /** Earliest allowed expiry (Unix seconds), when known. */
2293
+ minimum: bigint | undefined
2294
+
2295
+ constructor(
2296
+ parameters: AccessKeyError.Parameters & {
2297
+ expiry?: bigint | undefined
2298
+ minimum?: bigint | undefined
2299
+ },
2300
+ ) {
2301
+ const { expiry, minimum } = parameters
2302
+ super(parameters, {
2303
+ details: { expiry: formatTime(expiry), minimum: formatTime(minimum) },
2304
+ name: 'AccessKeyExpiryInPastError',
2305
+ shortMessage: `Access key "${parameters.accessKey}" expiry must be later${minimum ? ` than ${formatTime(minimum)}` : ''}.`,
2306
+ })
2307
+ this.expiry = expiry
2308
+ this.minimum = minimum
2309
+ }
2310
+ }
2311
+
2312
+ type KeyType = (typeof signatureTypes)[keyof typeof signatureTypes]
2313
+
2314
+ const keychain = {
2315
+ address: Addresses.accountKeychain,
2316
+ abi: Abis.accountKeychain,
2317
+ } as const
2318
+
2319
+ /** Signer and key for errors raised while validating the signing access key. */
2320
+ function getSigner(context: Context) {
2321
+ const { call, parameters, signer } = context
2322
+ if (!signer?.accessKey) return undefined
2323
+ // Key management calls and authorizations of another key fail about that key, not the signer.
2324
+ if (call && isAddressEqual(call.address, Addresses.accountKeychain))
2325
+ return undefined
2326
+ const authorized = parameters.keyAuthorization?.address as Address | undefined
2327
+ if (authorized && !isAddressEqual(authorized, signer.accessKey))
2328
+ return undefined
2329
+ return {
2330
+ ...context.base,
2331
+ account: signer.address,
2332
+ accessKey: signer.accessKey,
2333
+ }
2334
+ }
2335
+
2336
+ /** Fee payer and key for fee payment errors. External fee payers cannot be resolved. */
2337
+ function getFeePayer(context: Context) {
2338
+ const { feePayer } = context.parameters
2339
+ if (typeof feePayer !== 'object') return undefined
2340
+ const account = parseAccount(feePayer)
2341
+ if (account.source !== 'accessKey' || !('accessKeyAddress' in account))
2342
+ return undefined
2343
+ return {
2344
+ ...context.base,
2345
+ account: account.address,
2346
+ accessKey: account.accessKeyAddress as Address,
2347
+ }
2348
+ }
2349
+
2350
+ /** Account and key for errors raised while authorizing a key. */
2351
+ function getAuthorization(context: Context) {
2352
+ const { call, parameters, signer } = context
2353
+ const accessKey =
2354
+ (parameters.keyAuthorization?.address as Address | undefined) ??
2355
+ call?.arg<Address>('keyId')
2356
+ if (!signer || !accessKey) return undefined
2357
+ return { ...context.base, account: signer.address, accessKey }
2358
+ }
2359
+
2360
+ /** @internal */
2361
+ export const errorResolvers: Resolvers = {
2362
+ // Fallback for `AccountKeychain` errors without a specific resolver below.
2363
+ ...Object.fromEntries(
2364
+ Abis.accountKeychain.flatMap((item) =>
2365
+ item.type === 'error'
2366
+ ? [
2367
+ [
2368
+ formatAbiItem(item),
2369
+ (context: Context) => {
2370
+ const parameters = getSigner(context)
2371
+ return parameters && new AccessKeyError(parameters)
2372
+ },
2373
+ ],
2374
+ ]
2375
+ : [],
2376
+ ),
2377
+ ),
2378
+ 'CallNotAllowed()': (context) => {
2379
+ const parameters = getSigner(context)
2380
+ if (!parameters) return undefined
2381
+ return new AccessKeyCallNotAllowedError({
2382
+ ...parameters,
2383
+ selector: (context.parameters.data as Hex | undefined)?.slice(
2384
+ 0,
2385
+ 10,
2386
+ ) as Hex,
2387
+ target: context.call?.address ?? context.parameters.to,
2388
+ })
2389
+ },
2390
+ 'ExpiryInPast()': (context) => {
2391
+ const parameters = getAuthorization(context)
2392
+ if (!parameters) return undefined
2393
+ const [, expiry, minimum] =
2394
+ /expiry (\d+) <= min allowed (\d+)/.exec(context.details) ?? []
2395
+ const requested =
2396
+ context.parameters.keyAuthorization?.expiry ??
2397
+ context.call?.arg<bigint>('expiry') ??
2398
+ context.call?.arg<{ expiry: bigint }>('config')?.expiry
2399
+ return new AccessKeyExpiryInPastError({
2400
+ ...parameters,
2401
+ expiry: expiry
2402
+ ? BigInt(expiry)
2403
+ : requested === undefined || requested === null
2404
+ ? undefined
2405
+ : BigInt(requested),
2406
+ minimum: minimum ? BigInt(minimum) : undefined,
2407
+ })
2408
+ },
2409
+ 'KeyAlreadyExists()': async (context) => {
2410
+ const parameters = getAuthorization(context)
2411
+ if (!parameters) return undefined
2412
+ const [key] = await context.read([
2413
+ {
2414
+ ...keychain,
2415
+ functionName: 'getKey',
2416
+ args: [parameters.account, parameters.accessKey],
2417
+ },
2418
+ ])
2419
+ return new AccessKeyAlreadyExistsError({
2420
+ ...parameters,
2421
+ expiry: key?.result?.expiry,
2422
+ limited: key?.result?.enforceLimits,
2423
+ })
2424
+ },
2425
+ 'KeyExpired()': async (context) => {
2426
+ const parameters = getSigner(context)
2427
+ if (!parameters) return undefined
2428
+ const [key] = await context.read([
2429
+ {
2430
+ ...keychain,
2431
+ functionName: 'getKey',
2432
+ args: [parameters.account, parameters.accessKey],
2433
+ },
2434
+ ])
2435
+ return new AccessKeyExpiredError({
2436
+ ...parameters,
2437
+ expiry: key?.result?.expiry,
2438
+ })
2439
+ },
2440
+ 'SignatureTypeMismatch(uint8,uint8)': (context) => {
2441
+ const parameters = getSigner(context) ?? getAuthorization(context)
2442
+ return parameters && new AccessKeySignatureTypeMismatchError(parameters)
2443
+ },
2444
+ 'SpendingLimitExceeded()': async (context) => {
2445
+ // Without revert data, the fee payment exceeded the limit.
2446
+ const fee = context.validation
2447
+ const parameters =
2448
+ fee && context.parameters.feePayer
2449
+ ? getFeePayer(context)
2450
+ : getSigner(context)
2451
+ if (!parameters) return undefined
2452
+ const token = fee
2453
+ ? getFeeToken(context)
2454
+ : isTip20(context.call?.address)
2455
+ ? context.call.address
2456
+ : undefined
2457
+ if (!token)
2458
+ return new AccessKeySpendingLimitExceededError({
2459
+ ...parameters,
2460
+ fee,
2461
+ hints: fee
2462
+ ? [...parameters.hints, 'Pay fees with another token.']
2463
+ : parameters.hints,
2464
+ })
2465
+ const args = [parameters.account, parameters.accessKey, token] as const
2466
+ const [withPeriod, legacy, decimals] = await context.read([
2467
+ // `getRemainingLimitWithPeriod` is T3+; `getRemainingLimit` covers earlier hardforks.
2468
+ { ...keychain, functionName: 'getRemainingLimitWithPeriod', args },
2469
+ { ...keychain, functionName: 'getRemainingLimit', args },
2470
+ { address: token, abi: Abis.tip20, functionName: 'decimals' },
2471
+ ])
2472
+ return new AccessKeySpendingLimitExceededError({
2473
+ ...parameters,
2474
+ amount: fee ? undefined : context.call?.arg<bigint>('amount'),
2475
+ decimals: decimals?.result,
2476
+ fee,
2477
+ periodEnd: withPeriod?.result?.[1] || undefined,
2478
+ remaining: withPeriod?.result?.[0] ?? legacy?.result,
2479
+ token,
2480
+ })
2481
+ },
2482
+ }