@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.1

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 (565) 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 +12031 -11231
  7. package/dist/aepp-sdk.js.map +1 -1
  8. package/es/AeSdk.d.ts +7 -3
  9. package/es/AeSdk.mjs +17 -22
  10. package/es/AeSdk.mjs.map +1 -1
  11. package/es/AeSdkAepp.d.ts +6 -5
  12. package/es/AeSdkAepp.mjs +7 -30
  13. package/es/AeSdkAepp.mjs.map +1 -1
  14. package/es/AeSdkBase.d.ts +18 -140
  15. package/es/AeSdkBase.mjs +30 -184
  16. package/es/AeSdkBase.mjs.map +1 -1
  17. package/es/AeSdkMethods.d.ts +123 -0
  18. package/es/AeSdkMethods.mjs +122 -0
  19. package/es/AeSdkMethods.mjs.map +1 -0
  20. package/es/AeSdkWallet.d.ts +7 -21
  21. package/es/AeSdkWallet.mjs +38 -86
  22. package/es/AeSdkWallet.mjs.map +1 -1
  23. package/es/Node.d.ts +11 -15
  24. package/es/Node.mjs +35 -48
  25. package/es/Node.mjs.map +1 -1
  26. package/es/account/Base.d.ts +24 -40
  27. package/es/account/Base.mjs +1 -101
  28. package/es/account/Base.mjs.map +1 -1
  29. package/es/account/Generalized.d.ts +16 -0
  30. package/es/account/Generalized.mjs +113 -0
  31. package/es/account/Generalized.mjs.map +1 -0
  32. package/es/account/Ledger.d.ts +28 -0
  33. package/es/account/Ledger.mjs +102 -0
  34. package/es/account/Ledger.mjs.map +1 -0
  35. package/es/account/LedgerFactory.d.ts +39 -0
  36. package/es/account/LedgerFactory.mjs +81 -0
  37. package/es/account/LedgerFactory.mjs.map +1 -0
  38. package/es/account/Memory.d.ts +13 -17
  39. package/es/account/Memory.mjs +43 -64
  40. package/es/account/Memory.mjs.map +1 -1
  41. package/es/account/Rpc.d.ts +6 -8
  42. package/es/account/Rpc.mjs +14 -32
  43. package/es/account/Rpc.mjs.map +1 -1
  44. package/es/aens.d.ts +4 -4
  45. package/es/aens.mjs +46 -41
  46. package/es/aens.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
  48. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
  50. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
  51. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
  53. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
  54. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  55. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  56. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
  57. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
  58. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
  60. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/schema.mjs +14 -68
  62. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  64. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  65. package/es/apis/compiler/compiler.d.ts +23 -29
  66. package/es/apis/compiler/compiler.mjs +128 -189
  67. package/es/apis/compiler/compiler.mjs.map +1 -1
  68. package/es/apis/compiler/index.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +82 -135
  70. package/es/apis/compiler/models/index.mjs +1 -47
  71. package/es/apis/compiler/models/index.mjs.map +1 -1
  72. package/es/apis/compiler/models/mappers.d.ts +8 -8
  73. package/es/apis/compiler/models/mappers.mjs +165 -183
  74. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  75. package/es/apis/compiler/models/parameters.d.ts +0 -1
  76. package/es/apis/compiler/models/parameters.mjs +5 -9
  77. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  78. package/es/apis/node/index.mjs.map +1 -1
  79. package/es/apis/node/models/index.d.ts +48 -48
  80. package/es/apis/node/models/mappers.mjs +12 -6
  81. package/es/apis/node/models/mappers.mjs.map +1 -1
  82. package/es/apis/node/models/parameters.mjs.map +1 -1
  83. package/es/apis/node/node.mjs +43 -84
  84. package/es/apis/node/node.mjs.map +1 -1
  85. package/es/chain.d.ts +10 -2
  86. package/es/chain.mjs +37 -59
  87. package/es/chain.mjs.map +1 -1
  88. package/es/channel/Base.d.ts +200 -0
  89. package/es/channel/Base.mjs +293 -0
  90. package/es/channel/Base.mjs.map +1 -0
  91. package/es/channel/Contract.d.ts +248 -0
  92. package/es/channel/Contract.mjs +420 -0
  93. package/es/channel/Contract.mjs.map +1 -0
  94. package/es/channel/Spend.d.ts +219 -0
  95. package/es/channel/Spend.mjs +385 -0
  96. package/es/channel/Spend.mjs.map +1 -0
  97. package/es/channel/handlers.d.ts +8 -21
  98. package/es/channel/handlers.mjs +151 -899
  99. package/es/channel/handlers.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +27 -21
  101. package/es/channel/internal.mjs +101 -191
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Contract.d.ts +210 -0
  104. package/es/contract/Contract.mjs +551 -0
  105. package/es/contract/Contract.mjs.map +1 -0
  106. package/es/contract/compiler/Base.d.ts +81 -0
  107. package/es/contract/compiler/Base.mjs +5 -0
  108. package/es/contract/compiler/Base.mjs.map +1 -0
  109. package/es/contract/compiler/Cli.d.ts +23 -0
  110. package/es/contract/compiler/Cli.mjs +155 -0
  111. package/es/contract/compiler/Cli.mjs.map +1 -0
  112. package/es/contract/compiler/Http.d.ts +32 -0
  113. package/es/contract/compiler/Http.mjs +118 -0
  114. package/es/contract/compiler/Http.mjs.map +1 -0
  115. package/es/contract/compiler/HttpNode.d.ts +17 -0
  116. package/es/contract/compiler/HttpNode.mjs +26 -0
  117. package/es/contract/compiler/HttpNode.mjs.map +1 -0
  118. package/es/contract/compiler/getFileSystem.d.ts +6 -0
  119. package/es/contract/compiler/getFileSystem.mjs +40 -0
  120. package/es/contract/compiler/getFileSystem.mjs.map +1 -0
  121. package/es/contract/ga.d.ts +9 -34
  122. package/es/contract/ga.mjs +29 -112
  123. package/es/contract/ga.mjs.map +1 -1
  124. package/es/index-browser.d.ts +39 -0
  125. package/es/index-browser.mjs +55 -0
  126. package/es/index-browser.mjs.map +1 -0
  127. package/es/index.d.ts +4 -35
  128. package/es/index.mjs +4 -51
  129. package/es/index.mjs.map +1 -1
  130. package/es/oracle.d.ts +5 -5
  131. package/es/oracle.mjs +34 -40
  132. package/es/oracle.mjs.map +1 -1
  133. package/es/spend.d.ts +3 -3
  134. package/es/spend.mjs +18 -23
  135. package/es/spend.mjs.map +1 -1
  136. package/es/tx/builder/constants.d.ts +30 -2
  137. package/es/tx/builder/constants.mjs +43 -14
  138. package/es/tx/builder/constants.mjs.map +1 -1
  139. package/es/tx/builder/field-types/abi-version.d.ts +10 -0
  140. package/es/tx/builder/field-types/abi-version.mjs +20 -0
  141. package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
  142. package/es/tx/builder/field-types/address.d.ts +14 -0
  143. package/es/tx/builder/field-types/address.mjs +51 -0
  144. package/es/tx/builder/field-types/address.mjs.map +1 -0
  145. package/es/tx/builder/field-types/array.d.ts +7 -0
  146. package/es/tx/builder/field-types/array.mjs +11 -0
  147. package/es/tx/builder/field-types/array.mjs.map +1 -0
  148. package/es/tx/builder/field-types/boolean.d.ts +6 -0
  149. package/es/tx/builder/field-types/boolean.mjs +13 -0
  150. package/es/tx/builder/field-types/boolean.mjs.map +1 -0
  151. package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
  152. package/es/tx/builder/field-types/coin-amount.mjs +4 -12
  153. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  154. package/es/tx/builder/field-types/ct-version.d.ts +30 -0
  155. package/es/tx/builder/field-types/ct-version.mjs +48 -0
  156. package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
  157. package/es/tx/builder/field-types/deposit.d.ts +1 -2
  158. package/es/tx/builder/field-types/deposit.mjs +2 -4
  159. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  160. package/es/tx/builder/field-types/encoded.d.ts +6 -0
  161. package/es/tx/builder/field-types/encoded.mjs +21 -0
  162. package/es/tx/builder/field-types/encoded.mjs.map +1 -0
  163. package/es/tx/builder/field-types/entry.d.ts +11 -0
  164. package/es/tx/builder/field-types/entry.mjs +31 -0
  165. package/es/tx/builder/field-types/entry.mjs.map +1 -0
  166. package/es/tx/builder/field-types/enumeration.d.ts +7 -0
  167. package/es/tx/builder/field-types/enumeration.mjs +30 -0
  168. package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
  169. package/es/tx/builder/field-types/fee.d.ts +10 -15
  170. package/es/tx/builder/field-types/fee.mjs +31 -43
  171. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  172. package/es/tx/builder/field-types/field.mjs +0 -2
  173. package/es/tx/builder/field-types/field.mjs.map +1 -1
  174. package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
  175. package/es/tx/builder/field-types/gas-limit.mjs +12 -14
  176. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  177. package/es/tx/builder/field-types/gas-price.d.ts +1 -2
  178. package/es/tx/builder/field-types/gas-price.mjs +3 -7
  179. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  180. package/es/tx/builder/field-types/index.d.ts +80 -30
  181. package/es/tx/builder/field-types/index.mjs +34 -9
  182. package/es/tx/builder/field-types/index.mjs.map +1 -1
  183. package/es/tx/builder/field-types/mptree.d.ts +37 -0
  184. package/es/tx/builder/field-types/mptree.mjs +268 -0
  185. package/es/tx/builder/field-types/mptree.mjs.map +1 -0
  186. package/es/tx/builder/field-types/name-fee.d.ts +1 -3
  187. package/es/tx/builder/field-types/name-fee.mjs +3 -5
  188. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  189. package/es/tx/builder/field-types/name-id.d.ts +1 -4
  190. package/es/tx/builder/field-types/name-id.mjs +5 -10
  191. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  192. package/es/tx/builder/field-types/name.mjs +0 -2
  193. package/es/tx/builder/field-types/name.mjs.map +1 -1
  194. package/es/tx/builder/field-types/pointers.d.ts +23 -0
  195. package/es/tx/builder/field-types/pointers.mjs +36 -0
  196. package/es/tx/builder/field-types/pointers.mjs.map +1 -0
  197. package/es/tx/builder/field-types/raw.d.ts +6 -0
  198. package/es/tx/builder/field-types/raw.mjs +13 -0
  199. package/es/tx/builder/field-types/raw.mjs.map +1 -0
  200. package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  201. package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
  202. package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
  203. package/es/tx/builder/field-types/short-u-int.mjs +0 -2
  204. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  205. package/es/tx/builder/field-types/string.d.ts +6 -0
  206. package/es/tx/builder/field-types/string.mjs +10 -0
  207. package/es/tx/builder/field-types/string.mjs.map +1 -0
  208. package/es/tx/builder/field-types/u-int.d.ts +1 -2
  209. package/es/tx/builder/field-types/u-int.mjs +3 -4
  210. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  211. package/es/tx/builder/helpers.d.ts +2 -32
  212. package/es/tx/builder/helpers.mjs +19 -71
  213. package/es/tx/builder/helpers.mjs.map +1 -1
  214. package/es/tx/builder/index.d.ts +11 -49
  215. package/es/tx/builder/index.mjs +57 -337
  216. package/es/tx/builder/index.mjs.map +1 -1
  217. package/es/tx/builder/schema.d.ts +2367 -667
  218. package/es/tx/builder/schema.mjs +70 -145
  219. package/es/tx/builder/schema.mjs.map +1 -1
  220. package/es/tx/index.d.ts +4 -49
  221. package/es/tx/index.mjs +38 -112
  222. package/es/tx/index.mjs.map +1 -1
  223. package/es/tx/validator.d.ts +4 -6
  224. package/es/tx/validator.mjs +104 -90
  225. package/es/tx/validator.mjs.map +1 -1
  226. package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
  227. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
  228. package/es/utils/amount-formatter.mjs +4 -10
  229. package/es/utils/amount-formatter.mjs.map +1 -1
  230. package/es/utils/autorest.d.ts +1 -0
  231. package/es/utils/autorest.mjs +17 -19
  232. package/es/utils/autorest.mjs.map +1 -1
  233. package/es/utils/bignumber.mjs +4 -7
  234. package/es/utils/bignumber.mjs.map +1 -1
  235. package/es/utils/bytes.d.ts +0 -17
  236. package/es/utils/bytes.mjs +6 -35
  237. package/es/utils/bytes.mjs.map +1 -1
  238. package/es/utils/crypto.d.ts +15 -8
  239. package/es/utils/crypto.mjs +40 -40
  240. package/es/utils/crypto.mjs.map +1 -1
  241. package/es/utils/encoder-types.d.ts +28 -28
  242. package/es/utils/encoder-types.mjs +0 -1
  243. package/es/utils/encoder-types.mjs.map +1 -1
  244. package/es/utils/encoder.d.ts +0 -1
  245. package/es/utils/encoder.mjs +7 -15
  246. package/es/utils/encoder.mjs.map +1 -1
  247. package/es/utils/errors.d.ts +15 -14
  248. package/es/utils/errors.mjs +86 -172
  249. package/es/utils/errors.mjs.map +1 -1
  250. package/es/utils/hd-wallet.d.ts +27 -19
  251. package/es/utils/hd-wallet.mjs +42 -26
  252. package/es/utils/hd-wallet.mjs.map +1 -1
  253. package/es/utils/json-big.mjs +0 -8
  254. package/es/utils/json-big.mjs.map +1 -1
  255. package/es/utils/keystore.d.ts +2 -0
  256. package/es/utils/keystore.mjs +37 -36
  257. package/es/utils/keystore.mjs.map +1 -1
  258. package/es/utils/other.d.ts +4 -2
  259. package/es/utils/other.mjs +11 -7
  260. package/es/utils/other.mjs.map +1 -1
  261. package/es/utils/semver-satisfies.mjs +0 -3
  262. package/es/utils/semver-satisfies.mjs.map +1 -1
  263. package/es/utils/string.d.ts +0 -12
  264. package/es/utils/string.mjs +1 -21
  265. package/es/utils/string.mjs.map +1 -1
  266. package/package.json +98 -51
  267. package/src/AeSdk.ts +15 -11
  268. package/src/AeSdkAepp.ts +9 -7
  269. package/src/AeSdkBase.ts +31 -202
  270. package/src/AeSdkMethods.ts +169 -0
  271. package/src/AeSdkWallet.ts +16 -47
  272. package/src/Node.ts +17 -18
  273. package/src/account/Base.ts +29 -75
  274. package/src/account/Generalized.ts +98 -0
  275. package/src/account/Ledger.ts +131 -0
  276. package/src/account/LedgerFactory.ts +86 -0
  277. package/src/account/Memory.ts +46 -60
  278. package/src/account/Rpc.ts +17 -26
  279. package/src/aens.ts +13 -11
  280. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
  281. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
  282. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
  283. package/src/aepp-wallet-communication/rpc/types.ts +11 -1
  284. package/src/aepp-wallet-communication/schema.ts +18 -18
  285. package/src/apis/compiler/code-model-v4.yaml +681 -888
  286. package/src/apis/compiler/compiler.ts +113 -154
  287. package/src/apis/compiler/models/index.ts +80 -140
  288. package/src/apis/compiler/models/mappers.ts +165 -183
  289. package/src/apis/compiler/models/parameters.ts +6 -12
  290. package/src/chain.ts +11 -6
  291. package/src/channel/Base.ts +335 -0
  292. package/src/channel/Contract.ts +488 -0
  293. package/src/channel/Spend.ts +408 -0
  294. package/src/channel/handlers.ts +164 -582
  295. package/src/channel/internal.ts +114 -143
  296. package/src/contract/Contract.ts +610 -0
  297. package/src/contract/compiler/Base.ts +94 -0
  298. package/src/contract/compiler/Cli.ts +134 -0
  299. package/src/contract/compiler/Http.ts +124 -0
  300. package/src/contract/compiler/HttpNode.ts +26 -0
  301. package/src/contract/compiler/getFileSystem.ts +42 -0
  302. package/src/contract/ga.ts +23 -106
  303. package/src/index-browser.ts +58 -0
  304. package/src/index.ts +4 -55
  305. package/src/oracle.ts +8 -8
  306. package/src/spend.ts +6 -14
  307. package/src/tx/builder/constants.ts +33 -3
  308. package/src/tx/builder/field-types/abi-version.ts +21 -0
  309. package/src/tx/builder/field-types/address.ts +62 -0
  310. package/src/tx/builder/field-types/array.ts +19 -0
  311. package/src/tx/builder/field-types/boolean.ts +9 -0
  312. package/src/tx/builder/field-types/coin-amount.ts +4 -9
  313. package/src/tx/builder/field-types/ct-version.ts +50 -0
  314. package/src/tx/builder/field-types/deposit.ts +1 -1
  315. package/src/tx/builder/field-types/encoded.ts +27 -0
  316. package/src/tx/builder/field-types/entry.ts +31 -0
  317. package/src/tx/builder/field-types/enumeration.ts +32 -0
  318. package/src/tx/builder/field-types/fee.ts +39 -21
  319. package/src/tx/builder/field-types/gas-limit.ts +13 -8
  320. package/src/tx/builder/field-types/gas-price.ts +0 -2
  321. package/src/tx/builder/field-types/index.ts +54 -15
  322. package/src/tx/builder/field-types/mptree.ts +242 -0
  323. package/src/tx/builder/field-types/name-fee.ts +2 -3
  324. package/src/tx/builder/field-types/name-id.ts +7 -10
  325. package/src/tx/builder/field-types/pointers.ts +41 -0
  326. package/src/tx/builder/field-types/raw.ts +9 -0
  327. package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
  328. package/src/tx/builder/field-types/string.ts +11 -0
  329. package/src/tx/builder/field-types/u-int.ts +4 -5
  330. package/src/tx/builder/helpers.ts +10 -60
  331. package/src/tx/builder/index.ts +65 -308
  332. package/src/tx/builder/schema.ts +280 -341
  333. package/src/tx/index.ts +40 -103
  334. package/src/tx/validator.ts +91 -96
  335. package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
  336. package/src/utils/autorest.ts +16 -1
  337. package/src/utils/bytes.ts +6 -34
  338. package/src/utils/crypto.ts +23 -16
  339. package/src/utils/encoder.ts +0 -1
  340. package/src/utils/errors.ts +22 -25
  341. package/src/utils/hd-wallet.ts +30 -9
  342. package/src/utils/keystore.ts +24 -21
  343. package/src/utils/other.ts +16 -1
  344. package/src/utils/string.ts +0 -20
  345. package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
  346. package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
  347. package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
  348. package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
  349. package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
  350. package/types-legacy/ts4.2/Node.d.ts +78 -0
  351. package/types-legacy/ts4.2/account/Base.d.ts +52 -0
  352. package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
  353. package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
  354. package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
  355. package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
  356. package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
  357. package/types-legacy/ts4.2/aens.d.ts +222 -0
  358. package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  359. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  363. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
  364. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
  365. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  366. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
  367. package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
  368. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
  369. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
  370. package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
  371. package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
  372. package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
  373. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
  374. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
  375. package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
  376. package/types-legacy/ts4.2/chain.d.ts +256 -0
  377. package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
  378. package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
  379. package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
  380. package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
  381. package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
  382. package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
  383. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
  384. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
  385. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
  386. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
  387. package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
  388. package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
  389. package/types-legacy/ts4.2/globals.d.ts +16 -0
  390. package/types-legacy/ts4.2/index-browser.d.ts +39 -0
  391. package/types-legacy/ts4.2/index.d.ts +5 -0
  392. package/types-legacy/ts4.2/oracle.d.ts +161 -0
  393. package/types-legacy/ts4.2/spend.d.ts +62 -0
  394. package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
  395. package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
  397. package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
  398. package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
  399. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
  400. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
  401. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
  405. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
  407. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
  408. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
  409. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
  410. package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
  411. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
  412. package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
  413. package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
  414. package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
  415. package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
  416. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  417. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
  418. package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
  419. package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
  420. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
  421. package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
  422. package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
  423. package/types-legacy/ts4.2/tx/index.d.ts +19 -0
  424. package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
  425. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
  426. package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
  427. package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
  428. package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
  429. package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
  430. package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
  431. package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
  432. package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
  433. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
  434. package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
  435. package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
  436. package/types-legacy/ts4.2/utils/other.d.ts +31 -0
  437. package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
  438. package/types-legacy/ts4.2/utils/string.d.ts +12 -0
  439. package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
  440. package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
  441. package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
  442. package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
  443. package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
  444. package/types-legacy/ts4.5/Node.d.ts +78 -0
  445. package/types-legacy/ts4.5/account/Base.d.ts +52 -0
  446. package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
  447. package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
  448. package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
  449. package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
  450. package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
  451. package/types-legacy/ts4.5/aens.d.ts +222 -0
  452. package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  453. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  454. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  455. package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  456. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  457. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
  458. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
  459. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  460. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
  461. package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
  462. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
  463. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
  464. package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
  465. package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
  466. package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
  467. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
  468. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
  469. package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
  470. package/types-legacy/ts4.5/chain.d.ts +256 -0
  471. package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
  472. package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
  473. package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
  474. package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
  475. package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
  476. package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
  477. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
  478. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
  479. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
  480. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
  481. package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
  482. package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
  483. package/types-legacy/ts4.5/index-browser.d.ts +39 -0
  484. package/types-legacy/ts4.5/index.d.ts +4 -0
  485. package/types-legacy/ts4.5/oracle.d.ts +161 -0
  486. package/types-legacy/ts4.5/spend.d.ts +62 -0
  487. package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
  488. package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
  489. package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
  490. package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
  491. package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
  492. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
  493. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
  495. package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
  496. package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
  497. package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
  498. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
  499. package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
  500. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
  501. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
  502. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
  503. package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
  504. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
  505. package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
  506. package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
  507. package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
  508. package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
  509. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  510. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
  511. package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
  512. package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
  513. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
  514. package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
  515. package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
  516. package/types-legacy/ts4.5/tx/index.d.ts +19 -0
  517. package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
  518. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
  519. package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
  520. package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
  521. package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
  522. package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
  523. package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
  524. package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
  525. package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
  526. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
  527. package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
  528. package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
  529. package/types-legacy/ts4.5/utils/other.d.ts +31 -0
  530. package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
  531. package/types-legacy/ts4.5/utils/string.d.ts +12 -0
  532. package/es/channel/index.d.ts +0 -625
  533. package/es/channel/index.mjs +0 -975
  534. package/es/channel/index.mjs.map +0 -1
  535. package/es/contract/Compiler.d.ts +0 -18
  536. package/es/contract/Compiler.mjs +0 -68
  537. package/es/contract/Compiler.mjs.map +0 -1
  538. package/es/contract/aci.d.ts +0 -127
  539. package/es/contract/aci.mjs +0 -508
  540. package/es/contract/aci.mjs.map +0 -1
  541. package/es/contract/methods.d.ts +0 -71
  542. package/es/contract/methods.mjs +0 -104
  543. package/es/contract/methods.mjs.map +0 -1
  544. package/es/deprecated/index.d.ts +0 -143
  545. package/es/deprecated/index.mjs +0 -162
  546. package/es/deprecated/index.mjs.map +0 -1
  547. package/es/deprecated/methods.d.ts +0 -18
  548. package/es/deprecated/methods.mjs +0 -26
  549. package/es/deprecated/methods.mjs.map +0 -1
  550. package/es/tx/builder/address.d.ts +0 -25
  551. package/es/tx/builder/address.mjs +0 -45
  552. package/es/tx/builder/address.mjs.map +0 -1
  553. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
  554. package/es/utils/mptree.d.ts +0 -26
  555. package/es/utils/mptree.mjs +0 -165
  556. package/es/utils/mptree.mjs.map +0 -1
  557. package/src/channel/index.ts +0 -1025
  558. package/src/contract/Compiler.ts +0 -67
  559. package/src/contract/aci.ts +0 -537
  560. package/src/contract/methods.ts +0 -123
  561. package/src/deprecated/index.ts +0 -172
  562. package/src/deprecated/methods.ts +0 -25
  563. package/src/tx/builder/address.ts +0 -50
  564. package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
  565. package/src/utils/mptree.ts +0 -145
