@aeternity/aepp-sdk 13.0.0-alpha.1 → 13.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/bin/aesophia_cli +0 -0
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.map +1 -1
  4. package/dist/aepp-sdk.browser.js +1 -1
  5. package/dist/aepp-sdk.browser.js.map +1 -1
  6. package/dist/aepp-sdk.js +1792 -1525
  7. package/dist/aepp-sdk.js.map +1 -1
  8. package/es/AeSdk.mjs.map +1 -1
  9. package/es/AeSdkAepp.mjs.map +1 -1
  10. package/es/AeSdkBase.mjs.map +1 -1
  11. package/es/AeSdkMethods.d.ts +11 -12
  12. package/es/AeSdkMethods.mjs +6 -8
  13. package/es/AeSdkMethods.mjs.map +1 -1
  14. package/es/AeSdkWallet.mjs +1 -1
  15. package/es/AeSdkWallet.mjs.map +1 -1
  16. package/es/Node.d.ts +5 -1
  17. package/es/Node.mjs +11 -5
  18. package/es/Node.mjs.map +1 -1
  19. package/es/account/Base.d.ts +11 -6
  20. package/es/account/Base.mjs +0 -17
  21. package/es/account/Base.mjs.map +1 -1
  22. package/es/account/Generalized.mjs +11 -24
  23. package/es/account/Generalized.mjs.map +1 -1
  24. package/es/account/Ledger.mjs.map +1 -1
  25. package/es/account/LedgerFactory.mjs.map +1 -1
  26. package/es/account/Memory.d.ts +2 -1
  27. package/es/account/Memory.mjs +9 -21
  28. package/es/account/Memory.mjs.map +1 -1
  29. package/es/account/Rpc.mjs.map +1 -1
  30. package/es/aens.d.ts +12 -14
  31. package/es/aens.mjs +17 -31
  32. package/es/aens.mjs.map +1 -1
  33. package/es/aepp-wallet-communication/connection/Browser.mjs +0 -16
  34. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  35. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +0 -16
  36. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  37. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -16
  38. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  39. package/es/aepp-wallet-communication/connection-proxy.mjs +0 -17
  40. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  41. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -5
  42. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  43. package/es/aepp-wallet-communication/rpc/types.d.ts +6 -2
  44. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  45. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  46. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -16
  47. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  48. package/es/apis/compiler/compiler.d.ts +1 -1
  49. package/es/apis/compiler/compiler.mjs +4 -20
  50. package/es/apis/compiler/compiler.mjs.map +1 -1
  51. package/es/apis/compiler/models/index.d.ts +3 -2
  52. package/es/apis/compiler/models/index.mjs.map +1 -1
  53. package/es/apis/compiler/models/mappers.d.ts +1 -1
  54. package/es/apis/compiler/models/mappers.mjs +19 -2
  55. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  56. package/es/apis/node/models/index.d.ts +15 -15
  57. package/es/apis/node/models/index.mjs.map +1 -1
  58. package/es/apis/node/models/mappers.d.ts +1 -1
  59. package/es/apis/node/models/mappers.mjs +2 -1
  60. package/es/apis/node/models/mappers.mjs.map +1 -1
  61. package/es/apis/node/models/parameters.d.ts +2 -2
  62. package/es/apis/node/models/parameters.mjs +2 -2
  63. package/es/apis/node/models/parameters.mjs.map +1 -1
  64. package/es/apis/node/node.mjs +3 -19
  65. package/es/apis/node/node.mjs.map +1 -1
  66. package/es/chain.d.ts +8 -8
  67. package/es/chain.mjs +19 -22
  68. package/es/chain.mjs.map +1 -1
  69. package/es/channel/Base.d.ts +25 -12
  70. package/es/channel/Base.mjs +23 -26
  71. package/es/channel/Base.mjs.map +1 -1
  72. package/es/channel/Contract.mjs +8 -21
  73. package/es/channel/Contract.mjs.map +1 -1
  74. package/es/channel/Spend.d.ts +4 -2
  75. package/es/channel/Spend.mjs +0 -16
  76. package/es/channel/Spend.mjs.map +1 -1
  77. package/es/channel/handlers.mjs +6 -18
  78. package/es/channel/handlers.mjs.map +1 -1
  79. package/es/channel/internal.d.ts +19 -2
  80. package/es/channel/internal.mjs +19 -19
  81. package/es/channel/internal.mjs.map +1 -1
  82. package/es/contract/Contract.d.ts +30 -85
  83. package/es/contract/Contract.mjs +174 -211
  84. package/es/contract/Contract.mjs.map +1 -1
  85. package/es/contract/compiler/Base.d.ts +7 -14
  86. package/es/contract/compiler/Base.mjs.map +1 -1
  87. package/es/contract/compiler/Cli.mjs +5 -11
  88. package/es/contract/compiler/Cli.mjs.map +1 -1
  89. package/es/contract/compiler/Http.mjs +6 -30
  90. package/es/contract/compiler/Http.mjs.map +1 -1
  91. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  92. package/es/contract/compiler/getFileSystem.mjs.map +1 -1
  93. package/es/contract/delegation-signature.d.ts +43 -0
  94. package/es/contract/delegation-signature.mjs +45 -0
  95. package/es/contract/delegation-signature.mjs.map +1 -0
  96. package/es/contract/ga.d.ts +23 -7
  97. package/es/contract/ga.mjs +52 -27
  98. package/es/contract/ga.mjs.map +1 -1
  99. package/es/index-browser.d.ts +4 -3
  100. package/es/index-browser.mjs +6 -20
  101. package/es/index-browser.mjs.map +1 -1
  102. package/es/oracle.d.ts +12 -17
  103. package/es/oracle.mjs +28 -48
  104. package/es/oracle.mjs.map +1 -1
  105. package/es/spend.d.ts +19 -27
  106. package/es/spend.mjs +20 -43
  107. package/es/spend.mjs.map +1 -1
  108. package/es/tx/builder/SchemaTypes.d.ts +37 -0
  109. package/es/tx/builder/SchemaTypes.mjs +2 -0
  110. package/es/tx/builder/SchemaTypes.mjs.map +1 -0
  111. package/es/tx/builder/constants.d.ts +4 -2
  112. package/es/tx/builder/constants.mjs +2 -0
  113. package/es/tx/builder/constants.mjs.map +1 -1
  114. package/es/tx/builder/field-types/abi-version.d.ts +11 -2
  115. package/es/tx/builder/field-types/abi-version.mjs +24 -4
  116. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  117. package/es/tx/builder/field-types/address.mjs.map +1 -1
  118. package/es/tx/builder/field-types/array.d.ts +1 -1
  119. package/es/tx/builder/field-types/array.mjs.map +1 -1
  120. package/es/tx/builder/field-types/boolean.mjs.map +1 -1
  121. package/es/tx/builder/field-types/coin-amount.d.ts +3 -4
  122. package/es/tx/builder/field-types/coin-amount.mjs +4 -5
  123. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  124. package/es/tx/builder/field-types/ct-version.d.ts +22 -3
  125. package/es/tx/builder/field-types/ct-version.mjs +32 -4
  126. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  127. package/es/tx/builder/field-types/deposit.d.ts +2 -1
  128. package/es/tx/builder/field-types/deposit.mjs +3 -2
  129. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  130. package/es/tx/builder/field-types/encoded.d.ts +1 -1
  131. package/es/tx/builder/field-types/encoded.mjs.map +1 -1
  132. package/es/tx/builder/field-types/entry.mjs +3 -0
  133. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  134. package/es/tx/builder/field-types/enumeration.mjs.map +1 -1
  135. package/es/tx/builder/field-types/fee.d.ts +3 -1
  136. package/es/tx/builder/field-types/fee.mjs +5 -1
  137. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  138. package/es/tx/builder/field-types/field.mjs.map +1 -1
  139. package/es/tx/builder/field-types/gas-limit.d.ts +3 -2
  140. package/es/tx/builder/field-types/gas-limit.mjs +4 -2
  141. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  142. package/es/tx/builder/field-types/gas-price.d.ts +3 -1
  143. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  144. package/es/tx/builder/field-types/index.d.ts +52 -13
  145. package/es/tx/builder/field-types/index.mjs +10 -2
  146. package/es/tx/builder/field-types/index.mjs.map +1 -1
  147. package/es/tx/builder/field-types/map.d.ts +13 -0
  148. package/es/tx/builder/field-types/map.mjs +49 -0
  149. package/es/tx/builder/field-types/map.mjs.map +1 -0
  150. package/es/tx/builder/field-types/mptree.d.ts +7 -2
  151. package/es/tx/builder/field-types/mptree.mjs +5 -7
  152. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  153. package/es/tx/builder/field-types/name-fee.d.ts +1 -1
  154. package/es/tx/builder/field-types/name-fee.mjs +2 -2
  155. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  156. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  157. package/es/tx/builder/field-types/name.mjs.map +1 -1
  158. package/es/tx/builder/field-types/nonce.d.ts +14 -0
  159. package/es/tx/builder/field-types/nonce.mjs +29 -0
  160. package/es/tx/builder/field-types/nonce.mjs.map +1 -0
  161. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  162. package/es/tx/builder/field-types/raw.mjs.map +1 -1
  163. package/es/tx/builder/field-types/short-u-int-const.d.ts +4 -2
  164. package/es/tx/builder/field-types/short-u-int-const.mjs +12 -8
  165. package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -1
  166. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  167. package/es/tx/builder/field-types/string.mjs.map +1 -1
  168. package/es/tx/builder/field-types/ttl.d.ts +11 -0
  169. package/es/tx/builder/field-types/ttl.mjs +21 -0
  170. package/es/tx/builder/field-types/ttl.mjs.map +1 -0
  171. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  172. package/es/tx/builder/field-types/wrapped.d.ts +14 -0
  173. package/es/tx/builder/field-types/wrapped.mjs +22 -0
  174. package/es/tx/builder/field-types/wrapped.mjs.map +1 -0
  175. package/es/tx/builder/helpers.mjs.map +1 -1
  176. package/es/tx/builder/index.d.ts +20 -20
  177. package/es/tx/builder/index.mjs +54 -64
  178. package/es/tx/builder/index.mjs.map +1 -1
  179. package/es/tx/builder/schema.d.ts +2735 -2865
  180. package/es/tx/builder/schema.generated.d.ts +2011 -0
  181. package/es/tx/builder/schema.generated.mjs +2 -0
  182. package/es/tx/builder/schema.generated.mjs.map +1 -0
  183. package/es/tx/builder/schema.mjs +459 -155
  184. package/es/tx/builder/schema.mjs.map +1 -1
  185. package/es/tx/execution-cost.d.ts +35 -0
  186. package/es/tx/execution-cost.mjs +123 -0
  187. package/es/tx/execution-cost.mjs.map +1 -0
  188. package/es/tx/transaction-signer.d.ts +6 -0
  189. package/es/tx/transaction-signer.mjs +27 -0
  190. package/es/tx/transaction-signer.mjs.map +1 -0
  191. package/es/tx/validator.mjs +60 -109
  192. package/es/tx/validator.mjs.map +1 -1
  193. package/es/utils/amount-formatter.mjs +0 -16
  194. package/es/utils/amount-formatter.mjs.map +1 -1
  195. package/es/utils/autorest.d.ts +3 -2
  196. package/es/utils/autorest.mjs +43 -11
  197. package/es/utils/autorest.mjs.map +1 -1
  198. package/es/utils/bytes.mjs +0 -16
  199. package/es/utils/bytes.mjs.map +1 -1
  200. package/es/utils/crypto.mjs +0 -16
  201. package/es/utils/crypto.mjs.map +1 -1
  202. package/es/utils/encoder.mjs.map +1 -1
  203. package/es/utils/errors.d.ts +14 -31
  204. package/es/utils/errors.mjs +2 -32
  205. package/es/utils/errors.mjs.map +1 -1
  206. package/es/utils/hd-wallet.mjs.map +1 -1
  207. package/es/utils/json-big.mjs.map +1 -1
  208. package/es/utils/keystore.mjs.map +1 -1
  209. package/es/utils/other.d.ts +1 -1
  210. package/es/utils/other.mjs.map +1 -1
  211. package/es/utils/semver-satisfies.mjs.map +1 -1
  212. package/es/utils/string.mjs +0 -17
  213. package/es/utils/string.mjs.map +1 -1
  214. package/package.json +34 -30
  215. package/src/AeSdkMethods.ts +11 -16
  216. package/src/AeSdkWallet.ts +1 -1
  217. package/src/Node.ts +17 -6
  218. package/src/account/Base.ts +11 -22
  219. package/src/account/Generalized.ts +8 -23
  220. package/src/account/Memory.ts +14 -21
  221. package/src/aens.ts +31 -47
  222. package/src/aepp-wallet-communication/connection/Browser.ts +0 -17
  223. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +0 -17
  224. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +0 -17
  225. package/src/aepp-wallet-communication/connection-proxy.ts +0 -17
  226. package/src/aepp-wallet-communication/rpc/types.ts +6 -2
  227. package/src/aepp-wallet-communication/wallet-detector.ts +0 -17
  228. package/src/apis/compiler/compiler.ts +3 -27
  229. package/src/apis/compiler/models/index.ts +3 -2
  230. package/src/apis/compiler/models/mappers.ts +15 -2
  231. package/src/apis/node/models/index.ts +16 -15
  232. package/src/apis/node/models/mappers.ts +2 -1
  233. package/src/apis/node/models/parameters.ts +2 -2
  234. package/src/apis/node/node.ts +3 -27
  235. package/src/chain.ts +28 -27
  236. package/src/channel/Base.ts +33 -33
  237. package/src/channel/Contract.ts +8 -23
  238. package/src/channel/Spend.ts +2 -17
  239. package/src/channel/handlers.ts +5 -18
  240. package/src/channel/internal.ts +40 -22
  241. package/src/contract/Contract.ts +133 -163
  242. package/src/contract/compiler/Base.ts +7 -14
  243. package/src/contract/compiler/Cli.ts +5 -11
  244. package/src/contract/compiler/Http.ts +6 -25
  245. package/src/contract/delegation-signature.ts +56 -0
  246. package/src/contract/ga.ts +53 -32
  247. package/src/index-browser.ts +12 -20
  248. package/src/oracle.ts +46 -56
  249. package/src/spend.ts +33 -67
  250. package/src/tx/builder/SchemaTypes.ts +79 -0
  251. package/src/tx/builder/constants.ts +2 -0
  252. package/src/tx/builder/field-types/abi-version.ts +29 -6
  253. package/src/tx/builder/field-types/array.ts +1 -1
  254. package/src/tx/builder/field-types/coin-amount.ts +6 -4
  255. package/src/tx/builder/field-types/ct-version.ts +37 -4
  256. package/src/tx/builder/field-types/deposit.ts +3 -1
  257. package/src/tx/builder/field-types/encoded.ts +1 -1
  258. package/src/tx/builder/field-types/entry.ts +8 -3
  259. package/src/tx/builder/field-types/fee.ts +6 -4
  260. package/src/tx/builder/field-types/gas-limit.ts +2 -2
  261. package/src/tx/builder/field-types/index.ts +15 -1
  262. package/src/tx/builder/field-types/map.ts +45 -0
  263. package/src/tx/builder/field-types/mptree.ts +4 -3
  264. package/src/tx/builder/field-types/name-fee.ts +2 -1
  265. package/src/tx/builder/field-types/nonce.ts +40 -0
  266. package/src/tx/builder/field-types/short-u-int-const.ts +18 -8
  267. package/src/tx/builder/field-types/ttl.ts +24 -0
  268. package/src/tx/builder/field-types/wrapped.ts +32 -0
  269. package/src/tx/builder/index.ts +57 -71
  270. package/src/tx/builder/schema.generated.ts +2013 -0
  271. package/src/tx/builder/schema.ts +544 -624
  272. package/src/tx/execution-cost.ts +146 -0
  273. package/src/tx/transaction-signer.ts +27 -0
  274. package/src/tx/validator.ts +60 -91
  275. package/src/utils/amount-formatter.ts +0 -16
  276. package/src/utils/autorest.ts +52 -11
  277. package/src/utils/bytes.ts +0 -16
  278. package/src/utils/crypto.ts +0 -16
  279. package/src/utils/errors.ts +15 -44
  280. package/src/utils/string.ts +0 -17
  281. package/types-legacy/ts4.2/AeSdkMethods.d.ts +11 -12
  282. package/types-legacy/ts4.2/Node.d.ts +5 -1
  283. package/types-legacy/ts4.2/account/Base.d.ts +11 -6
  284. package/types-legacy/ts4.2/account/Memory.d.ts +2 -1
  285. package/types-legacy/ts4.2/aens.d.ts +12 -14
  286. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +6 -2
  287. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +1 -1
  288. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +3 -2
  289. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +1 -1
  290. package/types-legacy/ts4.2/apis/node/models/index.d.ts +15 -15
  291. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +1 -1
  292. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
  293. package/types-legacy/ts4.2/chain.d.ts +8 -8
  294. package/types-legacy/ts4.2/channel/Base.d.ts +25 -12
  295. package/types-legacy/ts4.2/channel/Spend.d.ts +4 -2
  296. package/types-legacy/ts4.2/channel/internal.d.ts +22 -2
  297. package/types-legacy/ts4.2/contract/Contract.d.ts +29 -84
  298. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +7 -14
  299. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +43 -0
  300. package/types-legacy/ts4.2/contract/ga.d.ts +23 -7
  301. package/types-legacy/ts4.2/index-browser.d.ts +4 -3
  302. package/types-legacy/ts4.2/oracle.d.ts +12 -17
  303. package/types-legacy/ts4.2/spend.d.ts +19 -27
  304. package/types-legacy/ts4.2/tx/builder/SchemaTypes.d.ts +37 -0
  305. package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -2
  306. package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +11 -2
  307. package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +1 -1
  308. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +3 -4
  309. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +33 -3
  310. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +2 -1
  311. package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +1 -1
  312. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +3 -1
  313. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +3 -2
  314. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +3 -1
  315. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +52 -13
  316. package/types-legacy/ts4.2/tx/builder/field-types/map.d.ts +13 -0
  317. package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +7 -2
  318. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
  319. package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +14 -0
  320. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +4 -2
  321. package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +11 -0
  322. package/types-legacy/ts4.2/tx/builder/field-types/wrapped.d.ts +14 -0
  323. package/types-legacy/ts4.2/tx/builder/index.d.ts +23 -20
  324. package/types-legacy/ts4.2/tx/builder/schema.d.ts +2962 -4629
  325. package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +2011 -0
  326. package/types-legacy/ts4.2/tx/execution-cost.d.ts +35 -0
  327. package/types-legacy/ts4.2/tx/transaction-signer.d.ts +6 -0
  328. package/types-legacy/ts4.2/utils/autorest.d.ts +3 -2
  329. package/types-legacy/ts4.2/utils/errors.d.ts +14 -31
  330. package/types-legacy/ts4.2/utils/other.d.ts +1 -1
  331. package/types-legacy/ts4.5/AeSdkMethods.d.ts +11 -12
  332. package/types-legacy/ts4.5/Node.d.ts +5 -1
  333. package/types-legacy/ts4.5/account/Base.d.ts +11 -6
  334. package/types-legacy/ts4.5/account/Memory.d.ts +2 -1
  335. package/types-legacy/ts4.5/aens.d.ts +12 -14
  336. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +6 -2
  337. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +1 -1
  338. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +3 -2
  339. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +1 -1
  340. package/types-legacy/ts4.5/apis/node/models/index.d.ts +15 -15
  341. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +1 -1
  342. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
  343. package/types-legacy/ts4.5/chain.d.ts +8 -8
  344. package/types-legacy/ts4.5/channel/Base.d.ts +25 -12
  345. package/types-legacy/ts4.5/channel/Spend.d.ts +4 -2
  346. package/types-legacy/ts4.5/channel/internal.d.ts +22 -2
  347. package/types-legacy/ts4.5/contract/Contract.d.ts +29 -84
  348. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +7 -14
  349. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +43 -0
  350. package/types-legacy/ts4.5/contract/ga.d.ts +23 -7
  351. package/types-legacy/ts4.5/index-browser.d.ts +4 -3
  352. package/types-legacy/ts4.5/oracle.d.ts +12 -17
  353. package/types-legacy/ts4.5/spend.d.ts +19 -27
  354. package/types-legacy/ts4.5/tx/builder/SchemaTypes.d.ts +37 -0
  355. package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -2
  356. package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +11 -2
  357. package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +1 -1
  358. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +3 -4
  359. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +33 -3
  360. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +2 -1
  361. package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +1 -1
  362. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +3 -1
  363. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +3 -2
  364. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +3 -1
  365. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +52 -13
  366. package/types-legacy/ts4.5/tx/builder/field-types/map.d.ts +13 -0
  367. package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +7 -2
  368. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
  369. package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +14 -0
  370. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +4 -2
  371. package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +11 -0
  372. package/types-legacy/ts4.5/tx/builder/field-types/wrapped.d.ts +14 -0
  373. package/types-legacy/ts4.5/tx/builder/index.d.ts +23 -20
  374. package/types-legacy/ts4.5/tx/builder/schema.d.ts +2962 -4629
  375. package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +2011 -0
  376. package/types-legacy/ts4.5/tx/execution-cost.d.ts +35 -0
  377. package/types-legacy/ts4.5/tx/transaction-signer.d.ts +6 -0
  378. package/types-legacy/ts4.5/utils/autorest.d.ts +3 -2
  379. package/types-legacy/ts4.5/utils/errors.d.ts +14 -31
  380. package/types-legacy/ts4.5/utils/other.d.ts +1 -1
  381. package/es/tx/index.d.ts +0 -19
  382. package/es/tx/index.mjs +0 -115
  383. package/es/tx/index.mjs.map +0 -1
  384. package/src/apis/compiler/code-model-v4.yaml +0 -2442
  385. package/src/apis/node/code-model-v4.yaml +0 -10080
  386. package/src/tx/index.ts +0 -129
  387. package/types-legacy/ts4.2/tx/index.d.ts +0 -19
  388. package/types-legacy/ts4.5/tx/index.d.ts +0 -19
