@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
@@ -0,0 +1,35 @@
1
+ import { Encoded } from '../utils/encoder';
2
+ import Node from '../Node';
3
+ /**
4
+ * Calculates the cost of transaction execution
5
+ * Provides an upper cost of contract-call-related transactions because of `gasLimit`.
6
+ * Also assumes that oracle query fee is 0 unless it is provided in options.
7
+ * @param transaction - Transaction to calculate the cost of
8
+ * @param innerTx - Should be provided if transaction wrapped with Tag.PayingForTx
9
+ * @param gasUsed - Amount of gas actually used to make calculation more accurate
10
+ * @param queryFee - Oracle query fee
11
+ * @param isInitiator - Is transaction signer an initiator of state channel
12
+ */
13
+ export declare function getExecutionCost(transaction: Encoded.Transaction, { innerTx, gasUsed, queryFee, isInitiator, }?: {
14
+ innerTx?: 'fee-payer' | 'freeloader';
15
+ gasUsed?: number;
16
+ queryFee?: string;
17
+ isInitiator?: boolean;
18
+ }): bigint;
19
+ /**
20
+ * Calculates the cost of signed transaction execution
21
+ * @param transaction - Transaction to calculate the cost of
22
+ * @param networkId - Network id used to sign the transaction
23
+ * @param options - Options
24
+ */
25
+ export declare function getExecutionCostBySignedTx(transaction: Encoded.Transaction, networkId: string, options?: Omit<Parameters<typeof getExecutionCost>[1], 'innerTx'>): bigint;
26
+ /**
27
+ * Calculates the cost of signed and not signed transaction execution using node
28
+ * @param transaction - Transaction to calculate the cost of
29
+ * @param node - Node to use
30
+ * @param isMined - Is transaction already mined or not
31
+ * @param options - Options
32
+ */
33
+ export declare function getExecutionCostUsingNode(transaction: Encoded.Transaction, node: Node, { isMined, ...options }?: {
34
+ isMined?: boolean;
35
+ } & Parameters<typeof getExecutionCost>[1]): Promise<bigint>;
@@ -0,0 +1,6 @@
1
+ import { Encoded } from '../utils/encoder';
2
+ /**
3
+ * Returns account address that signed a transaction
4
+ * @param transaction - transaction to get a signer of
5
+ */
6
+ export default function getTransactionSignerAddress(transaction: Encoded.Transaction): Encoded.AccountAddress;
@@ -1,5 +1,4 @@
1
- import { Tag } from './builder/constants';
2
- import { Encoded } from '../utils/encoder';
1
+ import { unpackTx } from './builder';
3
2
  import Node from '../Node';