@@ -8,10 +8,12 @@ import BigNumber from 'bignumber.js';
8
8
  import { Tag } from './constants';
9
9
  import {
10
10
  Field, uInt, shortUInt, coinAmount, name, nameId, nameFee, deposit, gasLimit, gasPrice, fee,
11
+ address, pointers, entry, enumeration, mptree, shortUIntConst, string, encoded, raw,
12
+ array, boolean, ctVersion, abiVersion,
11
13
  } from './field-types';
12
- import { Encoded, Encoding } from '../../utils/encoder';
13
- import MPTree from '../../utils/mptree';
14
- import { NamePointer } from '../../apis/node';
14
+ import { Encoding } from '../../utils/encoder';
15
+ import { UnionToIntersection } from '../../utils/other';
16
+ import { idTagToEncoding } from './field-types/address';
15
17
 
16
18
  export enum ORACLE_TTL_TYPES {
17
19
  delta = 0,
@@ -26,8 +28,6 @@ export const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };
26
28
  export const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
27
29
  export const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
28
30
  // # CONTRACT
29
- export const AMOUNT = 0;
30
- export const MAX_AUTH_FUN_GAS = 50000;
31
31
  export const DRY_RUN_ACCOUNT = {
32
32
  pub: 'ak_11111111111111111111111111111111273Yts',
33
33
  amount: 100000000000000000000000000000000000n,
@@ -35,141 +35,18 @@ export const DRY_RUN_ACCOUNT = {
35
35
 
36
36
  export type TxField = [
37
37
  name: string,
38
- type: FIELD_TYPES | Field,
39
- prefix?: Encoding | Encoding[],
38
+ type: Field,
40
39
  ];
41
40
 
42
- /**
43
- * @category transaction builder
44
- * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
45
- */
46
- export enum VM_VERSIONS {
47
- NO_VM = 0,
48
- SOPHIA = 1,
49
- SOPHIA_IMPROVEMENTS_MINERVA = 3,
50
- SOPHIA_IMPROVEMENTS_FORTUNA = 4,
51
- FATE = 5,
52
- SOPHIA_IMPROVEMENTS_LIMA = 6,
53
- FATE_2 = 7,
54
- }
55
-
56
- /**
57
- * @category transaction builder
58
- * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
59
- */
60
- export enum ABI_VERSIONS {
61
- NO_ABI = 0,
62
- SOPHIA = 1,
63
- FATE = 3,
64
- }
65
-
66
- /**
67
- * @category transaction builder
68
- */
69
- export enum PROTOCOL_VERSIONS {
70
- IRIS = 5,
71
- }
72
-
73
- // First abi/vm by default
74
- export const PROTOCOL_VM_ABI = {
75
- [PROTOCOL_VERSIONS.IRIS]: {
76
- [Tag.ContractCreateTx]: {
77
- vmVersion: [VM_VERSIONS.FATE_2], abiVersion: [ABI_VERSIONS.FATE],
78
- },
79
- // TODO: Ensure that AEVM (SOPHIA?) is still available here
80
- [Tag.ContractCallTx]: {
81
- vmVersion: [], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA],
82
- },
83
- [Tag.OracleRegisterTx]: {
84
- vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA],
85
- },
86
- },
87
- } as const;
88
-
89
- type PrefixType<Prefix> = Prefix extends Encoding
90
- ? Encoded.Generic<Prefix>
91
- : Prefix extends readonly Encoding[]
92
- ? Encoded.Generic<Prefix[number]>
93
- : Encoded.Generic<any>;
94
-
95
- /**
96
- * @category transaction builder
97
- */
98
- export interface CtVersion {
99
- vmVersion: VM_VERSIONS;
100
- abiVersion: ABI_VERSIONS;
101
- }
102
-
103
- /**
104
- * @category transaction builder
105
- */
106
- export enum FIELD_TYPES {
107
- id,
108
- ids,
109
- string,
110
- binary,
111
- bool,
112
- hex,
113
- rlpBinary,
114
- rlpBinaries,
115
- rawBinary,
116
- signatures,
117
- pointers,
118
- offChainUpdates,
119
- callStack,
120
- proofOfInclusion,
121
- mptrees,
122
- callReturnType,
123
- ctVersion,
124
- abiVersion,
125
- ttlType,
126
- sophiaCodeTypeInfo,
127
- payload,
128
- stateTree,
129
- }
130
-
131
- interface BuildFieldTypes<Prefix extends undefined | Encoding | readonly Encoding[]> {
132
- [FIELD_TYPES.id]: PrefixType<Prefix>;
133
- [FIELD_TYPES.ids]: Array<Encoded.Generic<Prefix extends Encoding[] ? Prefix : any>>;
134
- [FIELD_TYPES.string]: string;
135
- [FIELD_TYPES.binary]: PrefixType<Prefix>;
136
- [FIELD_TYPES.bool]: Boolean;
137
- [FIELD_TYPES.hex]: string;
138
- [FIELD_TYPES.rlpBinary]: any;
139
- [FIELD_TYPES.rlpBinaries]: any[];
140
- [FIELD_TYPES.rawBinary]: Uint8Array;
141
- [FIELD_TYPES.signatures]: Uint8Array[];
142
- [FIELD_TYPES.pointers]: NamePointer[];
143
- [FIELD_TYPES.offChainUpdates]: any;
144
- [FIELD_TYPES.callStack]: any;
145
- [FIELD_TYPES.proofOfInclusion]: any;
146
- [FIELD_TYPES.mptrees]: MPTree[];
147
- [FIELD_TYPES.callReturnType]: any;
148
- [FIELD_TYPES.ctVersion]: CtVersion;
149
- [FIELD_TYPES.abiVersion]: ABI_VERSIONS;
150
- [FIELD_TYPES.ttlType]: ORACLE_TTL_TYPES;
151
- [FIELD_TYPES.sophiaCodeTypeInfo]: any;
152
- [FIELD_TYPES.payload]: string | undefined;
153
- [FIELD_TYPES.stateTree]: any;
41
+ export enum CallReturnType {
42
+ Ok = 0,
43
+ Error = 1,
44
+ Revert = 2,
154
45
  }
155
46
 
156
- // based on https://stackoverflow.com/a/50375286/6176994
157
- type UnionToIntersection<Union> =
158
- (Union extends any ? (k: Union) => void : never) extends ((k: infer Intersection) => void)
159
- ? Intersection : never;
47
+ type TxElem = readonly [string, Field];
160
48
 
161
- type TxElem = readonly [string, FIELD_TYPES | Field]
162
- | readonly [string, FIELD_TYPES, Encoding | readonly Encoding[]];
163
-
164
- type BuildTxArgBySchemaType<
165
- Type extends FIELD_TYPES | Field,
166
- Prefix extends undefined | Encoding | readonly Encoding[],
167
- > =
168
- Type extends Field
169
- ? Parameters<Type['serialize']>[0]
170
- : Type extends FIELD_TYPES
171
- ? BuildFieldTypes<Prefix>[Type]
172
- : never;
49
+ type BuildTxArgBySchemaType<Type extends Field> = Parameters<Type['serialize']>[0];
173
50
 
174
51
  type NullablePartial<
175
52
  T,
@@ -180,7 +57,7 @@ type BuildTxArgBySchema<SchemaLine> =
180
57
  UnionToIntersection<
181
58
  SchemaLine extends ReadonlyArray<infer Elem>
182
59
  ? Elem extends TxElem
183
- ? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1], Elem[2]> }>
60
+ ? NullablePartial<{ [k in Elem[0]]: BuildTxArgBySchemaType<Elem[1]> }>
184
61
  : never