@@ -4,15 +4,14 @@
4
4
  // # RLP version number
5
5
  // # https://github.com/aeternity/protocol/blob/master/serializations.md#binary-serialization
6
6
 
7
- import BigNumber from 'bignumber.js';
8
7
  import { Tag } from './constants';
8
+ import SchemaTypes from './SchemaTypes';
9
9
  import {
10
- Field, uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
10
+ uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
11
11
  address, pointers, entry, enumeration, mptree, shortUIntConst, string, encoded, raw,
12
- array, boolean, ctVersion, abiVersion,
12
+ array, boolean, ctVersion, abiVersion, ttl, nonce, map, wrapped,
13
13
  } from './field-types';
14
- import { Encoding } from '../../utils/encoder';
15
- import { UnionToIntersection } from '../../utils/other';
14
+ import { Encoded, Encoding } from '../../utils/encoder';
16
15
  import { idTagToEncoding } from './field-types/address';
17
16
 
18
17
  export enum ORACLE_TTL_TYPES {
@@ -20,10 +19,7 @@ export enum ORACLE_TTL_TYPES {
20
19
  block = 1,
21
20
  }
22
21
 
23
- // # TRANSACTION DEFAULT TTL
24
- export const TX_TTL = 0;
25
22
  // # ORACLE
26
- export const QUERY_FEE = 30000;
27
23
  export const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };
