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