4
3
  export interface ValidatorResult {
5
4
  message: string;
@@ -8,13 +7,12 @@ export interface ValidatorResult {
8
7
  }
9
8
  /**
10
9
  * Transaction Validator
11
- * This function validates some of transaction properties,
10
+ * This function validates some transaction properties,
12
11
  * to make sure it can be posted it to the chain
13
12
  * @category transaction builder
14
13
  * @param transaction - Base64Check-encoded transaction
15
14
  * @param nodeNotCached - Node to validate transaction against
16
- * @param parentTxTypes - Types of parent transactions
17
15
  * @returns Array with verification errors
18
16
  * @example const errors = await verifyTransaction(transaction, node)
19
17
  */
20
- export default function verifyTransaction(transaction: Encoded.Transaction | Encoded.Poi, nodeNotCached: Node, parentTxTypes?: Tag[]): Promise<ValidatorResult[]>;
18
+ export default function verifyTransaction(transaction: Parameters<typeof unpackTx>[0], nodeNotCached: Node): Promise<ValidatorResult[]>;
@@ -2,6 +2,7 @@ import { PipelinePolicy } from '@azure/core-rest-pipeline';
2
2
  import { AdditionalPolicyConfig } from '@azure/core-client';
3
3
  export declare const genRequestQueuesPolicy: () => AdditionalPolicyConfig;
4
4
  export declare const genCombineGetRequestsPolicy: () => AdditionalPolicyConfig;
5
- export declare const genAggressiveCacheGetResponsesPolicy: () => PipelinePolicy;
5
+ export declare const genAggressiveCacheGetResponsesPolicy: () => AdditionalPolicyConfig;
6
6
  export declare const genErrorFormatterPolicy: (getMessage: (b: any) => string) => AdditionalPolicyConfig;
7
- export declare const genVersionCheckPolicy: (name: string, ignorePath: string, versionPromise: Promise<string>, geVersion: string, ltVersion: string) => PipelinePolicy;
7
+ export declare const genVersionCheckPolicy: (name: string, ignorePath: string, versionPromise: Promise<string | Error>, geVersion: string, ltVersion: string) => PipelinePolicy;
8
+ export declare const genRetryOnFailurePolicy: (retryCount: number, retryOverallDelay: number) => AdditionalPolicyConfig;
@@ -1,4 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
+ import { AensName, Int } from '../tx/builder/constants';
3
+ import * as Encoded from './encoder-types';
2
4
  /**
3
5
  * aepp-sdk originated error
4
6
  * @category exception
@@ -70,7 +72,7 @@ export declare class WalletError extends BaseError {
70
72
  * @category exception
71
73
  */
72
74
  export declare class ArgumentError extends BaseError {
73
- constructor(argumentName: string, requirement: string, argumentValue: any);
75
+ constructor(argumentName: string, requirement: unknown, argumentValue: unknown);
74
76
  }
75
77
  /**
76
78
  * @category exception
@@ -112,7 +114,7 @@ export declare class RequestTimedOutError extends BaseError {
112
114
  * @category exception
113
115
  */
114
116
  export declare class TxTimedOutError extends BaseError {
115
- constructor(blocks: number, th: string);
117
+ constructor(blocks: number, th: Encoded.TxHash);
116
118
  }
117
119
  /**
118
120
  * @category exception
@@ -160,13 +162,13 @@ export declare class UnexpectedTsError extends InternalError {
160
162
  * @category exception
161
163
  */
162
164
  export declare class UnavailableAccountError extends AccountError {
163
- constructor(address: string);
165
+ constructor(address: Encoded.AccountAddress);
164
166
  }
165
167
  /**
166
168
  * @category exception
167
169
  */
168
170
  export declare class AensPointerContextError extends AensError {
169
- constructor(nameOrId: string, prefix: string);
171
+ constructor(nameOrId: AensName | Encoded.Name, prefix: string);
170
172
  }
171
173
  /**
172
174
  * @category exception
@@ -196,7 +198,7 @@ export declare class MissingCallbackError extends AeppError {
196
198
  * @category exception
197
199
  */
198
200
  export declare class UnAuthorizedAccountError extends AeppError {
199
- constructor(onAccount: string);
201
+ constructor(onAccount: Encoded.AccountAddress);
200
202
  }
201
203
  /**
202
204
  * @category exception
@@ -262,7 +264,7 @@ export declare class InvalidAuthDataError extends CompilerError {
262
264
  * @category exception
263
265
  */
264
266
  export declare class BytecodeMismatchError extends ContractError {
265
- constructor(source: string);
267
+ constructor(source: 'source code' | 'bytecode');
266
268
  }
267
269
  /**
268
270
  * @category exception
@@ -274,7 +276,7 @@ export declare class DuplicateContractError extends ContractError {
274
276
  * @category exception
275
277
  */
276
278
  export declare class InactiveContractError extends ContractError {
277
- constructor(contractAddress: string);
279
+ constructor(contractAddress: Encoded.ContractAddress);
278
280
  }
279
281
  /**
280
282
  * @category exception
@@ -304,8 +306,8 @@ export declare class MissingFunctionNameError extends ContractError {
304
306
  * @category exception
305
307
  */
306
308
  export declare class NodeInvocationError extends ContractError {
307
- transaction: string;
308
- constructor(message: string, transaction: string);
309
+ transaction?: Encoded.Transaction;
310
+ constructor(message: string, transaction?: Encoded.Transaction);
309
311
  }
310
312
  /**
311
313
  * @category exception
@@ -317,19 +319,19 @@ export declare class NoSuchContractFunctionError extends ContractError {
317
319
  * @category exception
318
320
  */
319
321
  export declare class NotPayableFunctionError extends ContractError {
320
- constructor(amount: string, fn: string);
322
+ constructor(amount: Int, fn: string);
321
323
  }
322
324
  /**
323
325
  * @category exception
324
326
  */
325
327
  export declare class MissingEventDefinitionError extends ContractError {
326
- constructor(eventNameHash: string, eventAddress: string);
328
+ constructor(eventNameHash: string, eventAddress: Encoded.ContractAddress);
327
329
  }
328
330
  /**
329
331
  * @category exception
330
332
  */
331
333
  export declare class AmbiguousEventDefinitionError extends ContractError {
332
- constructor(eventAddress: string, matchedEvents: Array<[
334
+ constructor(eventAddress: Encoded.ContractAddress, matchedEvents: Array<[
333
335
  string,
334
336
  string
335
337
  ]>);
@@ -412,12 +414,6 @@ export declare class IllegalBidFeeError extends TransactionError {
412
414
  export declare class InvalidSignatureError extends TransactionError {
413
415
  constructor(message: string);
414
416
  }
415
- /**
416
- * @category exception
417
- */
418
- export declare class InvalidTxParamsError extends TransactionError {
419
- constructor(message: string);
420
- }
421
417
  /**
422
418
  * @category exception
423
419
  */
@@ -428,7 +424,7 @@ export declare class PrefixNotFoundError extends TransactionError {
428
424
  * @category exception
429
425
  */
430
426
  export declare class SchemaNotFoundError extends TransactionError {
431
- constructor(schemaName: string, key: string, version: number);
427
+ constructor(key: string, version: number);
432
428
  }
433
429
  /**
434
430
  * @category exception
@@ -440,25 +436,7 @@ export declare class TagNotFoundError extends TransactionError {
440
436
  * @category exception
441
437
  */
442
438
  export declare class TxNotInChainError extends TransactionError {
443
- constructor(txHash: string);
444
- }
445
- /**
446
- * @category exception
447
- */
448
- export declare class UnknownTxError extends TransactionError {
449
- constructor(message: string);
450
- }
451
- /**
452
- * @category exception
453
- */
454
- export declare class UnsupportedABIversionError extends TransactionError {
455
- constructor(message: string);
456
- }
457
- /**
458
- * @category exception
459
- */
460
- export declare class UnsupportedVMversionError extends TransactionError {
461
- constructor(message: string);
439
+ constructor(txHash: Encoded.TxHash);
462
440
  }
463
441
  /**
464
442
  * @category exception
@@ -1,18 +0,0 @@
1
- import { Compiler as CompilerApi } from '../apis/compiler';
2
- /**
3
- * Contract Compiler over HTTP
4
- *
5
- * This class include api call's related to contract compiler functionality.
6
- * @category contract
7
- * @example CompilerHttp('COMPILER_URL')
8
- */
9
- export default class CompilerHttp extends CompilerApi {
10
- /**
11
- * @param compilerUrl - Url for compiler API
12
- * @param options - Options
13
- * @param options.ignoreVersion - Don't check compiler version
14
- */
15
- constructor(compilerUrl: string, { ignoreVersion }?: {
16
- ignoreVersion?: boolean;
17
- });
18
- }
@@ -1,63 +0,0 @@
1
- /*
2
- * ISC License (ISC)
3
- * Copyright (c) 2022 aeternity developers
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- * PERFORMANCE OF THIS SOFTWARE.
16
- */
17
- import { Compiler as CompilerApi } from "../apis/compiler/index.mjs";
18
- import { genErrorFormatterPolicy, genVersionCheckPolicy } from "../utils/autorest.mjs";
19
- /**
20
- * Contract Compiler over HTTP
21
- *
22
- * This class include api call's related to contract compiler functionality.
23
- * @category contract
24
- * @example CompilerHttp('COMPILER_URL')
25
- */
26
- export default class CompilerHttp extends CompilerApi {
27
- /**
28
- * @param compilerUrl - Url for compiler API
29
- * @param options - Options
30
- * @param options.ignoreVersion - Don't check compiler version
31
- */
32
- constructor(compilerUrl) {
33
- let {
34
- ignoreVersion
35
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
36
- super(compilerUrl, {
37
- allowInsecureConnection: true,
38
- additionalPolicies: [genErrorFormatterPolicy(body => {
39
- let message = '';
40
- if ('reason' in body) {
41
- message += ` ${body.reason}${body.parameter != null ? ` in ${body.parameter}` : ''
42
- // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78
43
- }${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;
44
- }
45
- if (Array.isArray(body)) {
46
- message += `\n${body.map(e => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? `(${e.context})` : ''}`).map(e => e.trim()) // TODO: remove after fixing https://github.com/aeternity/aesophia_http/issues/80
47
- .join('\n')}`;
48
- }
49
- return message;
50
- })]
51
- });
52
- if (ignoreVersion !== true) {
53
- const versionPromise = this.apiVersion().then(_ref => {
54
- let {
55
- apiVersion
56
- } = _ref;
57
- return apiVersion;
58
- });
59
- this.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.0.1', '8.0.0'));
60
- }
61
- }
62
- }
63
- //# sourceMappingURL=CompilerHttp.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CompilerHttp.mjs","names":["Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerHttp","constructor","compilerUrl","ignoreVersion","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","trim","join","versionPromise","apiVersion","then","pipeline","addPolicy"],"sources":["../../src/contract/CompilerHttp.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\nimport { Compiler as CompilerApi, ErrorModel, CompilerError } from '../apis/compiler';\nimport { genErrorFormatterPolicy, genVersionCheckPolicy } from '../utils/autorest';\n\ntype GeneralCompilerError = ErrorModel & {\n info?: object;\n parameter?: string;\n};\n\n/**\n * Contract Compiler over HTTP\n *\n * This class include api call's related to contract compiler functionality.\n * @category contract\n * @example CompilerHttp('COMPILER_URL')\n */\nexport default class CompilerHttp extends CompilerApi {\n /**\n * @param compilerUrl - Url for compiler API\n * @param options - Options\n * @param options.ignoreVersion - Don't check compiler version\n */\n constructor(compilerUrl: string, { ignoreVersion }: { ignoreVersion?: boolean } = {}) {\n super(compilerUrl, {\n allowInsecureConnection: true,\n additionalPolicies: [\n genErrorFormatterPolicy((body: GeneralCompilerError | CompilerError[]) => {\n let message = '';\n if ('reason' in body) {\n message += ` ${body.reason\n }${body.parameter != null ? ` in ${body.parameter}` : ''\n // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78\n }${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;\n }\n if (Array.isArray(body)) {\n message += `\\n${body\n .map((e) => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? `(${e.context})` : ''}`)\n .map((e) => e.trim()) // TODO: remove after fixing https://github.com/aeternity/aesophia_http/issues/80\n .join('\\n')}`;\n }\n return message;\n }),\n ],\n });\n if (ignoreVersion !== true) {\n const versionPromise = this.apiVersion().then(({ apiVersion }) => apiVersion);\n this.pipeline.addPolicy(\n genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.0.1', '8.0.0'),\n );\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,QAAQ,IAAIC,WAAW;AAAA,SACvBC,uBAAuB,EAAEC,qBAAqB;AAOvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,YAAY,SAASH,WAAW,CAAC;EACpD;AACF;AACA;AACA;AACA;EACEI,WAAW,CAACC,WAAmB,EAAuD;IAAA,IAArD;MAAEC;IAA2C,CAAC,uEAAG,CAAC,CAAC;IAClF,KAAK,CAACD,WAAW,EAAE;MACjBE,uBAAuB,EAAE,IAAI;MAC7BC,kBAAkB,EAAE,CAClBP,uBAAuB,CAAEQ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ings } from './address';
3
- export default function genAddressesField<Encoding extends AddressEncodings>(): {
4
- serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];
5
- deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;
6
- };
@@ -1,13 +0,0 @@
1
- import genAddressField from "./address.mjs";
2
- export default function genAddressesField() {
3
- const address = genAddressField();
4
- return {
5
- serialize(addresses) {
6
- return addresses.map(address.serialize);
7
- },
8
- deserialize(addresses) {
9
- return addresses.map(address.deserialize);
10
- }
11
- };
12
- }
13
- //# sourceMappingURL=addresses.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addresses.mjs","names":["genAddressField","genAddressesField","address","serialize","addresses","map","deserialize"],"sources":["../../../../src/tx/builder/field-types/addresses.ts"],"sourcesContent":["import genAddressField, { AddressEncodings } from './address';\n\nexport default function genAddressesField<Encoding extends AddressEncodings>(): {\n serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];\n deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;\n} {\n const address = genAddressField<Encoding>();\n\n return {\n serialize(addresses) {\n return addresses.map(address.serialize);\n },\n\n deserialize(addresses) {\n return addresses.map(address.deserialize);\n },\n };\n}\n"],"mappings":"OAAOA,eAAe;AAEtB,eAAe,SAASC,iBAAiB,GAGvC;EACA,MAAMC,OAAO,GAAGF,eAAe,EAAY;EAE3C,OAAO;IACLG,SAAS,CAACC,SAAS,EAAE;MACnB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACC,SAAS,CAAC;IACzC,CAAC;IAEDG,WAAW,CAACF,SAAS,EAAE;MACrB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACI,WAAW,CAAC;IAC3C;EACF,CAAC;AACH"}
package/es/tx/index.d.ts DELETED
@@ -1,34 +0,0 @@
1
- /**
2
- * Transaction methods
3
- *
4
- * This is implementation of [Tx](api/tx.md) relays
5
- * the creation of transactions to {@link Node}.
6
- * These methods provide ability to create native transactions.
7
- */
8
- import BigNumber from 'bignumber.js';
9
- import { ABI_VERSIONS, CtVersion } from './builder/schema';
10
- import { Tag } from './builder/constants';
11
- import Node from '../Node';
12
- import { Encoded } from '../utils/encoder';
13
- import { buildTx as syncBuildTx } from './builder/index';
14
- import { AE_AMOUNT_FORMATS } from '../utils/amount-formatter';
15
- type Int = number | string | BigNumber;
16
- export type BuildTxOptions<TxType extends Tag, OmitFields extends string> = Omit<Parameters<typeof _buildTx<TxType>>[1], OmitFields>;
17
- /**
18
- * @category transaction builder
19
- */
20
- export declare function _buildTx<TxType extends Tag>(txType: TxType, { denomination, absoluteTtl, ..._params }: Omit<Parameters<typeof syncBuildTx<TxType, 'tx'>>[0], 'fee' | 'nonce' | 'ttl' | 'ctVersion' | 'abiVersion'> & {
21
- onNode: Node;
22
- fee?: Int;
23
- nonce?: number;
24
- ttl?: number;
25
- denomination?: AE_AMOUNT_FORMATS;
26
- absoluteTtl?: boolean;
27
- } & (TxType extends Tag.OracleExtendTx | Tag.OracleResponseTx ? {
28
- callerId: Encoded.AccountAddress;
29
- } : {}) & (TxType extends Tag.ContractCreateTx | Tag.GaAttachTx ? {
30
- ctVersion?: CtVersion;
31
- } : {}) & (TxType extends Tag.ContractCallTx | Tag.OracleRegisterTx ? {
32
- abiVersion?: ABI_VERSIONS;
33
- } : {})): Promise<Encoded.Transaction>;
34
- export {};
package/es/tx/index.mjs DELETED
@@ -1,172 +0,0 @@
1
- /*
2
- * ISC License (ISC)
3
- * Copyright (c) 2022 aeternity developers
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- * PERFORMANCE OF THIS SOFTWARE.
16
- */
17
- /**
18
- * Transaction methods
19
- *
20
- * This is implementation of [Tx](api/tx.md) relays
21
- * the creation of transactions to {@link Node}.
22
- * These methods provide ability to create native transactions.
23
- */
24
- import { ABI_VERSIONS, PROTOCOL_VM_ABI, TX_TTL } from "./builder/schema.mjs";
25
- import { Tag } from "./builder/constants.mjs";
26
- import { ArgumentError, UnsupportedProtocolError, UnknownTxError, InvalidTxParamsError } from "../utils/errors.mjs";
27
- import { buildTx as syncBuildTx, unpackTx } from "./builder/index.mjs";
28
- import { isAccountNotFoundError, isKeyOfObject } from "../utils/other.mjs";
29
- async function getVmVersion(txType, _ref) {
30
- var _abiVersion, _vmVersion;
31
- let {
32
- vmVersion,
33
- abiVersion,
34
- onNode
35
- } = _ref;
36
- const {
37
- consensusProtocolVersion
38
- } = await onNode.getNodeInfo();
39
- if (!isKeyOfObject(consensusProtocolVersion, PROTOCOL_VM_ABI)) {
40
- throw new UnsupportedProtocolError('Not supported consensus protocol version');
41
- }
42
- const supportedProtocol = PROTOCOL_VM_ABI[consensusProtocolVersion];
43
- if (!isKeyOfObject(txType, supportedProtocol)) {
44
- throw new UnknownTxError('Not supported tx type');
45
- }
46
- const protocolForTX = supportedProtocol[txType];
47
- (_abiVersion = abiVersion) !== null && _abiVersion !== void 0 ? _abiVersion : abiVersion = protocolForTX.abiVersion[0];
48
- (_vmVersion = vmVersion) !== null && _vmVersion !== void 0 ? _vmVersion : vmVersion = protocolForTX.vmVersion[0];
49
- return {
50
- vmVersion,
51
- abiVersion
52
- };
53
- }
54
-
55
- /**
56
- * Calculate fee, get absolute ttl (ttl + height), get account nonce
57
- * @category transaction builder
58
- * @param txType - Type of transaction
59
- * @param params - Object which contains all tx data
60
- * @returns Object with account nonce, absolute ttl and transaction fee
61
- */
62
- async function prepareTxParams(txType, _ref2) {
63
- var _nonce;
64
- let {
65
- senderId,
66
- nonce,
67
- ttl = TX_TTL,
68
- absoluteTtl,
69
- strategy,
70
- onNode
71
- } = _ref2;
72
- (_nonce = nonce) !== null && _nonce !== void 0 ? _nonce : nonce = (await onNode.getAccountNextNonce(senderId, {
73
- strategy
74
- }).catch(error => {
75
- if (!isAccountNotFoundError(error)) throw error;
76
- return {
77
- nextNonce: 1
78
- };
79
- })).nextNonce;
80
- if (ttl !== 0) {
81
- if (ttl < 0) throw new ArgumentError('ttl', 'greater or equal to 0', ttl);
82
- ttl += absoluteTtl === true ? 0 : (await onNode.getCurrentKeyBlock()).height;
83
- }
84
- return {
85
- ttl,
86
- nonce
87
- };
88
- }
89
-
90
- // TODO: find a better name or rearrange methods
91
- /**
92
- * @category transaction builder
93
- */
94
- export async function _buildTx(txType, _ref3) {
95
- let {
96
- denomination,
97
- absoluteTtl,
98
- ..._params
99
- } = _ref3;
100
- // TODO: avoid this assertion
101
- const params = _params;
102
- let senderKey;
103
- switch (txType) {
104
- case Tag.SpendTx:
105
- case Tag.OracleQueryTx:
106
- senderKey = 'senderId';
107
- break;
108
- case Tag.NameClaimTx:
109
- case Tag.NameUpdateTx:
110
- case Tag.NameRevokeTx:
111
- case Tag.NameTransferTx:
112
- case Tag.NamePreclaimTx:
113
- case Tag.OracleRegisterTx:
114
- senderKey = 'accountId';
115
- break;
116
- case Tag.ContractCreateTx:
117
- case Tag.GaAttachTx:
118
- senderKey = 'ownerId';
119
- break;
120
- case Tag.GaMetaTx:
121
- senderKey = 'gaId';
122
- break;
123
- case Tag.ContractCallTx:
124
- case Tag.OracleExtendTx:
125
- case Tag.OracleResponseTx:
126
- senderKey = 'callerId';
127
- break;
128
- case Tag.ChannelCloseSoloTx:
129
- case Tag.ChannelSlashTx:
130
- case Tag.ChannelSettleTx:
131
- case Tag.ChannelSnapshotSoloTx:
132
- senderKey = 'fromId';
133
- break;
134
- case Tag.PayingForTx:
135
- senderKey = 'payerId';
136
- break;
137
- default:
138
- throw new ArgumentError('txType', 'valid transaction type', txType);
139
- }
140
- // TODO: move specific cases to field-types
141
- if ([Tag.ContractCreateTx, Tag.GaAttachTx].includes(txType)) {
142
- params.ctVersion = await getVmVersion(Tag.ContractCreateTx, {
143
- ...params,
144
- ...params.ctVersion
145
- });
146
- }
147
- if ([Tag.ContractCallTx, Tag.GaMetaTx].includes(txType)) {
148
- params.abiVersion = (await getVmVersion(Tag.ContractCallTx, params)).abiVersion;
149
- }
150
- if (txType === Tag.OracleRegisterTx) {
151
- var _params$abiVersion;
152
- (_params$abiVersion = params.abiVersion) !== null && _params$abiVersion !== void 0 ? _params$abiVersion : params.abiVersion = ABI_VERSIONS.NO_ABI;
153
- }
154
- if (txType === Tag.PayingForTx) {
155
- params.tx = unpackTx(params.tx);
156
- }
157
- const senderId = params[senderKey];
158
- // TODO: do this check on TypeScript level
159
- if (senderId == null) throw new InvalidTxParamsError(`Transaction field ${senderKey} is missed`);
160
- const extraParams = await prepareTxParams(txType, {
161
- ...params,
162
- senderId,
163
- absoluteTtl
164
- });
165
- return syncBuildTx({
166
- ...params,
167
- ...extraParams
168
- }, txType, {
169
- denomination
170
- }).tx;
171
- }
172
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["ABI_VERSIONS","PROTOCOL_VM_ABI","TX_TTL","Tag","ArgumentError","UnsupportedProtocolError","UnknownTxError","InvalidTxParamsError","buildTx","syncBuildTx","unpackTx","isAccountNotFoundError","isKeyOfObject","getVmVersion","txType","vmVersion","abiVersion","onNode","consensusProtocolVersion","getNodeInfo","supportedProtocol","protocolForTX","prepareTxParams","senderId","nonce","ttl","absoluteTtl","strategy","getAccountNextNonce","catch","error","nextNonce","getCurrentKeyBlock","height","_buildTx","denomination","_params","params","senderKey","SpendTx","OracleQueryTx","NameClaimTx","NameUpdateTx","NameRevokeTx","NameTransferTx","NamePreclaimTx","OracleRegisterTx","ContractCreateTx","GaAttachTx","GaMetaTx","ContractCallTx","OracleExtendTx","OracleResponseTx","ChannelCloseSoloTx","ChannelSlashTx","ChannelSettleTx","ChannelSnapshotSoloTx","PayingForTx","includes","ctVersion","NO_ABI","tx","extraParams"],"sources":["../../src/tx/index.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Transaction methods\n *\n * This is implementation of [Tx](api/tx.md) relays\n * the creation of transactions to {@link Node}.\n * These methods provide ability to create native transactions.\n */\nimport BigNumber from 'bignumber.js';\nimport {\n ABI_VERSIONS, CtVersion, PROTOCOL_VM_ABI, TX_TTL, TxParamsCommon,\n} from './builder/schema';\nimport { Tag } from './builder/constants';\nimport {\n ArgumentError, UnsupportedProtocolError, UnknownTxError, InvalidTxParamsError,\n} from '../utils/errors';\nimport Node from '../Node';\nimport { Encoded } from '../utils/encoder';\nimport { buildTx as syncBuildTx, unpackTx } from './builder/index';\nimport { isAccountNotFoundError, isKeyOfObject } from '../utils/other';\nimport { AE_AMOUNT_FORMATS } from '../utils/amount-formatter';\n\ntype Int = number | string | BigNumber;\n\nexport type BuildTxOptions <TxType extends Tag, OmitFields extends string> =\n Omit<Parameters<typeof _buildTx<TxType>>[1], OmitFields>;\n\n/**\n * Validated vm/abi version or get default based on transaction type and NODE version\n * @category transaction builder\n * @param txType - Type of transaction\n * @param ctVersion - Object with vm and abi version fields\n * @returns Object with vm/abi version\n */\nasync function getVmVersion(\n txType: Tag.ContractCreateTx, ctVersion: Partial<CtVersion> & { onNode: Node }\n): Promise<CtVersion>;\nasync function getVmVersion(\n txType: Tag, ctVersion: Partial<Pick<CtVersion, 'abiVersion'>> & { onNode: Node }\n): Promise<Pick<CtVersion, 'abiVersion'>>;\nasync function getVmVersion(\n txType: Tag,\n { vmVersion, abiVersion, onNode }: Partial<CtVersion> & { onNode: Node },\n): Promise<Partial<CtVersion>> {\n const { consensusProtocolVersion } = await onNode.getNodeInfo();\n if (!isKeyOfObject(consensusProtocolVersion, PROTOCOL_VM_ABI)) {\n throw new UnsupportedProtocolError('Not supported consensus protocol version');\n }\n const supportedProtocol = PROTOCOL_VM_ABI[consensusProtocolVersion];\n if (!isKeyOfObject(txType, supportedProtocol)) {\n throw new UnknownTxError('Not supported tx type');\n }\n const protocolForTX = supportedProtocol[txType];\n abiVersion ??= protocolForTX.abiVersion[0];\n vmVersion ??= protocolForTX.vmVersion[0];\n return { vmVersion, abiVersion };\n}\n\n/**\n * Calculate fee, get absolute ttl (ttl + height), get account nonce\n * @category transaction builder\n * @param txType - Type of transaction\n * @param params - Object which contains all tx data\n * @returns Object with account nonce, absolute ttl and transaction fee\n */\nasync function prepareTxParams(\n txType: Tag,\n {\n senderId,\n nonce,\n ttl = TX_TTL,\n absoluteTtl,\n strategy,\n onNode,\n }: {\n senderId: Encoded.AccountAddress;\n absoluteTtl?: boolean;\n strategy?: 'continuity' | 'max';\n onNode: Node;\n } & Pick<TxParamsCommon, 'nonce' | 'ttl'>,\n): Promise<{ ttl: number; nonce: number }> {\n nonce ??= (\n await onNode.getAccountNextNonce(senderId, { strategy }).catch((error) => {\n if (!isAccountNotFoundError(error)) throw error;\n return { nextNonce: 1 };\n })\n ).nextNonce;\n\n if (ttl !== 0) {\n if (ttl < 0) throw new ArgumentError('ttl', 'greater or equal to 0', ttl);\n ttl += absoluteTtl === true ? 0 : (await onNode.getCurrentKeyBlock()).height;\n }\n\n return { ttl, nonce };\n}\n\n// TODO: find a better name or rearrange methods\n/**\n * @category transaction builder\n */\nexport async function _buildTx<TxType extends Tag>(\n txType: TxType,\n { denomination, absoluteTtl, ..._params }:\n Omit<Parameters<typeof syncBuildTx<TxType, 'tx'>>[0], 'fee' | 'nonce' | 'ttl' | 'ctVersion' | 'abiVersion'>\n & {\n onNode: Node;\n fee?: Int;\n nonce?: number;\n ttl?: number;\n denomination?: AE_AMOUNT_FORMATS;\n absoluteTtl?: boolean;\n }\n & (TxType extends Tag.OracleExtendTx | Tag.OracleResponseTx\n ? { callerId: Encoded.AccountAddress } : {})\n & (TxType extends Tag.ContractCreateTx | Tag.GaAttachTx ? { ctVersion?: CtVersion } : {})\n & (TxType extends Tag.ContractCallTx | Tag.OracleRegisterTx\n ? { abiVersion?: ABI_VERSIONS } : {}),\n): Promise<Encoded.Transaction> {\n // TODO: avoid this assertion\n const params = _params as unknown as TxParamsCommon & { onNode: Node };\n let senderKey: keyof TxParamsCommon | '<absent>';\n switch (txType) {\n case Tag.SpendTx:\n case Tag.OracleQueryTx:\n senderKey = 'senderId';\n break;\n case Tag.NameClaimTx:\n case Tag.NameUpdateTx:\n case Tag.NameRevokeTx:\n case Tag.NameTransferTx:\n case Tag.NamePreclaimTx:\n case Tag.OracleRegisterTx:\n senderKey = 'accountId';\n break;\n case Tag.ContractCreateTx:\n case Tag.GaAttachTx:\n senderKey = 'ownerId';\n break;\n case Tag.GaMetaTx:\n senderKey = 'gaId';\n break;\n case Tag.ContractCallTx:\n case Tag.OracleExtendTx:\n case Tag.OracleResponseTx:\n senderKey = 'callerId';\n break;\n case Tag.ChannelCloseSoloTx:\n case Tag.ChannelSlashTx:\n case Tag.ChannelSettleTx:\n case Tag.ChannelSnapshotSoloTx:\n senderKey = 'fromId';\n break;\n case Tag.PayingForTx:\n senderKey = 'payerId';\n break;\n default:\n throw new ArgumentError('txType', 'valid transaction type', txType);\n }\n // TODO: move specific cases to field-types\n if ([Tag.ContractCreateTx, Tag.GaAttachTx].includes(txType)) {\n params.ctVersion = await getVmVersion(\n Tag.ContractCreateTx,\n { ...params, ...params.ctVersion },\n );\n }\n if ([Tag.ContractCallTx, Tag.GaMetaTx].includes(txType)) {\n params.abiVersion = (await getVmVersion(Tag.ContractCallTx, params)).abiVersion;\n }\n if (txType === Tag.OracleRegisterTx) {\n params.abiVersion ??= ABI_VERSIONS.NO_ABI;\n }\n if (txType === Tag.PayingForTx) {\n params.tx = unpackTx(params.tx);\n }\n const senderId = params[senderKey];\n // TODO: do this check on TypeScript level\n if (senderId == null) throw new InvalidTxParamsError(`Transaction field ${senderKey} is missed`);\n const extraParams = await prepareTxParams(txType, { ...params, senderId, absoluteTtl });\n return syncBuildTx({ ...params, ...extraParams } as any, txType, { denomination }).tx;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SASEA,YAAY,EAAaC,eAAe,EAAEC,MAAM;AAAA,SAEzCC,GAAG;AAAA,SAEVC,aAAa,EAAEC,wBAAwB,EAAEC,cAAc,EAAEC,oBAAoB;AAAA,SAItEC,OAAO,IAAIC,WAAW,EAAEC,QAAQ;AAAA,SAChCC,sBAAsB,EAAEC,aAAa;AAqB9C,eAAeC,YAAY,CACzBC,MAAW,QAEkB;EAAA;EAAA,IAD7B;IAAEC,SAAS;IAAEC,UAAU;IAAEC;EAA8C,CAAC;EAExE,MAAM;IAAEC;EAAyB,CAAC,GAAG,MAAMD,MAAM,CAACE,WAAW,EAAE;EA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CAAC,CAAC0B,EAAE;AACvF"}
@@ -1,26 +0,0 @@
1
- /// <reference types="node" />
2
- export type MPTreeBinary = [Buffer, Array<[Buffer, Buffer[]]>];
3
- export default class MPTree {
4
- private readonly rootHash;
5
- private readonly nodes;
6
- private static nodeHash;
7
- /**
8
- * Deserialize Merkle Patricia Tree
9
- * @param binary - Binary
10
- * @returns Merkle Patricia Tree
11
- */
12
- constructor(binary: MPTreeBinary);
13
- isEqual(tree: MPTree): boolean;
14
- private static parseNode;
15
- /**
16
- * Serialize Merkle Patricia Tree
17
- * @returns Binary
18
- */
19
- serialize(): MPTreeBinary;
20
- /**
21
- * Retrieve value from Merkle Patricia Tree
22
- * @param _key - The key of the element to retrieve
23
- * @returns Value associated to the specified key
24
- */
25
- get(_key: string): Buffer | undefined;
26
- }