28
24
  export const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
29
25
  export const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
@@ -33,634 +29,558 @@ export const DRY_RUN_ACCOUNT = {
33
29
  amount: 100000000000000000000000000000000000n,
34
30
  } as const;
35
31
 
36
- export type TxField = [
37
- name: string,
38
- type: Field,
39
- ];
40
-
41
32
  export enum CallReturnType {
42
33
  Ok = 0,
43
34
  Error = 1,
44
35
  Revert = 2,
45
36
  }
46
37
 
47
- type TxElem = readonly [string, Field];
38
+ // TODO: figure out how to omit overriding types of recursive fields
39
+ interface EntryAny {
40
+ serialize: (value: TxParams | Uint8Array | Encoded.Transaction) => Buffer;
41
+ deserialize: (value: Buffer) => TxUnpacked;
42
+ recursiveType: true;
43
+ }
44
+
45
+ const entryAny = entry() as unknown as EntryAny;
46
+
47
+ interface EntrySignedTx {
48
+ serialize: (value: TxParams & { tag: Tag.SignedTx } | Uint8Array | Encoded.Transaction) => Buffer;
49
+ deserialize: (value: Buffer) => TxUnpacked & { tag: Tag.SignedTx };
50
+ recursiveType: true;
51
+ }
52
+
53
+ const entrySignedTx = entry(Tag.SignedTx) as unknown as EntrySignedTx;
48
54
 
49
- type BuildTxArgBySchemaType<Type extends Field> = Parameters<Type['serialize']>[0];
55
+ interface EntryMtreeValueArray {
56
+ serialize: (
57
+ value: Array<TxParams & { tag: Tag.MtreeValue } | Uint8Array | Encoded.Transaction>,
58
+ ) => Buffer[];
59
+ deserialize: (value: Buffer[]) => Array<TxUnpacked & { tag: Tag.MtreeValue }>;
60
+ recursiveType: true;
61
+ }
50
62
 
51
- type NullablePartial<
52
- T,
53
- NK extends keyof T = { [K in keyof T]: undefined extends T[K] ? K : never }[keyof T],
54
- > = Partial<Pick<T, NK>> & Omit<T, NK>;
63
+ const entryMtreeValueArray = array(entry(Tag.MtreeValue)) as unknown as EntryMtreeValueArray;
55
64
 
56
- type BuildTxArgBySchema<SchemaLine> =
57
- UnionToIntersection<
58
- SchemaLine extends ReadonlyArray<infer Elem>
59
- ? Elem extends TxElem
60
- ? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1]> }>
61
- : never
62
- : never
63
- >;
65
+ interface EntryTreesPoi {
66
+ serialize: (value: TxParams & { tag: Tag.TreesPoi } | Uint8Array | Encoded.Transaction) => Buffer;
67
+ deserialize: (value: Buffer) => TxUnpacked & { tag: Tag.TreesPoi };
68
+ recursiveType: true;
69
+ }
64
70
 