185
62
  : never
186
63
  >;
@@ -189,60 +66,75 @@ export type RawTxObject<Tx extends TxSchema> = {
189
66
  [k in keyof Tx]-?: Tx[k] extends BigNumber ? string : Tx[k]
190
67
  };
191
68
 
192
- const BASE_TX = [
193
- ['tag', shortUInt],
194
- ['VSN', shortUInt],
195
- ] as const;
196
-
69
+ /**
70
+ * @see {@link https://github.com/aeternity/protocol/blob/c007deeac4a01e401238412801ac7084ac72d60e/serializations.md#accounts-version-1-basic-accounts}
71
+ */
197
72
  export const TX_SCHEMA = {
198
73
  [Tag.Account]: {
199
74
  1: [
200
- ...BASE_TX,
75
+ ['tag', shortUIntConst(Tag.Account)],
76
+ ['version', shortUIntConst(1)],
201
77
  ['nonce', shortUInt],
202
78
  ['balance', uInt],
203
79
  ],
204
80
  2: [
205
- ...BASE_TX,
81
+ ['tag', shortUIntConst(Tag.Account)],
82
+ ['version', shortUIntConst(2)],
206
83
  ['flags', uInt],
207
84
  ['nonce', shortUInt],
208
85
  ['balance', uInt],
209
- ['gaContract', FIELD_TYPES.id, [Encoding.ContractAddress, Encoding.Name]],
210
- ['gaAuthFun', FIELD_TYPES.binary, Encoding.ContractBytearray],
86
+ ['gaContract', address(Encoding.ContractAddress, Encoding.Name)],
87
+ ['gaAuthFun', encoded(Encoding.ContractBytearray)],
211
88
  ],
212
89
  },
213
90
  [Tag.SignedTx]: {
214
91
  1: [
215
- ...BASE_TX,
216
- ['signatures', FIELD_TYPES.signatures],
217
- ['encodedTx', FIELD_TYPES.rlpBinary],
92
+ ['tag', shortUIntConst(Tag.SignedTx)],
93
+ ['version', shortUIntConst(1)],
94
+ ['signatures', array(raw)],
95
+ ['encodedTx', entry()],
218
96
  ],
219
97
  },
220
98
  [Tag.SpendTx]: {
221
99
  1: [
222
- ...BASE_TX,
223
- ['senderId', FIELD_TYPES.id, Encoding.AccountAddress],
224
- ['recipientId', FIELD_TYPES.id, [Encoding.AccountAddress, Encoding.Name]],
100
+ ['tag', shortUIntConst(Tag.SpendTx)],
101
+ ['version', shortUIntConst(1)],
102
+ ['senderId', address(Encoding.AccountAddress)],
103
+ ['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
225
104
  ['amount', coinAmount],
226
105
  ['fee', fee],
227
106
  ['ttl', shortUInt],
228
107
  ['nonce', shortUInt],
229
- ['payload', FIELD_TYPES.payload],
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],
230
120
  ],
231
121
  },
232
122
  [Tag.NamePreclaimTx]: {
233
123
  1: [
234
- ...BASE_TX,
235
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
124
+ ['tag', shortUIntConst(Tag.NamePreclaimTx)],
125
+ ['version', shortUIntConst(1)],
126
+ ['accountId', address(Encoding.AccountAddress)],
236
127
  ['nonce', shortUInt],
237
- ['commitmentId', FIELD_TYPES.id, Encoding.Commitment],
128
+ ['commitmentId', address(Encoding.Commitment)],
238
129
  ['fee', fee],
239
130
  ['ttl', shortUInt],
240
131
  ],
241
132
  },
242
133
  [Tag.NameClaimTx]: {
243
134
  2: [
244
- ...BASE_TX,
245
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
135
+ ['tag', shortUIntConst(Tag.NameClaimTx)],
136
+ ['version', shortUIntConst(2)],
137
+ ['accountId', address(Encoding.AccountAddress)],
246
138
  ['nonce', shortUInt],
247
139
  ['name', name],
248
140
  ['nameSalt', uInt],
@@ -253,12 +145,13 @@ export const TX_SCHEMA = {
253
145
  },
254
146
  [Tag.NameUpdateTx]: {
255
147
  1: [
256
- ...BASE_TX,
257
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
148
+ ['tag', shortUIntConst(Tag.NameUpdateTx)],
149
+ ['version', shortUIntConst(1)],
150
+ ['accountId', address(Encoding.AccountAddress)],
258
151
  ['nonce', shortUInt],
259
152
  ['nameId', nameId],
260
- ['nameTtl', uInt],
261
- ['pointers', FIELD_TYPES.pointers],
153
+ ['nameTtl', shortUInt],
154
+ ['pointers', pointers],
262
155
  ['clientTtl', shortUInt],
263
156
  ['fee', fee],
264
157
  ['ttl', shortUInt],
@@ -266,19 +159,21 @@ export const TX_SCHEMA = {
266
159
  },
267
160
  [Tag.NameTransferTx]: {
268
161
  1: [
269
- ...BASE_TX,
270
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
162
+ ['tag', shortUIntConst(Tag.NameTransferTx)],
163
+ ['version', shortUIntConst(1)],
164
+ ['accountId', address(Encoding.AccountAddress)],
271
165
  ['nonce', shortUInt],
272
166
  ['nameId', nameId],
273
- ['recipientId', FIELD_TYPES.id, [Encoding.AccountAddress, Encoding.Name]],
167
+ ['recipientId', address(Encoding.AccountAddress, Encoding.Name)],
274
168
  ['fee', fee],
275
169
  ['ttl', shortUInt],
276
170
  ],
277
171
  },
278
172
  [Tag.NameRevokeTx]: {
279
173
  1: [
280
- ...BASE_TX,
281
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
174
+ ['tag', shortUIntConst(Tag.NameRevokeTx)],
175
+ ['version', shortUIntConst(1)],
176
+ ['accountId', address(Encoding.AccountAddress)],
282
177
  ['nonce', shortUInt],
283
178
  ['nameId', nameId],
284
179
  ['fee', fee],
@@ -287,84 +182,102 @@ export const TX_SCHEMA = {
287
182
  },
288
183
  [Tag.Contract]: {
289
184
  1: [
290
- ...BASE_TX,
291
- ['owner', FIELD_TYPES.id, Encoding.AccountAddress],
292
- ['ctVersion', FIELD_TYPES.ctVersion],
293
- ['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
294
- ['log', FIELD_TYPES.binary, Encoding.ContractBytearray],
295
- ['active', FIELD_TYPES.bool],
296
- ['referers', FIELD_TYPES.ids, Encoding.AccountAddress],
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))],
297
193
  ['deposit', deposit],
298
194
  ],
299
195
  },
300
196
  [Tag.ContractCreateTx]: {
301
197
  1: [
302
- ...BASE_TX,
303
- ['ownerId', FIELD_TYPES.id, Encoding.AccountAddress],
198
+ ['tag', shortUIntConst(Tag.ContractCreateTx)],
199
+ ['version', shortUIntConst(1)],
200
+ ['ownerId', address(Encoding.AccountAddress)],
304
201
  ['nonce', shortUInt],
305
- ['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
306
- ['ctVersion', FIELD_TYPES.ctVersion],
202
+ ['code', encoded(Encoding.ContractBytearray)],
203
+ ['ctVersion', ctVersion],
307
204
  ['fee', fee],
308
205
  ['ttl', shortUInt],
309
206
  ['deposit', deposit],
310
207
  ['amount', coinAmount],
311
208
  ['gasLimit', gasLimit],
312
209
  ['gasPrice', gasPrice],
313
- ['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
210
+ ['callData', encoded(Encoding.ContractBytearray)],
314
211
  ],
315
212
  },
316
213
  [Tag.ContractCallTx]: {
317
214
  1: [
318
- ...BASE_TX,
319
- ['callerId', FIELD_TYPES.id, Encoding.AccountAddress],
215
+ ['tag', shortUIntConst(Tag.ContractCallTx)],
216
+ ['version', shortUIntConst(1)],
217
+ ['callerId', address(Encoding.AccountAddress)],
320
218
  ['nonce', shortUInt],
321
- ['contractId', FIELD_TYPES.id, [Encoding.ContractAddress, Encoding.Name]],
322
- ['abiVersion', FIELD_TYPES.abiVersion],
219
+ ['contractId', address(Encoding.ContractAddress, Encoding.Name)],
220
+ ['abiVersion', abiVersion],
323
221
  ['fee', fee],
324
222
  ['ttl', shortUInt],
325
223
  ['amount', coinAmount],
326
224
  ['gasLimit', gasLimit],
327
225
  ['gasPrice', gasPrice],
328
- ['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
226
+ ['callData', encoded(Encoding.ContractBytearray)],
329
227
  ],
330
228
  },
331
229
  [Tag.ContractCall]: {
332
230
  1: [
333
- ...BASE_TX,
334
- ['callerId', FIELD_TYPES.id, Encoding.AccountAddress],
231
+ ['tag', shortUIntConst(Tag.ContractCall)],
232
+ ['version', shortUIntConst(1)],
233
+ ['callerId', address(Encoding.AccountAddress)],
335
234
  ['callerNonce', shortUInt],
336
235
  ['height', shortUInt],
337
- ['contractId', FIELD_TYPES.id, Encoding.ContractAddress],
236
+ ['contractId', address(Encoding.ContractAddress)],
338
237
  ['gasPrice', gasPrice],
339
238
  ['gasUsed', shortUInt],
340
- ['returnValue', FIELD_TYPES.binary, Encoding.ContractBytearray],
341
- ['returnType', FIELD_TYPES.callReturnType],
239
+ ['returnValue', encoded(Encoding.ContractBytearray)],
240
+ ['returnType', enumeration(CallReturnType)],
342
241
  // TODO: add serialization for
343
242
  // <log> :: [ { <address> :: id, [ <topics> :: binary() ], <data> :: binary() } ]
344
- ['log', FIELD_TYPES.rawBinary],
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],
345
256
  ],
346
257
  },
347
258
  [Tag.OracleRegisterTx]: {
348
259
  1: [
349
- ...BASE_TX,
350
- ['accountId', FIELD_TYPES.id, Encoding.AccountAddress],
260
+ ['tag', shortUIntConst(Tag.OracleRegisterTx)],
261
+ ['version', shortUIntConst(1)],
262
+ ['accountId', address(Encoding.AccountAddress)],
351
263
  ['nonce', shortUInt],
352
- ['queryFormat', FIELD_TYPES.string],
353
- ['responseFormat', FIELD_TYPES.string],
264
+ ['queryFormat', string],
265
+ ['responseFormat', string],
354
266
  ['queryFee', coinAmount],
355
- ['oracleTtlType', FIELD_TYPES.ttlType],
267
+ ['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
356
268
  ['oracleTtlValue', shortUInt],
357
269
  ['fee', fee],
358
270
  ['ttl', shortUInt],
359
- ['abiVersion', FIELD_TYPES.abiVersion],
271
+ ['abiVersion', abiVersion],
360
272
  ],
361
273
  },
362
274
  [Tag.OracleExtendTx]: {
363
275
  1: [
364
- ...BASE_TX,
365
- ['oracleId', FIELD_TYPES.id, [Encoding.OracleAddress, Encoding.Name]],
276
+ ['tag', shortUIntConst(Tag.OracleExtendTx)],
277
+ ['version', shortUIntConst(1)],
278
+ ['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
366
279
  ['nonce', shortUInt],
367
- ['oracleTtlType', FIELD_TYPES.ttlType],
280
+ ['oracleTtlType', enumeration(ORACLE_TTL_TYPES)],
368
281
  ['oracleTtlValue', shortUInt],
369
282
  ['fee', fee],
370
283
  ['ttl', shortUInt],
@@ -372,15 +285,16 @@ export const TX_SCHEMA = {
372
285
  },
373
286
  [Tag.OracleQueryTx]: {
374
287
  1: [
375
- ...BASE_TX,
376
- ['senderId', FIELD_TYPES.id, Encoding.AccountAddress],
288
+ ['tag', shortUIntConst(Tag.OracleQueryTx)],
289
+ ['version', shortUIntConst(1)],
290
+ ['senderId', address(Encoding.AccountAddress)],
377
291
  ['nonce', shortUInt],
378
- ['oracleId', FIELD_TYPES.id, [Encoding.OracleAddress, Encoding.Name]],
379
- ['query', FIELD_TYPES.string],
292
+ ['oracleId', address(Encoding.OracleAddress, Encoding.Name)],
293
+ ['query', string],
380
294
  ['queryFee', coinAmount],
381
- ['queryTtlType', FIELD_TYPES.ttlType],
295
+ ['queryTtlType', enumeration(ORACLE_TTL_TYPES)],
382
296
  ['queryTtlValue', shortUInt],
383
- ['responseTtlType', FIELD_TYPES.ttlType],
297
+ ['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
384
298
  ['responseTtlValue', shortUInt],
385
299
  ['fee', fee],
386
300
  ['ttl', shortUInt],
@@ -388,12 +302,13 @@ export const TX_SCHEMA = {
388
302
  },
389
303
  [Tag.OracleResponseTx]: {
390
304
  1: [
391
- ...BASE_TX,
392
- ['oracleId', FIELD_TYPES.id, Encoding.OracleAddress],
305
+ ['tag', shortUIntConst(Tag.OracleResponseTx)],
306
+ ['version', shortUIntConst(1)],
307
+ ['oracleId', address(Encoding.OracleAddress)],
393
308
  ['nonce', shortUInt],
394
- ['queryId', FIELD_TYPES.binary, Encoding.OracleQueryId],
395
- ['response', FIELD_TYPES.string],
396
- ['responseTtlType', FIELD_TYPES.ttlType],
309
+ ['queryId', encoded(Encoding.OracleQueryId)],
310
+ ['response', string],
311
+ ['responseTtlType', enumeration(ORACLE_TTL_TYPES)],
397
312
  ['responseTtlValue', shortUInt],
398
313
  ['fee', fee],
399
314
  ['ttl', shortUInt],
@@ -401,26 +316,28 @@ export const TX_SCHEMA = {
401
316
  },
402
317
  [Tag.ChannelCreateTx]: {
403
318
  2: [
404
- ...BASE_TX,
405
- ['initiator', FIELD_TYPES.id, Encoding.AccountAddress],
319
+ ['tag', shortUIntConst(Tag.ChannelCreateTx)],
320
+ ['version', shortUIntConst(2)],
321
+ ['initiator', address(Encoding.AccountAddress)],
406
322
  ['initiatorAmount', uInt],
407
- ['responder', FIELD_TYPES.id, Encoding.AccountAddress],
323
+ ['responder', address(Encoding.AccountAddress)],
408
324
  ['responderAmount', uInt],
409
325
  ['channelReserve', uInt],
410
326
  ['lockPeriod', uInt],
411
327
  ['ttl', shortUInt],
412
328
  ['fee', fee],
413
- ['initiatorDelegateIds', FIELD_TYPES.string],
414
- ['responderDelegateIds', FIELD_TYPES.string],
415
- ['stateHash', FIELD_TYPES.binary, 'st'],
329
+ ['initiatorDelegateIds', array(address(...idTagToEncoding))],
330
+ ['responderDelegateIds', array(address(...idTagToEncoding))],
331
+ ['stateHash', encoded(Encoding.State)],
416
332
  ['nonce', shortUInt],
417
333
  ],
418
334
  },
419
335
  [Tag.ChannelCloseMutualTx]: {
420
336
  1: [
421
- ...BASE_TX,
422
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
423
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
337
+ ['tag', shortUIntConst(Tag.ChannelCloseMutualTx)],
338
+ ['version', shortUIntConst(1)],
339
+ ['channelId', address(Encoding.Channel)],
340
+ ['fromId', address(Encoding.AccountAddress)],
424
341
  ['initiatorAmountFinal', uInt],
425
342
  ['responderAmountFinal', uInt],
426
343
  ['ttl', shortUInt],
@@ -430,11 +347,12 @@ export const TX_SCHEMA = {
430
347
  },
431
348
  [Tag.ChannelCloseSoloTx]: {
432
349
  1: [
433
- ...BASE_TX,
434
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
435
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
436
- ['payload', FIELD_TYPES.binary, 'tx'],
437
- ['poi', FIELD_TYPES.binary, 'pi'],
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)],
438
356
  ['ttl', shortUInt],
439
357
  ['fee', fee],
440
358
  ['nonce', shortUInt],
@@ -442,11 +360,12 @@ export const TX_SCHEMA = {
442
360
  },
443
361
  [Tag.ChannelSlashTx]: {
444
362
  1: [
445
- ...BASE_TX,
446
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
447
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
448
- ['payload', FIELD_TYPES.binary, 'tx'],
449
- ['poi', FIELD_TYPES.binary, 'pi'],
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)],
450
369
  ['ttl', shortUInt],
451
370
  ['fee', fee],
452
371
  ['nonce', shortUInt],
@@ -454,35 +373,38 @@ export const TX_SCHEMA = {
454
373
  },
455
374
  [Tag.ChannelDepositTx]: {
456
375
  1: [
457
- ...BASE_TX,
458
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
459
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
376
+ ['tag', shortUIntConst(Tag.ChannelDepositTx)],
377
+ ['version', shortUIntConst(1)],
378
+ ['channelId', address(Encoding.Channel)],
379
+ ['fromId', address(Encoding.AccountAddress)],
460
380
  ['amount', uInt],
461
381
  ['ttl', shortUInt],
462
382
  ['fee', fee],
463
- ['stateHash', FIELD_TYPES.binary, 'st'],
383
+ ['stateHash', encoded(Encoding.State)],
464
384
  ['round', shortUInt],
465
385
  ['nonce', shortUInt],
466
386
  ],
467
387
  },
468
388
  [Tag.ChannelWithdrawTx]: {
469
389
  1: [
470
- ...BASE_TX,
471
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
472
- ['toId', FIELD_TYPES.id, Encoding.AccountAddress],
390
+ ['tag', shortUIntConst(Tag.ChannelWithdrawTx)],
391
+ ['version', shortUIntConst(1)],
392
+ ['channelId', address(Encoding.Channel)],
393
+ ['toId', address(Encoding.AccountAddress)],
473
394
  ['amount', uInt],
474
395
  ['ttl', shortUInt],
475
396
  ['fee', fee],
476
- ['stateHash', FIELD_TYPES.binary, 'st'],
397
+ ['stateHash', encoded(Encoding.State)],
477
398
  ['round', shortUInt],
478
399
  ['nonce', shortUInt],
479
400
  ],
480
401
  },
481
402
  [Tag.ChannelSettleTx]: {
482
403
  1: [
483
- ...BASE_TX,
484
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
485
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
404
+ ['tag', shortUIntConst(Tag.ChannelSettleTx)],
405
+ ['version', shortUIntConst(1)],
406
+ ['channelId', address(Encoding.Channel)],
407
+ ['fromId', address(Encoding.AccountAddress)],
486
408
  ['initiatorAmountFinal', uInt],
487
409
  ['responderAmountFinal', uInt],
488
410
  ['ttl', shortUInt],
@@ -492,14 +414,15 @@ export const TX_SCHEMA = {
492
414
  },
493
415
  [Tag.ChannelForceProgressTx]: {
494
416
  1: [
495
- ...BASE_TX,
496
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
497
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
498
- ['payload', FIELD_TYPES.binary, 'tx'],
417
+ ['tag', shortUIntConst(Tag.ChannelForceProgressTx)],
418
+ ['version', shortUIntConst(1)],
419
+ ['channelId', address(Encoding.Channel)],
420
+ ['fromId', address(Encoding.AccountAddress)],
421
+ ['payload', encoded(Encoding.Transaction)],
499
422
  ['round', shortUInt],
500
- ['update', FIELD_TYPES.binary, Encoding.ContractBytearray],
501
- ['stateHash', FIELD_TYPES.binary, 'st'],
502
- ['offChainTrees', FIELD_TYPES.stateTree],
423
+ ['update', encoded(Encoding.ContractBytearray)],
424
+ ['stateHash', encoded(Encoding.State)],
425
+ ['offChainTrees', encoded(Encoding.StateTrees)],
503
426
  ['ttl', shortUInt],
504
427
  ['fee', fee],
505
428
  ['nonce', shortUInt],
@@ -507,38 +430,41 @@ export const TX_SCHEMA = {
507
430
  },
508
431
  [Tag.ChannelOffChainTx]: {
509
432
  2: [
510
- ...BASE_TX,
511
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
433
+ ['tag', shortUIntConst(Tag.ChannelOffChainTx)],
434
+ ['version', shortUIntConst(2)],
435
+ ['channelId', address(Encoding.Channel)],
512
436
  ['round', shortUInt],
513
- ['stateHash', FIELD_TYPES.binary, 'st'],
437
+ ['stateHash', encoded(Encoding.State)],
514
438
  ],
515
439
  },
516
440
  [Tag.Channel]: {
517
441
  3: [
518
- ...BASE_TX,
519
- ['initiator', FIELD_TYPES.id, Encoding.AccountAddress],
520
- ['responder', FIELD_TYPES.id, Encoding.AccountAddress],
442
+ ['tag', shortUIntConst(Tag.Channel)],
443
+ ['version', shortUIntConst(3)],
444
+ ['initiator', address(Encoding.AccountAddress)],
445
+ ['responder', address(Encoding.AccountAddress)],
521
446
  ['channelAmount', uInt],
522
447
  ['initiatorAmount', uInt],
523
448
  ['responderAmount', uInt],
524
449
  ['channelReserve', uInt],
525
- ['initiatorDelegateIds', FIELD_TYPES.ids],
526
- ['responderDelegateIds', FIELD_TYPES.ids],
527
- ['stateHash', FIELD_TYPES.hex],
450
+ ['initiatorDelegateIds', array(address(...idTagToEncoding))],
451
+ ['responderDelegateIds', array(address(...idTagToEncoding))],
452
+ ['stateHash', encoded(Encoding.State)],
528
453
  ['round', shortUInt],
529
454
  ['soloRound', uInt],
530
455
  ['lockPeriod', uInt],
531
456
  ['lockedUntil', uInt],
532
- ['initiatorAuth', FIELD_TYPES.binary, Encoding.ContractBytearray],
533
- ['responderAuth', FIELD_TYPES.binary, Encoding.ContractBytearray],
457
+ ['initiatorAuth', encoded(Encoding.ContractBytearray)],
458
+ ['responderAuth', encoded(Encoding.ContractBytearray)],
534
459
  ],
535
460
  },
536
461
  [Tag.ChannelSnapshotSoloTx]: {
537
462
  1: [
538
- ...BASE_TX,
539
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
540
- ['fromId', FIELD_TYPES.id, Encoding.AccountAddress],
541
- ['payload', FIELD_TYPES.binary, 'tx'],
463
+ ['tag', shortUIntConst(Tag.ChannelSnapshotSoloTx)],
464
+ ['version', shortUIntConst(1)],
465
+ ['channelId', address(Encoding.Channel)],
466
+ ['fromId', address(Encoding.AccountAddress)],
467
+ ['payload', encoded(Encoding.Transaction)],
542
468
  ['ttl', shortUInt],
543
469
  ['fee', fee],
544
470
  ['nonce', shortUInt],
@@ -546,181 +472,194 @@ export const TX_SCHEMA = {
546
472
  },
547
473
  [Tag.ChannelOffChainUpdateTransfer]: {
548
474
  1: [
549
- ...BASE_TX,
550
- ['from', FIELD_TYPES.id, Encoding.AccountAddress],
551
- ['to', FIELD_TYPES.id, Encoding.AccountAddress],
475
+ ['tag', shortUIntConst(Tag.ChannelOffChainUpdateTransfer)],
476
+ ['version', shortUIntConst(1)],
477
+ ['from', address(Encoding.AccountAddress)],
478
+ ['to', address(Encoding.AccountAddress)],
552
479
  ['amount', uInt],
553
480
  ],
554
481
  },
555
482
  [Tag.ChannelOffChainUpdateDeposit]: {
556
483
  1: [
557
- ...BASE_TX,
558
- ['from', FIELD_TYPES.id, Encoding.AccountAddress],
484
+ ['tag', shortUIntConst(Tag.ChannelOffChainUpdateDeposit)],
485
+ ['version', shortUIntConst(1)],
486
+ ['from', address(Encoding.AccountAddress)],
559
487
  ['amount', uInt],
560
488
  ],
561
489
  },
562
490
  [Tag.ChannelOffChainUpdateWithdraw]: {
563
491
  1: [
564
- ...BASE_TX,
565
- ['from', FIELD_TYPES.id, Encoding.AccountAddress],
492
+ ['tag', shortUIntConst(Tag.ChannelOffChainUpdateWithdraw)],
493
+ ['version', shortUIntConst(1)],
494
+ ['from', address(Encoding.AccountAddress)],
566
495
  ['amount', uInt],
567
496
  ],
568
497
  },
569
498
  [Tag.ChannelOffChainUpdateCreateContract]: {
570
499
  1: [
571
- ...BASE_TX,
572
- ['owner', FIELD_TYPES.id, Encoding.AccountAddress],
573
- ['ctVersion', FIELD_TYPES.ctVersion],
574
- ['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
500
+ ['tag', shortUIntConst(Tag.ChannelOffChainUpdateCreateContract)],
501
+ ['version', shortUIntConst(1)],
502
+ ['owner', address(Encoding.AccountAddress)],
503
+ ['ctVersion', ctVersion],
504
+ ['code', encoded(Encoding.ContractBytearray)],
575
505
  ['deposit', uInt],
576
- ['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
506
+ ['callData', encoded(Encoding.ContractBytearray)],
577
507
  ],
578
508
  },
579
509
  [Tag.ChannelOffChainUpdateCallContract]: {
580
510
  1: [
581
- ...BASE_TX,
582
- ['caller', FIELD_TYPES.id, Encoding.AccountAddress],
583
- ['contract', FIELD_TYPES.id, Encoding.ContractAddress],
584
- ['abiVersion', FIELD_TYPES.abiVersion],
511
+ ['tag', shortUIntConst(Tag.ChannelOffChainUpdateCallContract)],
512
+ ['version', shortUIntConst(1)],
513
+ ['caller', address(Encoding.AccountAddress)],
514
+ ['contract', address(Encoding.ContractAddress)],
515
+ ['abiVersion', abiVersion],
585
516
  ['amount', uInt],
586
- ['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
587
- ['callStack', FIELD_TYPES.callStack],
517
+ ['callData', encoded(Encoding.ContractBytearray)],
518
+ ['callStack', raw],
588
519
  ['gasPrice', gasPrice],
589
520
  ['gasLimit', gasLimit],
590
521
  ],
591
522
  },
592
523
  [Tag.ChannelClientReconnectTx]: {
593
524
  1: [
594
- ...BASE_TX,
595
- ['channelId', FIELD_TYPES.id, Encoding.Channel],
525
+ ['tag', shortUIntConst(Tag.ChannelClientReconnectTx)],
526
+ ['version', shortUIntConst(1)],
527
+ ['channelId', address(Encoding.Channel)],
596
528
  ['round', shortUInt],
597
- ['role', FIELD_TYPES.string],
598
- ['pubkey', FIELD_TYPES.id, Encoding.AccountAddress],
529
+ ['role', string],
530
+ ['pubkey', address(Encoding.AccountAddress)],
599
531
  ],
600
532
  },
601
533
  [Tag.TreesPoi]: {
602
534
  1: [
603
- ...BASE_TX,
604
- ['accounts', FIELD_TYPES.mptrees],
605
- ['calls', FIELD_TYPES.mptrees],
606
- ['channels', FIELD_TYPES.mptrees],
607
- ['contracts', FIELD_TYPES.mptrees],
608
- ['ns', FIELD_TYPES.mptrees],
609
- ['oracles', FIELD_TYPES.mptrees],
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))],
610
543
  ],
611
544
  },
612
545
  [Tag.StateTrees]: {
613
546
  1: [
614
- ...BASE_TX,
615
- ['contracts', FIELD_TYPES.rlpBinary],
616
- ['calls', FIELD_TYPES.rlpBinary],
617
- ['channels', FIELD_TYPES.rlpBinary],
618
- ['ns', FIELD_TYPES.rlpBinary],
619
- ['oracles', FIELD_TYPES.rlpBinary],
620
- ['accounts', FIELD_TYPES.rlpBinary],
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()],
621
555
  ],
622
556
  },
623
557
  [Tag.Mtree]: {
624
558
  1: [
625
- ...BASE_TX,
626
- ['values', FIELD_TYPES.rlpBinaries],
559
+ ['tag', shortUIntConst(Tag.Mtree)],
560
+ ['version', shortUIntConst(1)],
561
+ ['values', array(entry())],
627
562
  ],
628
563
  },
629
564
  [Tag.MtreeValue]: {
630
565
  1: [
631
- ...BASE_TX,
632
- ['key', FIELD_TYPES.hex],
633
- ['value', FIELD_TYPES.rawBinary],
566
+ ['tag', shortUIntConst(Tag.MtreeValue)],
567
+ ['version', shortUIntConst(1)],
568
+ ['key', raw],
569
+ ['value', raw],
634
570
  ],
635
571
  },
636
572
  [Tag.ContractsMtree]: {
637
573
  1: [
638
- ...BASE_TX,
639
- ['contracts', FIELD_TYPES.rlpBinary],
574
+ ['tag', shortUIntConst(Tag.ContractsMtree)],
575
+ ['version', shortUIntConst(1)],
576
+ ['contracts', entry()],
640
577
  ],
641
578
  },
642
579
  [Tag.CallsMtree]: {
643
580
  1: [
644
- ...BASE_TX,
645
- ['calls', FIELD_TYPES.rlpBinary],
581
+ ['tag', shortUIntConst(Tag.CallsMtree)],
582
+ ['version', shortUIntConst(1)],
583
+ ['calls', entry()],
646
584
  ],
647
585
  },
648
586
  [Tag.ChannelsMtree]: {
649
587
  1: [
650
- ...BASE_TX,
651
- ['channels', FIELD_TYPES.rlpBinary],
588
+ ['tag', shortUIntConst(Tag.ChannelsMtree)],
589
+ ['version', shortUIntConst(1)],
590
+ ['channels', entry()],
652
591
  ],
653
592
  },
654
593
  [Tag.NameserviceMtree]: {
655
594
  1: [
656
- ...BASE_TX,
657
- ['mtree', FIELD_TYPES.rlpBinary],
595
+ ['tag', shortUIntConst(Tag.NameserviceMtree)],
596
+ ['version', shortUIntConst(1)],
597
+ ['mtree', entry()],
658
598
  ],
659
599
  },
660
600
  [Tag.OraclesMtree]: {
661
601
  1: [
662
- ...BASE_TX,
663
- ['otree', FIELD_TYPES.rlpBinary],
602
+ ['tag', shortUIntConst(Tag.OraclesMtree)],
603
+ ['version', shortUIntConst(1)],
604
+ ['otree', entry()],
664
605
  ],
665
606
  },
666
607
  [Tag.AccountsMtree]: {
667
608
  1: [
668
- ...BASE_TX,
669
- ['accounts', FIELD_TYPES.rlpBinary],
609
+ ['tag', shortUIntConst(Tag.AccountsMtree)],
610
+ ['version', shortUIntConst(1)],
611
+ ['accounts', entry()],
670
612
  ],
671
613
  },
672
614
  [Tag.GaAttachTx]: {
673
615
  1: [
674
- ...BASE_TX,
675
- ['ownerId', FIELD_TYPES.id, Encoding.AccountAddress],
616
+ ['tag', shortUIntConst(Tag.GaAttachTx)],
617
+ ['version', shortUIntConst(1)],
618
+ ['ownerId', address(Encoding.AccountAddress)],
676
619
  ['nonce', shortUInt],
677
- ['code', FIELD_TYPES.binary, Encoding.ContractBytearray],
678
- ['authFun', FIELD_TYPES.rawBinary],
679
- ['ctVersion', FIELD_TYPES.ctVersion],
620
+ ['code', encoded(Encoding.ContractBytearray)],
621
+ ['authFun', raw],
622
+ ['ctVersion', ctVersion],
680
623
  ['fee', fee],
681
624
  ['ttl', shortUInt],
682
625
  ['gasLimit', gasLimit],
683
626
  ['gasPrice', gasPrice],
684
- ['callData', FIELD_TYPES.binary, Encoding.ContractBytearray],
627
+ ['callData', encoded(Encoding.ContractBytearray)],
685
628
  ],
686
629
  },
687
630
  [Tag.GaMetaTx]: {
688
631
  2: [
689
- ...BASE_TX,
690
- ['gaId', FIELD_TYPES.id, Encoding.AccountAddress],
691
- ['authData', FIELD_TYPES.binary, Encoding.ContractBytearray],
692
- ['abiVersion', FIELD_TYPES.abiVersion],
632
+ ['tag', shortUIntConst(Tag.GaMetaTx)],
633
+ ['version', shortUIntConst(2)],
634
+ ['gaId', address(Encoding.AccountAddress)],
635
+ ['authData', encoded(Encoding.ContractBytearray)],
636
+ ['abiVersion', abiVersion],
693
637
  ['fee', fee],
694
638
  ['gasLimit', gasLimit],
695
639
  ['gasPrice', gasPrice],
696
- ['tx', FIELD_TYPES.rlpBinary],
640
+ ['tx', entry()],
697
641
  ],
698
642
  },
699
643
  [Tag.PayingForTx]: {
700
644
  1: [
701
- ...BASE_TX,
702
- ['payerId', FIELD_TYPES.id, Encoding.AccountAddress],
645
+ ['tag', shortUIntConst(Tag.PayingForTx)],
646
+ ['version', shortUIntConst(1)],
647
+ ['payerId', address(Encoding.AccountAddress)],
703
648
  ['nonce', shortUInt],
704
649
  ['fee', fee],
705
- ['tx', FIELD_TYPES.rlpBinary],
706
- ],
707
- },
708
- [Tag.CompilerSophia]: {
709
- 3: [
710
- ...BASE_TX,
711
- ['sourceCodeHash', FIELD_TYPES.rawBinary],
712
- ['typeInfo', FIELD_TYPES.sophiaCodeTypeInfo],
713
- ['byteCode', FIELD_TYPES.rawBinary],
714
- ['compilerVersion', FIELD_TYPES.string],
715
- ['payable', FIELD_TYPES.bool],
650
+ ['tx', entry()],
716
651
  ],
717
652
  },
718
653
  } as const;
719
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
+
720
661
  export type TxTypeSchemas = {
721
- [key in Tag]: BuildTxArgBySchema<
722
- typeof TX_SCHEMA[key][keyof typeof TX_SCHEMA[key]]
723
- >
662
+ [key in Tag]: TxTypeSchemasNotCombined[key][keyof TxTypeSchemasNotCombined[key]]
724
663
  };
725
664
 
726
665
  export type TxSchema = TxTypeSchemas[Tag];