65
- export type RawTxObject<Tx extends TxSchema> = {
66
- [k in keyof Tx]-?: Tx[k] extends BigNumber ? string : Tx[k]
67
- };
71
+ const entryTreesPoi = entry(Tag.TreesPoi) as unknown as EntryTreesPoi;
72
+
73
+ interface MapContracts {
74
+ serialize: (
75
+ value: Record<Encoded.ContractAddress, TxParams & { tag: Tag.Contract }>,
76
+ ) => Buffer;
77
+ deserialize: (
78
+ value: Buffer,
79
+ ) => Record<Encoded.ContractAddress, TxUnpacked & { tag: Tag.Contract }>;
80
+ recursiveType: true;
81
+ }
82
+
83
+ const mapContracts = map(Encoding.ContractAddress, Tag.Contract) as unknown as MapContracts;
84
+
85
+ interface MapAccounts {
86
+ serialize: (
87
+ value: Record<Encoded.AccountAddress, TxParams & { tag: Tag.Account }>,
88
+ ) => Buffer;
89
+ deserialize: (value: Buffer) => Record<Encoded.AccountAddress, TxUnpacked & { tag: Tag.Account }>;
90
+ recursiveType: true;
91
+ }
92
+
93
+ const mapAccounts = map(Encoding.AccountAddress, Tag.Account) as unknown as MapAccounts;
94
+
95
+ interface MapCalls {
96
+ serialize: (
97
+ value: Record<Encoded.Bytearray, TxParams & { tag: Tag.ContractCall }>,
98
+ ) => Buffer;
99
+ deserialize: (value: Buffer) => Record<Encoded.Bytearray, TxUnpacked & { tag: Tag.ContractCall }>;
100
+ recursiveType: true;
101
+ }
102
+
103
+ const mapCalls = map(Encoding.Bytearray, Tag.ContractCall) as unknown as MapCalls;
104
+
105
+ interface MapChannels {
106
+ serialize: (
107
+ value: Record<Encoded.Channel, TxParams & { tag: Tag.Channel }>,
108
+ ) => Buffer;
109
+ deserialize: (value: Buffer) => Record<Encoded.Channel, TxUnpacked & { tag: Tag.Channel }>;
110
+ recursiveType: true;
111
+ }
112
+
113
+ const mapChannels = map(Encoding.Channel, Tag.Channel) as unknown as MapChannels;
114
+
115
+ interface MapNames {
116
+ serialize: (
117
+ value: Record<Encoded.Name, TxParams & { tag: Tag.Name }>,
118
+ ) => Buffer;
119
+ deserialize: (value: Buffer) => Record<Encoded.Name, TxUnpacked & { tag: Tag.Name }>;
120
+ recursiveType: true;
121
+ }
122
+
123
+ const mapNames = map(Encoding.Name, Tag.Name) as unknown as MapNames;
124
+
125
+ interface MapOracles {
126
+ serialize: (
127
+ value: Record<Encoded.OracleAddress, TxParams & { tag: Tag.Oracle }>,
128
+ ) => Buffer;
129
+ deserialize: (value: Buffer) => Record<Encoded.OracleAddress, TxUnpacked & { tag: Tag.Oracle }>;
130
+ recursiveType: true;
131
+ }
132
+
133
+ const mapOracles = map(Encoding.OracleAddress, Tag.Oracle) as unknown as MapOracles;
68
134
 
69
135
  /**
70
136
  * @see {@link https://github.com/aeternity/protocol/blob/c007deeac4a01e401238412801ac7084ac72d60e/serializations.md#accounts-version-1-basic-accounts}
71
137
  */
72
- export const TX_SCHEMA = {
73
- [Tag.Account]: {
74
- 1: [
75
- ['tag', shortUIntConst(Tag.Account)],
76
- ['version', shortUIntConst(1)],
77
- ['nonce', shortUInt],
78
- ['balance', uInt],
79
- ],
80
- 2: [
81
- ['tag', shortUIntConst(Tag.Account)],
82
- ['version', shortUIntConst(2)],
83
- ['flags', uInt],
84
- ['nonce', shortUInt],
85
- ['balance', uInt],
86
- ['gaContract', address(Encoding.ContractAddress, Encoding.Name)],
87
- ['gaAuthFun', encoded(Encoding.ContractBytearray)],
88
- ],
89
- },
90
- [Tag.SignedTx]: {
91
- 1: [
92
- ['tag', shortUIntConst(Tag.SignedTx)],
93
- ['version', shortUIntConst(1)],
94
- ['signatures', array(raw)],
95
- ['encodedTx', entry()],
96
- ],
97
- },
98
- [Tag.SpendTx]: {
99
- 1: [
100
- ['tag', shortUIntConst(Tag.SpendTx)],
101
- ['version', shortUIntConst(1)],
102
- ['senderId', address(Encoding.AccountAddress)],
103
- ['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
104
- ['amount', coinAmount],
105
- ['fee', fee],
106
- ['ttl', shortUInt],
107
- ['nonce', shortUInt],
108
- ['payload', encoded(Encoding.Bytearray, true)],
109
- ],
110
- },
111
- [Tag.Name]: {
112
- 1: [
113
- ['tag', shortUIntConst(Tag.Name)],
114
- ['version', shortUIntConst(1)],
115
- ['accountId', address(Encoding.AccountAddress)],
116
- ['nameTtl', shortUInt],
117
- ['status', raw],
118
- ['clientTtl', shortUInt],
119
- ['pointers', pointers],
120
- ],
121
- },
122
- [Tag.NamePreclaimTx]: {
123
- 1: [
124
- ['tag', shortUIntConst(Tag.NamePreclaimTx)],
125
- ['version', shortUIntConst(1)],
126
- ['accountId', address(Encoding.AccountAddress)],
127
- ['nonce', shortUInt],
128
- ['commitmentId', address(Encoding.Commitment)],
129
- ['fee', fee],
130
- ['ttl', shortUInt],
131
- ],
132
- },
133
- [Tag.NameClaimTx]: {
134
- 2: [
135
- ['tag', shortUIntConst(Tag.NameClaimTx)],
136
- ['version', shortUIntConst(2)],
137
- ['accountId', address(Encoding.AccountAddress)],
138
- ['nonce', shortUInt],
139
- ['name', name],
140
- ['nameSalt', uInt],
141
- ['nameFee', nameFee],
142
- ['fee', fee],
143
- ['ttl', shortUInt],
144
- ],
145
- },
146
- [Tag.NameUpdateTx]: {
147
- 1: [
148
- ['tag', shortUIntConst(Tag.NameUpdateTx)],
149
- ['version', shortUIntConst(1)],
150
- ['accountId', address(Encoding.AccountAddress)],
151
- ['nonce', shortUInt],
152
- ['nameId', nameId],
153
- ['nameTtl', shortUInt],
154
- ['pointers', pointers],
155
- ['clientTtl', shortUInt],
156
- ['fee', fee],
157
- ['ttl', shortUInt],
158
- ],
159
- },
160
- [Tag.NameTransferTx]: {
161
- 1: [
162
- ['tag', shortUIntConst(Tag.NameTransferTx)],
163
- ['version', shortUIntConst(1)],
164
- ['accountId', address(Encoding.AccountAddress)],
165
- ['nonce', shortUInt],
166
- ['nameId', nameId],
167
- ['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
168
- ['fee', fee],
169
- ['ttl', shortUInt],
170
- ],
171
- },
172
- [Tag.NameRevokeTx]: {
173
- 1: [
174
- ['tag', shortUIntConst(Tag.NameRevokeTx)],
175
- ['version', shortUIntConst(1)],
176
- ['accountId', address(Encoding.AccountAddress)],
177
- ['nonce', shortUInt],
178
- ['nameId', nameId],
179
- ['fee', fee],
180
- ['ttl', shortUInt],
181
- ],
182
- },
183
- [Tag.Contract]: {
184
- 1: [
185
- ['tag', shortUIntConst(Tag.Contract)],
186
- ['version', shortUIntConst(1)],
187
- ['owner', address(Encoding.AccountAddress)],
188
- ['ctVersion', ctVersion],
189
- ['code', encoded(Encoding.ContractBytearray)],
190
- ['log', encoded(Encoding.ContractBytearray)],
191
- ['active', boolean],
192
- ['referers', array(address(Encoding.AccountAddress))],
193
- ['deposit', deposit],
194
- ],
195
- },
196
- [Tag.ContractCreateTx]: {
197
- 1: [
198
- ['tag', shortUIntConst(Tag.ContractCreateTx)],
199
- ['version', shortUIntConst(1)],
200
- ['ownerId', address(Encoding.AccountAddress)],
201
- ['nonce', shortUInt],
202
- ['code', encoded(Encoding.ContractBytearray)],
203
- ['ctVersion', ctVersion],
204
- ['fee', fee],
205
- ['ttl', shortUInt],
206
- ['deposit', deposit],
207
- ['amount', coinAmount],
208
- ['gasLimit', gasLimit],
209
- ['gasPrice', gasPrice],
210
- ['callData', encoded(Encoding.ContractBytearray)],
211
- ],
212
- },
213
- [Tag.ContractCallTx]: {
214
- 1: [
215
- ['tag', shortUIntConst(Tag.ContractCallTx)],
216
- ['version', shortUIntConst(1)],
217
- ['callerId', address(Encoding.AccountAddress)],
218
- ['nonce', shortUInt],
219
- ['contractId', address(Encoding.ContractAddress, Encoding.Name)],
220
- ['abiVersion', abiVersion],
221
- ['fee', fee],
222
- ['ttl', shortUInt],
223
- ['amount', coinAmount],
224
- ['gasLimit', gasLimit],
225
- ['gasPrice', gasPrice],
226
- ['callData', encoded(Encoding.ContractBytearray)],
227
- ],
228
- },
229
- [Tag.ContractCall]: {
230
- 1: [
231
- ['tag', shortUIntConst(Tag.ContractCall)],
232
- ['version', shortUIntConst(1)],
233
- ['callerId', address(Encoding.AccountAddress)],
234
- ['callerNonce', shortUInt],
235
- ['height', shortUInt],
236
- ['contractId', address(Encoding.ContractAddress)],
237
- ['gasPrice', gasPrice],
238
- ['gasUsed', shortUInt],
239
- ['returnValue', encoded(Encoding.ContractBytearray)],
240
- ['returnType', enumeration(CallReturnType)],
241
- // TODO: add serialization for
242
- // <log> :: [ { <address> :: id, [ <topics> :: binary() ], <data> :: binary() } ]
243
- ['log', raw],
244
- ],
245
- },
246
- [Tag.Oracle]: {
247
- 1: [
248
- ['tag', shortUIntConst(Tag.Oracle)],
249
- ['version', shortUIntConst(1)],
250
- ['accountId', address(Encoding.AccountAddress)],
251
- ['queryFormat', string],
252
- ['responseFormat', string],
253
- ['queryFee', coinAmount],
254
- ['oracleTtlValue', shortUInt],
255
- ['abiVersion', abiVersion],
256
- ],
257
- },
258
- [Tag.OracleRegisterTx]: {
259
- 1: [
260
- ['tag', shortUIntConst(Tag.OracleRegisterTx)],
261
- ['version', shortUIntConst(1)],
262
- ['accountId', address(Encoding.AccountAddress)],
263
- ['nonce', shortUInt],
264
- ['queryFormat', string],
265
- ['responseFormat', string],
266
- ['queryFee', coinAmount],
267
- ['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
268
- ['oracleTtlValue', shortUInt],
269
- ['fee', fee],
270
- ['ttl', shortUInt],
271
- ['abiVersion', abiVersion],
272
- ],
273
- },
274
- [Tag.OracleExtendTx]: {
275
- 1: [
276
- ['tag', shortUIntConst(Tag.OracleExtendTx)],
277
- ['version', shortUIntConst(1)],
278
- ['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
279
- ['nonce', shortUInt],
280
- ['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
281
- ['oracleTtlValue', shortUInt],
282
- ['fee', fee],
283
- ['ttl', shortUInt],
284
- ],
285
- },
286
- [Tag.OracleQueryTx]: {
287
- 1: [
288
- ['tag', shortUIntConst(Tag.OracleQueryTx)],
289
- ['version', shortUIntConst(1)],
290
- ['senderId', address(Encoding.AccountAddress)],
291
- ['nonce', shortUInt],
292
- ['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
293
- ['query', string],
294
- ['queryFee', coinAmount],
295
- ['queryTtlType', enumeration(ORACLE_TTL_TYPES)],
296
- ['queryTtlValue', shortUInt],
297
- ['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
298
- ['responseTtlValue', shortUInt],
299
- ['fee', fee],
300
- ['ttl', shortUInt],
301
- ],
302
- },
303
- [Tag.OracleResponseTx]: {
304
- 1: [
305
- ['tag', shortUIntConst(Tag.OracleResponseTx)],
306
- ['version', shortUIntConst(1)],
307
- ['oracleId', address(Encoding.OracleAddress)],
308
- ['nonce', shortUInt],
309
- ['queryId', encoded(Encoding.OracleQueryId)],
310
- ['response', string],
311
- ['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
312
- ['responseTtlValue', shortUInt],
313
- ['fee', fee],
314
- ['ttl', shortUInt],
315
- ],
316
- },
317
- [Tag.ChannelCreateTx]: {
318
- 2: [
319
- ['tag', shortUIntConst(Tag.ChannelCreateTx)],
320
- ['version', shortUIntConst(2)],
321
- ['initiator', address(Encoding.AccountAddress)],
322
- ['initiatorAmount', uInt],
323
- ['responder', address(Encoding.AccountAddress)],
324
- ['responderAmount', uInt],
325
- ['channelReserve', uInt],
326
- ['lockPeriod', uInt],
327
- ['ttl', shortUInt],
328
- ['fee', fee],
329
- ['initiatorDelegateIds', array(address(...idTagToEncoding))],
330
- ['responderDelegateIds', array(address(...idTagToEncoding))],
331
- ['stateHash', encoded(Encoding.State)],
332
- ['nonce', shortUInt],
333
- ],
334
- },
335
- [Tag.ChannelCloseMutualTx]: {
336
- 1: [
337
- ['tag', shortUIntConst(Tag.ChannelCloseMutualTx)],
338
- ['version', shortUIntConst(1)],
339
- ['channelId', address(Encoding.Channel)],
340
- ['fromId', address(Encoding.AccountAddress)],
341
- ['initiatorAmountFinal', uInt],
342
- ['responderAmountFinal', uInt],
343
- ['ttl', shortUInt],
344
- ['fee', fee],
345
- ['nonce', shortUInt],
346
- ],
347
- },
348
- [Tag.ChannelCloseSoloTx]: {
349
- 1: [
350
- ['tag', shortUIntConst(Tag.ChannelCloseSoloTx)],
351
- ['version', shortUIntConst(1)],
352
- ['channelId', address(Encoding.Channel)],
353
- ['fromId', address(Encoding.AccountAddress)],
354
- ['payload', encoded(Encoding.Transaction)],
355
- ['poi', entry(Tag.TreesPoi)],
356
- ['ttl', shortUInt],
357
- ['fee', fee],
358
- ['nonce', shortUInt],
359
- ],
360
- },
361
- [Tag.ChannelSlashTx]: {
362
- 1: [
363
- ['tag', shortUIntConst(Tag.ChannelSlashTx)],
364
- ['version', shortUIntConst(1)],
365
- ['channelId', address(Encoding.Channel)],
366
- ['fromId', address(Encoding.AccountAddress)],
367
- ['payload', encoded(Encoding.Transaction)],
368
- ['poi', entry(Tag.TreesPoi)],
369
- ['ttl', shortUInt],
370
- ['fee', fee],
371
- ['nonce', shortUInt],
372
- ],
373
- },
374
- [Tag.ChannelDepositTx]: {
375
- 1: [
376
- ['tag', shortUIntConst(Tag.ChannelDepositTx)],
377
- ['version', shortUIntConst(1)],
378
- ['channelId', address(Encoding.Channel)],
379
- ['fromId', address(Encoding.AccountAddress)],
380
- ['amount', uInt],
381
- ['ttl', shortUInt],
382
- ['fee', fee],
383
- ['stateHash', encoded(Encoding.State)],
384
- ['round', shortUInt],
385
- ['nonce', shortUInt],
386
- ],
387
- },
388
- [Tag.ChannelWithdrawTx]: {
389
- 1: [
390
- ['tag', shortUIntConst(Tag.ChannelWithdrawTx)],
391
- ['version', shortUIntConst(1)],
392
- ['channelId', address(Encoding.Channel)],
393
- ['toId', address(Encoding.AccountAddress)],
394
- ['amount', uInt],
395
- ['ttl', shortUInt],
396
- ['fee', fee],
397
- ['stateHash', encoded(Encoding.State)],
398
- ['round', shortUInt],
399
- ['nonce', shortUInt],
400
- ],
401
- },
402
- [Tag.ChannelSettleTx]: {
403
- 1: [
404
- ['tag', shortUIntConst(Tag.ChannelSettleTx)],
405
- ['version', shortUIntConst(1)],
406
- ['channelId', address(Encoding.Channel)],
407
- ['fromId', address(Encoding.AccountAddress)],
408
- ['initiatorAmountFinal', uInt],
409
- ['responderAmountFinal', uInt],
410
- ['ttl', shortUInt],
411
- ['fee', fee],
412
- ['nonce', shortUInt],
413
- ],
414
- },
415
- [Tag.ChannelForceProgressTx]: {
416
- 1: [
417
- ['tag', shortUIntConst(Tag.ChannelForceProgressTx)],
418
- ['version', shortUIntConst(1)],
419
- ['channelId', address(Encoding.Channel)],
420
- ['fromId', address(Encoding.AccountAddress)],
421
- ['payload', encoded(Encoding.Transaction)],
422
- ['round', shortUInt],
423
- ['update', encoded(Encoding.ContractBytearray)],
424
- ['stateHash', encoded(Encoding.State)],
425
- ['offChainTrees', encoded(Encoding.StateTrees)],
426
- ['ttl', shortUInt],
427
- ['fee', fee],
428
- ['nonce', shortUInt],
429
- ],
430
- },
431
- [Tag.ChannelOffChainTx]: {
432
- 2: [
433
- ['tag', shortUIntConst(Tag.ChannelOffChainTx)],
434
- ['version', shortUIntConst(2)],
435
- ['channelId', address(Encoding.Channel)],
436
- ['round', shortUInt],
437
- ['stateHash', encoded(Encoding.State)],
438
- ],
439
- },
440
- [Tag.Channel]: {
441
- 3: [
442
- ['tag', shortUIntConst(Tag.Channel)],
443
- ['version', shortUIntConst(3)],
444
- ['initiator', address(Encoding.AccountAddress)],
445
- ['responder', address(Encoding.AccountAddress)],
446
- ['channelAmount', uInt],
447
- ['initiatorAmount', uInt],
448
- ['responderAmount', uInt],
449
- ['channelReserve', uInt],
450
- ['initiatorDelegateIds', array(address(...idTagToEncoding))],
451
- ['responderDelegateIds', array(address(...idTagToEncoding))],
452
- ['stateHash', encoded(Encoding.State)],
453
- ['round', shortUInt],
454
- ['soloRound', uInt],
455
- ['lockPeriod', uInt],
456
- ['lockedUntil', uInt],
457
- ['initiatorAuth', encoded(Encoding.ContractBytearray)],
458
- ['responderAuth', encoded(Encoding.ContractBytearray)],
459
- ],
460
- },
461
- [Tag.ChannelSnapshotSoloTx]: {
462
- 1: [
463
- ['tag', shortUIntConst(Tag.ChannelSnapshotSoloTx)],
464
- ['version', shortUIntConst(1)],
465
- ['channelId', address(Encoding.Channel)],
466
- ['fromId', address(Encoding.AccountAddress)],
467
- ['payload', encoded(Encoding.Transaction)],
468
- ['ttl', shortUInt],
469
- ['fee', fee],
470
- ['nonce', shortUInt],
471
- ],
472
- },
473
- [Tag.ChannelOffChainUpdateTransfer]: {
474
- 1: [
475
- ['tag', shortUIntConst(Tag.ChannelOffChainUpdateTransfer)],
476
- ['version', shortUIntConst(1)],
477
- ['from', address(Encoding.AccountAddress)],
478
- ['to', address(Encoding.AccountAddress)],
479
- ['amount', uInt],
480
- ],
481
- },
482
- [Tag.ChannelOffChainUpdateDeposit]: {
483
- 1: [
484
- ['tag', shortUIntConst(Tag.ChannelOffChainUpdateDeposit)],
485
- ['version', shortUIntConst(1)],
486
- ['from', address(Encoding.AccountAddress)],
487
- ['amount', uInt],
488
- ],
489
- },
490
- [Tag.ChannelOffChainUpdateWithdraw]: {
491
- 1: [
492
- ['tag', shortUIntConst(Tag.ChannelOffChainUpdateWithdraw)],
493
- ['version', shortUIntConst(1)],
494
- ['from', address(Encoding.AccountAddress)],
495
- ['amount', uInt],
496
- ],
497
- },
498
- [Tag.ChannelOffChainUpdateCreateContract]: {
499
- 1: [
500
- ['tag', shortUIntConst(Tag.ChannelOffChainUpdateCreateContract)],
501
- ['version', shortUIntConst(1)],
502
- ['owner', address(Encoding.AccountAddress)],
503
- ['ctVersion', ctVersion],
504
- ['code', encoded(Encoding.ContractBytearray)],
505
- ['deposit', uInt],
506
- ['callData', encoded(Encoding.ContractBytearray)],
507
- ],
508
- },
509
- [Tag.ChannelOffChainUpdateCallContract]: {
510
- 1: [
511
- ['tag', shortUIntConst(Tag.ChannelOffChainUpdateCallContract)],
512
- ['version', shortUIntConst(1)],
513
- ['caller', address(Encoding.AccountAddress)],
514
- ['contract', address(Encoding.ContractAddress)],
515
- ['abiVersion', abiVersion],
516
- ['amount', uInt],
517
- ['callData', encoded(Encoding.ContractBytearray)],
518
- ['callStack', raw],
519
- ['gasPrice', gasPrice],
520
- ['gasLimit', gasLimit],
521
- ],
522
- },
523
- [Tag.ChannelClientReconnectTx]: {
524
- 1: [
525
- ['tag', shortUIntConst(Tag.ChannelClientReconnectTx)],
526
- ['version', shortUIntConst(1)],
527
- ['channelId', address(Encoding.Channel)],
528
- ['round', shortUInt],
529
- ['role', string],
530
- ['pubkey', address(Encoding.AccountAddress)],
531
- ],
532
- },
533
- [Tag.TreesPoi]: {
534
- 1: [
535
- ['tag', shortUIntConst(Tag.TreesPoi)],
536
- ['version', shortUIntConst(1)],
537
- ['accounts', array(mptree(Encoding.AccountAddress, Tag.Account))],
538
- ['calls', array(mptree(Encoding.Bytearray, Tag.ContractCall))],
539
- ['channels', array(mptree(Encoding.Channel, Tag.Channel))],
540
- ['contracts', array(mptree(Encoding.ContractAddress, Tag.Contract))],
541
- ['ns', array(mptree(Encoding.Name, Tag.Name))],
542
- ['oracles', array(mptree(Encoding.OracleAddress, Tag.Oracle))],
543
- ],
544
- },
545
- [Tag.StateTrees]: {
546
- 1: [
547
- ['tag', shortUIntConst(Tag.StateTrees)],
548
- ['version', shortUIntConst(1)],
549
- ['contracts', entry()],
550
- ['calls', entry()],
551
- ['channels', entry()],
552
- ['ns', entry()],
553
- ['oracles', entry()],
554
- ['accounts', entry()],
555
- ],
556
- },
557
- [Tag.Mtree]: {
558
- 1: [
559
- ['tag', shortUIntConst(Tag.Mtree)],
560
- ['version', shortUIntConst(1)],
561
- ['values', array(entry())],
562
- ],
563
- },
564
- [Tag.MtreeValue]: {
565
- 1: [
566
- ['tag', shortUIntConst(Tag.MtreeValue)],
567
- ['version', shortUIntConst(1)],
568
- ['key', raw],
569
- ['value', raw],
570
- ],
571
- },
572
- [Tag.ContractsMtree]: {
573
- 1: [
574
- ['tag', shortUIntConst(Tag.ContractsMtree)],
575
- ['version', shortUIntConst(1)],
576
- ['contracts', entry()],
577
- ],
578
- },
579
- [Tag.CallsMtree]: {
580
- 1: [
581
- ['tag', shortUIntConst(Tag.CallsMtree)],
582
- ['version', shortUIntConst(1)],
583
- ['calls', entry()],
584
- ],
585
- },
586
- [Tag.ChannelsMtree]: {
587
- 1: [
588
- ['tag', shortUIntConst(Tag.ChannelsMtree)],
589
- ['version', shortUIntConst(1)],
590
- ['channels', entry()],
591
- ],
592
- },
593
- [Tag.NameserviceMtree]: {
594
- 1: [
595
- ['tag', shortUIntConst(Tag.NameserviceMtree)],
596
- ['version', shortUIntConst(1)],
597
- ['mtree', entry()],
598
- ],
599
- },
600
- [Tag.OraclesMtree]: {
601
- 1: [
602
- ['tag', shortUIntConst(Tag.OraclesMtree)],
603
- ['version', shortUIntConst(1)],
604
- ['otree', entry()],
605
- ],
606
- },
607
- [Tag.AccountsMtree]: {
608
- 1: [
609
- ['tag', shortUIntConst(Tag.AccountsMtree)],
610
- ['version', shortUIntConst(1)],
611
- ['accounts', entry()],
612
- ],
613
- },
614
- [Tag.GaAttachTx]: {
615
- 1: [
616
- ['tag', shortUIntConst(Tag.GaAttachTx)],
617
- ['version', shortUIntConst(1)],
618
- ['ownerId', address(Encoding.AccountAddress)],
619
- ['nonce', shortUInt],
620
- ['code', encoded(Encoding.ContractBytearray)],
621
- ['authFun', raw],
622
- ['ctVersion', ctVersion],
623
- ['fee', fee],
624
- ['ttl', shortUInt],
625
- ['gasLimit', gasLimit],
626
- ['gasPrice', gasPrice],
627
- ['callData', encoded(Encoding.ContractBytearray)],
628
- ],
629
- },
630
- [Tag.GaMetaTx]: {
631
- 2: [
632
- ['tag', shortUIntConst(Tag.GaMetaTx)],
633
- ['version', shortUIntConst(2)],
634
- ['gaId', address(Encoding.AccountAddress)],
635
- ['authData', encoded(Encoding.ContractBytearray)],
636
- ['abiVersion', abiVersion],
637
- ['fee', fee],
638
- ['gasLimit', gasLimit],
639
- ['gasPrice', gasPrice],
640
- ['tx', entry()],
641
- ],
642
- },
643
- [Tag.PayingForTx]: {
644
- 1: [
645
- ['tag', shortUIntConst(Tag.PayingForTx)],
646
- ['version', shortUIntConst(1)],
647
- ['payerId', address(Encoding.AccountAddress)],
648
- ['nonce', shortUInt],
649
- ['fee', fee],
650
- ['tx', entry()],
651
- ],
652
- },
653
- } as const;
654
-
655
- type TxTypeSchemasNotCombined = {
656
- [tag in Tag]: {
657
- [ver in keyof typeof TX_SCHEMA[tag]]: BuildTxArgBySchema<typeof TX_SCHEMA[tag][ver]>
658
- }
659
- };
660
-
661
- export type TxTypeSchemas = {
662
- [key in Tag]: TxTypeSchemasNotCombined[key][keyof TxTypeSchemasNotCombined[key]]
663
- };
138
+ export const txSchema = [{
139
+ tag: shortUIntConst(Tag.Account),
140
+ version: shortUIntConst(1),
141
+ nonce: shortUInt,
142
+ balance: uInt,
143
+ }, {
144
+ tag: shortUIntConst(Tag.Account),
145
+ version: shortUIntConst(2, true),
146
+ flags: uInt,
147
+ nonce: shortUInt,
148
+ balance: uInt,
149
+ gaContract: address(Encoding.ContractAddress, Encoding.Name),
150
+ gaAuthFun: encoded(Encoding.ContractBytearray),
151
+ }, {
152
+ tag: shortUIntConst(Tag.SignedTx),
153
+ version: shortUIntConst(1, true),
154
+ signatures: array(raw),
155
+ encodedTx: entryAny,
156
+ }, {
157
+ tag: shortUIntConst(Tag.SpendTx),
158
+ version: shortUIntConst(1, true),
159
+ senderId: address(Encoding.AccountAddress),
160
+ recipientId: address(Encoding.AccountAddress, Encoding.Name),
161
+ amount: coinAmount,
162
+ fee,
163
+ ttl,
164
+ nonce: nonce('senderId'),
165
+ payload: encoded(Encoding.Bytearray, true),
166
+ }, {
167
+ tag: shortUIntConst(Tag.Name),
168
+ version: shortUIntConst(1, true),
169
+ accountId: address(Encoding.AccountAddress),
170
+ nameTtl: shortUInt,
171
+ status: raw,
172
+ clientTtl: shortUInt,
173
+ pointers,
174
+ }, {
175
+ tag: shortUIntConst(Tag.NamePreclaimTx),
176
+ version: shortUIntConst(1, true),
177
+ accountId: address(Encoding.AccountAddress),
178
+ nonce: nonce('accountId'),
179
+ commitmentId: address(Encoding.Commitment),
180
+ fee,
181
+ ttl,
182
+ }, {
183
+ tag: shortUIntConst(Tag.NameClaimTx),
184
+ version: shortUIntConst(2, true),
185
+ accountId: address(Encoding.AccountAddress),
186
+ nonce: nonce('accountId'),
187
+ name,
188
+ nameSalt: uInt,
189
+ nameFee,
190
+ fee,
191
+ ttl,
192
+ }, {
193
+ tag: shortUIntConst(Tag.NameUpdateTx),
194
+ version: shortUIntConst(1, true),
195
+ accountId: address(Encoding.AccountAddress),
196
+ nonce: nonce('accountId'),
197
+ nameId,
198
+ nameTtl: shortUInt,
199
+ pointers,
200
+ clientTtl: shortUInt,
201
+ fee,
202
+ ttl,
203
+ }, {
204
+ tag: shortUIntConst(Tag.NameTransferTx),
205
+ version: shortUIntConst(1, true),
206
+ accountId: address(Encoding.AccountAddress),
207
+ nonce: nonce('accountId'),
208
+ nameId,
209
+ recipientId: address(Encoding.AccountAddress, Encoding.Name),
210
+ fee,
211
+ ttl,
212
+ }, {
213
+ tag: shortUIntConst(Tag.NameRevokeTx),
214
+ version: shortUIntConst(1, true),
215
+ accountId: address(Encoding.AccountAddress),
216
+ nonce: nonce('accountId'),
217
+ nameId,
218
+ fee,
219
+ ttl,
220
+ }, {
221
+ tag: shortUIntConst(Tag.Contract),
222
+ version: shortUIntConst(1, true),
223
+ owner: address(Encoding.AccountAddress),
224
+ ctVersion,
225
+ code: encoded(Encoding.ContractBytearray),
226
+ log: encoded(Encoding.ContractBytearray),
227
+ active: boolean,
228
+ referers: array(address(Encoding.AccountAddress)),
229
+ deposit,
230
+ }, {
231
+ tag: shortUIntConst(Tag.ContractCreateTx),
232
+ version: shortUIntConst(1, true),
233
+ ownerId: address(Encoding.AccountAddress),
234
+ nonce: nonce('ownerId'),
235
+ code: encoded(Encoding.ContractBytearray),
236
+ ctVersion,
237
+ fee,
238
+ ttl,
239
+ deposit,
240
+ amount: coinAmount,
241
+ gasLimit,
242
+ gasPrice,
243
+ callData: encoded(Encoding.ContractBytearray),
244
+ }, {
245
+ tag: shortUIntConst(Tag.ContractCallTx),
246
+ version: shortUIntConst(1, true),
247
+ callerId: address(Encoding.AccountAddress),
248
+ nonce: nonce('callerId'),
249
+ contractId: address(Encoding.ContractAddress, Encoding.Name),
250
+ abiVersion,
251
+ fee,
252
+ ttl,
253
+ amount: coinAmount,
254
+ gasLimit,
255
+ gasPrice,
256
+ callData: encoded(Encoding.ContractBytearray),
257
+ }, {
258
+ tag: shortUIntConst(Tag.ContractCall),
259
+ version: shortUIntConst(2, true),
260
+ callerId: address(Encoding.AccountAddress),
261
+ callerNonce: shortUInt,
262
+ height: shortUInt,
263
+ contractId: address(Encoding.ContractAddress),
264
+ // TODO: rename after resolving https://github.com/aeternity/protocol/issues/506
265
+ gasPrice: uInt,
266
+ gasUsed: shortUInt,
267
+ returnValue: encoded(Encoding.ContractBytearray),
268
+ returnType: enumeration(CallReturnType),
269
+ // TODO: add serialization for
270
+ // <log> :: [ { <address> :: id, [ <topics> :: binary() }, <data> :: binary() } ]
271
+ log: array(raw),
272
+ }, {
273
+ tag: shortUIntConst(Tag.Oracle),
274
+ version: shortUIntConst(1, true),
275
+ accountId: address(Encoding.AccountAddress),
276
+ queryFormat: string,
277
+ responseFormat: string,
278
+ queryFee: coinAmount,
279
+ oracleTtlValue: shortUInt,
280
+ abiVersion,
281
+ }, {
282
+ tag: shortUIntConst(Tag.OracleRegisterTx),
283
+ version: shortUIntConst(1, true),
284
+ accountId: address(Encoding.AccountAddress),
285
+ nonce: nonce('accountId'),
286
+ queryFormat: string,
287
+ responseFormat: string,
288
+ queryFee: coinAmount,
289
+ oracleTtlType: enumeration(ORACLE_TTL_TYPES),
290
+ oracleTtlValue: shortUInt,
291
+ fee,
292
+ ttl,
293
+ abiVersion,
294
+ }, {
295
+ tag: shortUIntConst(Tag.OracleExtendTx),
296
+ version: shortUIntConst(1, true),
297
+ oracleId: address(Encoding.OracleAddress, Encoding.Name),
298
+ nonce: nonce('oracleId'),
299
+ oracleTtlType: enumeration(ORACLE_TTL_TYPES),
300
+ oracleTtlValue: shortUInt,
301
+ fee,
302
+ ttl,
303
+ }, {
304
+ tag: shortUIntConst(Tag.OracleQueryTx),
305
+ version: shortUIntConst(1, true),
306
+ senderId: address(Encoding.AccountAddress),
307
+ nonce: nonce('senderId'),
308
+ oracleId: address(Encoding.OracleAddress, Encoding.Name),
309
+ query: string,
310
+ queryFee: coinAmount,
311
+ queryTtlType: enumeration(ORACLE_TTL_TYPES),
312
+ queryTtlValue: shortUInt,
313
+ responseTtlType: enumeration(ORACLE_TTL_TYPES),
314
+ responseTtlValue: shortUInt,
315
+ fee,
316
+ ttl,
317
+ }, {
318
+ tag: shortUIntConst(Tag.OracleResponseTx),
319
+ version: shortUIntConst(1, true),
320
+ oracleId: address(Encoding.OracleAddress),
321
+ nonce: nonce('oracleId'),
322
+ queryId: encoded(Encoding.OracleQueryId),
323
+ response: string,
324
+ responseTtlType: enumeration(ORACLE_TTL_TYPES),
325
+ responseTtlValue: shortUInt,
326
+ fee,
327
+ ttl,
328
+ }, {
329
+ tag: shortUIntConst(Tag.ChannelCreateTx),
330
+ version: shortUIntConst(2, true),
331
+ initiator: address(Encoding.AccountAddress),
332
+ initiatorAmount: uInt,
333
+ responder: address(Encoding.AccountAddress),
334
+ responderAmount: uInt,
335
+ channelReserve: uInt,
336
+ lockPeriod: uInt,
337
+ ttl,
338
+ fee,
339
+ initiatorDelegateIds: array(address(...idTagToEncoding)),
340
+ responderDelegateIds: array(address(...idTagToEncoding)),
341
+ stateHash: encoded(Encoding.State),
342
+ nonce: nonce('initiator'),
343
+ }, {
344
+ tag: shortUIntConst(Tag.ChannelCloseMutualTx),
345
+ version: shortUIntConst(1, true),
346
+ channelId: address(Encoding.Channel),
347
+ fromId: address(Encoding.AccountAddress),
348
+ initiatorAmountFinal: uInt,
349
+ responderAmountFinal: uInt,
350
+ ttl,
351
+ fee,
352
+ nonce: nonce('fromId'),
353
+ }, {
354
+ tag: shortUIntConst(Tag.ChannelCloseSoloTx),
355
+ version: shortUIntConst(1, true),
356
+ channelId: address(Encoding.Channel),
357
+ fromId: address(Encoding.AccountAddress),
358
+ payload: encoded(Encoding.Transaction),
359
+ poi: entryTreesPoi,
360
+ ttl,
361
+ fee,
362
+ nonce: nonce('fromId'),
363
+ }, {
364
+ tag: shortUIntConst(Tag.ChannelSlashTx),
365
+ version: shortUIntConst(1, true),
366
+ channelId: address(Encoding.Channel),
367
+ fromId: address(Encoding.AccountAddress),
368
+ payload: encoded(Encoding.Transaction),
369
+ poi: entryTreesPoi,
370
+ ttl,
371
+ fee,
372
+ nonce: nonce('fromId'),
373
+ }, {
374
+ tag: shortUIntConst(Tag.ChannelDepositTx),
375
+ version: shortUIntConst(1, true),
376
+ channelId: address(Encoding.Channel),
377
+ fromId: address(Encoding.AccountAddress),
378
+ amount: uInt,
379
+ ttl,
380
+ fee,
381
+ stateHash: encoded(Encoding.State),
382
+ round: shortUInt,
383
+ nonce: nonce('fromId'),
384
+ }, {
385
+ tag: shortUIntConst(Tag.ChannelWithdrawTx),
386
+ version: shortUIntConst(1, true),
387
+ channelId: address(Encoding.Channel),
388
+ toId: address(Encoding.AccountAddress),
389
+ amount: uInt,
390
+ ttl,
391
+ fee,
392
+ stateHash: encoded(Encoding.State),
393
+ round: shortUInt,
394
+ nonce: nonce('fromId'),
395
+ }, {
396
+ tag: shortUIntConst(Tag.ChannelSettleTx),
397
+ version: shortUIntConst(1, true),
398
+ channelId: address(Encoding.Channel),
399
+ fromId: address(Encoding.AccountAddress),
400
+ initiatorAmountFinal: uInt,
401
+ responderAmountFinal: uInt,
402
+ ttl,
403
+ fee,
404
+ nonce: nonce('fromId'),
405
+ }, {
406
+ tag: shortUIntConst(Tag.ChannelForceProgressTx),
407
+ version: shortUIntConst(1, true),
408
+ channelId: address(Encoding.Channel),
409
+ fromId: address(Encoding.AccountAddress),
410
+ payload: encoded(Encoding.Transaction),
411
+ round: shortUInt,
412
+ update: encoded(Encoding.ContractBytearray),
413
+ stateHash: encoded(Encoding.State),
414
+ offChainTrees: encoded(Encoding.StateTrees),
415
+ ttl,
416
+ fee,
417
+ nonce: nonce('fromId'),
418
+ }, {
419
+ tag: shortUIntConst(Tag.ChannelOffChainTx),
420
+ version: shortUIntConst(2, true),
421
+ channelId: address(Encoding.Channel),
422
+ round: shortUInt,
423
+ stateHash: encoded(Encoding.State),
424
+ }, {
425
+ tag: shortUIntConst(Tag.Channel),
426
+ version: shortUIntConst(3, true),
427
+ initiator: address(Encoding.AccountAddress),
428
+ responder: address(Encoding.AccountAddress),
429
+ channelAmount: uInt,
430
+ initiatorAmount: uInt,
431
+ responderAmount: uInt,
432
+ channelReserve: uInt,
433
+ initiatorDelegateIds: array(address(...idTagToEncoding)),
434
+ responderDelegateIds: array(address(...idTagToEncoding)),
435
+ stateHash: encoded(Encoding.State),
436
+ round: shortUInt,
437
+ soloRound: uInt,
438
+ lockPeriod: uInt,
439
+ lockedUntil: uInt,
440
+ initiatorAuth: encoded(Encoding.ContractBytearray),
441
+ responderAuth: encoded(Encoding.ContractBytearray),
442
+ }, {
443
+ tag: shortUIntConst(Tag.ChannelSnapshotSoloTx),
444
+ version: shortUIntConst(1, true),
445
+ channelId: address(Encoding.Channel),
446
+ fromId: address(Encoding.AccountAddress),
447
+ payload: encoded(Encoding.Transaction),
448
+ ttl,
449
+ fee,
450
+ nonce: nonce('fromId'),
451
+ }, {
452
+ tag: shortUIntConst(Tag.ChannelOffChainUpdateTransfer),
453
+ version: shortUIntConst(1, true),
454
+ from: address(Encoding.AccountAddress),
455
+ to: address(Encoding.AccountAddress),
456
+ amount: uInt,
457
+ }, {
458
+ tag: shortUIntConst(Tag.ChannelOffChainUpdateDeposit),
459
+ version: shortUIntConst(1, true),
460
+ from: address(Encoding.AccountAddress),
461
+ amount: uInt,
462
+ }, {
463
+ tag: shortUIntConst(Tag.ChannelOffChainUpdateWithdraw),
464
+ version: shortUIntConst(1, true),
465
+ from: address(Encoding.AccountAddress),
466
+ amount: uInt,
467
+ }, {
468
+ tag: shortUIntConst(Tag.ChannelOffChainUpdateCreateContract),
469
+ version: shortUIntConst(1, true),
470
+ owner: address(Encoding.AccountAddress),
471
+ ctVersion,
472
+ code: encoded(Encoding.ContractBytearray),
473
+ deposit: uInt,
474
+ callData: encoded(Encoding.ContractBytearray),
475
+ }, {
476
+ tag: shortUIntConst(Tag.ChannelOffChainUpdateCallContract),
477
+ version: shortUIntConst(1, true),
478
+ caller: address(Encoding.AccountAddress),
479
+ contract: address(Encoding.ContractAddress),
480
+ abiVersion,
481
+ amount: uInt,
482
+ callData: encoded(Encoding.ContractBytearray),
483
+ callStack: raw,
484
+ gasPrice,
485
+ gasLimit,
486
+ }, {
487
+ tag: shortUIntConst(Tag.ChannelClientReconnectTx),
488
+ version: shortUIntConst(1, true),
489
+ channelId: address(Encoding.Channel),
490
+ round: shortUInt,
491
+ role: string,
492
+ pubkey: address(Encoding.AccountAddress),
493
+ }, {
494
+ tag: shortUIntConst(Tag.TreesPoi),
495
+ version: shortUIntConst(1, true),
496
+ // TODO: inline an extra wrapping array after resolving https://github.com/aeternity/protocol/issues/505
497
+ accounts: array(mptree(Encoding.AccountAddress, Tag.Account)),
498
+ calls: array(mptree(Encoding.Bytearray, Tag.ContractCall)),
499
+ channels: array(mptree(Encoding.Channel, Tag.Channel)),
500
+ contracts: array(mptree(Encoding.ContractAddress, Tag.Contract)),
501
+ ns: array(mptree(Encoding.Name, Tag.Name)),
502
+ oracles: array(mptree(Encoding.OracleAddress, Tag.Oracle)),
503
+ }, {
504
+ tag: shortUIntConst(Tag.StateTrees),
505
+ version: shortUIntConst(0, true),
506
+ contracts: wrapped(Tag.ContractsMtree) as unknown as MapContracts,
507
+ calls: wrapped(Tag.CallsMtree) as unknown as MapCalls,
508
+ channels: wrapped(Tag.ChannelsMtree) as unknown as MapChannels,
509
+ ns: wrapped(Tag.NameserviceMtree) as unknown as MapNames,
510
+ oracles: wrapped(Tag.OraclesMtree) as unknown as MapOracles,
511
+ accounts: wrapped(Tag.AccountsMtree) as unknown as MapAccounts,
512
+ }, {
513
+ tag: shortUIntConst(Tag.Mtree),
514
+ version: shortUIntConst(1, true),
515
+ values: entryMtreeValueArray,
516
+ }, {
517
+ tag: shortUIntConst(Tag.MtreeValue),
518
+ version: shortUIntConst(1, true),
519
+ key: raw,
520
+ value: raw,
521
+ }, {
522
+ tag: shortUIntConst(Tag.ContractsMtree),
523
+ version: shortUIntConst(1, true),
524
+ payload: mapContracts,
525
+ }, {
526
+ tag: shortUIntConst(Tag.CallsMtree),
527
+ version: shortUIntConst(1, true),
528
+ payload: mapCalls,
529
+ }, {
530
+ tag: shortUIntConst(Tag.ChannelsMtree),
531
+ version: shortUIntConst(1, true),
532
+ payload: mapChannels,
533
+ }, {
534
+ tag: shortUIntConst(Tag.NameserviceMtree),
535
+ version: shortUIntConst(1, true),
536
+ payload: mapNames,
537
+ }, {
538
+ tag: shortUIntConst(Tag.OraclesMtree),
539
+ version: shortUIntConst(1, true),
540
+ payload: mapOracles,
541
+ }, {
542
+ tag: shortUIntConst(Tag.AccountsMtree),
543
+ version: shortUIntConst(1, true),
544
+ payload: mapAccounts,
545
+ }, {
546
+ tag: shortUIntConst(Tag.GaAttachTx),
547
+ version: shortUIntConst(1, true),
548
+ ownerId: address(Encoding.AccountAddress),
549
+ nonce: nonce('ownerId'),
550
+ code: encoded(Encoding.ContractBytearray),
551
+ authFun: raw,
552
+ ctVersion,
553
+ fee,
554
+ ttl,
555
+ gasLimit,
556
+ gasPrice,
557
+ callData: encoded(Encoding.ContractBytearray),
558
+ }, {
559
+ tag: shortUIntConst(Tag.GaMetaTx),
560
+ version: shortUIntConst(2, true),
561
+ gaId: address(Encoding.AccountAddress),
562
+ authData: encoded(Encoding.ContractBytearray),
563
+ abiVersion,
564
+ fee,
565
+ gasLimit,
566
+ gasPrice,
567
+ tx: entrySignedTx,
568
+ }, {
569
+ tag: shortUIntConst(Tag.PayingForTx),
570
+ version: shortUIntConst(1, true),
571
+ payerId: address(Encoding.AccountAddress),
572
+ nonce: nonce('payerId'),
573
+ fee,
574
+ tx: entrySignedTx,
575
+ }, {
576
+ tag: shortUIntConst(Tag.GaMetaTxAuthData),
577
+ version: shortUIntConst(1, true),
578
+ fee: coinAmount,
579
+ gasPrice,
580
+ txHash: encoded(Encoding.TxHash),
581
+ }] as const;
664
582
 
665
- export type TxSchema = TxTypeSchemas[Tag];
666
- export type TxParamsCommon = Partial<UnionToIntersection<TxSchema>>;
583
+ type TxSchema = SchemaTypes<typeof txSchema>;
584
+ export type TxParams = TxSchema['TxParams'];
585
+ export type TxParamsAsync = TxSchema['TxParamsAsync'];
586
+ export type TxUnpacked = TxSchema['TxUnpacked'];