@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
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see aepp-sdk.browser.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@azure/core-rest-pipeline"),require("buffer"),require("bignumber.js"),require("@azure/core-client"),require("rlp"),require("bs58"),require("tweetnacl"),require("varuint-bitcoin"),require("@aeternity/uuid"),require("@aeternity/argon2"),require("tweetnacl-auth"),require("bip32-path"),require("aes-js"),require("@aeternity/aepp-calldata"),require("json-bigint"),require("events"),require("websocket")):"function"==typeof define&&define.amd?define(["@azure/core-rest-pipeline","buffer","bignumber.js","@azure/core-client","rlp","bs58","tweetnacl","varuint-bitcoin","@aeternity/uuid","@aeternity/argon2","tweetnacl-auth","bip32-path","aes-js","@aeternity/aepp-calldata","json-bigint","events","websocket"],t):"object"==typeof exports?exports.Aeternity=t(require("@azure/core-rest-pipeline"),require("buffer"),require("bignumber.js"),require("@azure/core-client"),require("rlp"),require("bs58"),require("tweetnacl"),require("varuint-bitcoin"),require("@aeternity/uuid"),require("@aeternity/argon2"),require("tweetnacl-auth"),require("bip32-path"),require("aes-js"),require("@aeternity/aepp-calldata"),require("json-bigint"),require("events"),require("websocket")):e.Aeternity=t(e["@azure/core-rest-pipeline"],e.buffer,e["bignumber.js"],e["@azure/core-client"],e.rlp,e.bs58,e.tweetnacl,e["varuint-bitcoin"],e["@aeternity/uuid"],e["@aeternity/argon2"],e["tweetnacl-auth"],e["bip32-path"],e["aes-js"],e["@aeternity/aepp-calldata"],e["json-bigint"],e.events,e.websocket)}(self,(function(e,t,n,r,a,i,o,s,c,l,u,d,p,m,h,y,f){return function(){var g={8442:function(e,t,n){const r=n(9488);function a(e,t,n){const r=e[t]+e[n];let a=e[t+1]+e[n+1];r>=4294967296&&a++,e[t]=r,e[t+1]=a}function i(e,t,n,r){let a=e[t]+n;n<0&&(a+=4294967296);let i=e[t+1]+r;a>=4294967296&&i++,e[t]=a,e[t+1]=i}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,n,r,o,s){const c=d[o],l=d[o+1],p=d[s],m=d[s+1];a(u,e,t),i(u,e,c,l);let h=u[r]^u[e],y=u[r+1]^u[e+1];u[r]=y,u[r+1]=h,a(u,n,r),h=u[t]^u[n],y=u[t+1]^u[n+1],u[t]=h>>>24^y<<8,u[t+1]=y>>>24^h<<8,a(u,e,t),i(u,e,p,m),h=u[r]^u[e],y=u[r+1]^u[e+1],u[r]=h>>>16^y<<16,u[r+1]=y>>>16^h<<16,a(u,n,r),h=u[t]^u[n],y=u[t+1]^u[n+1],u[t]=y>>>31^h<<1,u[t+1]=h>>>31^y<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),u=new Uint32Array(32),d=new Uint32Array(32);function p(e,t){let n=0;for(n=0;n<16;n++)u[n]=e.h[n],u[n+16]=c[n];for(u[24]=u[24]^e.t,u[25]=u[25]^e.t/4294967296,t&&(u[28]=~u[28],u[29]=~u[29]),n=0;n<32;n++)d[n]=o(e.b,4*n);for(n=0;n<12;n++)s(0,8,16,24,l[16*n+0],l[16*n+1]),s(2,10,18,26,l[16*n+2],l[16*n+3]),s(4,12,20,28,l[16*n+4],l[16*n+5]),s(6,14,22,30,l[16*n+6],l[16*n+7]),s(0,10,20,30,l[16*n+8],l[16*n+9]),s(2,12,22,24,l[16*n+10],l[16*n+11]),s(4,14,16,26,l[16*n+12],l[16*n+13]),s(6,8,18,28,l[16*n+14],l[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^u[n]^u[n+16]}const m=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function h(e,t,n,r){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&16!==n.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(r&&16!==r.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const a={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};m.fill(0),m[0]=e,t&&(m[1]=t.length),m[2]=1,m[3]=1,n&&m.set(n,32),r&&m.set(r,48);for(let e=0;e<16;e++)a.h[e]=c[e]^o(m,4*e);return t&&(y(a,t),a.c=128),a}function y(e,t){for(let n=0;n<t.length;n++)128===e.c&&(e.t+=e.c,p(e,!1),e.c=0),e.b[e.c++]=t[n]}function f(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;p(e,!0);const t=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)t[n]=e.h[n>>2]>>8*(3&n);return t}function g(e,t,n,a,i){n=n||64,e=r.normalizeInput(e),a&&(a=r.normalizeInput(a)),i&&(i=r.normalizeInput(i));const o=h(n,t,a,i);return y(o,e),f(o)}e.exports={blake2b:g,blake2bHex:function(e,t,n,a,i){const o=g(e,t,n,a,i);return r.toHex(o)},blake2bInit:h,blake2bUpdate:y,blake2bFinal:f}},9488:function(e){function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,n,r){let a="\n"+e+" = ";for(let i=0;i<n.length;i+=2){if(32===r)a+=t(n[i]).toUpperCase(),a+=" ",a+=t(n[i+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);a+=t(n[i+1]).toUpperCase(),a+=t(n[i]).toUpperCase()}i%6==4?a+="\n"+new Array(e.length+4).join(" "):i<n.length-2&&(a+=" ")}console.log(a)},testSpeed:function(e,t,n){let r=(new Date).getTime();const a=new Uint8Array(t);for(let e=0;e<t;e++)a[e]=e%256;const i=(new Date).getTime();console.log("Generated random input in "+(i-r)+"ms"),r=i;for(let i=0;i<n;i++){const n=e(a),i=(new Date).getTime(),o=i-r;r=i,console.log("Hashed in "+o+"ms: "+n.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(o/1e3)*100)/100+" MB PER SECOND")}}}},3536:function(e,t,n){var r=n(1910);e.exports=r},8171:function(e,t,n){n(6450);var r=n(4058).Object,a=e.exports=function(e,t,n){return r.defineProperty(e,t,n)};r.defineProperty.sham&&(a.sham=!0)},3685:function(e,t,n){e.exports=n(621)},621:function(e,t,n){var r=n(3536);e.exports=r},4883:function(e,t,n){var r=n(7475),a=n(9826),i=TypeError;e.exports=function(e){if(r(e))return e;throw i(a(e)+" is not a function")}},6059:function(e,t,n){var r=n(941),a=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw i(a(e)+" is not an object")}},2532:function(e,t,n){var r=n(5329),a=r({}.toString),i=r("".slice);e.exports=function(e){return i(a(e),8,-1)}},2029:function(e,t,n){var r=n(5746),a=n(5988),i=n(1887);e.exports=r?function(e,t,n){return a.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},1887:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},5609:function(e,t,n){var r=n(1899),a=Object.defineProperty;e.exports=function(e,t){try{a(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},5746:function(e,t,n){var r=n(5981);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},6616:function(e){var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},1333:function(e,t,n){var r=n(1899),a=n(941),i=r.document,o=a(i)&&a(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},2861:function(e,t,n){var r=n(626);e.exports=r("navigator","userAgent")||""},3385:function(e,t,n){var r,a,i=n(1899),o=n(2861),s=i.process,c=i.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(a=(r=u.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!a&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(a=+r[1]),e.exports=a},6887:function(e,t,n){"use strict";var r=n(1899),a=n(9730),i=n(7484),o=n(7475),s=n(9677).f,c=n(7252),l=n(4058),u=n(6843),d=n(2029),p=n(953),m=function(e){var t=function(n,r,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,i)}return a(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var n,a,h,y,f,g,N,C,w=e.target,b=e.global,S=e.stat,x=e.proto,v=b?r:S?r[w]:(r[w]||{}).prototype,T=b?l:l[w]||d(l,w,{})[w],_=T.prototype;for(h in t)n=!c(b?h:w+(S?".":"#")+h,e.forced)&&v&&p(v,h),f=T[h],n&&(g=e.dontCallGetSet?(C=s(v,h))&&C.value:v[h]),y=n&&g?g:t[h],n&&typeof f==typeof y||(N=e.bind&&n?u(y,r):e.wrap&&n?m(y):x&&o(y)?i(y):y,(e.sham||y&&y.sham||f&&f.sham)&&d(N,"sham",!0),d(T,h,N),x&&(p(l,a=w+"Prototype")||d(l,a,{}),d(l[a],h,y),e.real&&_&&!_[h]&&d(_,h,y)))}},5981:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},9730:function(e,t,n){var r=n(8285),a=Function.prototype,i=a.apply,o=a.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?o.bind(i):function(){return o.apply(i,arguments)})},6843:function(e,t,n){var r=n(7484),a=n(4883),i=n(8285),o=r(r.bind);e.exports=function(e,t){return a(e),void 0===t?e:i?o(e,t):function(){return e.apply(t,arguments)}}},8285:function(e,t,n){var r=n(5981);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},8834:function(e,t,n){var r=n(8285),a=Function.prototype.call;e.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},7484:function(e,t,n){var r=n(2532),a=n(5329);e.exports=function(e){if("Function"===r(e))return a(e)}},5329:function(e,t,n){var r=n(8285),a=Function.prototype,i=a.call,o=r&&a.bind.bind(i,i);e.exports=r?o:function(e){return function(){return i.apply(e,arguments)}}},626:function(e,t,n){var r=n(4058),a=n(1899),i=n(7475),o=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e])||o(a[e]):r[e]&&r[e][t]||a[e]&&a[e][t]}},4229:function(e,t,n){var r=n(4883),a=n(2119);e.exports=function(e,t){var n=e[t];return a(n)?void 0:r(n)}},1899:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},953:function(e,t,n){var r=n(5329),a=n(9678),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(a(e),t)}},2840:function(e,t,n){var r=n(5746),a=n(5981),i=n(1333);e.exports=!r&&!a((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7026:function(e,t,n){var r=n(5329),a=n(5981),i=n(2532),o=Object,s=r("".split);e.exports=a((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?s(e,""):o(e)}:o},7475:function(e,t,n){var r=n(6616),a=r.all;e.exports=r.IS_HTMLDDA?function(e){return"function"==typeof e||e===a}:function(e){return"function"==typeof e}},7252:function(e,t,n){var r=n(5981),a=n(7475),i=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n==u||n!=l&&(a(t)?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},c=o.data={},l=o.NATIVE="N",u=o.POLYFILL="P";e.exports=o},2119:function(e){e.exports=function(e){return null==e}},941:function(e,t,n){var r=n(7475),a=n(6616),i=a.all;e.exports=a.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===i}:function(e){return"object"==typeof e?null!==e:r(e)}},2529:function(e){e.exports=!0},6664:function(e,t,n){var r=n(626),a=n(7475),i=n(7046),o=n(2302),s=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return a(t)&&i(t.prototype,s(e))}},5988:function(e,t,n){var r=n(5746),a=n(2840),i=n(3937),o=n(6059),s=n(3894),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor;t.f=r?i?function(e,t,n){if(o(e),t=s(t),o(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var r=u(e,t);r&&r.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:r.configurable,enumerable:"enumerable"in n?n.enumerable:r.enumerable,writable:!1})}return l(e,t,n)}:l:function(e,t,n){if(o(e),t=s(t),o(n),a)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},9677:function(e,t,n){var r=n(5746),a=n(8834),i=n(6760),o=n(1887),s=n(4529),c=n(3894),l=n(953),u=n(2840),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return o(!a(i.f,e,t),e[t])}},7046:function(e,t,n){var r=n(5329);e.exports=r({}.isPrototypeOf)},6760:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,a=r&&!n.call({1:2},1);t.f=a?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},9811:function(e,t,n){var r=n(8834),a=n(7475),i=n(941),o=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&a(n=e.toString)&&!i(s=r(n,e)))return s;if(a(n=e.valueOf)&&!i(s=r(n,e)))return s;if("string"!==t&&a(n=e.toString)&&!i(s=r(n,e)))return s;throw o("Can't convert object to primitive value")}},4058:function(e){e.exports={}},8219:function(e,t,n){var r=n(2119),a=TypeError;e.exports=function(e){if(r(e))throw a("Can't call method on "+e);return e}},3030:function(e,t,n){var r=n(1899),a=n(5609),i="__core-js_shared__",o=r[i]||a(i,{});e.exports=o},8726:function(e,t,n){var r=n(2529),a=n(3030);(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"})},3405:function(e,t,n){var r=n(3385),a=n(5981);e.exports=!!Object.getOwnPropertySymbols&&!a((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},4529:function(e,t,n){var r=n(7026),a=n(8219);e.exports=function(e){return r(a(e))}},9678:function(e,t,n){var r=n(8219),a=Object;e.exports=function(e){return a(r(e))}},6935:function(e,t,n){var r=n(8834),a=n(941),i=n(6664),o=n(4229),s=n(9811),c=n(9813),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!a(e)||i(e))return e;var n,c=o(e,u);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!a(n)||i(n))return n;throw l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},3894:function(e,t,n){var r=n(6935),a=n(6664);e.exports=function(e){var t=r(e,"string");return a(t)?t:t+""}},9826:function(e){var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},9418:function(e,t,n){var r=n(5329),a=0,i=Math.random(),o=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++a+i,36)}},2302:function(e,t,n){var r=n(3405);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3937:function(e,t,n){var r=n(5746),a=n(5981);e.exports=r&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},9813:function(e,t,n){var r=n(1899),a=n(8726),i=n(953),o=n(9418),s=n(3405),c=n(2302),l=a("wks"),u=r.Symbol,d=u&&u.for,p=c?u:u&&u.withoutSetter||o;e.exports=function(e){if(!i(l,e)||!s&&"string"!=typeof l[e]){var t="Symbol."+e;s&&i(u,e)?l[e]=u[e]:l[e]=c&&d?d(t):p(t)}return l[e]}},6450:function(e,t,n){var r=n(6887),a=n(5746),i=n(5988).f;r({target:"Object",stat:!0,forced:Object.defineProperty!==i,sham:!a},{defineProperty:i})},1910:function(e,t,n){var r=n(8171);e.exports=r},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},9509:function(e,t,n){var r=n(9408),a=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return a(e,t,n)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(a.prototype),i(a,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=a(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},4189:function(e,t,n){var r=n(9509).Buffer;function a(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}a.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,a=this._blockSize,i=e.length,o=this._len,s=0;s<i;){for(var c=o%a,l=Math.min(i-s,a-c),u=0;u<l;u++)n[c+u]=e[s+u];s+=l,(o+=l)%a==0&&this._update(n)}return this._len+=i,this},a.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,a=(n-r)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},a.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=a},7499:function(e,t,n){var r=n(5717),a=n(4189),i=n(9509).Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function c(){this.init(),this._w=s,a.call(this,64,56)}function l(e,t,n){return n^e&(t^n)}function u(e,t,n){return e&t|n&(e|t)}function d(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function p(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function m(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}r(c,a),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,s=0|this._d,c=0|this._e,h=0|this._f,y=0|this._g,f=0|this._h,g=0;g<16;++g)n[g]=e.readInt32BE(4*g);for(;g<64;++g)n[g]=0|(((t=n[g-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[g-7]+m(n[g-15])+n[g-16];for(var N=0;N<64;++N){var C=f+p(c)+l(c,h,y)+o[N]+n[N]|0,w=d(r)+u(r,a,i)|0;f=y,y=h,h=c,c=s+C|0,s=i,i=a,a=r,r=C+w|0}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0,this._f=h+this._f|0,this._g=y+this._g|0,this._h=f+this._h|0},c.prototype._hash=function(){var e=i.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=c},7946:function(e){"use strict";e.exports=m},7417:function(e){"use strict";e.exports=l},3983:function(e){"use strict";e.exports=c},4711:function(e){"use strict";e.exports=r},5039:function(t){"use strict";t.exports=e},8236:function(e){"use strict";e.exports=p},5192:function(e){"use strict";e.exports=n},1986:function(e){"use strict";e.exports=d},3783:function(e){"use strict";e.exports=i},9408:function(e){"use strict";e.exports=t},3735:function(e){"use strict";e.exports=y},2716:function(e){"use strict";e.exports=h},3485:function(e){"use strict";e.exports=a},79:function(e){"use strict";e.exports=o},9882:function(e){"use strict";e.exports=u},7480:function(e){"use strict";e.exports=s},8079:function(e){"use strict";e.exports=f},7445:function(e,t,n){e.exports=n(3685)}},N={};function C(e){var t=N[e];if(void 0!==t)return t.exports;var n=N[e]={exports:{}};return g[e](n,n.exports,C),n.exports}C.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return C.d(t,{a:t}),t},C.d=function(e,t){for(var n in t)C.o(t,n)&&!C.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},C.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),C.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},C.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var w={};return function(){"use strict";C.r(w),C.d(w,{ABI_VERSIONS:function(){return Wn},AE_AMOUNT_FORMATS:function(){return Be},AccountBase:function(){return Ws},AccountError:function(){return d},AccountGeneralized:function(){return Uc},AccountLedger:function(){return Hc},AccountLedgerFactory:function(){return Lc},AeSdk:function(){return Qs},AeSdkAepp:function(){return Pc},AeSdkBase:function(){return Ks},AeSdkMethods:function(){return Ls},AeSdkWallet:function(){return Bc},AensError:function(){return p},AensPointerContextError:function(){return j},AeppError:function(){return m},AlreadyConnectedError:function(){return ke},AmbiguousEventDefinitionError:function(){return de},ArgumentCountMismatchError:function(){return T},ArgumentError:function(){return x},BaseError:function(){return u},BrowserRuntimeConnection:function(){return zu},BrowserWindowMessageConnection:function(){return Tu},BytecodeMismatchError:function(){return ee},CLIENT_TTL:function(){return Mt},CallReturnType:function(){return Yn},Channel:function(){return Nu},ChannelCallError:function(){return K},ChannelConnectionError:function(){return Q},ChannelError:function(){return h},ChannelIncomingMessageError:function(){return J},ChannelPingTimedOutError:function(){return W},CompilerError:function(){return y},CompilerHttp:function(){return Ul},Contract:function(){return zs},ContractError:function(){return f},CryptographyError:function(){return g},DRY_RUN_ACCOUNT:function(){return Kn},DecodeError:function(){return we},DerivationError:function(){return ts},DryRunError:function(){return Se},DuplicateContractError:function(){return te},DuplicateNodeError:function(){return Ne},Encoding:function(){return tt},FIELD_TYPES:function(){return Zn},IllegalArgumentError:function(){return v},IllegalBidFeeError:function(){return xe},InactiveContractError:function(){return ne},InsufficientBalanceError:function(){return _},InsufficientNameFeeError:function(){return $},InternalError:function(){return B},InvalidAensNameError:function(){return U},InvalidAuthDataError:function(){return Z},InvalidChecksumError:function(){return pe},InvalidMethodInvocationError:function(){return re},InvalidPasswordError:function(){return me},InvalidRpcMessageError:function(){return F},InvalidSignatureError:function(){return ve},InvalidTxError:function(){return yo},InvalidTxParamsError:function(){return Te},MAX_AUTH_FUN_GAS:function(){return At},MESSAGE_DIRECTION:function(){return Ys},METHODS:function(){return Zs},MIN_GAS_PRICE:function(){return Bt},MemoryAccount:function(){return jc},MerkleTreeHashMismatchError:function(){return he},MissingCallbackError:function(){return V},MissingContractAddressError:function(){return ae},MissingContractDefError:function(){return ie},MissingEventDefinitionError:function(){return ue},MissingFunctionNameError:function(){return oe},MissingNodeInTreeError:function(){return ye},MissingParamError:function(){return z},NAME_BID_MAX_LENGTH:function(){return Ut},NAME_BID_RANGES:function(){return Ft},NAME_BID_TIMEOUT_BLOCKS:function(){return jt},NAME_FEE_BID_INCREMENT:function(){return Dt},NAME_FEE_MULTIPLIER:function(){return Rt},NAME_MAX_CLIENT_TTL:function(){return Ot},NAME_MAX_LENGTH_FEE:function(){return $t},NAME_MAX_TTL:function(){return kt},NAME_TTL:function(){return It},NoSerializerFoundError:function(){return q},NoSuchContractFunctionError:function(){return ce},NoWalletConnectedError:function(){return Oe},Node:function(){return co},NodeError:function(){return N},NodeInvocationError:function(){return se},NodeNotFoundError:function(){return Ce},NotImplementedError:function(){return O},NotPayableFunctionError:function(){return le},ORACLE_TTL:function(){return Hn},ORACLE_TTL_TYPES:function(){return Un},PROTOCOL_VERSIONS:function(){return Jn},PROTOCOL_VM_ABI:function(){return Xn},PayloadLengthError:function(){return be},PrefixNotFoundError:function(){return _e},QUERY_FEE:function(){return Vn},QUERY_TTL:function(){return Gn},RESPONSE_TTL:function(){return Ln},RPC_STATUS:function(){return ec},RequestTimedOutError:function(){return E},RpcBroadcastError:function(){return ac},RpcConnectionDenyError:function(){return sc},RpcConnectionError:function(){return Me},RpcError:function(){return nc},RpcInternalError:function(){return uc},RpcInvalidTransactionError:function(){return rc},RpcMethodNotFoundError:function(){return dc},RpcNotAuthorizeError:function(){return cc},RpcPermissionDenyError:function(){return lc},RpcRejectedByUserError:function(){return ic},RpcUnsupportedProtocolError:function(){return oc},SUBSCRIPTION_TYPES:function(){return Xs},SchemaNotFoundError:function(){return ze},TX_SCHEMA:function(){return tr},TX_TTL:function(){return Fn},Tag:function(){return Vt},TagNotFoundError:function(){return qe},TransactionError:function(){return b},TxNotInChainError:function(){return Ee},TxTimedOutError:function(){return P},TypeError:function(){return A},UnAuthorizedAccountError:function(){return H},UnavailableAccountError:function(){return D},UnexpectedChannelMessageError:function(){return Y},UnexpectedTsError:function(){return R},UnknownChannelStateError:function(){return X},UnknownNodeLengthError:function(){return fe},UnknownPathNibbleError:function(){return ge},UnknownRpcClientError:function(){return G},UnknownTxError:function(){return Pe},UnsubscribedAccountError:function(){return L},UnsupportedABIversionError:function(){return Ae},UnsupportedPlatformError:function(){return I},UnsupportedProtocolError:function(){return k},UnsupportedVMversionError:function(){return Ie},UnsupportedVersionError:function(){return M},VM_VERSIONS:function(){return Qn},WALLET_TYPE:function(){return Js},WalletError:function(){return S},_buildTx:function(){return Lo},_getPollInterval:function(){return ho},aensBid:function(){return xs},aensClaim:function(){return bs},aensPreclaim:function(){return Ss},aensQuery:function(){return ws},aensRevoke:function(){return gs},aensTransfer:function(){return Cs},aensUpdate:function(){return Ns},awaitHeight:function(){return No},buildAuthTxHash:function(){return Ds},buildContractId:function(){return Kt},buildContractIdByContractTx:function(){return yr},buildTx:function(){return pr},buildTxHash:function(){return hr},commitmentHash:function(){return Yt},computeAuctionEndBlock:function(){return an},computeBidFee:function(){return rn},connectionProxy:function(){return Cu},createGeneralizedAccount:function(){return Rs},decode:function(){return ht},deriveChild:function(){return as},derivePathFromKey:function(){return is},derivePathFromSeed:function(){return ss},dump:function(){return Ho},encode:function(){return yt},encodeContractAddress:function(){return St},encodeUnsigned:function(){return wt},extendOracleTtl:function(){return Is},formatAmount:function(){return De},genSalt:function(){return Ct},generateKeyPair:function(){return vt},generateKeyPairFromSecret:function(){return xt},generateSaveHDWalletFromSeed:function(){return us},getAccount:function(){return bo},getAddressFromPriv:function(){return gt},getBalance:function(){return So},getContract:function(){return Io},getContractByteCode:function(){return Ao},getCurrentGeneration:function(){return xo},getDefaultPointerKey:function(){return tn},getGeneration:function(){return vo},getHdWalletAccountFromSeed:function(){return ps},getHeight:function(){return fo},getKeyBlock:function(){return _o},getKeyPair:function(){return ls},getMasterKeyFromSeed:function(){return os},getMicroBlockHeader:function(){return zo},getMicroBlockTransactions:function(){return To},getMinimumNameFee:function(){return nn},getName:function(){return ko},getOracleObject:function(){return Os},getQueryObject:function(){return Ps},getSaveHDWalletAccounts:function(){return ds},hash:function(){return bt},isAddressValid:function(){return Nt},isAuctionName:function(){return on},isNameValid:function(){return Zt},isValidKeypair:function(){return Pt},messageToHash:function(){return zt},oracleQueryId:function(){return Qt},payForTransaction:function(){return fs},poll:function(){return go},pollForQueries:function(){return qs},pollForQueryResponse:function(){return Es},postQueryToOracle:function(){return As},produceNameId:function(){return Wt},readInt:function(){return Jt},recover:function(){return Vo},registerOracle:function(){return Ms},resolveName:function(){return Oo},respondToQuery:function(){return ks},send:function(){return ms},sendTransaction:function(){return wo},sign:function(){return Tt},signMessage:function(){return qt},spend:function(){return hs},toAe:function(){return je},toAettos:function(){return $e},toBytes:function(){return Gt},transferFunds:function(){return ys},txDryRun:function(){return Po},unpackTx:function(){return mr},verify:function(){return _t},verifyMessage:function(){return Et},verifyTransaction:function(){return mo},waitForTxConfirm:function(){return Co},walletDetector:function(){return _u}});var e={};C.r(e),C.d(e,{Account:function(){return Fr},ByteCode:function(){return aa},Channel:function(){return ua},ChannelCloseMutualTx:function(){return Aa},ChannelCloseSoloTx:function(){return Ia},ChannelCreateTx:function(){return za},ChannelDepositTx:function(){return qa},ChannelForceProgressTx:function(){return Pa},ChannelSetDelegatesTx:function(){return Ba},ChannelSettleTx:function(){return Oa},ChannelSlashTx:function(){return ka},ChannelSnapshotSoloTx:function(){return Ma},ChannelWithdrawTx:function(){return Ea},CheckTxInPoolResponse:function(){return Ya},CommitmentId:function(){return Ta},ContractCallObject:function(){return Jr},ContractCallTx:function(){return Ha},ContractCreateTx:function(){return Va},ContractObject:function(){return ra},CountResponse:function(){return $r},CreateContractUnsignedTx:function(){return ni},Delegates:function(){return Mr},DryRunAccount:function(){return Gr},DryRunCallContext:function(){return Qr},DryRunCallReq:function(){return Kr},DryRunInput:function(){return Hr},DryRunInputItem:function(){return Lr},DryRunResult:function(){return Yr},DryRunResults:function(){return Wr},EncodedTx:function(){return ta},ErrorModel:function(){return zr},Event:function(){return Xr},GAAttachTx:function(){return Ka},GAMetaTx:function(){return Qa},GAObject:function(){return ea},Generation:function(){return Ur},HashResponse:function(){return Er},Header:function(){return _r},HeightResponse:function(){return Pr},KeyBlock:function(){return qr},MicroBlockHeader:function(){return Ar},NameClaimTx:function(){return ba},NameEntry:function(){return la},NameHash:function(){return _a},NamePointer:function(){return jr},NamePreclaimTx:function(){return wa},NameRevokeTx:function(){return va},NameTransferTx:function(){return xa},NameUpdateTx:function(){return Sa},NextNonceResponse:function(){return Vr},OffChainCallContract:function(){return ti},OffChainDeposit:function(){return Za},OffChainNewContract:function(){return ei},OffChainTransfer:function(){return Ja},OffChainUpdate:function(){return Br},OffChainWithdrawal:function(){return Xa},OracleExtendTx:function(){return ga},OracleQueries:function(){return sa},OracleQuery:function(){return ca},OracleQueryTx:function(){return Na},OracleRegisterTx:function(){return fa},OracleRespondTx:function(){return Ca},PayingForTx:function(){return Wa},PeerConnections:function(){return ha},PeerCount:function(){return $a},PeerCountAvailable:function(){return Fa},PeerCountConnected:function(){return Ua},PeerDetails:function(){return Da},PeerPubKey:function(){return da},Peers:function(){return ja},PoI:function(){return ia},PostTxResponse:function(){return na},Protocol:function(){return ma},PubKey:function(){return Ra},RegisteredOracle:function(){return oa},RelativeTTL:function(){return Rr},SignedTx:function(){return kr},SignedTxs:function(){return Ir},SpendTx:function(){return ya},Status:function(){return pa},TokenSupply:function(){return La},Ttl:function(){return Dr},Tx:function(){return Or},TxInfoObject:function(){return Zr},UnsignedTx:function(){return Ga},discriminators:function(){return ri}});var t={};C.r(t),C.d(t,{InvalidTxError:function(){return yo},_getPollInterval:function(){return ho},awaitHeight:function(){return No},getAccount:function(){return bo},getBalance:function(){return So},getContract:function(){return Io},getContractByteCode:function(){return Ao},getCurrentGeneration:function(){return xo},getGeneration:function(){return vo},getHeight:function(){return fo},getKeyBlock:function(){return _o},getMicroBlockHeader:function(){return zo},getMicroBlockTransactions:function(){return To},getName:function(){return ko},poll:function(){return go},resolveName:function(){return Oo},sendTransaction:function(){return wo},txDryRun:function(){return Po},waitForTxConfirm:function(){return Co}});var n={};C.r(n),C.d(n,{payForTransaction:function(){return fs},send:function(){return ms},spend:function(){return hs},transferFunds:function(){return ys}});var r={};C.r(r),C.d(r,{aensBid:function(){return xs},aensClaim:function(){return bs},aensPreclaim:function(){return Ss},aensQuery:function(){return ws},aensRevoke:function(){return gs},aensTransfer:function(){return Cs},aensUpdate:function(){return Ns}});var a={};C.r(a),C.d(a,{extendOracleTtl:function(){return Is},getOracleObject:function(){return Os},getQueryObject:function(){return Ps},pollForQueries:function(){return qs},pollForQueryResponse:function(){return Es},postQueryToOracle:function(){return As},registerOracle:function(){return Ms},respondToQuery:function(){return ks}});var i={};C.r(i),C.d(i,{buildAuthTxHash:function(){return Ds},createGeneralizedAccount:function(){return Rs}});var o={};C.r(o),C.d(o,{Aci:function(){return Wc},ApiVersion:function(){return pl},ByteCode:function(){return Xc},ByteCodeInput:function(){return cl},BytecodeCallResultInput:function(){return el},Calldata:function(){return rl},CompileOpts:function(){return Qc},CompilerError:function(){return Yc},CompilerVersion:function(){return dl},Contract:function(){return Kc},DecodeCalldataBytecode:function(){return al},DecodeCalldataSource:function(){return sl},DecodedCalldata:function(){return il},DecodedCallresult:function(){return tl},ErrorModel:function(){return ol},ErrorPos:function(){return Jc},FateAssembler:function(){return ll},FunctionCallInput:function(){return nl},SophiaBinaryData:function(){return ml},SophiaCallResultInput:function(){return Zc},SophiaJsonData:function(){return hl},ValidateByteCodeInput:function(){return ul}});var s=C(5192),c=C.n(s);const l=e=>e.integerValue(c().ROUND_CEIL);class u extends Error{constructor(e){super(e),this.name="BaseError"}}class d extends u{constructor(e){super(e),this.name="AccountError"}}class p extends u{constructor(e){super(e),this.name="AensError"}}class m extends u{constructor(e){super(e),this.name="AeppError"}}class h extends u{constructor(e){super(e),this.name="ChannelError"}}class y extends u{constructor(e){super(e),this.name="CompilerError"}}class f extends u{constructor(e){super(e),this.name="ContractError"}}class g extends u{constructor(e){super(e),this.name="CryptographyError"}}class N extends u{constructor(e){super(e),this.name="NodeError"}}class b extends u{constructor(e){super(e),this.name="TransactionError"}}class S extends u{constructor(e){super(e),this.name="WalletError"}}class x extends u{constructor(e,t,n){super(`${e} should be ${t}, got ${String(n)} instead`),this.name="ArgumentError"}}class v extends g{constructor(e){super(e),this.name="IllegalArgumentError"}}class T extends u{constructor(e,t,n){super(`${e} expects ${t} arguments, got ${n} instead`),this.name="ArgumentCountMismatchError"}}class _ extends u{constructor(e){super(e),this.name="InsufficientBalanceError"}}class z extends u{constructor(e){super(e),this.name="MissingParamError"}}class q extends u{constructor(){super("Byte serialization not supported"),this.name="NoSerializerFoundError"}}class E extends u{constructor(e){super(`Giving up at height ${e}`),this.name="RequestTimedOutError"}}class P extends u{constructor(e,t){super([`Giving up after ${e} blocks mined`,`transaction hash: ${t}`].join(", ")),this.name="TxTimedOutError"}}class A extends u{constructor(e){super(e),this.name="TypeError"}}class I extends u{constructor(e){super(e),this.name="UnsupportedPlatformError"}}class k extends u{constructor(e){super(e),this.name="UnsupportedProtocolError"}}class O extends u{constructor(e){super(e),this.name="NotImplementedError"}}class M extends u{constructor(e,t,n,r){super(`Unsupported ${e} version ${t}. Supported: >= ${n} < ${r}`),this.name="UnsupportedVersionError"}}class B extends u{constructor(e){super(e),this.name="InternalError"}}class R extends B{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Expected to not happen, required for TS"),this.name="UnexpectedTsError"}}class D extends d{constructor(e){super(`Account for ${e} not available`),this.name="UnavailableAccountError"}}class j extends p{constructor(e,t){super(`Name ${e} don't have pointers for ${t}`),this.name="AensPointerContextError"}}class $ extends p{constructor(e,t){super(`the provided fee ${e.toString()} is not enough to execute the claim, required: ${t.toString()}`),this.name="InsufficientNameFeeError"}}class U extends p{constructor(e){super(e),this.name="InvalidAensNameError"}}class F extends m{constructor(e){super(`Received invalid message: ${e}`),this.name="InvalidRpcMessageError"}}class V extends m{constructor(e){super(`Can't find callback for this messageId ${e}`),this.name="MissingCallbackError"}}class H extends m{constructor(e){super(`You do not have access to account ${e}`),this.name="UnAuthorizedAccountError"}}class G extends m{constructor(e){super(`RpcClient with id ${e} do not exist`),this.name="UnknownRpcClientError"}}class L extends m{constructor(){super("You are not subscribed for an account."),this.name="UnsubscribedAccountError"}}class K extends h{constructor(e){super(e),this.name="ChannelCallError"}}class Q extends h{constructor(e){super(e),this.name="ChannelConnectionError"}}class W extends h{constructor(){super("Server pong timed out"),this.name="ChannelPingTimedOutError"}}class Y extends h{constructor(e){super(e),this.name="UnexpectedChannelMessageError"}}class J extends h{constructor(e,t){super(e.message),this.handlerError=e,this.incomingMessage=t,this.name="ChannelIncomingMessageError"}}class X extends h{constructor(){super("State Channels FSM entered unknown state"),this.name="UnknownChannelStateError"}}class Z extends y{constructor(e){super(e),this.name="InvalidAuthDataError"}}class ee extends f{constructor(e){super(`Contract ${e} do not correspond to the bytecode deployed on the chain`),this.name="BytecodeMismatchError"}}class te extends f{constructor(){super("Contract already deployed"),this.name="DuplicateContractError"}}class ne extends f{constructor(e){super(`Contract with address ${e} not active`),this.name="InactiveContractError"}}class re extends f{constructor(e){super(e),this.name="InvalidMethodInvocationError"}}class ae extends f{constructor(e){super(e),this.name="MissingContractAddressError"}}class ie extends f{constructor(){super("Either ACI or source code is required"),this.name="MissingContractDefError"}}class oe extends f{constructor(){super("Function name is required"),this.name="MissingFunctionNameError"}}class se extends f{constructor(e,t){super("Invocation failed"+(null==e?"":`: "${e}"`)),this.name="NodeInvocationError",this.transaction=t}}class ce extends f{constructor(e){super(`Function ${e} doesn't exist in contract`),this.name="NoSuchContractFunctionError"}}class le extends f{constructor(e,t){super(`You try to pay "${e}" to function "${t}" which is not payable. Only payable function can accept coins`),this.name="NotPayableFunctionError"}}class ue extends f{constructor(e,t){super(`Can't find definition of ${e} event emitted by ${t} (use omitUnknown option to ignore events like this)`),this.name="MissingEventDefinitionError"}}class de extends f{constructor(e,t){super(`Found multiple definitions of "${t[0][1]}" event with different types emitted by ${e} in ${t.map((e=>{let[t]=e;return`"${t}"`})).join(", ")} contracts (use contractAddressToName option to specify contract name corresponding to address)`),this.name="AmbiguousEventDefinitionError"}}class pe extends g{constructor(){super("Invalid checksum"),this.name="InvalidChecksumError"}}class me extends g{constructor(){super("Invalid password or nonce"),this.name="InvalidPasswordError"}}class he extends g{constructor(){super("Node hash is not equal to provided one"),this.name="MerkleTreeHashMismatchError"}}class ye extends g{constructor(e){super(e),this.name="MissingNodeInTreeError"}}class fe extends g{constructor(e){super(`Unknown node length: ${e}`),this.name="UnknownNodeLengthError"}}class ge extends g{constructor(e){super(`Unknown path nibble: ${e}`),this.name="UnknownPathNibbleError"}}class Ne extends N{constructor(e){super(`Node with name ${e} already exist`),this.name="DuplicateNodeError"}}class Ce extends N{constructor(e){super(e),this.name="NodeNotFoundError"}}class we extends b{constructor(e){super(e),this.name="DecodeError"}}class be extends b{constructor(e){super(e),this.name="PayloadLengthError"}}class Se extends b{constructor(e){super(e),this.name="DryRunError"}}class xe extends b{constructor(e){super(e),this.name="IllegalBidFeeError"}}class ve extends b{constructor(e){super(e),this.name="InvalidSignatureError"}}class Te extends b{constructor(e){super(e),this.name="InvalidTxParamsError"}}class _e extends b{constructor(e){super(`Prefix for id-tag ${e} not found.`),this.name="PrefixNotFoundError"}}class ze extends b{constructor(e,t,n){super(`Transaction ${e} not implemented for ${t} version ${n}`),this.name="SchemaNotFoundError"}}class qe extends b{constructor(e){super(`Id tag for prefix ${e} not found.`),this.name="DecodeError"}}class Ee extends b{constructor(e){super(`Transaction ${e} is removed from chain`),this.name="TxNotInChainError"}}class Pe extends b{constructor(e){super(e),this.name="UnknownTxError"}}class Ae extends b{constructor(e){super(e),this.name="UnsupportedABIversionError"}}class Ie extends b{constructor(e){super(e),this.name="UnsupportedVMversionError"}}class ke extends S{constructor(e){super(e),this.name="AlreadyConnectedError"}}class Oe extends S{constructor(e){super(e),this.name="NoWalletConnectedError"}}class Me extends S{constructor(e){super(e),this.name="RpcConnectionError"}}let Be;!function(e){e.AE="ae",e.MILI_AE="miliAE",e.MICRO_AE="microAE",e.NANO_AE="nanoAE",e.PICO_AE="picoAE",e.FEMTO_AE="femtoAE",e.AETTOS="aettos"}(Be||(Be={}));const Re={[Be.AE]:0,[Be.MILI_AE]:-3,[Be.MICRO_AE]:-6,[Be.NANO_AE]:-9,[Be.PICO_AE]:-12,[Be.FEMTO_AE]:-15,[Be.AETTOS]:-18},De=(e,t)=>{let{denomination:n=Be.AETTOS,targetDenomination:r=Be.AETTOS}=t;if("bigint"!=typeof(a=e)&&(!["number","object","string"].includes(typeof a)||isNaN(a)&&!Number.isInteger(a)&&!c().isBigNumber(a)))throw new x("value","a number",e);var a;return new(c())("bigint"==typeof e?e.toString():e).shiftedBy(Re[n]-Re[r]).toFixed()},je=function(e){let{denomination:t=Be.AETTOS}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return De(e,{denomination:t,targetDenomination:Be.AE})},$e=function(e){let{denomination:t=Be.AE}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return De(e,{denomination:t})};var Ue=C(79),Fe=C.n(Ue),Ve=C(8442),He=C(7480),Ge=C(5039),Le=C(9408).Buffer;const Ke=async e=>new Promise((t=>{setTimeout(t,e)})),Qe=(e,t)=>Object.fromEntries(Object.entries(e).map(t)),We=(()=>{try{return Le.concat([Uint8Array.from([])]),!1}catch(e){return!0}})()?(e,t)=>Le.concat(e.map((e=>Le.from(e))),t):Le.concat;function Ye(e,t){return e in t}function Je(e){return e instanceof Ge.RestError&&404===e.statusCode&&e.message.includes("Account not found")}var Xe=C(3783),Ze=C(7499),et=C.n(Ze);let tt;!function(e){e.KeyBlockHash="kh",e.MicroBlockHash="mh",e.BlockPofHash="bf",e.BlockTxHash="bx",e.BlockStateHash="bs",e.Channel="ch",e.ContractAddress="ct",e.ContractBytearray="cb",e.ContractStoreKey="ck",e.ContractStoreValue="cv",e.Transaction="tx",e.TxHash="th",e.OracleAddress="ok",e.OracleQuery="ov",e.OracleQueryId="oq",e.OracleResponse="or",e.AccountAddress="ak",e.Signature="sg",e.Commitment="cm",e.PeerPubkey="pp",e.Name="nm",e.State="st",e.Poi="pi",e.StateTrees="ss",e.CallStateTree="cs",e.Bytearray="ba"}(tt||(tt={}));var nt=C(9408).Buffer;function rt(e){return(new(et())).update(e).digest()}const at=[tt.ContractBytearray,tt.ContractStoreKey,tt.ContractStoreValue,tt.Transaction,tt.OracleQuery,tt.OracleResponse,tt.State,tt.Poi,tt.StateTrees,tt.CallStateTree,tt.Bytearray],it=[tt.KeyBlockHash,tt.MicroBlockHash,tt.BlockPofHash,tt.BlockTxHash,tt.BlockStateHash,tt.Channel,tt.ContractAddress,tt.TxHash,tt.OracleAddress,tt.OracleQueryId,tt.AccountAddress,tt.Signature,tt.Commitment,tt.PeerPubkey,tt.Name],ot={[tt.KeyBlockHash]:32,[tt.MicroBlockHash]:32,[tt.BlockPofHash]:32,[tt.BlockTxHash]:32,[tt.BlockStateHash]:32,[tt.Channel]:32,[tt.ContractAddress]:32,[tt.TxHash]:32,[tt.OracleAddress]:32,[tt.OracleQueryId]:32,[tt.AccountAddress]:32,[tt.Signature]:64,[tt.Commitment]:32,[tt.PeerPubkey]:32,[tt.State]:32};function st(e,t){if(!Ye(t,ot))return;const n=ot[t];if(null!=n&&e.length!==n)throw new be(`Payload should be ${n} bytes, got ${e.length} instead`)}const ct=e=>rt(rt(e)).slice(0,4),lt=e=>We([e,ct(e)]);function ut(e){const t=e.slice(0,-4);if(!ct(t).equals(e.slice(-4)))throw new pe;return t}const dt={encode:e=>lt(e).toString("base64"),decode:e=>ut(nt.from(e,"base64"))},pt={encode:e=>(0,Xe.encode)(lt(e)),decode:e=>ut(nt.from((0,Xe.decode)(e)))},mt=e=>{const t=at.find((t=>t===e));if(null!=t)return[t,dt];const n=it.find((t=>t===e));if(null!=n)return[n,pt];throw new x("prefix",`one of ${[...it,...at].join(", ")}`,e)};function ht(e){const[t,n,r]=e.split("_");if(null==n)throw new we(`Encoded string missing payload: ${e}`);if(null!=r)throw new we(`Encoded string have extra parts: ${e}`);const[a,i]=mt(t),o=i.decode(n);return st(o,a),o}function yt(e,t){const[,n]=mt(t);return st(e,t),`${t}_${n.encode(e)}`}var ft=C(9408).Buffer;function gt(e){const t="string"==typeof e?ft.from(e,"hex"):e;return yt(Fe().sign.keyPair.fromSecretKey(t).publicKey,tt.AccountAddress)}function Nt(e){arguments.length>1&&void 0!==arguments[1]||tt.AccountAddress;try{return ht(e),!0}catch(e){return!1}}function Ct(){const[e]=new BigUint64Array(Fe().randomBytes(8).buffer);return Number(e%BigInt(Number.MAX_SAFE_INTEGER))}function wt(e){const t=ft.allocUnsafe(4);return t.writeUInt32BE(e),t.slice(t.findIndex((e=>0!==e)))}function bt(e){return ft.from((0,Ve.blake2b)(e,void 0,32))}function St(e,t){const n=ht(e);return yt(bt(We([n,wt(t)])),tt.ContractAddress)}function xt(e){return Fe().sign.keyPair.fromSecretKey(e)}function vt(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=Fe().sign.keyPair(),n=ft.from(t.publicKey),r=ft.from(t.secretKey);return e?{publicKey:n,secretKey:r}:{publicKey:yt(n,tt.AccountAddress),secretKey:r.toString("hex")}}function Tt(e,t){return Fe().sign.detached(ft.from(e),ft.from(t))}function _t(e,t,n){return Fe().sign.detached.verify(e,t,ht(n))}function zt(e){const t=ft.from("aeternity Signed Message:\n","utf8"),n=ft.from(e,"utf8");return bt(We([(0,He.encode)(t.length),t,(0,He.encode)(n.length),n]))}function qt(e,t){return Tt(zt(e),t)}function Et(e,t,n){return _t(zt(e),t,n)}function Pt(e,t){const n=ft.from("TheMessage");return _t(n,Tt(n,e),yt("string"==typeof t?ft.from(t,"hex"):t,tt.AccountAddress))}const At=5e4,It=18e4,kt=36e3,Ot=84600,Mt=Ot,Bt=1e9,Rt=1e14,Dt=.05,jt=480,$t=31,Ut=12,Ft=Qe({31:3,30:5,29:8,28:13,27:21,26:34,25:55,24:89,23:144,22:233,21:377,20:610,19:987,18:1597,17:2584,16:4181,15:6765,14:10946,13:17711,12:28657,11:46368,10:75025,9:121393,8:196418,7:317811,6:514229,5:832040,4:1346269,3:2178309,2:3524578,1:5702887},(e=>{let[t,n]=e;return[t,new(c())(n).times(Rt)]}));let Vt;!function(e){e[e.Account=10]="Account",e[e.SignedTx=11]="SignedTx",e[e.SpendTx=12]="SpendTx",e[e.OracleRegisterTx=22]="OracleRegisterTx",e[e.OracleQueryTx=23]="OracleQueryTx",e[e.OracleResponseTx=24]="OracleResponseTx",e[e.OracleExtendTx=25]="OracleExtendTx",e[e.NameClaimTx=32]="NameClaimTx",e[e.NamePreclaimTx=33]="NamePreclaimTx",e[e.NameUpdateTx=34]="NameUpdateTx",e[e.NameRevokeTx=35]="NameRevokeTx",e[e.NameTransferTx=36]="NameTransferTx",e[e.Contract=40]="Contract",e[e.ContractCall=41]="ContractCall",e[e.ContractCreateTx=42]="ContractCreateTx",e[e.ContractCallTx=43]="ContractCallTx",e[e.ChannelCreateTx=50]="ChannelCreateTx",e[e.ChannelDepositTx=51]="ChannelDepositTx",e[e.ChannelWithdrawTx=52]="ChannelWithdrawTx",e[e.ChannelForceProgressTx=521]="ChannelForceProgressTx",e[e.ChannelCloseMutualTx=53]="ChannelCloseMutualTx",e[e.ChannelCloseSoloTx=54]="ChannelCloseSoloTx",e[e.ChannelSlashTx=55]="ChannelSlashTx",e[e.ChannelSettleTx=56]="ChannelSettleTx",e[e.ChannelOffChainTx=57]="ChannelOffChainTx",e[e.ChannelOffChainUpdateTransfer=570]="ChannelOffChainUpdateTransfer",e[e.ChannelOffChainUpdateDeposit=571]="ChannelOffChainUpdateDeposit",e[e.ChannelOffChainUpdateWithdraw=572]="ChannelOffChainUpdateWithdraw",e[e.ChannelOffChainUpdateCreateContract=573]="ChannelOffChainUpdateCreateContract",e[e.ChannelOffChainUpdateCallContract=574]="ChannelOffChainUpdateCallContract",e[e.ChannelClientReconnectTx=575]="ChannelClientReconnectTx",e[e.Channel=58]="Channel",e[e.ChannelSnapshotSoloTx=59]="ChannelSnapshotSoloTx",e[e.TreesPoi=60]="TreesPoi",e[e.StateTrees=62]="StateTrees",e[e.Mtree=63]="Mtree",e[e.MtreeValue=64]="MtreeValue",e[e.ContractsMtree=621]="ContractsMtree",e[e.CallsMtree=622]="CallsMtree",e[e.ChannelsMtree=623]="ChannelsMtree",e[e.NameserviceMtree=624]="NameserviceMtree",e[e.OraclesMtree=625]="OraclesMtree",e[e.AccountsMtree=626]="AccountsMtree",e[e.CompilerSophia=70]="CompilerSophia",e[e.GaAttachTx=80]="GaAttachTx",e[e.GaMetaTx=81]="GaMetaTx",e[e.PayingForTx=82]="PayingForTx"}(Vt||(Vt={}));var Ht=C(9408).Buffer;function Gt(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==e)return Ht.from([]);if(Number.isInteger(e)||c().isBigNumber(e)||t){if(c().isBigNumber(e)||(e=new(c())(e)),!e.isInteger())throw new A(`Unexpected not integer value: ${e.toFixed()}`);let t=e.toString(16);return t.length%2==1&&(t=`0${t}`),Ht.from(t,"hex")}if("string"==typeof e)return Ht.from(e);throw new q}var Lt=C(9408).Buffer;function Kt(e,t){return yt(bt(Lt.from([...ht(e),...Gt(t)])),tt.ContractAddress)}function Qt(e,t,n){return yt(bt(Lt.from([...ht(e),...function(e){const t=Gt(e,!0);return We([Lt.alloc(32-t.length),t])}(t),...ht(n)])),tt.OracleQueryId)}function Wt(e){return yt(bt(e.toLowerCase()),tt.Name)}function Yt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ct();return yt(bt(We([Lt.from(e.toLowerCase()),Lt.from(t.toString(16).padStart(64,"0"),"hex")])),tt.Commitment)}function Jt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Lt.from([]);return new(c())(Lt.from(e).toString("hex"),16).toString(10)}const Xt=".chain";function Zt(e){return e.endsWith(Xt)}const en=[[tt.AccountAddress,"account_pubkey"],[tt.OracleAddress,"oracle_pubkey"],[tt.ContractAddress,"contract_pubkey"],[tt.Channel,"channel"]];function tn(e){var t;ht(e);const n=e.substring(0,2),r=null===(t=en.find((e=>{let[t]=e;return t===n})))||void 0===t?void 0:t[1];if(null!=r)return r;throw new x("identifier",`prefixed with one of ${en.map((e=>{let[t]=e;return`${t}_`})).join(", ")}`,e)}function nn(e){const t=e.length-Xt.length;return Ft[Math.min(t,$t)]}function rn(e){let{startFee:t,increment:n=Dt}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Number(n)!==n||n%1==0)throw new xe(`Increment must be float. Current increment ${n}`);if(n<Dt)throw new xe(`minimum increment percentage is ${Dt}`);return l(new(c())(null!=t?t:nn(e)).times(new(c())(Dt).plus(1)))}function an(e,t){var n,r,a;const i=e.length-Xt.length;return(null!==(n=null!==(r=null!==(a=i<=4?62*jt:null)&&void 0!==a?a:i<=8?31*jt:null)&&void 0!==r?r:i<=12?jt:null)&&void 0!==n?n:0)+t}function on(e){return e.length<13+Xt.length}var sn={serialize(e){if(e<0)throw new x("value","greater or equal to 0",e);return Gt(e,!0)},deserialize(e){return Jt(e)}},cn={serialize(e){return sn.serialize(e)},deserialize(e){return+sn.deserialize(e)}},ln={...sn,serializeAettos(e){return null!=e?e:"0"},serialize(e,t){let{denomination:n,...r}=t;return sn.serialize(this.serializeAettos(null!=e?De(e,{denomination:n}):e,r))}},un=C(9408).Buffer;const dn=[tt.AccountAddress,tt.Name,tt.Commitment,tt.OracleAddress,tt.ContractAddress,tt.Channel];function pn(){return{serialize(e){const t=e.slice(0,2);if(n=t,!dn.includes(n))throw new qe(t);var n;const r=dn.indexOf(t)+1;return un.from([...Gt(r),...ht(e)])},deserialize(e){const t=un.from(e).readUIntBE(0,1),n=dn[t-1];if(null==n)throw new _e(t);return yt(e.subarray(1),n)}}}var mn={...ln,serialize(e,t){var n;if(null!==(n=e)&&void 0!==n||(e=0),0!=+e)throw new v(`Contract deposit is not refundable, so it should be equal 0, got ${e.toString()} instead`);return ln.serialize(e,t)}},hn=C(9408).Buffer;function yn(e,t){const n={[Vt.OracleRegisterTx]:"oracleTtlValue",[Vt.OracleExtendTx]:"oracleTtlValue",[Vt.OracleQueryTx]:"queryTtlValue",[Vt.OracleResponseTx]:"responseTtlValue"};return Ye(t,n)?e[n[t]]:1}function fn(e,t){const{rlpEncoded:{length:n},txObject:r}=t;return(e=>{var t;const n=null!==(t={[Vt.ChannelForceProgressTx]:30,[Vt.ChannelOffChainTx]:0,[Vt.ChannelOffChainUpdateCallContract]:0,[Vt.ChannelOffChainUpdateCreateContract]:0,[Vt.ChannelOffChainUpdateDeposit]:0,[Vt.ChannelOffChainUpdateWithdraw]:0,[Vt.ChannelOffChainUpdateTransfer]:0,[Vt.ContractCreateTx]:5,[Vt.ContractCallTx]:12,[Vt.GaAttachTx]:5,[Vt.GaMetaTx]:5,[Vt.PayingForTx]:.2}[e])&&void 0!==t?t:1;return new(c())(15e3*n)})(e).plus(((e,t,n)=>{let{relativeTtl:r,innerTxSize:a}=n;switch(e){case Vt.OracleRegisterTx:case Vt.OracleExtendTx:case Vt.OracleQueryTx:case Vt.OracleResponseTx:return new(c())(t).times(20).plus(Math.ceil(32e3*r/Math.floor(175200)));case Vt.GaMetaTx:case Vt.PayingForTx:return new(c())(t).minus(a).times(20);default:return new(c())(t).times(20)}})(e,n,{relativeTtl:yn(r,e),innerTxSize:[Vt.GaMetaTx,Vt.PayingForTx].includes(e)?r.tx.tx.encodedTx.rlpEncoded.length:0})).times(Bt)}var gn={...ln,serializeAettos(e,t){let{txType:n,rebuildTx:r,_computingMinFee:a}=t;if(null!=a)return a;const i=function(e,t){let n,r=new(c())(0);do{n=r,r=fn(e,t(r))}while(!r.eq(n));return r}(n,(e=>r({_computingMinFee:e}))),o=new(c())(null!=e?e:i);if(i.gt(o))throw new v(`Fee ${o.toString()} must be bigger then ${i}`);return o.toFixed()}},Nn={...cn,serialize(e,t){let{txType:n,rebuildTx:r,gasMax:a=6e6,_computingGasLimit:i}=t;if(null!=i)return cn.serialize(i);const o=n===Vt.GaMetaTx?At:function(e,t,n){return t-+fn(e,n(t)).dividedBy(Bt)}(n,a,(e=>r({_computingGasLimit:e}))),s=null!=e?e:o;if(s>o)throw new v(`Gas limit ${s} must be less or equal to ${o}`);return cn.serialize(s)}},Cn={...ln,serializeAettos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bt.toString();if(+e<Bt)throw new v(`Gas price ${e.toString()} must be bigger then ${Bt}`);return e}},wn=C(9408).Buffer,bn={serialize(e){return wn.from(e)},deserialize(e){return e.toString()}},Sn={serialize(e){return bn.serialize(e)},deserialize(e){return bn.deserialize(e)}},xn={...ln,serializeAettos(e,t){const n=nn(t.name),r=new(c())(null!=e?e:n);if(n.gt(r))throw new $(r,n);return r.toFixed()},serialize(e,t){return ln.serialize.call(this,e,t)}};const vn=pn();var Tn={...vn,serialize(e){return vn.serialize(Zt(e)?Wt(e):e)}};const _n=pn(),zn=sn,qn=cn,En=ln,Pn=pn,An=function(){const e=pn();return{serialize(t){return t.map(e.serialize)},deserialize(t){return t.map(e.deserialize)}}},In=mn,kn=function(){return{serialize(e){if("number"!=typeof e)throw new x("value","to be a number",e);if(e>255)throw new x("value","to be less than 256",e);return hn.from([e])},deserialize(e){if(1!==e.length)throw new x("buffer","to have single element",e.length);return e[0]}}},On=gn,Mn=Nn,Bn=Cn,Rn=Sn,Dn=xn,jn=Tn,$n={serialize(e){if(e.length>32)throw new v(`Expected 32 pointers or less, got ${e.length} instead`);return e.map((e=>[Gt(e.key),_n.serialize(e.id)]))},deserialize(e){return e.map((e=>{let[t,n]=e;return{key:t.toString(),id:_n.deserialize(n)}}))}};let Un;!function(e){e[e.delta=0]="delta",e[e.block=1]="block"}(Un||(Un={}));const Fn=0,Vn=3e4,Hn={type:Un.delta,value:500},Gn={type:Un.delta,value:10},Ln={type:Un.delta,value:10},Kn={pub:"ak_11111111111111111111111111111111273Yts",amount:100000000000000000000000000000000000n};let Qn,Wn,Yn,Jn;!function(e){e[e.NO_VM=0]="NO_VM",e[e.SOPHIA=1]="SOPHIA",e[e.SOPHIA_IMPROVEMENTS_MINERVA=3]="SOPHIA_IMPROVEMENTS_MINERVA",e[e.SOPHIA_IMPROVEMENTS_FORTUNA=4]="SOPHIA_IMPROVEMENTS_FORTUNA",e[e.FATE=5]="FATE",e[e.SOPHIA_IMPROVEMENTS_LIMA=6]="SOPHIA_IMPROVEMENTS_LIMA",e[e.FATE_2=7]="FATE_2"}(Qn||(Qn={})),function(e){e[e.NO_ABI=0]="NO_ABI",e[e.SOPHIA=1]="SOPHIA",e[e.FATE=3]="FATE"}(Wn||(Wn={})),function(e){e[e.Ok=0]="Ok",e[e.Error=1]="Error",e[e.Revert=2]="Revert"}(Yn||(Yn={})),function(e){e[e.IRIS=5]="IRIS"}(Jn||(Jn={}));const Xn={[Jn.IRIS]:{[Vt.ContractCreateTx]:{vmVersion:[Qn.FATE_2],abiVersion:[Wn.FATE]},[Vt.ContractCallTx]:{vmVersion:[],abiVersion:[Wn.FATE,Wn.SOPHIA]},[Vt.OracleRegisterTx]:{vmVersion:[],abiVersion:[Wn.NO_ABI,Wn.SOPHIA]}}};let Zn;!function(e){e[e.string=0]="string",e[e.binary=1]="binary",e[e.bool=2]="bool",e[e.hex=3]="hex",e[e.rlpBinary=4]="rlpBinary",e[e.rlpBinaries=5]="rlpBinaries",e[e.rawBinary=6]="rawBinary",e[e.signatures=7]="signatures",e[e.offChainUpdates=8]="offChainUpdates",e[e.callStack=9]="callStack",e[e.proofOfInclusion=10]="proofOfInclusion",e[e.mptrees=11]="mptrees",e[e.ctVersion=12]="ctVersion",e[e.sophiaCodeTypeInfo=13]="sophiaCodeTypeInfo",e[e.payload=14]="payload",e[e.stateTree=15]="stateTree"}(Zn||(Zn={}));const er=[["tag",qn],["VSN",qn]],tr={[Vt.Account]:{1:[...er,["nonce",qn],["balance",zn]],2:[...er,["flags",zn],["nonce",qn],["balance",zn],["gaContract",Pn()],["gaAuthFun",Zn.binary,tt.ContractBytearray]]},[Vt.SignedTx]:{1:[...er,["signatures",Zn.signatures],["encodedTx",Zn.rlpBinary]]},[Vt.SpendTx]:{1:[...er,["senderId",Pn()],["recipientId",Pn()],["amount",En],["fee",On],["ttl",qn],["nonce",qn],["payload",Zn.payload]]},[Vt.NamePreclaimTx]:{1:[...er,["accountId",Pn()],["nonce",qn],["commitmentId",Pn()],["fee",On],["ttl",qn]]},[Vt.NameClaimTx]:{2:[...er,["accountId",Pn()],["nonce",qn],["name",Rn],["nameSalt",zn],["nameFee",Dn],["fee",On],["ttl",qn]]},[Vt.NameUpdateTx]:{1:[...er,["accountId",Pn()],["nonce",qn],["nameId",jn],["nameTtl",qn],["pointers",$n],["clientTtl",qn],["fee",On],["ttl",qn]]},[Vt.NameTransferTx]:{1:[...er,["accountId",Pn()],["nonce",qn],["nameId",jn],["recipientId",Pn()],["fee",On],["ttl",qn]]},[Vt.NameRevokeTx]:{1:[...er,["accountId",Pn()],["nonce",qn],["nameId",jn],["fee",On],["ttl",qn]]},[Vt.Contract]:{1:[...er,["owner",Pn()],["ctVersion",Zn.ctVersion],["code",Zn.binary,tt.ContractBytearray],["log",Zn.binary,tt.ContractBytearray],["active",Zn.bool],["referers",An()],["deposit",In]]},[Vt.ContractCreateTx]:{1:[...er,["ownerId",Pn()],["nonce",qn],["code",Zn.binary,tt.ContractBytearray],["ctVersion",Zn.ctVersion],["fee",On],["ttl",qn],["deposit",In],["amount",En],["gasLimit",Mn],["gasPrice",Bn],["callData",Zn.binary,tt.ContractBytearray]]},[Vt.ContractCallTx]:{1:[...er,["callerId",Pn()],["nonce",qn],["contractId",Pn()],["abiVersion",kn()],["fee",On],["ttl",qn],["amount",En],["gasLimit",Mn],["gasPrice",Bn],["callData",Zn.binary,tt.ContractBytearray]]},[Vt.ContractCall]:{1:[...er,["callerId",Pn()],["callerNonce",qn],["height",qn],["contractId",Pn()],["gasPrice",Bn],["gasUsed",qn],["returnValue",Zn.binary,tt.ContractBytearray],["returnType",kn()],["log",Zn.rawBinary]]},[Vt.OracleRegisterTx]:{1:[...er,["accountId",Pn()],["nonce",qn],["queryFormat",Zn.string],["responseFormat",Zn.string],["queryFee",En],["oracleTtlType",kn()],["oracleTtlValue",qn],["fee",On],["ttl",qn],["abiVersion",kn()]]},[Vt.OracleExtendTx]:{1:[...er,["oracleId",Pn()],["nonce",qn],["oracleTtlType",kn()],["oracleTtlValue",qn],["fee",On],["ttl",qn]]},[Vt.OracleQueryTx]:{1:[...er,["senderId",Pn()],["nonce",qn],["oracleId",Pn()],["query",Zn.string],["queryFee",En],["queryTtlType",kn()],["queryTtlValue",qn],["responseTtlType",kn()],["responseTtlValue",qn],["fee",On],["ttl",qn]]},[Vt.OracleResponseTx]:{1:[...er,["oracleId",Pn()],["nonce",qn],["queryId",Zn.binary,tt.OracleQueryId],["response",Zn.string],["responseTtlType",kn()],["responseTtlValue",qn],["fee",On],["ttl",qn]]},[Vt.ChannelCreateTx]:{2:[...er,["initiator",Pn()],["initiatorAmount",zn],["responder",Pn()],["responderAmount",zn],["channelReserve",zn],["lockPeriod",zn],["ttl",qn],["fee",On],["initiatorDelegateIds",Zn.string],["responderDelegateIds",Zn.string],["stateHash",Zn.binary,tt.State],["nonce",qn]]},[Vt.ChannelCloseMutualTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["initiatorAmountFinal",zn],["responderAmountFinal",zn],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelCloseSoloTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["payload",Zn.binary,tt.Transaction],["poi",Zn.binary,tt.Poi],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelSlashTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["payload",Zn.binary,tt.Transaction],["poi",Zn.binary,tt.Poi],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelDepositTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["amount",zn],["ttl",qn],["fee",On],["stateHash",Zn.binary,tt.State],["round",qn],["nonce",qn]]},[Vt.ChannelWithdrawTx]:{1:[...er,["channelId",Pn()],["toId",Pn()],["amount",zn],["ttl",qn],["fee",On],["stateHash",Zn.binary,tt.State],["round",qn],["nonce",qn]]},[Vt.ChannelSettleTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["initiatorAmountFinal",zn],["responderAmountFinal",zn],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelForceProgressTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["payload",Zn.binary,tt.Transaction],["round",qn],["update",Zn.binary,tt.ContractBytearray],["stateHash",Zn.binary,tt.State],["offChainTrees",Zn.stateTree],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelOffChainTx]:{2:[...er,["channelId",Pn()],["round",qn],["stateHash",Zn.binary,tt.State]]},[Vt.Channel]:{3:[...er,["initiator",Pn()],["responder",Pn()],["channelAmount",zn],["initiatorAmount",zn],["responderAmount",zn],["channelReserve",zn],["initiatorDelegateIds",An()],["responderDelegateIds",An()],["stateHash",Zn.hex],["round",qn],["soloRound",zn],["lockPeriod",zn],["lockedUntil",zn],["initiatorAuth",Zn.binary,tt.ContractBytearray],["responderAuth",Zn.binary,tt.ContractBytearray]]},[Vt.ChannelSnapshotSoloTx]:{1:[...er,["channelId",Pn()],["fromId",Pn()],["payload",Zn.binary,tt.Transaction],["ttl",qn],["fee",On],["nonce",qn]]},[Vt.ChannelOffChainUpdateTransfer]:{1:[...er,["from",Pn()],["to",Pn()],["amount",zn]]},[Vt.ChannelOffChainUpdateDeposit]:{1:[...er,["from",Pn()],["amount",zn]]},[Vt.ChannelOffChainUpdateWithdraw]:{1:[...er,["from",Pn()],["amount",zn]]},[Vt.ChannelOffChainUpdateCreateContract]:{1:[...er,["owner",Pn()],["ctVersion",Zn.ctVersion],["code",Zn.binary,tt.ContractBytearray],["deposit",zn],["callData",Zn.binary,tt.ContractBytearray]]},[Vt.ChannelOffChainUpdateCallContract]:{1:[...er,["caller",Pn()],["contract",Pn()],["abiVersion",kn()],["amount",zn],["callData",Zn.binary,tt.ContractBytearray],["callStack",Zn.callStack],["gasPrice",Bn],["gasLimit",Mn]]},[Vt.ChannelClientReconnectTx]:{1:[...er,["channelId",Pn()],["round",qn],["role",Zn.string],["pubkey",Pn()]]},[Vt.TreesPoi]:{1:[...er,["accounts",Zn.mptrees],["calls",Zn.mptrees],["channels",Zn.mptrees],["contracts",Zn.mptrees],["ns",Zn.mptrees],["oracles",Zn.mptrees]]},[Vt.StateTrees]:{1:[...er,["contracts",Zn.rlpBinary],["calls",Zn.rlpBinary],["channels",Zn.rlpBinary],["ns",Zn.rlpBinary],["oracles",Zn.rlpBinary],["accounts",Zn.rlpBinary]]},[Vt.Mtree]:{1:[...er,["values",Zn.rlpBinaries]]},[Vt.MtreeValue]:{1:[...er,["key",Zn.hex],["value",Zn.rawBinary]]},[Vt.ContractsMtree]:{1:[...er,["contracts",Zn.rlpBinary]]},[Vt.CallsMtree]:{1:[...er,["calls",Zn.rlpBinary]]},[Vt.ChannelsMtree]:{1:[...er,["channels",Zn.rlpBinary]]},[Vt.NameserviceMtree]:{1:[...er,["mtree",Zn.rlpBinary]]},[Vt.OraclesMtree]:{1:[...er,["otree",Zn.rlpBinary]]},[Vt.AccountsMtree]:{1:[...er,["accounts",Zn.rlpBinary]]},[Vt.GaAttachTx]:{1:[...er,["ownerId",Pn()],["nonce",qn],["code",Zn.binary,tt.ContractBytearray],["authFun",Zn.rawBinary],["ctVersion",Zn.ctVersion],["fee",On],["ttl",qn],["gasLimit",Mn],["gasPrice",Bn],["callData",Zn.binary,tt.ContractBytearray]]},[Vt.GaMetaTx]:{2:[...er,["gaId",Pn()],["authData",Zn.binary,tt.ContractBytearray],["abiVersion",kn()],["fee",On],["gasLimit",Mn],["gasPrice",Bn],["tx",Zn.rlpBinary]]},[Vt.PayingForTx]:{1:[...er,["payerId",Pn()],["nonce",qn],["fee",On],["tx",Zn.rlpBinary]]},[Vt.CompilerSophia]:{3:[...er,["sourceCodeHash",Zn.rawBinary],["typeInfo",Zn.sophiaCodeTypeInfo],["byteCode",Zn.rawBinary],["compilerVersion",Zn.string],["payable",Zn.bool]]}};var nr,rr=C(3485),ar=C(9408).Buffer;!function(e){e[e.Branch=0]="Branch",e[e.Extension=1]="Extension",e[e.Leaf=2]="Leaf"}(nr||(nr={}));class ir{static nodeHash(e){return ar.from(bt((0,rr.encode)(e))).toString("hex")}constructor(e){if(this.rootHash=e[0].toString("hex"),this.nodes=Object.fromEntries(e[1].map((e=>[e[0].toString("hex"),e[1]]))),void 0===this.nodes[this.rootHash])throw new ye("Can't find a node by root hash");Object.entries(this.nodes).forEach((e=>{let[t,n]=e;if(ir.nodeHash(n)!==t)throw new he;const{type:r,payload:a}=ir.parseNode(n);switch(r){case nr.Branch:a.slice(0,16).filter((e=>e.length)).forEach((e=>{if(void 0===this.nodes[e.toString("hex")])throw new ye("Can't find a node by hash in branch node")}));break;case nr.Extension:if(void 0===this.nodes[a[0].toString("hex")])throw new ye("Can't find a node by hash in extension node")}}))}isEqual(e){return this.rootHash===e.rootHash}static parseNode(e){switch(e.length){case 17:return{type:nr.Branch,payload:e,path:null};case 2:{const t=e[0][0]>>4;if(t>3)throw new ge(t);const n=t<=1?nr.Extension:nr.Leaf,r=[0,2].includes(t)?2:1;return{type:n,payload:[e[1]],path:e[0].toString("hex").slice(r)}}default:throw new fe(e.length)}}serialize(){return[ar.from(this.rootHash,"hex"),Object.entries(this.nodes).map((e=>{let[t,n]=e;return[ar.from(t,"hex"),n]}))]}get(e){let t=this.rootHash,n=e;for(;;){const{type:e,payload:r,path:a}=ir.parseNode(this.nodes[t]);switch(e){case nr.Branch:if(0===n.length)return r[16];t=r[+`0x${n[0]}`].toString("hex"),n=n.substring(1);break;case nr.Extension:if(n.substring(0,null==a?void 0:a.length)!==a)return;t=r[0].toString("hex"),n=n.substring(a.length);break;case nr.Leaf:if(a!==n)return;return r[0]}}}}var or=C(9408).Buffer;function sr(e,t,n){if(null==e)return"";switch(t){case Zn.ctVersion:{const[t,,n]=e;return{vmVersion:Jt(or.from([t])),abiVersion:Jt(or.from([n]))}}case Zn.bool:return 1===e[0];case Zn.binary:return yt(e,n);case Zn.stateTree:return yt(e,tt.StateTrees);case Zn.string:return e.toString();case Zn.payload:return yt(e,tt.Bytearray);case Zn.rlpBinary:return mr(yt(e,tt.Transaction));case Zn.rlpBinaries:return e.map((e=>mr(yt(e,tt.Transaction))));case Zn.rawBinary:return e;case Zn.hex:return e.toString("hex");case Zn.offChainUpdates:return e.map((e=>mr(yt(e,tt.Transaction))));case Zn.callStack:return[Jt(e)];case Zn.mptrees:return e.map((e=>new ir(e)));case Zn.sophiaCodeTypeInfo:return e.reduce(((e,t)=>{let[n,r,a,i]=t;return{...e,[r.toString()]:{funHash:n,argType:a,outType:i}}}),{});default:return"number"==typeof t?e:t.deserialize(e)}}function cr(e,t,n){var r;switch(t){case Zn.bool:return or.from([!0===e?1:0]);case Zn.binary:case Zn.stateTree:return ht(e);case Zn.hex:return or.from(e,"hex");case Zn.signatures:return e.map(or.from);case Zn.payload:return"string"==typeof e&&"ba"===e.split("_")[0]?ht(e):Gt(e);case Zn.string:return Gt(e);case Zn.rlpBinary:return null!==(r=e.rlpEncoded)&&void 0!==r?r:e;case Zn.mptrees:return e.map((e=>e.serialize()));case Zn.ctVersion:return or.from([...Gt(e.vmVersion),0,...Gt(e.abiVersion)]);default:return"number"==typeof t?e:t.serialize(e,n)}}function lr(e,t){return null==e?"Field is required":t===Zn.ctVersion?Boolean(e.abiVersion)&&Boolean(e.vmVersion)?void 0:'Value must be an object with "vmVersion" and "abiVersion" fields':void 0}function ur(e,t,n){let{excludeKeys:r=[]}=n;const a=["payload","nameFee","deposit","gasPrice","fee","gasLimit","amount"];return Object.fromEntries(t.filter((e=>{let[t]=e;return!r.includes(t)&&!a.includes(t)})).map((t=>{let[n,r]=t;return[n,lr(e[n],r)]})).filter((e=>{let[,t]=e;return t})))}function dr(e,t){return t.reduce(((t,n,r)=>{let[a,i,o]=n;return Object.assign(t,{[a]:sr(e[r],i,o)})}),{})}function pr(e,t){var n;let{excludeKeys:r=[],prefix:a=tt.Transaction,vsn:i,denomination:o=Be.AETTOS}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=tr[t];if(null!==(n=i)&&void 0!==n||(i=Math.max(...Object.keys(s).map((e=>+e)))),!Ye(i,s))throw new ze("serialization",Vt[t],i);const c=s[i],l=e;l.VSN=i,l.tag=t,l.denomination=o;const u=c.filter((e=>{let[t]=e;return!r.includes(t)})),d=ur(l,c,{excludeKeys:r});if(Object.keys(d).length>0)throw new Te(`Transaction build error. ${JSON.stringify(d)}`);const p=u.map((e=>{let[n,a]=e;return cr(l[n],a,{...l,txType:t,rebuildTx:e=>pr({...l,...e},t,{excludeKeys:r,prefix:tt.Transaction,vsn:i,denomination:o})})})).filter((e=>void 0!==e)),m=(0,rr.encode)(p),h=yt(m,a);return{tx:h,rlpEncoded:m,binary:p,txObject:dr(p,c)}}function mr(e,t){const n=ht(e),r=(0,rr.decode)(n),a=+Jt(r[0]);if(!Ye(a,tr))throw new we(`Unknown transaction tag: ${a}`);if(null!=t&&t!==a)throw new we(`Expected transaction to have ${Vt[t]} tag, got ${Vt[a]} instead`);const i=+Jt(r[1]);if(!Ye(i,tr[a]))throw new ze("deserialization",`tag ${a}`,i);return{txType:a,tx:dr(r,tr[a][i]),rlpEncoded:n}}function hr(e){return yt(bt("string"==typeof e&&e.startsWith("tx_")?ht(e):e),tt.TxHash)}function yr(e){const{txType:t,tx:n}=mr(e);if(![Vt.ContractCreateTx,Vt.GaAttachTx].includes(t))throw new x("contractCreateTx","a contractCreateTx or gaAttach",t);return Kt(n.ownerId,+n.nonce)}function fr(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function gr(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,fr(e,t,"get"))}function Nr(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,fr(e,t,"set"),n),n}function Cr(e,t,n){const r=e=>e.split(/[-+]/)[0].split(".").map((e=>+e)),a=r(e),i=r(t),o=r(n),s=Math.max(...a,...i,...o)+1,c=e=>e.reverse().reduce(((e,t,n)=>e+t*s**n),0),l=c(a),u=c(i),d=c(o);return l>=u&&l<d}const wr=()=>{const e=new Map;return{policy:{name:"request-queues",async sendRequest(t,n){var r;const a=t.headers.get("__queue");t.headers.delete("__queue");const i=async()=>n(t);if(null==a)return i();const o=(null!==(r=e.get(a))&&void 0!==r?r:Promise.resolve()).then(i,i);return e.set(a,o.then((async()=>Ke(750)))),o}},position:"perCall"}},br=()=>{const e=new Map;return{policy:{name:"combine-get-requests",async sendRequest(t,n){var r;if("GET"!==t.method)return n(t);const a=JSON.stringify([t.url,t.body]),i=null!==(r=e.get(a))&&void 0!==r?r:n(t);e.set(a,i);try{return await i}finally{e.delete(a)}}},position:"perCall"}},Sr=()=>{const e=new Map;return{name:"aggressive-cache-get-responses",async sendRequest(t,n){var r;if("GET"!==t.method)return n(t);const a=JSON.stringify([t.url,t.body]),i=null!==(r=e.get(a))&&void 0!==r?r:n(t);return e.set(a,i),i}}},xr=e=>({policy:{name:"error-formatter",async sendRequest(t,n){try{return await n(t)}catch(t){var r;if(!(t instanceof Ge.RestError)||null==t.request)throw t;if(null==(null===(r=t.response)||void 0===r?void 0:r.bodyAsText))throw t;let n;try{n=JSON.parse(t.response.bodyAsText)}catch(e){throw t}t.message=`${new URL(t.request.url).pathname.slice(1)} error`;const a=e(n);throw""!==a&&(t.message+=`:${a}`),t}}},position:"perCall"}),vr=(e,t,n,r,a)=>({name:"version-check",async sendRequest(i,o){if(new URL(i.url).pathname===t)return o(i);const s=[await n,r,a];if(!Cr(...s))throw new M(e,...s);return o(i)}});var Tr=C(4711);const _r={type:{name:"Composite",className:"Header",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},miner:{serializedName:"miner",type:{name:"String"}},beneficiary:{serializedName:"beneficiary",type:{name:"String"}},target:{serializedName:"target",type:{name:"String"}},pow:{constraints:{MinItems:42,MaxItems:42},serializedName:"pow",type:{name:"Sequence",element:{type:{name:"String"}}}},nonce:{serializedName:"nonce",type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},info:{serializedName:"info",type:{name:"String"}},pofHash:{serializedName:"pof_hash",type:{name:"String"}},txsHash:{serializedName:"txs_hash",type:{name:"String"}},signature:{serializedName:"signature",type:{name:"String"}}}}},zr={type:{name:"Composite",className:"ErrorModel",modelProperties:{reason:{serializedName:"reason",required:!0,type:{name:"String"}}}}},qr={type:{name:"Composite",className:"KeyBlock",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},miner:{serializedName:"miner",required:!0,type:{name:"String"}},beneficiary:{serializedName:"beneficiary",required:!0,type:{name:"String"}},target:{serializedName:"target",required:!0,type:{name:"String"}},pow:{constraints:{MinItems:42,MaxItems:42},serializedName:"pow",type:{name:"Sequence",element:{type:{name:"String"}}}},nonce:{serializedName:"nonce",type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},info:{serializedName:"info",required:!0,type:{name:"String"}}}}},Er={type:{name:"Composite",className:"HashResponse",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}}}}},Pr={type:{name:"Composite",className:"HeightResponse",modelProperties:{height:{serializedName:"height",required:!0,type:{name:"String"}}}}},Ar={type:{name:"Composite",className:"MicroBlockHeader",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},pofHash:{serializedName:"pof_hash",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},txsHash:{serializedName:"txs_hash",required:!0,type:{name:"String"}},signature:{serializedName:"signature",required:!0,type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}}}}},Ir={type:{name:"Composite",className:"SignedTxs",modelProperties:{transactions:{serializedName:"transactions",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"SignedTx"}}}}}}},kr={type:{name:"Composite",className:"SignedTx",modelProperties:{tx:{serializedName:"tx",type:{name:"Composite",className:"Tx"}},blockHeight:{serializedName:"block_height",required:!0,type:{name:"String"}},blockHash:{serializedName:"block_hash",required:!0,type:{name:"String"}},hash:{serializedName:"hash",required:!0,type:{name:"String"}},signatures:{serializedName:"signatures",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Or={type:{name:"Composite",className:"Tx",uberParent:"Tx",polymorphicDiscriminator:{serializedName:"type",clientName:"type"},modelProperties:{recipientId:{serializedName:"recipient_id",type:{name:"String"}},amount:{serializedName:"amount",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},payload:{serializedName:"payload",type:{name:"String"}},initiatorId:{serializedName:"initiator_id",type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",type:{name:"String"}},responderId:{serializedName:"responder_id",type:{name:"String"}},responderAmount:{serializedName:"responder_amount",type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",type:{name:"String"}},lockPeriod:{serializedName:"lock_period",type:{name:"String"}},stateHash:{serializedName:"state_hash",type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}},channelId:{serializedName:"channel_id",type:{name:"String"}},fromId:{serializedName:"from_id",type:{name:"String"}},round:{serializedName:"round",type:{name:"String"}},toId:{serializedName:"to_id",type:{name:"String"}},update:{serializedName:"update",type:{name:"Composite",className:"OffChainUpdate"}},offchainTrees:{serializedName:"offchain_trees",type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",type:{name:"String"}},poi:{serializedName:"poi",type:{name:"String"}},initiatorDelegateIds:{serializedName:"initiator_delegate_ids",type:{name:"Sequence",element:{type:{name:"String"}}}},responderDelegateIds:{serializedName:"responder_delegate_ids",type:{name:"Sequence",element:{type:{name:"String"}}}},queryFormat:{serializedName:"query_format",type:{name:"String"}},responseFormat:{serializedName:"response_format",type:{name:"String"}},queryFee:{serializedName:"query_fee",type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"RelativeTTL"}},accountId:{serializedName:"account_id",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}},oracleId:{serializedName:"oracle_id",type:{name:"String"}},query:{serializedName:"query",type:{name:"String"}},queryTtl:{serializedName:"query_ttl",type:{name:"Composite",className:"Ttl"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},queryId:{serializedName:"query_id",type:{name:"String"}},response:{serializedName:"response",type:{name:"String"}},commitmentId:{serializedName:"commitment_id",type:{name:"String"}},name:{serializedName:"name",type:{name:"String"}},nameSalt:{serializedName:"name_salt",type:{name:"String"}},nameFee:{serializedName:"name_fee",type:{name:"String"}},nameId:{serializedName:"name_id",type:{name:"String"}},nameTtl:{serializedName:"name_ttl",type:{name:"String"}},pointers:{serializedName:"pointers",type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}},clientTtl:{serializedName:"client_ttl",type:{name:"String"}},ownerId:{serializedName:"owner_id",type:{name:"String"}},code:{serializedName:"code",type:{name:"String"}},vmVersion:{serializedName:"vm_version",type:{name:"String"}},deposit:{serializedName:"deposit",type:{name:"String"}},gas:{serializedName:"gas",type:{name:"String"}},gasPrice:{serializedName:"gas_price",type:{name:"String"}},callData:{serializedName:"call_data",type:{name:"String"}},callerId:{serializedName:"caller_id",type:{name:"String"}},contractId:{serializedName:"contract_id",type:{name:"String"}},authFun:{constraints:{Pattern:new RegExp("^(0x|0X)?[a-fA-F0-9]+$")},serializedName:"auth_fun",type:{name:"String"}},gaId:{serializedName:"ga_id",type:{name:"String"}},authData:{serializedName:"auth_data",type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}},payerId:{serializedName:"payer_id",type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},type:{serializedName:"type",required:!0,type:{name:"Enum",allowedValues:["SpendTx","ChannelCreateTx","ChannelDepositTx","ChannelWithdrawTx","ChannelForceProgressTx","ChannelCloseMutualTx","ChannelCloseSoloTx","ChannelSlashTx","ChannelSettleTx","ChannelSnapshotSoloTx","ChannelSetDelegatesTx","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleRespondTx","NamePreclaimTx","NameClaimTx","NameUpdateTx","NameTransferTx","NameRevokeTx","ContractCreateTx","ContractCallTx","GAAttachTx","GAMetaTx","PayingForTx"]}}}}},Mr={type:{name:"Composite",className:"Delegates",modelProperties:{initiator:{serializedName:"initiator",type:{name:"Sequence",element:{type:{name:"String"}}}},responder:{serializedName:"responder",type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Br={type:{name:"Composite",className:"OffChainUpdate",uberParent:"OffChainUpdate",polymorphicDiscriminator:{serializedName:"op",clientName:"op"},modelProperties:{op:{serializedName:"op",required:!0,type:{name:"String"}}}}},Rr={type:{name:"Composite",className:"RelativeTTL",modelProperties:{type:{defaultValue:"delta",isConstant:!0,serializedName:"type",type:{name:"String"}},value:{serializedName:"value",required:!0,type:{name:"String"}}}}},Dr={type:{name:"Composite",className:"Ttl",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"Enum",allowedValues:["delta","block"]}},value:{serializedName:"value",required:!0,type:{name:"String"}}}}},jr={type:{name:"Composite",className:"NamePointer",modelProperties:{key:{serializedName:"key",required:!0,type:{name:"String"}},id:{serializedName:"id",required:!0,type:{name:"String"}}}}},$r={type:{name:"Composite",className:"CountResponse",modelProperties:{count:{serializedName:"count",required:!0,type:{name:"String"}}}}},Ur={type:{name:"Composite",className:"Generation",modelProperties:{keyBlock:{serializedName:"key_block",type:{name:"Composite",className:"KeyBlock"}},microBlocks:{serializedName:"micro_blocks",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Fr={type:{name:"Composite",className:"Account",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},balance:{serializedName:"balance",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},payable:{serializedName:"payable",type:{name:"Boolean"}},kind:{serializedName:"kind",type:{name:"Enum",allowedValues:["basic","generalized"]}},contractId:{serializedName:"contract_id",type:{name:"String"}},authFun:{serializedName:"auth_fun",type:{name:"String"}}}}},Vr={type:{name:"Composite",className:"NextNonceResponse",modelProperties:{nextNonce:{serializedName:"next_nonce",required:!0,type:{name:"String"}}}}},Hr={type:{name:"Composite",className:"DryRunInput",modelProperties:{top:{serializedName:"top",type:{name:"String"}},accounts:{serializedName:"accounts",type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunAccount"}}}},txs:{serializedName:"txs",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunInputItem"}}}},txEvents:{defaultValue:!1,serializedName:"tx_events",type:{name:"Boolean"}}}}},Gr={type:{name:"Composite",className:"DryRunAccount",modelProperties:{pubKey:{serializedName:"pub_key",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Lr={type:{name:"Composite",className:"DryRunInputItem",modelProperties:{tx:{serializedName:"tx",type:{name:"String"}},callReq:{serializedName:"call_req",type:{name:"Composite",className:"DryRunCallReq"}}}}},Kr={type:{name:"Composite",className:"DryRunCallReq",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},contract:{serializedName:"contract",required:!0,type:{name:"String"}},amount:{serializedName:"amount",type:{name:"String"}},gas:{serializedName:"gas",type:{name:"String"}},caller:{serializedName:"caller",type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}},context:{serializedName:"context",type:{name:"Composite",className:"DryRunCallContext"}}}}},Qr={type:{name:"Composite",className:"DryRunCallContext",modelProperties:{tx:{serializedName:"tx",type:{name:"String"}},txHash:{serializedName:"tx_hash",type:{name:"String"}},stateful:{serializedName:"stateful",type:{name:"Boolean"}}}}},Wr={type:{name:"Composite",className:"DryRunResults",modelProperties:{results:{serializedName:"results",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunResult"}}}},txEvents:{serializedName:"tx_events",type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}}}}},Yr={type:{name:"Composite",className:"DryRunResult",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"String"}},result:{serializedName:"result",required:!0,type:{name:"String"}},reason:{serializedName:"reason",type:{name:"String"}},callObj:{serializedName:"call_obj",type:{name:"Composite",className:"ContractCallObject"}}}}},Jr={type:{name:"Composite",className:"ContractCallObject",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},callerNonce:{serializedName:"caller_nonce",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},gasUsed:{serializedName:"gas_used",required:!0,type:{name:"String"}},log:{serializedName:"log",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"Event"}}}},returnValue:{serializedName:"return_value",required:!0,type:{name:"String"}},returnType:{serializedName:"return_type",required:!0,type:{name:"Enum",allowedValues:["ok","error","revert"]}}}}},Xr={type:{name:"Composite",className:"Event",modelProperties:{address:{serializedName:"address",required:!0,type:{name:"String"}},topics:{serializedName:"topics",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},data:{serializedName:"data",required:!0,type:{name:"String"}}}}},Zr={type:{name:"Composite",className:"TxInfoObject",modelProperties:{callInfo:{serializedName:"call_info",type:{name:"Composite",className:"ContractCallObject"}},gaInfo:{serializedName:"ga_info",type:{name:"Composite",className:"GAObject"}},txInfo:{serializedName:"tx_info",type:{name:"String"}}}}},ea={type:{name:"Composite",className:"GAObject",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},gasUsed:{serializedName:"gas_used",required:!0,type:{name:"String"}},returnValue:{serializedName:"return_value",required:!0,type:{name:"String"}},returnType:{serializedName:"return_type",required:!0,type:{name:"Enum",allowedValues:["ok","error"]}},innerObject:{serializedName:"inner_object",type:{name:"Composite",className:"TxInfoObject"}}}}},ta={type:{name:"Composite",className:"EncodedTx",modelProperties:{tx:{serializedName:"tx",required:!0,type:{name:"String"}}}}},na={type:{name:"Composite",className:"PostTxResponse",modelProperties:{txHash:{serializedName:"tx_hash",required:!0,type:{name:"String"}}}}},ra={type:{name:"Composite",className:"ContractObject",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},active:{serializedName:"active",required:!0,type:{name:"Boolean"}},referrerIds:{serializedName:"referrer_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}}}}},aa={type:{name:"Composite",className:"ByteCode",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},ia={type:{name:"Composite",className:"PoI",modelProperties:{poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},oa={type:{name:"Composite",className:"RegisteredOracle",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},queryFormat:{serializedName:"query_format",required:!0,type:{name:"String"}},responseFormat:{serializedName:"response_format",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}}}}},sa={type:{name:"Composite",className:"OracleQueries",modelProperties:{oracleQueries:{serializedName:"oracle_queries",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"OracleQuery"}}}}}}},ca={type:{name:"Composite",className:"OracleQuery",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},senderNonce:{serializedName:"sender_nonce",required:!0,type:{name:"String"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},query:{serializedName:"query",required:!0,type:{name:"String"}},response:{serializedName:"response",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"Ttl"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}}}}},la={type:{name:"Composite",className:"NameEntry",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},owner:{serializedName:"owner",type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},pointers:{serializedName:"pointers",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}}}}},ua={type:{name:"Composite",className:"Channel",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},initiatorId:{serializedName:"initiator_id",required:!0,type:{name:"String"}},responderId:{serializedName:"responder_id",required:!0,type:{name:"String"}},channelAmount:{serializedName:"channel_amount",required:!0,type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",required:!0,type:{name:"String"}},responderAmount:{serializedName:"responder_amount",required:!0,type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",required:!0,type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},soloRound:{serializedName:"solo_round",required:!0,type:{name:"String"}},lockPeriod:{serializedName:"lock_period",required:!0,type:{name:"String"}},lockedUntil:{serializedName:"locked_until",required:!0,type:{name:"String"}}}}},da={type:{name:"Composite",className:"PeerPubKey",modelProperties:{pubkey:{serializedName:"pubkey",required:!0,type:{name:"String"}}}}},pa={type:{name:"Composite",className:"Status",modelProperties:{genesisKeyBlockHash:{serializedName:"genesis_key_block_hash",required:!0,type:{name:"String"}},solutions:{serializedName:"solutions",required:!0,type:{name:"String"}},difficulty:{serializedName:"difficulty",required:!0,type:{name:"String"}},syncing:{serializedName:"syncing",required:!0,type:{name:"Boolean"}},syncProgress:{constraints:{InclusiveMaximum:100,InclusiveMinimum:0},serializedName:"sync_progress",type:{name:"Number"}},listening:{serializedName:"listening",required:!0,type:{name:"Boolean"}},protocols:{serializedName:"protocols",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"Protocol"}}}},nodeVersion:{serializedName:"node_version",required:!0,type:{name:"String"}},nodeRevision:{serializedName:"node_revision",required:!0,type:{name:"String"}},peerCount:{serializedName:"peer_count",required:!0,type:{name:"String"}},peerConnections:{serializedName:"peer_connections",type:{name:"Composite",className:"PeerConnections"}},pendingTransactionsCount:{serializedName:"pending_transactions_count",required:!0,type:{name:"String"}},networkId:{serializedName:"network_id",required:!0,type:{name:"String"}},peerPubkey:{serializedName:"peer_pubkey",required:!0,type:{name:"String"}},topKeyBlockHash:{serializedName:"top_key_block_hash",required:!0,type:{name:"String"}},topBlockHeight:{serializedName:"top_block_height",required:!0,type:{name:"String"}}}}},ma={type:{name:"Composite",className:"Protocol",modelProperties:{version:{serializedName:"version",required:!0,type:{name:"String"}},effectiveAtHeight:{serializedName:"effective_at_height",required:!0,type:{name:"String"}}}}},ha={type:{name:"Composite",className:"PeerConnections",modelProperties:{inbound:{serializedName:"inbound",required:!0,type:{name:"String"}},outbound:{serializedName:"outbound",required:!0,type:{name:"String"}}}}},ya={type:{name:"Composite",className:"SpendTx",modelProperties:{recipientId:{serializedName:"recipient_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}}}}},fa={type:{name:"Composite",className:"OracleRegisterTx",modelProperties:{queryFormat:{serializedName:"query_format",required:!0,type:{name:"String"}},responseFormat:{serializedName:"response_format",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"Ttl"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}}}}},ga={type:{name:"Composite",className:"OracleExtendTx",modelProperties:{fee:{serializedName:"fee",required:!0,type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"RelativeTTL"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}}}}},Na={type:{name:"Composite",className:"OracleQueryTx",modelProperties:{oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},query:{serializedName:"query",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},queryTtl:{serializedName:"query_ttl",type:{name:"Composite",className:"Ttl"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Ca={type:{name:"Composite",className:"OracleRespondTx",modelProperties:{queryId:{serializedName:"query_id",required:!0,type:{name:"String"}},response:{serializedName:"response",required:!0,type:{name:"String"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},wa={type:{name:"Composite",className:"NamePreclaimTx",modelProperties:{commitmentId:{serializedName:"commitment_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},ba={type:{name:"Composite",className:"NameClaimTx",modelProperties:{name:{serializedName:"name",required:!0,type:{name:"String"}},nameSalt:{serializedName:"name_salt",required:!0,type:{name:"String"}},nameFee:{serializedName:"name_fee",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Sa={type:{name:"Composite",className:"NameUpdateTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},nameTtl:{serializedName:"name_ttl",required:!0,type:{name:"String"}},pointers:{serializedName:"pointers",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}},clientTtl:{serializedName:"client_ttl",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},xa={type:{name:"Composite",className:"NameTransferTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},recipientId:{serializedName:"recipient_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},va={type:{name:"Composite",className:"NameRevokeTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Ta={type:{name:"Composite",className:"CommitmentId",modelProperties:{commitmentId:{serializedName:"commitment_id",required:!0,type:{name:"String"}}}}},_a={type:{name:"Composite",className:"NameHash",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}}}}},za={type:{name:"Composite",className:"ChannelCreateTx",modelProperties:{initiatorId:{serializedName:"initiator_id",required:!0,type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",required:!0,type:{name:"String"}},responderId:{serializedName:"responder_id",required:!0,type:{name:"String"}},responderAmount:{serializedName:"responder_amount",required:!0,type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",required:!0,type:{name:"String"}},lockPeriod:{serializedName:"lock_period",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}}}}},qa={type:{name:"Composite",className:"ChannelDepositTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}}}}},Ea={type:{name:"Composite",className:"ChannelWithdrawTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},toId:{serializedName:"to_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}}}}},Pa={type:{name:"Composite",className:"ChannelForceProgressTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},update:{serializedName:"update",type:{name:"Composite",className:"OffChainUpdate"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},offchainTrees:{serializedName:"offchain_trees",type:{name:"String"}}}}},Aa={type:{name:"Composite",className:"ChannelCloseMutualTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",required:!0,type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}}}}},Ia={type:{name:"Composite",className:"ChannelCloseSoloTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},ka={type:{name:"Composite",className:"ChannelSlashTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},Oa={type:{name:"Composite",className:"ChannelSettleTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",required:!0,type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}}}}},Ma={type:{name:"Composite",className:"ChannelSnapshotSoloTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Ba={type:{name:"Composite",className:"ChannelSetDelegatesTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorDelegateIds:{serializedName:"initiator_delegate_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},responderDelegateIds:{serializedName:"responder_delegate_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Ra={type:{name:"Composite",className:"PubKey",modelProperties:{pubKey:{serializedName:"pub_key",required:!0,type:{name:"String"}}}}},Da={type:{name:"Composite",className:"PeerDetails",modelProperties:{host:{serializedName:"host",required:!0,type:{name:"String"}},port:{serializedName:"port",required:!0,type:{name:"String"}},firstSeen:{serializedName:"first_seen",required:!0,type:{name:"String"}},lastSeen:{serializedName:"last_seen",required:!0,type:{name:"String"}},genesisHash:{serializedName:"genesis_hash",required:!0,type:{name:"String"}},topHash:{serializedName:"top_hash",required:!0,type:{name:"String"}},topDifficulty:{serializedName:"top_difficulty",required:!0,type:{name:"String"}},networkId:{serializedName:"network_id",type:{name:"String"}},nodeVersion:{serializedName:"node_version",type:{name:"String"}},nodeRevision:{serializedName:"node_revision",type:{name:"String"}},nodeVendor:{serializedName:"node_vendor",type:{name:"String"}},nodeOs:{serializedName:"node_os",type:{name:"String"}}}}},ja={type:{name:"Composite",className:"Peers",modelProperties:{peers:{serializedName:"peers",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},blocked:{serializedName:"blocked",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},$a={type:{name:"Composite",className:"PeerCount",modelProperties:{connected:{serializedName:"connected",type:{name:"Composite",className:"PeerCountConnected"}},available:{serializedName:"available",type:{name:"Composite",className:"PeerCountAvailable"}},blocked:{serializedName:"blocked",required:!0,type:{name:"String"}}}}},Ua={type:{name:"Composite",className:"PeerCountConnected",modelProperties:{inbound:{serializedName:"inbound",type:{name:"String"}},outbound:{serializedName:"outbound",type:{name:"String"}}}}},Fa={type:{name:"Composite",className:"PeerCountAvailable",modelProperties:{verified:{serializedName:"verified",type:{name:"String"}},unverified:{serializedName:"unverified",type:{name:"String"}}}}},Va={type:{name:"Composite",className:"ContractCreateTx",modelProperties:{ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},code:{serializedName:"code",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Ha={type:{name:"Composite",className:"ContractCallTx",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Ga={type:{name:"Composite",className:"UnsignedTx",modelProperties:{tx:{serializedName:"tx",required:!0,type:{name:"String"}}}}},La={type:{name:"Composite",className:"TokenSupply",modelProperties:{accounts:{serializedName:"accounts",type:{name:"String"}},contracts:{serializedName:"contracts",type:{name:"String"}},contractOracles:{serializedName:"contract_oracles",type:{name:"String"}},locked:{serializedName:"locked",type:{name:"String"}},oracles:{serializedName:"oracles",type:{name:"String"}},oracleQueries:{serializedName:"oracle_queries",type:{name:"String"}},pendingRewards:{serializedName:"pending_rewards",type:{name:"String"}},total:{serializedName:"total",type:{name:"String"}}}}},Ka={type:{name:"Composite",className:"GAAttachTx",modelProperties:{ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},code:{serializedName:"code",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}},authFun:{constraints:{Pattern:new RegExp("^(0x|0X)?[a-fA-F0-9]+$")},serializedName:"auth_fun",required:!0,type:{name:"String"}}}}},Qa={type:{name:"Composite",className:"GAMetaTx",modelProperties:{gaId:{serializedName:"ga_id",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},authData:{serializedName:"auth_data",required:!0,type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}}}}},Wa={type:{name:"Composite",className:"PayingForTx",modelProperties:{payerId:{serializedName:"payer_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}}}}},Ya={type:{name:"Composite",className:"CheckTxInPoolResponse",modelProperties:{status:{serializedName:"status",required:!0,type:{name:"String"}}}}},Ja={serializedName:"OffChainTransfer",type:{name:"Composite",className:"OffChainTransfer",uberParent:"OffChainUpdate",polymorphicDiscriminator:Br.type.polymorphicDiscriminator,modelProperties:{...Br.type.modelProperties,from:{serializedName:"from",required:!0,type:{name:"String"}},to:{serializedName:"to",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Xa={serializedName:"OffChainWithdrawal",type:{name:"Composite",className:"OffChainWithdrawal",uberParent:"OffChainUpdate",polymorphicDiscriminator:Br.type.polymorphicDiscriminator,modelProperties:{...Br.type.modelProperties,to:{serializedName:"to",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Za={serializedName:"OffChainDeposit",type:{name:"Composite",className:"OffChainDeposit",uberParent:"OffChainUpdate",polymorphicDiscriminator:Br.type.polymorphicDiscriminator,modelProperties:{...Br.type.modelProperties,from:{serializedName:"from",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},ei={serializedName:"OffChainNewContract",type:{name:"Composite",className:"OffChainNewContract",uberParent:"OffChainUpdate",polymorphicDiscriminator:Br.type.polymorphicDiscriminator,modelProperties:{...Br.type.modelProperties,owner:{serializedName:"owner",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},code:{serializedName:"code",type:{name:"Composite",className:"ByteCode"}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},ti={serializedName:"OffChainCallContract",type:{name:"Composite",className:"OffChainCallContract",uberParent:"OffChainUpdate",polymorphicDiscriminator:Br.type.polymorphicDiscriminator,modelProperties:{...Br.type.modelProperties,caller:{serializedName:"caller",required:!0,type:{name:"String"}},contract:{serializedName:"contract",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},ni={type:{name:"Composite",className:"CreateContractUnsignedTx",modelProperties:{...Ga.type.modelProperties,contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}}}}};let ri={"Tx.undefined":Or,OffChainUpdate:Br,"OffChainUpdate.OffChainTransfer":Ja,"OffChainUpdate.OffChainWithdrawal":Xa,"OffChainUpdate.OffChainDeposit":Za,"OffChainUpdate.OffChainNewContract":ei,"OffChainUpdate.OffChainCallContract":ti};const ai={parameterPath:"accept",mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Accept",type:{name:"String"}}},ii={parameterPath:"$host",mapper:{serializedName:"$host",required:!0,type:{name:"String"}},skipEncoding:!0},oi={parameterPath:"intAsString",mapper:{defaultValue:!1,serializedName:"int-as-string",type:{name:"Boolean"}}},si={parameterPath:"hash",mapper:{serializedName:"hash",required:!0,type:{name:"String"}}},ci={parameterPath:"height",mapper:{constraints:{InclusiveMaximum:0x10000000000000000,InclusiveMinimum:0},serializedName:"height",required:!0,type:{name:"Number"}}},li={parameterPath:"pubkey",mapper:{serializedName:"pubkey",required:!0,type:{name:"String"}}},ui={parameterPath:["options","contentType"],mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Content-Type",type:{name:"String"}}},di={parameterPath:"body",mapper:Hr},pi={parameterPath:"body",mapper:ta};class mi extends Tr.ServiceClient{constructor(e,t){var n,r,a;if(void 0===e)throw new Error("'$host' cannot be null");t||(t={});const i="azsdk-js-node/1.0.0-beta.1",o=t.userAgentOptions&&t.userAgentOptions.userAgentPrefix?`${t.userAgentOptions.userAgentPrefix} ${i}`:`${i}`,s={requestContentType:"application/json; charset=utf-8",...t,userAgentOptions:{userAgentPrefix:o},baseUri:null!==(n=null!==(r=t.endpoint)&&void 0!==r?r:t.baseUri)&&void 0!==n?n:"{$host}"};super(s),null!==(a=t)&&void 0!==a&&a.pipeline&&t.pipeline.getOrderedPolicies().length>0&&(t.pipeline.getOrderedPolicies().some((e=>e.name===Ge.bearerTokenAuthenticationPolicyName))||(this.pipeline.removePolicy({name:Ge.bearerTokenAuthenticationPolicyName}),this.pipeline.addPolicy(Ge.bearerTokenAuthenticationPolicy({scopes:`${s.baseUri}/.default`,challengeCallbacks:{authorizeRequestOnChallenge:Tr.authorizeRequestOnClaimChallenge}})))),this.$host=e}getTopHeader(e){return this.sendOperationRequest({options:e},yi)}getCurrentKeyBlock(e){return this.sendOperationRequest({options:e},fi)}getCurrentKeyBlockHash(e){return this.sendOperationRequest({options:e},gi)}getCurrentKeyBlockHeight(e){return this.sendOperationRequest({options:e},Ni)}getPendingKeyBlock(e){return this.sendOperationRequest({options:e},Ci)}getKeyBlockByHash(e,t){return this.sendOperationRequest({hash:e,options:t},wi)}getKeyBlockByHeight(e,t){return this.sendOperationRequest({height:e,options:t},bi)}getMicroBlockHeaderByHash(e,t){return this.sendOperationRequest({hash:e,options:t},Si)}getMicroBlockTransactionsByHash(e,t){return this.sendOperationRequest({hash:e,options:t},xi)}getMicroBlockTransactionByHashAndIndex(e,t,n){return this.sendOperationRequest({hash:e,index:t,options:n},vi)}getMicroBlockTransactionsCountByHash(e,t){return this.sendOperationRequest({hash:e,options:t},Ti)}getCurrentGeneration(e){return this.sendOperationRequest({options:e},_i)}getGenerationByHash(e,t){return this.sendOperationRequest({hash:e,options:t},zi)}getGenerationByHeight(e,t){return this.sendOperationRequest({height:e,options:t},qi)}getAccountByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Ei)}getAccountByPubkeyAndHeight(e,t,n){return this.sendOperationRequest({pubkey:e,height:t,options:n},Pi)}getAccountByPubkeyAndHash(e,t,n){return this.sendOperationRequest({pubkey:e,hash:t,options:n},Ai)}getPendingAccountTransactionsByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Ii)}getAccountNextNonce(e,t){return this.sendOperationRequest({pubkey:e,options:t},ki)}protectedDryRunTxs(e,t){return this.sendOperationRequest({body:e,options:t},Oi)}getTransactionByHash(e,t){return this.sendOperationRequest({hash:e,options:t},Mi)}getTransactionInfoByHash(e,t){return this.sendOperationRequest({hash:e,options:t},Bi)}postTransaction(e,t){return this.sendOperationRequest({body:e,options:t},Ri)}getContract(e,t){return this.sendOperationRequest({pubkey:e,options:t},Di)}getContractCode(e,t){return this.sendOperationRequest({pubkey:e,options:t},ji)}getContractPoI(e,t){return this.sendOperationRequest({pubkey:e,options:t},$i)}getOracleByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Ui)}getOracleQueriesByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Fi)}getOracleQueryByPubkeyAndQueryId(e,t,n){return this.sendOperationRequest({pubkey:e,queryId:t,options:n},Vi)}getNameEntryByName(e,t){return this.sendOperationRequest({name:e,options:t},Hi)}getChannelByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Gi)}getPeerPubkey(e){return this.sendOperationRequest({options:e},Li)}getStatus(e){return this.sendOperationRequest({options:e},Ki)}getChainEnds(e){return this.sendOperationRequest({options:e},Qi)}}const hi=Tr.createSerializer(e,!1),yi={path:"/v3/headers/top",httpMethod:"GET",responses:{200:{bodyMapper:_r},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},fi={path:"/v3/key-blocks/current",httpMethod:"GET",responses:{200:{bodyMapper:qr},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},gi={path:"/v3/key-blocks/current/hash",httpMethod:"GET",responses:{200:{bodyMapper:Er},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},Ni={path:"/v3/key-blocks/current/height",httpMethod:"GET",responses:{200:{bodyMapper:Pr},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},Ci={path:"/v3/key-blocks/pending",httpMethod:"GET",responses:{200:{bodyMapper:qr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},wi={path:"/v3/key-blocks/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:qr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},bi={path:"/v3/key-blocks/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:qr},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,ci],headerParameters:[ai],serializer:hi},Si={path:"/v3/micro-blocks/hash/{hash}/header",httpMethod:"GET",responses:{200:{bodyMapper:Ar},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},xi={path:"/v3/micro-blocks/hash/{hash}/transactions",httpMethod:"GET",responses:{200:{bodyMapper:Ir},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},vi={path:"/v3/micro-blocks/hash/{hash}/transactions/index/{index}",httpMethod:"GET",responses:{200:{bodyMapper:kr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si,{parameterPath:"index",mapper:{constraints:{InclusiveMinimum:1},serializedName:"index",required:!0,type:{name:"Number"}}}],headerParameters:[ai],serializer:hi},Ti={path:"/v3/micro-blocks/hash/{hash}/transactions/count",httpMethod:"GET",responses:{200:{bodyMapper:$r},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},_i={path:"/v3/generations/current",httpMethod:"GET",responses:{200:{bodyMapper:Ur},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},zi={path:"/v3/generations/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:Ur},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},qi={path:"/v3/generations/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:Ur},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,ci],headerParameters:[ai],serializer:hi},Ei={path:"/v3/accounts/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:Fr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Pi={path:"/v3/accounts/{pubkey}/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:Fr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,ci,li],headerParameters:[ai],serializer:hi},Ai={path:"/v3/accounts/{pubkey}/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:Fr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si,li],headerParameters:[ai],serializer:hi},Ii={path:"/v3/accounts/{pubkey}/transactions/pending",httpMethod:"GET",responses:{200:{bodyMapper:Ir},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},ki={path:"/v3/accounts/{pubkey}/next-nonce",httpMethod:"GET",responses:{200:{bodyMapper:Vr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi,{parameterPath:["options","strategy"],mapper:{defaultValue:"max",serializedName:"strategy",type:{name:"Enum",allowedValues:["max","continuity"]}}}],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Oi={path:"/v3/dry-run",httpMethod:"POST",responses:{200:{bodyMapper:Wr},403:{bodyMapper:zr,isError:!0}},requestBody:di,queryParameters:[oi],urlParameters:[ii],headerParameters:[ai,ui],mediaType:"json",serializer:hi},Mi={path:"/v3/transactions/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:kr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},Bi={path:"/v3/transactions/{hash}/info",httpMethod:"GET",responses:{200:{bodyMapper:Zr},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,si],headerParameters:[ai],serializer:hi},Ri={path:"/v3/transactions",httpMethod:"POST",responses:{200:{bodyMapper:na},400:{bodyMapper:zr,isError:!0}},requestBody:pi,queryParameters:[oi],urlParameters:[ii],headerParameters:[ai,ui],mediaType:"json",serializer:hi},Di={path:"/v3/contracts/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:ra},400:{bodyMapper:zr,isError:!0},404:{isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},ji={path:"/v3/contracts/{pubkey}/code",httpMethod:"GET",responses:{200:{bodyMapper:aa},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},$i={path:"/v3/contracts/{pubkey}/poi",httpMethod:"GET",responses:{200:{bodyMapper:ia},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Ui={path:"/v3/oracles/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:oa},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Fi={path:"/v3/oracles/{pubkey}/queries",httpMethod:"GET",responses:{200:{bodyMapper:sa},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi,{parameterPath:["options","from"],mapper:{serializedName:"from",type:{name:"String"}}},{parameterPath:["options","limit"],mapper:{defaultValue:20,constraints:{InclusiveMaximum:1e3,InclusiveMinimum:1},serializedName:"limit",type:{name:"Number"}}},{parameterPath:["options","type"],mapper:{defaultValue:"all",serializedName:"type",type:{name:"Enum",allowedValues:["open","closed","all"]}}}],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Vi={path:"/v3/oracles/{pubkey}/queries/{query-id}",httpMethod:"GET",responses:{200:{bodyMapper:ca},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li,{parameterPath:"queryId",mapper:{serializedName:"query-id",required:!0,type:{name:"String"}}}],headerParameters:[ai],serializer:hi},Hi={path:"/v3/names/{name}",httpMethod:"GET",responses:{200:{bodyMapper:la},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,{parameterPath:"name",mapper:{serializedName:"name",required:!0,type:{name:"String"}}}],headerParameters:[ai],serializer:hi},Gi={path:"/v3/channels/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:ua},400:{bodyMapper:zr,isError:!0},404:{bodyMapper:zr,isError:!0}},queryParameters:[oi],urlParameters:[ii,li],headerParameters:[ai],serializer:hi},Li={path:"/v3/peers/pubkey",httpMethod:"GET",responses:{200:{bodyMapper:da}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},Ki={path:"/v3/status",httpMethod:"GET",responses:{200:{bodyMapper:pa}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi},Qi={path:"/v3/status/chain-ends",httpMethod:"GET",responses:{200:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"String"}}}}}},queryParameters:[oi],urlParameters:[ii],headerParameters:[ai],serializer:hi};function Wi(e,t){Yi(e,t),t.add(e)}function Yi(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ji(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}const Xi=["balance","queryFee","fee","amount","nameFee","channelAmount","initiatorAmount","responderAmount","channelReserve","initiatorAmountFinal","responderAmountFinal","gasPrice","deposit"],Zi=["time","gas","gasUsed","nameSalt","nonce","nextNonce","height","blockHeight","top","topBlockHeight","ttl","nameTtl","clientTtl","inbound","outbound","peerCount","pendingTransactionsCount","effectiveAtHeight","version","solutions","round"];var eo=new WeakSet,to=new WeakSet,no=new WeakSet;class ro extends mi{constructor(){super(...arguments),Wi(this,no),Wi(this,to),Wi(this,eo)}async sendOperationRequest(e,t){const n=Qe(e,(e=>{let[t,n]=e;return[t,Ji(this,to,io).call(this,n)]}));return Ji(this,no,oo).call(this,await super.sendOperationRequest(n,t))}}function ao(e,t){return Array.isArray(e)?e.map((e=>Ji(this,eo,ao).call(this,e,t))):null!=e&&"object"==typeof e?Qe(e,(e=>{let[n,r]=e;return null==r?[n,r]:Xi.some((e=>e===n))?[n,t.bigInt(r)]:Zi.some((e=>e===n))?[n,t.number(r)]:[n,Ji(this,eo,ao).call(this,r,t)]})):e}function io(e){return Ji(this,eo,ao).call(this,e,{bigInt:e=>e instanceof c()?e.toFixed():e.toString(),number:e=>e.toString()})}function oo(e){return Ji(this,eo,ao).call(this,e,{bigInt:e=>BigInt(e),number:e=>+e})}var so=new WeakMap;class co extends ro{constructor(e){let{ignoreVersion:t=!1,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var r,a;if(super(e,{allowInsecureConnection:!0,additionalPolicies:[wr(),br(),xr((e=>` ${e.reason}`))],...n}),a={writable:!0,value:void 0},Yi(this,r=so),r.set(this,a),!t){const e=this.getStatus(),t=e.then((e=>{let{nodeVersion:t}=e;return t}));Nr(this,so,e.then((e=>{let{networkId:t}=e;return t}))),this.pipeline.addPolicy(vr("node","/v3/status",t,"6.2.0","7.0.0"))}this.intAsString=!0}async getNetworkId(){var e;return null!==(e=gr(this,so))&&void 0!==e||Nr(this,so,this.getStatus().then((e=>{let{networkId:t}=e;return t}))),gr(this,so)}async getNodeInfo(){const{nodeVersion:e,networkId:t,protocols:n,topBlockHeight:r}=await this.getStatus(),a=n.filter((e=>{let{effectiveAtHeight:t}=e;return r>=t})).reduce(((e,t)=>t.effectiveAtHeight>e.effectiveAtHeight?t:e),{effectiveAtHeight:-1,version:0}).version;return{url:this.$host,nodeNetworkId:t,version:e,consensusProtocolVersion:a}}}var lo=C(9408).Buffer;const uo=[],po=e=>["senderId","accountId","ownerId","callerId","oracleId","fromId","initiator","gaId","payerId"].map((t=>e[t])).filter((e=>e)).map((e=>null==e?void 0:e.toString().replace(/^ok_/,"ak_")))[0];async function mo(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=t;a.pipeline.getOrderedPolicies().some((e=>{let{name:t}=e;return"aggressive-cache-get-responses"===t}))||(a=new co(t.$host,{ignoreVersion:!0}),a.pipeline.addPolicy(Sr()));const{tx:i,txType:o}=mr(e),s=null!==(n=po(i))&&void 0!==n?n:o===Vt.SignedTx?po(i.encodedTx.tx):void 0,[c,{height:l},{consensusProtocolVersion:u,nodeNetworkId:d}]=await Promise.all([null==s?void 0:a.getAccountByPubkey(s).catch((e=>{if(!Je(e))throw e;return{id:s,balance:0n,nonce:0}})).then((e=>({...e,id:e.id}))),a.getCurrentKeyBlockHeight(),a.getNodeInfo()]);return(await Promise.all(uo.map((e=>e(i,{txType:o,node:a,account:c,height:l,consensusProtocolVersion:u,nodeNetworkId:d,parentTxTypes:r}))))).flat()}function ho(e,t){let{_expectedMineRate:n=18e4,_microBlockCycle:r=3e3,_maxPollInterval:a=5e3}=t;const i={block:n,microblock:r}[e];return Math.min(i/3,a)}uo.push(((e,t)=>{let{encodedTx:n,signatures:r}=e,{account:a,nodeNetworkId:i,parentTxTypes:o}=t;if(void 0===(null!=n?n:r))return[];if(null==a)return[];if(1!==r.length)return[];const s=lo.from([i,...o.includes(Vt.PayingForTx)?["inner_tx"]:[]].join("-")),c=We([s,n.rlpEncoded]),l=We([s,bt(n.rlpEncoded)]);return _t(c,r[0],a.id)||_t(l,r[0],a.id)?[]:[{message:"Signature cannot be verified, please ensure that you transaction have the correct prefix and the correct private key for the sender address",key:"InvalidSignature",checkedKeys:["encodedTx","signatures"]}]}),(async(e,t)=>{let{encodedTx:n,tx:r}=e,{node:a,parentTxTypes:i,txType:o}=t;return void 0===(null!=n?n:r)?[]:mo(yt((null!=n?n:r).rlpEncoded,tt.Transaction),a,[...i,o])}),((e,t)=>{let{ttl:n}=e,{height:r}=t;return void 0===n?[]:(n=+n,0===n||n>=r?[]:[{message:`TTL ${n} is already expired, current height is ${r}`,key:"ExpiredTTL",checkedKeys:["ttl"]}])}),((e,t)=>{var n,r;let{amount:a,fee:i,nameFee:o,tx:s}=e,{account:l,parentTxTypes:u,txType:d}=t;if(null==l)return[];if(void 0===(null!==(n=null!=a?a:i)&&void 0!==n?n:o))return[];null!==(r=i)&&void 0!==r||(i=0);const p=new(c())(i).plus(null!=o?o:0).plus(null!=a?a:0).plus(d===Vt.PayingForTx?s.tx.encodedTx.tx.fee:0).minus(u.includes(Vt.PayingForTx)?i:0);return p.lte(l.balance.toString())?[]:[{message:`Account balance ${l.balance.toString()} is not enough to execute the transaction that costs ${p.toFixed()}`,key:"InsufficientBalance",checkedKeys:["amount","fee","nameFee"]}]}),((e,t)=>{let n,{signatures:r}=e,{account:a,txType:i}=t;return null==a?[]:(i===Vt.SignedTx&&"generalized"===a.kind&&0!==r.length&&(n="Generalized account can't be used to generate SignedTx with signatures"),i===Vt.GaMetaTx&&"basic"===a.kind&&(n="Basic account can't be used to generate GaMetaTx"),null==n?[]:[{message:n,key:"InvalidAccountType",checkedKeys:["tag"]}])}),((e,t)=>{let{nonce:n}=e,{account:r,parentTxTypes:a}=t;if(null==n||null==r||a.includes(Vt.GaMetaTx))return[];n=+n;const i=r.nonce+1;return n===i?[]:[{...n<i?{message:`Nonce ${n} is already used, valid nonce is ${i}`,key:"NonceAlreadyUsed"}:{message:`Nonce ${n} is too high, valid nonce is ${i}`,key:"NonceHigh"},checkedKeys:["nonce"]}]}),((e,t)=>{let{ctVersion:n,abiVersion:r}=e,{txType:a,consensusProtocolVersion:i}=t;if(!Ye(i,Xn))throw new k(`Unsupported protocol: ${i}`);null==n&&(n={abiVersion:r});const o=Xn[i][a];return null==o?[]:Object.entries(n).some((e=>{let[t,n]=e;return!o[t].includes(+n)}))?[{message:`ABI/VM version ${JSON.stringify(n)} is wrong, supported is: ${JSON.stringify(o)}`,key:"VmAndAbiVersionMismatch",checkedKeys:["ctVersion","abiVersion"]}]:[]}),(async(e,t)=>{let{contractId:n}=e,{txType:r,node:a}=t;if(Vt.ContractCallTx!==r)return[];try{const{active:e}=await a.getContract(n);return e?[]:[{message:`Contract ${n} is not active`,key:"ContractNotActive",checkedKeys:["contractId"]}]}catch(e){var i,o;if(null==(null===(i=e.response)||void 0===i||null===(o=i.parsedBody)||void 0===o?void 0:o.reason))throw e;return[{message:e.response.parsedBody.reason,key:"ContractNotFound",checkedKeys:["contractId"]}]}}));class yo extends b{constructor(e,t,n){super(e),this.name="InvalidTxError",this.validation=t,this.transaction=n}}async function fo(e){let{onNode:t}=e;return(await t.getCurrentKeyBlockHeight()).height}async function go(e,t){var n;let{blocks:r=10,interval:a,onNode:i,...o}=t;null!==(n=a)&&void 0!==n||(a=ho("microblock",o));const s=await fo({onNode:i})+r;do{const t=await i.getTransactionByHash(e);if(-1!==t.blockHeight)return t;await Ke(a)}while(await fo({onNode:i})<s);throw new P(r,e)}async function No(e,t){var n;let r,{interval:a,onNode:i,...o}=t;null!==(n=a)&&void 0!==n||(a=ho("block",o));do{null!=r&&await Ke(a),r=(await i.getCurrentKeyBlockHeight()).height}while(r<e);return r}async function Co(e,t){let{confirm:n=3,onNode:r,...a}=t;const{blockHeight:i}=await r.getTransactionByHash(e),o=await No(i+n,{onNode:r,...a}),{blockHeight:s}=await r.getTransactionByHash(e);switch(s){case-1:throw new Ee(e);case i:return o;default:return Co(e,{onNode:r,confirm:n,...a})}}async function wo(e,t){let{onNode:n,onAccount:r,verify:a=!0,waitMined:i=!0,confirm:o,...s}=t;if(a){const t=await mo(e,n);if(t.length>0){const n=`Transaction verification errors: ${t.map((e=>e.message)).join(", ")}`;throw new yo(n,t,e)}}try{let t;try{t=null!=r?`tx-${r.address}`:null}catch(e){t=null}const{txHash:a}=await n.postTransaction({tx:e},null!=t?{requestOptions:{customHeaders:{__queue:t}}}:{});if(i){const t=await go(a,{onNode:n,...s}),r={...t,hash:t.hash,rawTx:e};if(null!=o&&(!0===o||o>0)){const e="boolean"==typeof o?void 0:o;return{...r,confirmationHeight:await Co(a,{onNode:n,confirm:e,...s})}}return r}return{hash:a,rawTx:e}}catch(t){throw Object.assign(t,{rawTx:e,verifyTx:async()=>mo(e,n)})}}async function bo(e,t){let{height:n,hash:r,onNode:a}=t;return null!=n?a.getAccountByPubkeyAndHeight(e,n):null!=r?a.getAccountByPubkeyAndHash(e,r):a.getAccountByPubkey(e)}async function So(e,t){let{format:n=Be.AETTOS,...r}=t;const{balance:a}=await bo(e,r).catch((e=>{if(!Je(e))throw e;return{balance:0n}}));return De(a,{targetDenomination:n})}async function xo(e){let{onNode:t}=e;return t.getCurrentGeneration()}async function vo(e,t){let{onNode:n}=t;return"number"==typeof e?n.getGenerationByHeight(e):n.getGenerationByHash(e)}async function To(e,t){let{onNode:n}=t;return(await n.getMicroBlockTransactionsByHash(e)).transactions}async function _o(e,t){let{onNode:n}=t;return"number"==typeof e?n.getKeyBlockByHeight(e):n.getKeyBlockByHash(e)}async function zo(e,t){let{onNode:n}=t;return n.getMicroBlockHeaderByHash(e)}const qo=new Map;async function Eo(e,t){const n=qo.get(e);if(qo.delete(e),null==n)throw new B("Can't get dry-run request");let r;try{r=await t.protectedDryRunTxs({top:n[0].top,txEvents:n[0].txEvents,txs:n.map((e=>({tx:e.tx}))),accounts:Array.from(new Set(n.map((e=>e.accountAddress)))).map((e=>({pubKey:e,amount:Kn.amount})))})}catch(e){return void n.forEach((t=>{let{reject:n}=t;return n(e)}))}const{results:a,txEvents:i}=r;a.forEach(((e,t)=>{let{result:r,reason:a,...o}=e;const{resolve:s,reject:c,tx:l,accountAddress:u}=n[t];"ok"===r?s({...o,txEvents:i}):c(Object.assign(new Se(a),{tx:l,accountAddress:u}))}))}async function Po(e,t,n){var r;let{top:a,txEvents:i,combine:o,onNode:s}=n;const c=!0===o?[a,i].join():"immediate",l=null!==(r=qo.get(c))&&void 0!==r?r:[];return qo.set(c,l),new Promise(((n,r)=>{var u;l.push({tx:e,accountAddress:t,top:a,txEvents:i,resolve:n,reject:r}),!0===o?null!==(u=l.timeout)&&void 0!==u||(l.timeout=setTimeout((()=>{Eo(c,s)}))):Eo(c,s)}))}async function Ao(e,t){let{onNode:n}=t;return n.getContractCode(e)}async function Io(e,t){let{onNode:n}=t;return n.getContract(e)}async function ko(e,t){let{onNode:n}=t;return n.getNameEntryByName(e)}async function Oo(e,t,n){let{verify:r=!0,resolveByNode:a=!1,onNode:i}=n;if(Zt(e)){if(r||a){const n=(await i.getNameEntryByName(e)).pointers.find((e=>e.key===t));if(null==n)throw new j(e,t);if(a)return n.id}return Wt(e)}try{return ht(e),e}catch(t){throw new U(`Invalid name or address: ${e}`)}}var Mo=C(3983),Bo=C(7417),Ro=C(9408).Buffer;const Do={async argon2id(e,t,n){const{memlimit_kib:r,opslimit:a}=n;return(0,Bo.hash)(e,{hashLength:32,salt:t,timeCost:a,memoryCost:r,type:Bo.argon2id})}},jo={"xsalsa20-poly1305":{encrypt:Fe().secretbox,decrypt(){const e=Fe().secretbox.open(...arguments);if(null==e)throw new me;return e}}},$o={secret_type:"ed25519",symmetric_alg:"xsalsa20-poly1305",kdf:"argon2id",kdf_params:{memlimit_kib:65536,opslimit:3,parallelism:1}};function Uo(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$o.symmetric_alg;return jo[r].encrypt(e,n,t)}async function Fo(e,t,n,r){return Do[n](e,t,r)}async function Vo(e,t){let{crypto:n}=t;const r=Ro.from(n.kdf_params.salt,"hex");return Ro.from(function(e,t,n){return jo[arguments.length>3&&void 0!==arguments[3]?arguments[3]:$o.symmetric_alg].decrypt(e,n,t)}(Ro.from(n.ciphertext,"hex"),await Fo(e,r,n.kdf,n.kdf_params),Ro.from(n.cipher_params.nonce,"hex"),n.symmetric_alg)).toString("hex")}async function Ho(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Fe().randomBytes(24),a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Fe().randomBytes(16),i=arguments.length>5?arguments[5]:void 0;const o={...$o,...i},s=await Fo(t,a,o.kdf,o.kdf_params),c="string"==typeof n?Ro.from(n,"hex"):n;return{name:e,version:1,public_key:gt(c),id:(0,Mo.v4)(),crypto:{secret_type:o.secret_type,symmetric_alg:o.symmetric_alg,ciphertext:Ro.from(Uo(c,s,r,o.symmetric_alg)).toString("hex"),cipher_params:{nonce:Ro.from(r).toString("hex")},kdf:o.kdf,kdf_params:{...o.kdf_params,salt:Ro.from(a).toString("hex")}}}}async function Go(e,t){var n,r;let{vmVersion:a,abiVersion:i,onNode:o}=t;const{consensusProtocolVersion:s}=await o.getNodeInfo();if(!Ye(s,Xn))throw new k("Not supported consensus protocol version");const c=Xn[s];if(!Ye(e,c))throw new Pe("Not supported tx type");const l=c[e];return null!==(n=i)&&void 0!==n||(i=l.abiVersion[0]),null!==(r=a)&&void 0!==r||(a=l.vmVersion[0]),{vmVersion:a,abiVersion:i}}async function Lo(e,t){let{denomination:n,absoluteTtl:r,...a}=t;const i=a;let o;switch(e){case Vt.SpendTx:case Vt.OracleQueryTx:o="senderId";break;case Vt.NameClaimTx:case Vt.NameUpdateTx:case Vt.NameRevokeTx:case Vt.NameTransferTx:case Vt.NamePreclaimTx:case Vt.OracleRegisterTx:o="accountId";break;case Vt.ContractCreateTx:case Vt.GaAttachTx:o="ownerId";break;case Vt.GaMetaTx:o="gaId";break;case Vt.ContractCallTx:case Vt.OracleExtendTx:case Vt.OracleResponseTx:o="callerId";break;case Vt.ChannelCloseSoloTx:case Vt.ChannelSlashTx:case Vt.ChannelSettleTx:case Vt.ChannelSnapshotSoloTx:o="fromId";break;case Vt.PayingForTx:o="payerId";break;default:throw new x("txType","valid transaction type",e)}var s;[Vt.ContractCreateTx,Vt.GaAttachTx].includes(e)&&(i.ctVersion=await Go(Vt.ContractCreateTx,{...i,...i.ctVersion})),[Vt.ContractCallTx,Vt.GaMetaTx].includes(e)&&(i.abiVersion=(await Go(Vt.ContractCallTx,i)).abiVersion),e===Vt.OracleRegisterTx&&(null!==(s=i.abiVersion)&&void 0!==s||(i.abiVersion=Wn.NO_ABI)),e===Vt.PayingForTx&&(i.tx=mr(i.tx));const c=i[o];if(null==c)throw new Te(`Transaction field ${o} is missed`);const l=await async function(e,t){var n;let{senderId:r,nonce:a,ttl:i=Fn,absoluteTtl:o,strategy:s,onNode:c}=t;if(null!==(n=a)&&void 0!==n||(a=(await c.getAccountNextNonce(r,{strategy:s}).catch((e=>{if(!Je(e))throw e;return{nextNonce:1}}))).nextNonce),0!==i){if(i<0)throw new x("ttl","greater or equal to 0",i);i+=!0===o?0:(await c.getCurrentKeyBlock()).height}return{ttl:i,nonce:a}}(0,{...i,senderId:c,absoluteTtl:r});return pr({...i,...l},e,{denomination:n}).tx}var Ko=C(9882),Qo=C(1986),Wo=C(8236),Yo=C.n(Wo),Jo=C(9408).Buffer;const Xo=Yo().ModeOfOperation.ecb;function Zo(e,t){const n=rt(e);return new Xo(n).encrypt(t)}function es(e,t){const n=Jo.from(t),r=rt(e);return new Xo(r).decrypt(n)}class ts extends g{constructor(e){super(e),this.name="DerivationError"}}const ns=Jo.from("ed25519 seed"),rs=2147483648;function as(e,t){let{secretKey:n,chainCode:r}=e;if(t<rs)throw new ts(`Segment ${t} is not hardened`);const a=Jo.allocUnsafe(4);a.writeUInt32BE(t,0);const i=We([Jo.alloc(1,0),n,a]),o=(0,Ko.full)(i,r);return{secretKey:o.slice(0,32),chainCode:o.slice(32)}}function is(e,t){const n=""===e?[]:(0,Qo.fromString)(e).toPathArray();return n.forEach(((e,t)=>{if(e<rs)throw new ts(`Segment #${t+1} is not hardened`)})),n.reduce(((e,t)=>as(e,t)),t)}function os(e){const t=(0,Ko.full)(e,ns);return{secretKey:t.slice(0,32),chainCode:t.slice(32)}}function ss(e,t){if(!["m","m/"].includes(e.slice(0,2)))throw new ts("Root element is required");const n=os(t);return is(e.slice(2),n)}function cs(e){const{secretKey:t,publicKey:n}=e;return{secretKey:Jo.from(t).toString("hex"),publicKey:yt(n,tt.AccountAddress)}}function ls(e){return Fe().sign.keyPair.fromSeed(e)}function us(e,t){const n=ss("m/44h/457h",e);return{secretKey:Jo.from(Zo(t,n.secretKey)).toString("hex"),chainCode:Jo.from(Zo(t,n.chainCode)).toString("hex")}}function ds(e,t,n){const r={secretKey:es(t,Jo.from(e.secretKey,"hex")),chainCode:es(t,Jo.from(e.chainCode,"hex"))};return new Array(n).fill(void 0).map(((e,t)=>cs(ls(is(`${t}h/0h/0h`,r).secretKey))))}const ps=(e,t)=>({...cs(ls(is(`${t}h/0h/0h`,ss("m/44h/457h",e)).secretKey)),idx:t});async function ms(e,t){const n=await t.onAccount.signTransaction(e,{...t,networkId:await t.onNode.getNetworkId()});return!0===t.innerTx?{hash:hr(n),rawTx:n}:wo(n,t)}async function hs(e,t,n){return ms(await Lo(Vt.SpendTx,{...n,senderId:n.onAccount.address,recipientId:await Oo(t,"account_pubkey",n),amount:e}),n)}async function ys(e,t,n){if(e<0||e>1)throw new x("fraction","a number between 0 and 1",e);const r=await Oo(t,"account_pubkey",n),a=n.onAccount.address,i=new(c())(await So.bind(n.onAccount)(a,n)),o=i.times(e).integerValue(c().ROUND_HALF_UP),{tx:{fee:s}}=mr(await Lo(Vt.SpendTx,{...n,senderId:a,recipientId:r,amount:o}),Vt.SpendTx),l=o.plus(s).gt(i)?i.minus(s):o;return ms(await Lo(Vt.SpendTx,{...n,senderId:a,recipientId:r,amount:l}),n)}async function fs(e,t){return ms(await Lo(Vt.PayingForTx,{...t,payerId:t.onAccount.address,tx:e}),t)}async function gs(e,t){return ms(await Lo(Vt.NameRevokeTx,{...t,nameId:e,accountId:t.onAccount.address}),t)}async function Ns(e,t,n){let{extendPointers:r,...a}=n;const i={...!0===r&&Object.fromEntries((await ko(e,a)).pointers.map((e=>{let{key:t,id:n}=e;return[t,n]}))),...t};return ms(await Lo(Vt.NameUpdateTx,{clientTtl:Mt,nameTtl:It,...a,nameId:e,accountId:a.onAccount.address,pointers:Object.entries(i).map((e=>{let[t,n]=e;return{key:t,id:n}}))}),a)}async function Cs(e,t,n){return ms(await Lo(Vt.NameTransferTx,{...n,nameId:e,accountId:n.onAccount.address,recipientId:t}),n)}async function ws(e,t){const n=await ko(e,t);return Object.freeze({...n,id:n.id,owner:n.owner,async update(n,r){return{...await Ns(e,n,{...t,...r}),...await ws(e,{...t,...r})}},async transfer(n,r){return{...await Cs(e,n,{...t,...r}),...await ws(e,{...t,...r})}},async revoke(n){return gs(e,{...t,...n})},async extendTtl(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:It,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n>It||n<=0)throw new x("nameTtl",`a number between 1 and ${It} blocks`,n);return{...await Ns(e,{},{...t,...r,nameTtl:n,extendPointers:!0}),...await ws(e,{...t,...r})}}})}async function bs(e,t,n){const r=await Lo(Vt.NameClaimTx,{...n,accountId:n.onAccount.address,nameSalt:t,name:e}),a=await ms(r,n);if(!on(e)){const t=null!=a.blockHeight&&a.blockHeight>0?await ws(e,n):{};return Object.assign(a,t)}return a}async function Ss(e,t){const n=Ct(),r=await fo(t),a=Yt(e,n),i=await Lo(Vt.NamePreclaimTx,{...t,accountId:t.onAccount.address,commitmentId:a});return Object.freeze({...await ms(i,t),height:r,salt:n,commitmentId:a,async claim(r){return bs(e,n,{...t,...r})}})}async function xs(e,t,n){return bs(e,0,{...n,nameFee:t})}var vs=C(7946),Ts=C(9408).Buffer;const _s=class{async $createDelegationSignature(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;const n={...this.$options,...t},r=this.$options.address;if(null==n.onAccount)throw new v("Can't create delegation signature without account");if(null==r)throw new ae("Can't create delegation signature without address");return n.onAccount.sign(We([Ts.from(await n.onNode.getNetworkId()),...!0===n.omitAddress?[]:[ht(n.onAccount.address)],...e.map((e=>Zt(e)?Wt(e):e)).map((e=>ht(e))),ht(r)]),n)}async $compile(){if(null!=this.$options.bytecode)return this.$options.bytecode;if(null==this.$options.sourceCode)throw new v("Can't compile without source code");return this.$options.bytecode=(await this.$options.onCompiler.compileContract({code:this.$options.sourceCode,options:{fileSystem:this.$options.fileSystem}})).bytecode,this.$options.bytecode}_handleCallError(e,t){let n,{returnType:r,returnValue:a}=e;switch(r){case"ok":return;case"revert":n=this._calldata.decodeFateString(a);break;case"error":n=ht(a).toString();break;default:throw new B(`Unknown return type: ${r}`)}throw new se(n,t)}async _sendAndProcess(e,t){t={...this.$options,...t};const n=await ms(e,t),r={hash:n.hash,tx:mr(n.rawTx),txData:n,rawTx:n.rawTx};if(null==n.blockHeight)return r;const{callInfo:a}=await this.$options.onNode.getTransactionInfoByHash(n.hash);return Object.assign(r.txData,a),this._handleCallError(a,e),{...r,result:a}}async _estimateGas(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{result:r}=await this.$call(e,t,{...n,callStatic:!0});if(null==r)throw new R;const{gasUsed:a}=r;return Math.floor(1.25*a)}async $deploy(e,t){var n;const r={...this.$options,...t};if(null==this.$options.bytecode&&await this.$compile(),!0===r.callStatic)return this.$call("init",e,r);if(null!=this.$options.address)throw new te;const a=r.onAccount.address,i=await Lo(Vt.ContractCreateTx,{...r,gasLimit:null!==(n=r.gasLimit)&&void 0!==n?n:await this._estimateGas("init",e,r),callData:this._calldata.encode(this._name,"init",e),code:this.$options.bytecode,ownerId:a});this.$options.address=yr(i);const{hash:o,...s}=await this._sendAndProcess(i,r);return{...s,owner:a,transaction:o,address:this.$options.address}}_getFunctionACI(e){const t=this._aci.encodedAci.contract.functions.find((t=>t.name===e));if(null!=t)return t;if("init"===e)return{payable:!1};throw new ce(`Function ${e} doesn't exist in contract`)}async $call(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...this.$options,...n},a=this._getFunctionACI(e),i=this.$options.address,{onNode:o}=r;if(null==e)throw new oe;if("init"===e&&!1===r.callStatic)throw new re('"init" can be called only via dryRun');if("init"!==e&&r.amount>0&&!1===a.payable)throw new le(r.amount,e);let s;try{s=r.onAccount.address}catch(e){if(!0!==r.callStatic||!(e instanceof A&&"Account should be an address (ak-prefixed string), or instance of AccountBase, got undefined instead"===e.message||e instanceof Oe))throw e;s=Kn.pub}const c=this._calldata.encode(this._name,e,t);let l;if(!0===r.callStatic){"number"==typeof r.top&&(r.top=(await _o(r.top,{onNode:o})).hash);const t={...r,onNode:o,callData:c};let n;if(null==r.nonce&&null!=r.top&&(r.nonce=(await bo(s,{hash:r.top,onNode:o})).nonce+1),"init"===e){if(null==this.$options.bytecode)throw new v('Can\'t dry-run "init" without bytecode');n=await Lo(Vt.ContractCreateTx,{...t,code:this.$options.bytecode,ownerId:s})}else{if(null==i)throw new ae("Can't dry-run contract without address");n=await Lo(Vt.ContractCallTx,{...t,callerId:s,contractId:i})}const{callObj:a,...u}=await Po(n,s,r);if(null==a)throw new R;this._handleCallError({returnType:a.returnType,returnValue:a.returnValue},n),l={...u,tx:mr(n),result:a}}else{var u;if(null==i)throw new ae("Can't call contract without address");const n=await Lo(Vt.ContractCallTx,{...r,gasLimit:null!==(u=r.gasLimit)&&void 0!==u?u:await this._estimateGas(e,t,r),callerId:s,contractId:i,callData:c});l=await this._sendAndProcess(n,r)}return!0!==r.callStatic&&null==l.txData.blockHeight||(l.decodedResult=null!=a.returns&&"unit"!==a.returns&&"init"!==e&&this._calldata.decode(this._name,e,l.result.returnValue),l.decodedEvents=this.$decodeEvents(l.result.log,r)),l}_getContractNameByEvent(e,t,n){let{contractAddressToName:r}=n;const a={...this.$options.contractAddressToName,...r};if(null!=a[e])return a[e];const i=[this._aci.encodedAci,...this._aci.externalEncodedAci].filter((e=>{let{contract:t}=e;return null==t?void 0:t.event})).map((e=>{let{contract:t}=e;return[t.name,t.event.variant]})).map((e=>{let[t,n]=e;return n.map((e=>[t,Object.keys(e)[0],Object.values(e)[0]]))})).flat().filter((e=>{let[,n]=e;return BigInt(`0x${bt(n).toString("hex")}`)===t})).filter(((e,t,n)=>{let[,,r]=e;return!n.slice(0,t).some((e=>{return t=e[2],n=r,JSON.stringify(t)===JSON.stringify(n);var t,n}))}));switch(i.length){case 0:throw new ue(t.toString(),e);case 1:return i[0][0];default:throw new de(e,i)}}$decodeEvents(e){let{omitUnknown:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.map((e=>{const r=e.topics.map((e=>BigInt(e)));let a;try{a=this._getContractNameByEvent(e.address,r[0],n)}catch(e){if(null!=t&&t&&e instanceof ue)return null;throw e}const i=this._calldata.decodeEvent(a,e.data,r),[o,s]=Object.entries(i)[0];return{name:o,args:s,contract:{name:a,address:e.address}}})).filter((e=>null!=e))}static async initialize(e){let{onCompiler:t,onNode:n,sourceCode:r,bytecode:a,aci:i,address:o,fileSystem:s,validateBytecode:c,...l}=e;if(null==i&&null!=r&&(i=await t.generateACI({code:r,options:{fileSystem:s}})),null==i)throw new ie;if(null!=o&&(o=await Oo(o,"contract_pubkey",{resolveByNode:!0,onNode:n})),null==o&&null==r&&null==a)throw new ae("Can't create instance by ACI without address");if(null!=o&&null==(await Io(o,{onNode:n})).active)throw new ne(o);if(null!=c){if(null==o)throw new ae("Can't validate bytecode without contract address");const e=(await Ao(o,{onNode:n})).bytecode;if(!(null!=r?await t.validateByteCode({bytecode:e,source:r,options:{fileSystem:s}}).then((()=>!0),(()=>!1)):a===e))throw new ee(null!=r?"source code":"bytecode")}return new _s({onCompiler:t,onNode:n,sourceCode:r,bytecode:a,aci:i,address:o,fileSystem:s,...l})}constructor(e){var t=this;let{aci:n,...r}=e;this._aci=n,this._name=n.encodedAci.contract.name,this._calldata=new vs.Encoder([n.encodedAci,...n.externalEncodedAci]),this.$options={callStatic:!1,...r},Object.assign(this,Object.fromEntries(this._aci.encodedAci.contract.functions.map((e=>{let{name:n,arguments:r,stateful:a}=e;const i="init"!==n&&!a;return[n,async function(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];const s=a.length===r.length+1?a.pop():{};if("object"!=typeof s)throw new A(`Options should be an object: ${s}`);return"init"===n?t.$deploy(a,{callStatic:i,...s}):t.$call(n,a,{callStatic:i,...s})}]}))))}};var zs=_s;function qs(e,t,n){var r;let{interval:a,onNode:i,...o}=n;null!==(r=a)&&void 0!==r||(a=ho("microblock",o));const s=new Set,c=async()=>{var n;const r=(null!==(n=(await i.getOracleQueriesByPubkey(e)).oracleQueries)&&void 0!==n?n:[]).filter((e=>{let{id:t}=e;return!s.has(t)}));r.forEach((e=>{let{id:t}=e;return s.add(t)})),r.length>0&&t(r)};let l=!1;return(async()=>{for(;!l;)await c().catch(console.error),await Ke(a)})(),()=>{l=!0}}async function Es(e,t,n){var r;let a,i,o,{interval:s,onNode:c,...l}=n;null!==(r=s)&&void 0!==r||(s=ho("microblock",l));do{({response:o,ttl:i}=await c.getOracleQueryByPubkeyAndQueryId(e,t));const n=ht(o);if(n.length>0)return n.toString();await Ke(s),a=await fo({onNode:c})}while(i>=a);throw new E(a)}async function Ps(e,t,n){const r=await n.onNode.getOracleQueryByPubkeyAndQueryId(e,t);return{...r,decodedQuery:ht(r.query).toString(),decodedResponse:ht(r.response).toString(),respond:async(r,a)=>ks(e,t,r,{...n,...a}),pollForResponse:async r=>Es(e,t,{...n,...r})}}async function As(e,t,n){var r;null!==(r=n.queryFee)&&void 0!==r||(n.queryFee=(await n.onNode.getOracleByPubkey(e)).queryFee.toString());const a=n.onAccount.address,i=await Lo(Vt.OracleQueryTx,{queryTtlType:Gn.type,queryTtlValue:Gn.value,responseTtlType:Ln.type,responseTtlValue:Ln.value,...n,oracleId:e,senderId:a,query:t}),{nonce:o}=mr(i,Vt.OracleQueryTx).tx,s=Qt(a,o,e);return{...await ms(i,n),...await Ps(e,s,n)}}async function Is(e,t){const n=await Lo(Vt.OracleExtendTx,{oracleTtlType:Hn.type,oracleTtlValue:Hn.value,...t,callerId:t.onAccount.address,oracleId:e});return{...await ms(n,t),...await Os(e,t)}}async function ks(e,t,n,r){const a=await Lo(Vt.OracleResponseTx,{responseTtlType:Ln.type,responseTtlValue:Ln.value,...r,callerId:r.onAccount.address,oracleId:e,queryId:t,response:n});return{...await ms(a,r),...await Os(e,r)}}async function Os(e,t){return{...await t.onNode.getOracleByPubkey(e),queries:(await t.onNode.getOracleQueriesByPubkey(e)).oracleQueries,...Qe({pollQueries:qs,postQuery:As,respondToQuery:ks,extendOracle:Is,getQuery:Ps},(n=>{let[r,a]=n;return[r,function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const o=r[r.length-1];return null!=o&&"object"==typeof o&&o.constructor===Object?Object.assign(o,{...t,...o}):r.push(t),a(e,...r)}]}))}}async function Ms(e,t,n){const r=n.onAccount.address,a=await Lo(Vt.OracleRegisterTx,{queryFee:Vn,oracleTtlValue:Hn.value,oracleTtlType:Hn.type,...n,accountId:r,queryFormat:e,responseFormat:t});return{...await ms(a,n),...await Os(yt(ht(r),tt.OracleAddress),n)}}var Bs=C(9408).Buffer;async function Rs(e,t,n,r){var a;let{onAccount:i,onCompiler:o,onNode:s,...c}=r;const l=i.address;if("generalized"===(await bo(l,{onNode:s})).kind)throw new v(`Account ${l} is already GA`);const u=await zs.initialize({onAccount:i,onCompiler:o,onNode:s,sourceCode:t}),d=await Lo(Vt.GaAttachTx,{...c,onNode:s,code:await u.$compile(),gasLimit:null!==(a=c.gasLimit)&&void 0!==a?a:await u._estimateGas("init",n,c),ownerId:l,callData:u._calldata.encode(u._name,"init",n),authFun:bt(e)}),p=yr(d),{hash:m,rawTx:h}=await ms(d,{onNode:s,onAccount:i,onCompiler:o,...c});return Object.freeze({owner:l,transaction:m,rawTx:h,gaContractId:p})}async function Ds(e,t){let{onNode:n}=t;return new Uint8Array(bt(We([Bs.from(await n.getNetworkId()),ht(e)])))}var js=C(7445);function $s(e,t,n){return t in e?js(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Us(e){return new Proxy({},{...Object.fromEntries(["apply","construct","defineProperty","deleteProperty","getOwnPropertyDescriptor","getPrototypeOf","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"].map((e=>[e,()=>{throw new O(`${e} proxy request`)}]))),get(t,n,r){const a=e(),i=Reflect.get(a,n,r);return"function"==typeof i?i.bind(a):i},has(t,n){return Reflect.has(e(),n)}})}const{InvalidTxError:Fs,...Vs}=t,Hs={...Vs,...r,...n,...a,...i};class Gs{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};$s(this,"_options",{denomination:Be.AETTOS}),Object.assign(this._options,e)}_resolveAccount(e){if("string"==typeof e)throw new O("Address in AccountResolver");if("object"==typeof e)return e;throw new A(`Account should be an address (ak-prefixed string), or instance of AccountBase, got ${String(e)} instead`)}_getOptions(){return{...this._options,onAccount:Us((()=>this._resolveAccount()))}}async buildTx(e,t){return Lo(e,{...this._getOptions(),...t})}async initializeContract(e){const{onNode:t,onCompiler:n,...r}=this._getOptions();if(null==n||null==t)throw new x("onCompiler, onNode","provided",null);return zs.initialize({...r,onNode:t,onCompiler:n,...e})}}Object.assign(Gs.prototype,Qe(Hs,(e=>{let[t,n]=e;return[t,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length=n.length;const a=t[t.length-1];return t[t.length-1]={...this._getOptions(),...a,...null!=(null==a?void 0:a.onAccount)&&{onAccount:this._resolveAccount(a.onAccount)}},n(...t)}]})));var Ls=Gs;class Ks extends Ls{constructor(){let{nodes:e=[],...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),$s(this,"pool",new Map),e.forEach(((e,t)=>{let{name:n,instance:r}=e;return this.addNode(n,r,0===t)}))}get compilerApi(){if(null==this._options.onCompiler)throw new y("You can't use Compiler API. Compiler is not ready!");return this._options.onCompiler}get api(){return this.ensureNodeConnected(),this.pool.get(this.selectedNodeName)}addNode(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.pool.has(e))throw new Ne(e);this.pool.set(e,t),(n||null==this.selectedNodeName)&&this.selectNode(e)}selectNode(e){if(!this.pool.has(e))throw new Ce(`Node with name ${e} not in pool`);this.selectedNodeName=e}isNodeConnected(){return null!=this.selectedNodeName}ensureNodeConnected(){if(!this.isNodeConnected())throw new Ce("You can't use Node API. Node is not connected or not defined!")}async getNodeInfo(){return this.ensureNodeConnected(),{name:this.selectedNodeName,...await this.api.getNodeInfo()}}async getNodesInPool(){return Promise.all(Array.from(this.pool.entries()).map((async e=>{let[t,n]=e;return{name:t,...await n.getNodeInfo()}})))}addresses(){return[]}get address(){return this._resolveAccount().address}async sign(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._resolveAccount(t).sign(e,n)}async signTransaction(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=null!==this.selectedNodeName?await this.api.getNetworkId():void 0;return this._resolveAccount(t).signTransaction(e,{networkId:r,...n})}async signMessage(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._resolveAccount(t).signMessage(e,n)}_getOptions(){return{...super._getOptions(),onNode:Us((()=>this.api)),onCompiler:Us((()=>this.compilerApi))}}}class Qs extends Ks{constructor(){let{accounts:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),$s(this,"accounts",{}),null==e||e.forEach(((e,t)=>this.addAccount(e,{select:0===t})))}_resolveAccount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectedAddress;if("string"==typeof e){const t=e;if(ht(t),null==this.accounts[t])throw new D(e);e=this.accounts[t]}return super._resolveAccount(e)}addresses(){return Object.keys(this.accounts)}addAccount(e){let{select:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{address:n}=e;this.accounts[n]=e,!0===t&&this.selectAccount(n)}removeAccount(e){if(null==this.accounts[e])throw new D(e);delete this.accounts[e],this.selectedAddress===e&&delete this.selectedAddress}selectAccount(e){if(ht(e),null==this.accounts[e])throw new D(e);this.selectedAddress=e}}class Ws{}let Ys,Js,Xs,Zs,ec;!function(e){e.to_waellet="to_waellet",e.to_aepp="to_aepp"}(Ys||(Ys={})),function(e){e.window="window",e.extension="extension"}(Js||(Js={})),function(e){e.subscribe="subscribe",e.unsubscribe="unsubscribe"}(Xs||(Xs={})),function(e){e.readyToConnect="connection.announcePresence",e.updateAddress="address.update",e.address="address.get",e.connect="connection.open",e.sign="transaction.sign",e.signMessage="message.sign",e.subscribeAddress="address.subscribe",e.updateNetwork="networkId.update",e.closeConnection="connection.close"}(Zs||(Zs={})),function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.WAITING_FOR_CONNECTION_REQUEST="WAITING_FOR_CONNECTION_REQUEST"}(ec||(ec={}));const tc=[];class nc extends u{toJSON(){return{code:this.code,message:this.message,data:this.data}}static deserialize(e){const t=tc.find((t=>t.code===e.code));if(null==t)throw new B(`Can't find RpcError with code: ${e.code}`);return new t(e.data)}}class rc extends nc{constructor(e){super("Invalid transaction"),$s(this,"code",2),this.data=e,this.name="RpcInvalidTransactionError"}}$s(rc,"code",2),tc.push(rc);class ac extends nc{constructor(e){super("Broadcast failed"),$s(this,"code",3),this.data=e,this.name="RpcBroadcastError"}}$s(ac,"code",3),tc.push(ac);class ic extends nc{constructor(e){super("Operation rejected by user"),$s(this,"code",4),this.data=e,this.name="RpcRejectedByUserError"}}$s(ic,"code",4),tc.push(ic);class oc extends nc{constructor(){super("Unsupported Protocol Version"),$s(this,"code",5),this.name="RpcUnsupportedProtocolError"}}$s(oc,"code",5),tc.push(oc);class sc extends nc{constructor(e){super("Wallet deny your connection request"),$s(this,"code",9),this.data=e,this.name="RpcConnectionDenyError"}}$s(sc,"code",9),tc.push(sc);class cc extends nc{constructor(){super("You are not connected to the wallet"),$s(this,"code",10),this.name="RpcNotAuthorizeError"}}$s(cc,"code",10),tc.push(cc);class lc extends nc{constructor(e){super(`You are not subscribed for account ${e}`),$s(this,"code",11),this.data=e,this.name="RpcPermissionDenyError"}}$s(lc,"code",11),tc.push(lc);class uc extends nc{constructor(){super("The peer failed to execute your request due to unknown error"),$s(this,"code",12),this.name="RpcInternalError"}}$s(uc,"code",12),tc.push(uc);class dc extends nc{constructor(){super("Method not found"),$s(this,"code",-32601),this.name="RpcMethodNotFoundError"}}$s(dc,"code",-32601),tc.push(dc);var pc=C(9408).Buffer;class mc extends Ws{constructor(e,t){super(),this._rpcClient=e,this.address=t}async sign(){throw new O("RAW signing using wallet")}async signTransaction(e){let{innerTx:t,networkId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t)throw new O("innerTx option in AccountRpc");if(null==n)throw new x("networkId","provided",n);const r=await this._rpcClient.request(Zs.sign,{onAccount:this.address,tx:e,returnSigned:!0,networkId:n});if(null==r.signedTransaction)throw new k("signedTransaction is missed in wallet response");return r.signedTransaction}async signMessage(e){const{signature:t}=await this._rpcClient.request(Zs.signMessage,{onAccount:this.address,message:e});return pc.from(t,"hex")}}function hc(e,t){fc(e,t),t.add(e)}function yc(e,t,n){fc(e,t),t.set(e,n)}function fc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function gc(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var Nc=new WeakMap,Cc=new WeakMap,wc=new WeakMap,bc=new WeakSet,Sc=new WeakSet,xc=new WeakSet,vc=new WeakSet;class Tc{constructor(e,t,n){hc(this,vc),hc(this,xc),hc(this,Sc),hc(this,bc),yc(this,Nc,{writable:!0,value:new Map}),yc(this,Cc,{writable:!0,value:0}),yc(this,wc,{writable:!0,value:void 0}),this.connection=e,Nr(this,wc,n),e.connect(gc(this,bc,_c).bind(this),t)}async request(e,t){return gc(this,Sc,zc).call(this,Nr(this,Cc,gr(this,Cc)+1),e,t),new Promise(((e,t)=>{gr(this,Nc).set(gr(this,Cc),{resolve:e,reject:t})}))}notify(e,t){gc(this,Sc,zc).call(this,void 0,e,t)}}async function _c(e,t){if("2.0"!==(null==e?void 0:e.jsonrpc))throw new F(JSON.stringify(e));if("result"in e||"error"in e)return void gc(this,vc,Ec).call(this,e);const n=e;let r,a;try{if(!(n.method in gr(this,wc)))throw new dc;const e=n.method;r=await gr(this,wc)[e](n.params,t)}catch(e){a=e instanceof nc?e:new uc}null!=n.id&&gc(this,xc,qc).call(this,n.id,n.method,r,a)}function zc(e,t,n){this.connection.sendMessage({jsonrpc:"2.0",...null!=e?{id:e}:{},method:t,...null!=n?{params:n}:{}})}function qc(e,t,n,r){this.connection.sendMessage({jsonrpc:"2.0",id:e,method:t,...null!=r?{error:r}:{result:n}})}function Ec(e){let{id:t,error:n,result:r}=e;const a=gr(this,Nc).get(t);if(null==a)throw new V(t);null!=n?a.reject(nc.deserialize(n)):a.resolve(r),gr(this,Nc).delete(t)}class Pc extends Ks{constructor(e){let{name:t,onAddressChange:n=(()=>{}),onDisconnect:r=(()=>{}),onNetworkChange:a=(()=>{}),...i}=e;super(i),this.onAddressChange=n,this.onDisconnect=r,this.onNetworkChange=a,this.name=t}_resolveAccount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.addresses()[0];if("string"==typeof e){const t=e;if(ht(t),!this.addresses().includes(t))throw new H(t);this._ensureConnected(),e=new mc(this.rpcClient,t)}return null==e&&this._ensureAccountAccess(),super._resolveAccount(e)}addresses(){if(null==this._accounts)return[];const e=Object.keys(this._accounts.current)[0];return[...null!=e?[e]:[],...Object.keys(this._accounts.connected)]}async connectToWallet(e){let t,{connectNode:n=!1,name:r="wallet-node",select:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=this.rpcClient)throw new ke("You are already connected to wallet");const i=new Tc(e,(()=>{delete this.rpcClient,delete this._accounts,this.onDisconnect(t)}),{[Zs.updateAddress]:e=>{this._accounts=e,this.onAddressChange(e)},[Zs.updateNetwork]:e=>{const{node:t}=e;null!=t&&this.addNode(t.name,new co(t.url),!0),this.onNetworkChange(e)},[Zs.closeConnection]:e=>{t=e,i.connection.disconnect()},[Zs.readyToConnect]:()=>{}}),{node:o,...s}=await i.request(Zs.connect,{name:this.name,version:1,connectNode:n});if(n){if(null==o)throw new Me("Missing URLs of the Node");this.addNode(r,new co(o.url),a)}return this.rpcClient=i,s}disconnectWallet(){this._ensureConnected(),this.rpcClient.notify(Zs.closeConnection,{reason:"bye"}),this.rpcClient.connection.disconnect()}async askAddresses(){return this._ensureAccountAccess(),this.rpcClient.request(Zs.address,void 0)}async subscribeAddress(e,t){this._ensureConnected();const n=await this.rpcClient.request(Zs.subscribeAddress,{type:e,value:t});return this._accounts=n.address,n}_ensureConnected(){if(null==this.rpcClient)throw new Oe("You are not connected to Wallet")}_ensureAccountAccess(){if(this._ensureConnected(),0===this.addresses().length)throw new L}}var Ac=C(2716);const Ic=C.n(Ac)()({storeAsString:!0}),kc=e=>{if("object"==typeof e&&null!==e&&e.constructor===Object)return Qe(e,(e=>{let[t,n]=e;return[t,kc(n)]}));if(Array.isArray(e))return e.map((e=>kc(e)));if("string"==typeof e&&new(c())(e).toString(10)===e){const t=new(c())(e);return t.toJSON=()=>t.toString(10),t}return e};var Oc={stringify:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Ic.stringify(kc(t[0]),...t.slice(1))},parse:Ic.parse},Mc=C(9408).Buffer;class Bc extends Qs{constructor(e){let{name:t,id:n,type:r,onConnection:a,onSubscription:i,onDisconnect:o,onAskAccounts:s,...c}=e;super(c),$s(this,"_clients",new Map),this.onConnection=a,this.onSubscription=i,this.onDisconnect=o,this.onAskAccounts=s,this.name=t,this.id=n,this._type=r}_pushAccountsToApps(){null!=this._clients&&Array.from(this._clients.keys()).filter((e=>this._isRpcClientSubscribed(e))).map((e=>this._getClient(e).rpc)).forEach((e=>e.notify(Zs.updateAddress,this.getAccounts())))}selectAccount(e){super.selectAccount(e),this._pushAccountsToApps()}addAccount(e,t){super.addAccount(e,t),this._pushAccountsToApps()}_getNode(){return this.ensureNodeConnected(),{node:{url:this.api.$host,name:this.selectedNodeName}}}async selectNode(e){super.selectNode(e);const t=await this.api.getNetworkId();Array.from(this._clients.keys()).filter((e=>this._isRpcClientConnected(e))).map((e=>this._getClient(e))).forEach((e=>{e.rpc.notify(Zs.updateNetwork,{networkId:t,...e.connectNode&&this._getNode()})}))}_getClient(e){const t=this._clients.get(e);if(null==t)throw new G(e);return t}_isRpcClientSubscribed(e){return this._isRpcClientConnected(e)&&0!==this._getClient(e).addressSubscription.size}_isRpcClientConnected(e){return ec.CONNECTED===this._getClient(e).status&&this._getClient(e).rpc.connection.isConnected()}_disconnectRpcClient(e){const t=this._getClient(e);t.rpc.connection.disconnect(),t.status=ec.DISCONNECTED,t.addressSubscription=new Set}removeRpcClient(e){this._disconnectRpcClient(e),this._clients.delete(e)}addRpcClient(e){const t=(0,Mo.v4)();let n;const r={id:t,status:ec.WAITING_FOR_CONNECTION_REQUEST,addressSubscription:new Set,connectNode:!1,rpc:new Tc(e,(()=>{this._clients.delete(t),this.onDisconnect(t,n)}),{[Zs.closeConnection]:e=>{n=e,this._disconnectRpcClient(t)},[Zs.connect]:async(e,n)=>{let{name:a,version:i,icons:o,connectNode:s}=e;if(1!==i)throw new oc;return await this.onConnection(t,{name:a,icons:o,connectNode:s},n),r.status=ec.CONNECTED,r.connectNode=s,{...await this.getWalletInfo(),...s&&this._getNode()}},[Zs.subscribeAddress]:async(e,n)=>{let{type:a,value:i}=e;if(!this._isRpcClientConnected(t))throw new cc;switch(await this.onSubscription(t,{type:a,value:i},n),a){case Xs.subscribe:r.addressSubscription.add(i);break;case Xs.unsubscribe:r.addressSubscription.delete(i);break;default:throw new B(`Unknown subscription type: ${a}`)}return{subscription:Array.from(r.addressSubscription),address:this.getAccounts()}},[Zs.address]:async(e,n)=>{if(!this._isRpcClientSubscribed(t))throw new cc;return await this.onAskAccounts(t,e,n),this.addresses()},[Zs.sign]:async(e,n)=>{let{tx:r,onAccount:a=this.address,returnSigned:i}=e;if(!this._isRpcClientConnected(t))throw new cc;if(!this.addresses().includes(a))throw new lc(a);const o={onAccount:a,aeppOrigin:n,aeppRpcClientId:t};if(i)return{signedTransaction:await this.signTransaction(r,o)};try{return Oc.parse(Oc.stringify({transactionHash:await this.send(r,{...o,verify:!1})}))}catch(e){const t=await mo(r,this.api);if(t.length>0)throw new rc(t);throw new ac(e.message)}},[Zs.signMessage]:async(e,n)=>{let{message:r,onAccount:a=this.address}=e;if(!this._isRpcClientConnected(t))throw new cc;if(!this.addresses().includes(a))throw new lc(a);const i={onAccount:a,aeppOrigin:n,aeppRpcClientId:t};return{signature:Mc.from(await this.signMessage(r,i)).toString("hex")}}})};return this._clients.set(t,r),t}async shareWalletInfo(e){this._getClient(e).rpc.notify(Zs.readyToConnect,await this.getWalletInfo())}async getWalletInfo(){return{id:this.id,name:this.name,networkId:await this.api.getNetworkId(),origin:window.location.origin,type:this._type}}getAccounts(){return{current:null!=this.selectedAddress?{[this.selectedAddress]:{}}:{},connected:this.addresses().filter((e=>e!==this.selectedAddress)).reduce(((e,t)=>({...e,[t]:{}})),{})}}}var Rc=C(9408).Buffer;const Dc=new WeakMap;class jc extends Ws{constructor(e){if(super(),64!==(e="string"==typeof e?Rc.from(e,"hex"):e).length)throw new x("secretKey","64 bytes",e.length);Dc.set(this,e),this.address=yt(xt(Dc.get(this)).publicKey,tt.AccountAddress)}static generate(){return new jc(vt().secretKey)}async sign(e,t){return Tt(e,Dc.get(this))}async signTransaction(e){let{innerTx:t,networkId:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==n)throw new x("networkId","provided",n);const a=[n];!0===t&&a.push("inner_tx");const i=ht(e),o=We([Rc.from(a.join("-")),bt(i)]);return pr({encodedTx:i,signatures:[await this.sign(o,r)]},Vt.SignedTx).tx}async signMessage(e,t){return this.sign(zt(e),t)}}var $c=new WeakMap;class Uc extends Ws{constructor(e){var t,n,r;super(),r={writable:!0,value:void 0},function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t=this,n=$c),n.set(t,r),ht(e),this.address=e}async sign(){throw new O("Can't sign using generalized account")}async signMessage(){throw new O("Can't sign using generalized account")}async signTransaction(e,t){let{authData:n,onCompiler:r,onNode:a}=t;if(null==n||null==r||null==a)throw new x("authData, onCompiler, onNode","provided",null);const{callData:i,sourceCode:o,args:s,gasLimit:c}=n,l=null!=i?i:await(async()=>{if(null==gr(this,$c)){const e=await bo(this.address,{onNode:a});if("generalized"!==e.kind)throw new x("account kind","generalized",e.kind);Nr(this,$c,e.authFun)}if(null==gr(this,$c))throw new B("Account in generalised, but authFun not provided");if(null==o||null==s)throw new Z("Auth data must contain source code and arguments.");const e=await zs.initialize({onCompiler:r,onNode:a,sourceCode:o});return e._calldata.encode(e._name,gr(this,$c),s)})(),u=await Lo(Vt.GaMetaTx,{tx:pr({encodedTx:ht(e),signatures:[]},Vt.SignedTx).rlpEncoded,gaId:this.address,authData:l,gasLimit:c,nonce:0,onNode:a});return pr({encodedTx:ht(u),signatures:[]},Vt.SignedTx).tx}}var Fc=C(9408).Buffer;const Vc=224;class Hc extends Ws{constructor(e,t,n){super(),this.transport=e,this.index=t,this.address=n,e.decorateAppAPIMethods(this,["signTransaction","signMessage"],"w0w")}async sign(){throw new O("RAW signing using Ledger HW")}async signTransaction(e){let{innerTx:t,networkId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t)throw new O("innerTx option in AccountLedger");if(null==n)throw new x("networkId","provided",n);const r=ht(e);let a=0;const i=Fc.from(n),o=[];for(;a!==r.length;){const e=0===a?141-i.length:150,t=a+e>r.length?r.length-a:e,n=Fc.alloc(0===a?9+i.length+t:t);if(0===a){let e=n.writeUInt32BE(this.index,0);e=n.writeUInt32BE(r.length,e),e=n.writeUInt8(i.length,e),e+=i.copy(n,e,0,i.length),r.copy(n,e,0,150-e)}else r.copy(n,0,a,a+t);o.push(n),a+=t}return pr({encodedTx:r,signatures:[(await o.reduce((async(e,t,n)=>(await e,this.transport.send(Vc,4,0===n?0:128,0,t))),Promise.resolve(Fc.alloc(0)))).subarray(0,64)]},Vt.SignedTx).tx}async signMessage(e){let t=0;const n=Fc.from(e),r=[];for(;t!==n.length;){const e=0===t?142:150,a=t+e>n.length?n.length-t:e,i=Fc.alloc(0===t?8+a:a);0===t?(i.writeUInt32BE(this.index,0),i.writeUInt32BE(n.length,4),n.copy(i,8,t,t+a)):n.copy(i,0,t,t+a),r.push(i),t+=a}return(await r.reduce((async(e,t,n)=>(await e,this.transport.send(Vc,8,0===n?0:128,0,t))),Promise.resolve(Fc.alloc(0)))).subarray(0,64)}}var Gc=C(9408).Buffer;class Lc{constructor(e){this.transport=e,this.versionCheckPromise=this.getAppConfiguration().then((e=>{let{version:t}=e;const n=[t,"0.4.4","0.5.0"];if(!Cr(...n))throw new M("app on ledger",...n)})),e.decorateAppAPIMethods(this,["getAddress","getAppConfiguration"],"w0w")}async getAppConfiguration(){await this.versionCheckPromise;const e=await this.transport.send(Vc,6,0,0);return{version:[e[1],e[2],e[3]].join(".")}}async getAddress(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];await this.versionCheckPromise;const n=Gc.alloc(4);n.writeUInt32BE(e,0);const r=await this.transport.send(Vc,2,t?1:0,0,n),a=r[0];return r.subarray(1,1+a).toString("ascii")}async initialize(e){return await this.versionCheckPromise,new Hc(this.transport,e,await this.getAddress(e))}async discover(e){let t=0;const n=[];let r;do{null!=r&&n.push(r),r=await this.initialize(t),t+=1}while(await e.getAccountByPubkey(r.address).then((()=>!0),(()=>!1)));return n}}const Kc={type:{name:"Composite",className:"Contract",modelProperties:{code:{serializedName:"code",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}}}}},Qc={type:{name:"Composite",className:"CompileOpts",modelProperties:{fileSystem:{serializedName:"file_system",type:{name:"Dictionary",value:{type:{name:"any"}}}},srcFile:{serializedName:"src_file",type:{name:"String"}}}}},Wc={type:{name:"Composite",className:"Aci",modelProperties:{encodedAci:{serializedName:"encoded_aci",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}},externalEncodedAci:{serializedName:"external_encoded_aci",type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}},interface:{serializedName:"interface",required:!0,type:{name:"String"}}}}},Yc={type:{name:"Composite",className:"CompilerError",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"String"}},pos:{serializedName:"pos",type:{name:"Composite",className:"ErrorPos"}},message:{serializedName:"message",required:!0,type:{name:"String"}},context:{serializedName:"context",type:{name:"String"}}}}},Jc={type:{name:"Composite",className:"ErrorPos",modelProperties:{file:{serializedName:"file",type:{name:"String"}},line:{serializedName:"line",required:!0,type:{name:"Number"}},col:{serializedName:"col",required:!0,type:{name:"Number"}}}}},Xc={type:{name:"Composite",className:"ByteCode",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},Zc={type:{name:"Composite",className:"SophiaCallResultInput",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},function:{serializedName:"function",required:!0,type:{name:"String"}},callResult:{serializedName:"call-result",required:!0,type:{name:"String"}},callValue:{serializedName:"call-value",required:!0,type:{name:"String"}}}}},el={type:{name:"Composite",className:"BytecodeCallResultInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}},function:{serializedName:"function",required:!0,type:{name:"String"}},callResult:{serializedName:"call-result",required:!0,type:{name:"String"}},callValue:{serializedName:"call-value",required:!0,type:{name:"String"}}}}},tl={type:{name:"Composite",className:"DecodedCallresult",modelProperties:{function:{serializedName:"function",required:!0,type:{name:"String"}},result:{serializedName:"result",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}}}}},nl={type:{name:"Composite",className:"FunctionCallInput",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},function:{serializedName:"function",required:!0,type:{name:"String"}},arguments:{serializedName:"arguments",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},rl={type:{name:"Composite",className:"Calldata",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}}}}},al={type:{name:"Composite",className:"DecodeCalldataBytecode",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},il={type:{name:"Composite",className:"DecodedCalldata",modelProperties:{function:{serializedName:"function",required:!0,type:{name:"String"}},arguments:{serializedName:"arguments",required:!0,type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}}}}},ol={type:{name:"Composite",className:"ErrorModel",modelProperties:{reason:{serializedName:"reason",required:!0,type:{name:"String"}}}}},sl={type:{name:"Composite",className:"DecodeCalldataSource",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},function:{serializedName:"function",required:!0,type:{name:"String"}}}}},cl={type:{name:"Composite",className:"ByteCodeInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},ll={type:{name:"Composite",className:"FateAssembler",modelProperties:{fateAssembler:{serializedName:"fate-assembler",required:!0,type:{name:"String"}}}}},ul={type:{name:"Composite",className:"ValidateByteCodeInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}},source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}}}}},dl={type:{name:"Composite",className:"CompilerVersion",modelProperties:{version:{serializedName:"version",required:!0,type:{name:"String"}}}}},pl={type:{name:"Composite",className:"ApiVersion",modelProperties:{apiVersion:{serializedName:"api-version",required:!0,type:{name:"String"}}}}},ml={type:{name:"Composite",className:"SophiaBinaryData",modelProperties:{sophiaType:{serializedName:"sophia-type",required:!0,type:{name:"String"}},data:{serializedName:"data",required:!0,type:{name:"String"}}}}},hl={type:{name:"Composite",className:"SophiaJsonData",modelProperties:{data:{serializedName:"data",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}}}}},yl={parameterPath:["options","contentType"],mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Content-Type",type:{name:"String"}}},fl={parameterPath:"body",mapper:Kc},gl={parameterPath:"accept",mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Accept",type:{name:"String"}}},Nl={parameterPath:"$host",mapper:{serializedName:"$host",required:!0,type:{name:"String"}},skipEncoding:!0},Cl={parameterPath:"body",mapper:Zc},wl={parameterPath:"body",mapper:el},bl={parameterPath:"body",mapper:nl},Sl={parameterPath:"body",mapper:al},xl={parameterPath:"body",mapper:sl},vl={parameterPath:"body",mapper:cl},Tl={parameterPath:"body",mapper:ul};class _l extends Tr.ServiceClient{constructor(e,t){var n,r,a;if(void 0===e)throw new Error("'$host' cannot be null");t||(t={});const i="azsdk-js-compiler/1.0.0-beta.1",o=t.userAgentOptions&&t.userAgentOptions.userAgentPrefix?`${t.userAgentOptions.userAgentPrefix} ${i}`:`${i}`,s={requestContentType:"application/json; charset=utf-8",...t,userAgentOptions:{userAgentPrefix:o},baseUri:null!==(n=null!==(r=t.endpoint)&&void 0!==r?r:t.baseUri)&&void 0!==n?n:"{$host}"};super(s),null!==(a=t)&&void 0!==a&&a.pipeline&&t.pipeline.getOrderedPolicies().length>0&&(t.pipeline.getOrderedPolicies().some((e=>e.name===Ge.bearerTokenAuthenticationPolicyName))||(this.pipeline.removePolicy({name:Ge.bearerTokenAuthenticationPolicyName}),this.pipeline.addPolicy(Ge.bearerTokenAuthenticationPolicy({scopes:`${s.baseUri}/.default`,challengeCallbacks:{authorizeRequestOnChallenge:Tr.authorizeRequestOnClaimChallenge}})))),this.$host=e}generateACI(e,t){return this.sendOperationRequest({body:e,options:t},ql)}compileContract(e,t){return this.sendOperationRequest({body:e,options:t},El)}decodeCallResult(e,t){return this.sendOperationRequest({body:e,options:t},Pl)}decodeCallResultBytecode(e,t){return this.sendOperationRequest({body:e,options:t},Al)}encodeCalldata(e,t){return this.sendOperationRequest({body:e,options:t},Il)}decodeCalldataBytecode(e,t){return this.sendOperationRequest({body:e,options:t},kl)}decodeCalldataSource(e,t){return this.sendOperationRequest({body:e,options:t},Ol)}getFateAssemblerCode(e,t){return this.sendOperationRequest({body:e,options:t},Ml)}validateByteCode(e,t){return this.sendOperationRequest({body:e,options:t},Bl)}getCompilerVersion(e,t){return this.sendOperationRequest({body:e,options:t},Rl)}version(e){return this.sendOperationRequest({options:e},Dl)}apiVersion(e){return this.sendOperationRequest({options:e},jl)}api(e){return this.sendOperationRequest({options:e},$l)}}const zl=Tr.createSerializer(o,!1),ql={path:"/aci",httpMethod:"POST",responses:{200:{bodyMapper:Wc},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:fl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},El={path:"/compile",httpMethod:"POST",responses:{200:{bodyMapper:Xc},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:fl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Pl={path:"/decode-call-result",httpMethod:"POST",responses:{200:{bodyMapper:{type:{name:"any"}}},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Cl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Al={path:"/decode-call-result/bytecode",httpMethod:"POST",responses:{200:{bodyMapper:tl},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:wl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Il={path:"/encode-calldata",httpMethod:"POST",responses:{200:{bodyMapper:rl},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:bl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},kl={path:"/decode-calldata/bytecode",httpMethod:"POST",responses:{200:{bodyMapper:il},400:{bodyMapper:ol,isError:!0}},requestBody:Sl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Ol={path:"/decode-calldata/source",httpMethod:"POST",responses:{200:{bodyMapper:il},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:xl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Ml={path:"/fate-assembler",httpMethod:"POST",responses:{200:{bodyMapper:ll},400:{bodyMapper:ol,isError:!0}},requestBody:vl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Bl={path:"/validate-byte-code",httpMethod:"POST",responses:{200:{},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Tl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Rl={path:"/compiler-version",httpMethod:"POST",responses:{200:{bodyMapper:dl},400:{bodyMapper:ol,isError:!0}},requestBody:vl,urlParameters:[Nl],headerParameters:[yl,gl],mediaType:"json",serializer:zl},Dl={path:"/version",httpMethod:"GET",responses:{200:{bodyMapper:dl},500:{bodyMapper:ol,isError:!0}},urlParameters:[Nl],headerParameters:[gl],serializer:zl},jl={path:"/api-version",httpMethod:"GET",responses:{200:{bodyMapper:pl},500:{bodyMapper:ol,isError:!0}},urlParameters:[Nl],headerParameters:[gl],serializer:zl},$l={path:"/api",httpMethod:"GET",responses:{200:{bodyMapper:{type:{name:"Dictionary",value:{type:{name:"any"}}}}},400:{bodyMapper:ol,isError:!0}},urlParameters:[Nl],headerParameters:[gl],serializer:zl};class Ul extends _l{constructor(e){let{ignoreVersion:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(e,{allowInsecureConnection:!0,additionalPolicies:[xr((e=>{let t="";return"reason"in e&&(t+=` ${e.reason}${null!=e.parameter?` in ${e.parameter}`:""}${null!=e.info?` (${JSON.stringify(e.info)})`:""}`),Array.isArray(e)&&(t+=`\n${e.map((e=>`${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${null!=e.context?`(${e.context})`:""}`)).map((e=>e.trim())).join("\n")}`),t}))]}),!0!==t){const e=this.apiVersion().then((e=>{let{apiVersion:t}=e;return t}));this.pipeline.addPolicy(vr("compiler","/api-version",e,"7.0.1","8.0.0"))}}}function Fl(e){return e.replace(/_./g,(e=>e[1].toUpperCase()))}var Vl=C(8079);function Hl(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const[a,...i]=n;e._eventEmitter.emit(a,...i)}function Gl(e,t){var n;if(null==t)throw new X;e._fsm=t,null!=(null==t||null===(n=t.handler)||void 0===n?void 0:n.enter)&&t.handler.enter(e),Yl(e)}function Ll(e,t){t!==e._status&&(e._status=t,Hl(e,"statusChanged",t))}function Kl(e,t){e._state=t,Hl(e,"stateChanged",t)}function Ql(e,t){e._options.debug&&console.log("Send message: ",t),e._websocket.send(Oc.stringify({jsonrpc:"2.0",...t}))}function Wl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ql(e,{method:t,params:n})}async function Yl(e){if(e._isActionQueueLocked)return;const t=e._actionQueue;if(0===t.length)return;const n=t.findIndex((t=>t.guard(e,e._fsm)));if(-1===n)return;e._actionQueue=t.filter(((e,t)=>n!==t)),e._isActionQueueLocked=!0;const r=await t[n].action(e,e._fsm);e._isActionQueueLocked=!1,Gl(e,r)}async function Jl(e,t){const{handler:n,state:r}=e._fsm;Gl(e,await Promise.resolve(n(e,t,r)))}function Xl(e){e._websocket.close(),clearTimeout(e._pingTimeoutId)}function Zl(e){clearTimeout(e._pingTimeoutId),e._pingTimeoutId=setTimeout((()=>{Wl(e,"channels.system",{action:"ping"}),e._pingTimeoutId=setTimeout((()=>{Xl(e),Hl(e,"error",new W)}),15e3)}),1e4)}async function eu(e,t,n){return new Promise(((r,a)=>{const i=e._nextRpcMessageId;e._nextRpcMessageId+=1,e._rpcCallbacks.set(i,(e=>{if(null!=e.error){var t;const n=null!==(t=e.error.data[0].message)&&void 0!==t?t:"";a(new K(e.error.message+n))}else r(e.result)})),Ql(e,{method:t,id:i,params:n})}))}async function tu(e,t,n,r){var a;let i;if(null!=n.tx)i=await r(n.tx);else{if(null==n.signed_tx)throw new h("Can't find transaction in message");i=await async function(e,t){const{signatures:n,encodedTx:r}=mr(e,Vt.SignedTx).tx,a=await t(yt(r.rlpEncoded,tt.Transaction));if("string"==typeof a){const{tx:e}=mr(a,Vt.SignedTx);return pr({signatures:n.concat(e.signatures),encodedTx:e.encodedTx.rlpEncoded},Vt.SignedTx).tx}return a}(n.signed_tx,r)}const o="string"!=typeof i,s=null!=n.tx?"tx":"signed_tx";return Wl(e,t,o?{error:null!==(a=i)&&void 0!==a?a:1}:{[s]:i}),o}function nu(e,t,n){var r;return null==n||null===(r=n.reject)||void 0===r||r.call(n,Object.assign(new Y(`Unexpected message received:\n\n${JSON.stringify(t)}`),{wsMessage:t})),{handler:lu}}function ru(e,t,n,r){if(null!=r&&"channels.update"===t.method)return r(e,t,n);if("channels.conflict"===t.method)return n.resolve({accepted:!1,errorCode:t.params.data.error_code,errorMessage:t.params.data.error_msg}),{handler:lu};if("channels.info"===t.method&&"aborted_update"===t.params.data.event)return n.resolve({accepted:!1}),{handler:lu};if(null!=t.error){const e=t.error.data.map((e=>e.code));return e.includes(1001)?n.reject(new _("Insufficient balance")):e.includes(1002)?n.reject(new v("Amount cannot be negative")):n.reject(new Q(t.error.message)),{handler:lu}}return nu(0,t,n)}function au(e,t){if("channels.info"===t.method){const n=t.params.data.event;let r=null;return"channel_accept"===n&&(r="accepted"),"funding_created"===n&&(r="halfSigned"),null!=r?(Ll(e,r),{handler:ou}):"channel_reestablished"===t.params.data.event?{handler:cu}:"fsm_up"===t.params.data.event?(e._fsmId=t.params.data.fsm_id,{handler:au}):{handler:au}}var n;if("channels.error"===t.method)return Hl(e,"error",new Q(null==t||null===(n=t.payload)||void 0===n?void 0:n.message)),{handler:mu}}async function iu(e,t,n){return"channels.info"===t.method&&"fsm_up"===t.params.data.event?(e._fsmId=t.params.data.fsm_id,Kl(e,(await eu(e,"channels.get.offchain_state",{})).signed_tx),{handler:lu}):nu(0,t,n)}async function ou(e,t){const n="initiator"===e._options.role?"initiator_sign":"responder_sign";if(t.method===`channels.sign.${n}`)return await tu(e,`channels.${n}`,t.params.data,(async t=>e._options.sign(n,t))),{handler:su}}function su(e,t){if("channels.on_chain_tx"===t.method){const{info:n}=t.params.data,{role:r}=e._options;if("funding_signed"===n&&"initiator"===r||"funding_created"===n&&"responder"===r)return{handler:function t(n,r){if("channels.info"===r.method)switch(r.params.data.event){case"funding_created":case"own_funding_locked":return{handler:t};case"funding_locked":return{handler:cu}}if("channels.on_chain_tx"===r.method)return Hl(e,"onChainTx",r.params.data.tx,{info:r.params.data.info,type:r.params.data.type}),{handler:t}}}}if("channels.info"===t.method&&"funding_signed"===t.params.data.event&&"initiator"===e._options.role)return e._channelId=t.params.channel_id,Ll(e,"signed"),{handler:su}}function cu(e,t){if("channels.info"===t.method&&"open"===t.params.data.event)return e._channelId=t.params.channel_id,{handler(t,n){if("channels.update"===n.method)return Kl(e,n.params.data.state),{handler:lu}}}}async function lu(e,t,n){switch(t.method){case"channels.info":switch(t.params.data.event){case"update":case"withdraw_created":case"deposit_created":return{handler:uu};case"own_withdraw_locked":case"withdraw_locked":case"own_deposit_locked":case"deposit_locked":case"peer_disconnected":case"channel_reestablished":case"open":return Hl(e,t.params.data.event),{handler:lu};case"fsm_up":return e._fsmId=t.params.data.fsm_id,{handler:lu};case"timeout":case"close_mutual":case"shutdown":return{handler:lu};case"closing":return Ll(e,"closing"),{handler:lu};case"closed_confirmed":return Ll(e,"closed"),{handler:mu};case"died":return Ll(e,"died"),{handler:mu}}break;case"channels.on_chain_tx":return Hl(e,"onChainTx",t.params.data.tx,{info:t.params.data.info,type:t.params.data.type}),{handler:lu};case"channels.leave":return{handler:lu};case"channels.update":return Kl(e,t.params.data.state),{handler:lu};case"channels.sign.shutdown_sign_ack":return uu(e,t,n)}}async function uu(e,t,n){var r;const[,a]=null!==(r=t.method.match(/^channels\.sign\.([^.]+)$/))&&void 0!==r?r:[];return null==a?nu(0,t,n):await tu(e,`channels.${a}`,t.params.data,(async n=>e._options.sign(a,n,{updates:t.params.data.updates})))?{handler:function e(t,r){return null!=r.error?{handler:e,state:n}:"channels.conflict"===r.method?{handler:lu}:nu(0,r,n)},state:n}:{handler:lu}}async function du(e,t,n){return"channels.sign.shutdown_sign"!==t.method?nu(0,t,n):(await tu(e,"channels.shutdown_sign",t.params.data,(async e=>n.sign(e))),{handler(e,t){return"channels.on_chain_tx"!==t.method?nu(0,t,n):{handler:mu,state:n}},state:n})}function pu(e,t,n){return"channels.leave"===t.method?(n.resolve({channelId:t.params.channel_id,signedTx:t.params.data.state}),Xl(e),{handler:mu}):"channels.error"===t.method?(n.reject(new Q(t.data.message)),{handler:lu}):nu(0,t,n)}function mu(e,t,n){return null==n?{handler:mu}:"closing"===t.params.data.event?{handler:mu,state:n}:"channel_closed"===t.params.data.info?(n.closeTx=t.params.data.tx,{handler:mu,state:n}):"closed_confirmed"===t.params.data.event?(n.resolve(n.closeTx),{handler:mu}):{handler:mu,state:n}}lu.enter=e=>{Ll(e,"open")};var hu=C(3735);class yu{constructor(){$s(this,"_eventEmitter",new hu.EventEmitter),$s(this,"_nextRpcMessageId",0),$s(this,"_rpcCallbacks",new Map),$s(this,"_messageQueue",[]),$s(this,"_isMessageQueueLocked",!1),$s(this,"_actionQueue",[]),$s(this,"_isActionQueueLocked",!1),$s(this,"_status","disconnected")}static async initialize(e){return yu._initialize(new yu,e)}static async _initialize(e,t){return await async function(e,t,n,r){let{url:a,...i}=r;e._options={url:a,...i},e._fsm={handler:t};const o=new URL(a);Object.entries(i).filter((e=>{let[t]=e;return!["sign","debug"].includes(t)})).forEach((e=>{let[t,n]=e;return o.searchParams.set(t.replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`)),n.toString())})),o.searchParams.set("protocol","json-rpc"),Ll(e,"connecting"),e._websocket=new Vl.w3cwebsocket(o.toString()),await new Promise(((t,r)=>{Object.assign(e._websocket,{onerror:r,onopen:async()=>{if(t(),Ll(e,"connected"),null!=i.reconnectTx){Gl(e,{handler:n});const t=(await eu(e,"channels.get.offchain_state",{})).signed_tx;Kl(e,t)}Zl(e)},onclose:()=>{Ll(e,"disconnected"),clearTimeout(e._pingTimeoutId)},onmessage:t=>{let{data:n}=t;return function(e,t){const n=Oc.parse(t);if(e._options.debug&&console.log("Receive message: ",n),null==n.id)"channels.message"!==n.method?"channels.system.pong"!==n.method?(e._messageQueue.push(n),async function(e){if(!e._isMessageQueueLocked){for(e._isMessageQueueLocked=!0;e._messageQueue.length>0;){const t=e._messageQueue.shift();if(null==t)throw new R;try{await Jl(e,t)}catch(n){Hl(e,"error",new J(n,t))}}e._isMessageQueueLocked=!1}}(e)):n.params.channel_id!==e._channelId&&null!=e._channelId||Zl(e):Hl(e,"message",n.params.data.message);else{const t=e._rpcCallbacks.get(n.id);if(null==t)return void Hl(e,"error",new h(`Can't find callback by id: ${n.id}`));try{t(n)}finally{e._rpcCallbacks.delete(n.id)}}}(e,n)}})}))}(e,null!=t.existingFsmId?iu:au,lu,t),e}on(e,t){this._eventEmitter.on(e,t)}off(e,t){this._eventEmitter.removeListener(e,t)}disconnect(){return Xl(this)}status(){return this._status}async state(){return e=await eu(this,"channels.get.offchain_state",{}),Object.entries(e).reduce(((e,t)=>{let[n,r]=t;return{...e,[Fl(n)]:r}}),{});var e}round(){if(null==this._state)return null;const{txType:e,tx:t}=mr(this._state,Vt.SignedTx).tx.encodedTx;switch(e){case Vt.ChannelCreateTx:return 1;case Vt.ChannelOffChainTx:case Vt.ChannelWithdrawTx:case Vt.ChannelDepositTx:return t.round;default:return null}}id(){if(null==this._channelId)throw new h("Channel is not initialized");return this._channelId}fsmId(){if(null==this._fsmId)throw new h("Channel is not initialized");return this._fsmId}async enqueueAction(e){return async function(e,t,n){const r=new Promise(((r,a)=>{e._actionQueue.push({guard:t,action(){const e=n();return{...e,state:{...e.state,resolve:r,reject:a}}}})}));return Yl(e),r}(this,((e,t)=>(null==t?void 0:t.handler)===lu),e)}async leave(){return this.enqueueAction((()=>(Wl(this,"channels.leave"),{handler:pu})))}async shutdown(e){return this.enqueueAction((()=>(Wl(this,"channels.shutdown"),{handler:du,state:{sign:e}})))}static async reconnect(e,t){const{sign:n}=e;return yu.initialize({...e,reconnectTx:await n("reconnect",pr(t,Vt.ChannelClientReconnectTx).tx)})}}class fu extends yu{async update(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.enqueueAction((()=>{Wl(this,"channels.update.new",{from:e,to:t,amount:n,meta:a});const i=async(e,t,n)=>"channels.sign.update"===t.method?await tu(this,"channels.update",t.params.data,(async e=>r(e,{updates:t.params.data.updates})))?{handler:i,state:n}:{handler:(e,t)=>ru(this,t,n,(()=>(Kl(this,t.params.data.state),n.resolve({accepted:!0,signedTx:t.params.data.state}),{handler:lu}))),state:n}:"channels.error"===t.method?(n.reject(new Q(t.data.message)),{handler:lu}):ru(this,t,n);return{handler:i}}))}async poi(e){let{accounts:t,contracts:n}=e;return(await eu(this,"channels.get.poi",{accounts:t,contracts:n})).poi}async balances(e){return Object.fromEntries((await eu(this,"channels.get.balances",{accounts:e})).map((e=>[e.account,e.balance])))}async awaitingActionTx(e,t,n){if(t.method!==`channels.sign.${e}_tx`)return nu(0,t,n);const r=(t,a)=>{var i;if("channels.on_chain_tx"===a.method)return null===(i=n.onOnChainTx)||void 0===i||i.call(n,a.params.data.tx),{handler:r,state:n};if("channels.info"===a.method&&[`own_${e}_locked`,`${e}_locked`].includes(a.params.data.event)){var o;const t="deposit"===e?"Deposit":"Withdraw",i=a.params.data.event.startsWith("own_");return null===(o=n[`on${i?"Own":""}${t}Locked`])||void 0===o||o.call(n),{handler:r,state:n}}return ru(this,a,n,(()=>(Kl(this,a.params.data.state),n.resolve({accepted:!0,signedTx:a.params.data.state}),{handler:lu})))},{sign:a}=n;return await tu(this,`channels.${e}_tx`,t.params.data,(async e=>a(e,{updates:t.params.data.updates}))),{handler:r,state:n}}async withdraw(e,t){let{onOnChainTx:n,onOwnWithdrawLocked:r,onWithdrawLocked:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(Wl(this,"channels.withdraw",{amount:e}),{handler:async(e,t,n)=>this.awaitingActionTx("withdraw",t,n),state:{sign:t,onOnChainTx:n,onOwnWithdrawLocked:r,onWithdrawLocked:a}})))}async deposit(e,t){let{onOnChainTx:n,onOwnDepositLocked:r,onDepositLocked:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(Wl(this,"channels.deposit",{amount:e}),{handler:async(e,t,n)=>this.awaitingActionTx("deposit",t,n),state:{sign:t,onOnChainTx:n,onOwnDepositLocked:r,onDepositLocked:a}})))}async sendMessage(e,t){const n="object"==typeof e?JSON.stringify(e):e;"connecting"===this.status()&&(await new Promise((e=>{const t=n=>{"connecting"!==n&&(e(),this.off("statusChanged",t))};this.on("statusChanged",t)})),await Ke(500)),Wl(this,"channels.message",{info:n,to:t})}}function gu(e){return Object.entries(e).reduce(((e,t)=>{let[n,r]=t;return{...e,[Fl(n)]:r}}),{})}class Nu extends fu{static async initialize(e){return yu._initialize(new Nu,e)}async createContract(e,t){let{code:n,callData:r,deposit:a,vmVersion:i,abiVersion:o}=e;return this.enqueueAction((()=>(Wl(this,"channels.update.new_contract",{code:n,call_data:r,deposit:a,vm_version:i,abi_version:o}),{handler:async(e,t,n)=>"channels.sign.update"!==t.method?nu(0,t,n):(await tu(this,"channels.update",t.params.data,(async e=>n.sign(e))),{handler:(e,t,n)=>ru(this,t,n,(()=>{const{round:e}=mr(t.params.data.state,Vt.SignedTx).tx.encodedTx.tx,r="initiator"===this._options.role?"initiatorId":"responderId",a=this._options[r];return Kl(this,t.params.data.state),n.resolve({accepted:!0,address:St(a,e),signedTx:t.params.data.state}),{handler:lu}})),state:n}),state:{sign:t}})))}async callContract(e,t){let{amount:n,callData:r,contract:a,abiVersion:i}=e;return this.enqueueAction((()=>(Wl(this,"channels.update.call_contract",{amount:n,call_data:r,contract_id:a,abi_version:i}),{handler:async(e,t,n)=>"channels.sign.update"!==t.method?nu(0,t,n):(await tu(this,"channels.update",t.params.data,(async e=>n.sign(e,{updates:t.params.data.updates}))),{handler:(e,t,n)=>ru(this,t,n,(()=>(Kl(this,t.params.data.state),n.resolve({accepted:!0,signedTx:t.params.data.state}),{handler:lu}))),state:n}),state:{sign:t}})))}async forceProgress(e,t){let{amount:n,callData:r,contract:a,abiVersion:i,gasLimit:o=1e6,gasPrice:s=Bt}=e,{onOnChainTx:c}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(Wl(this,"channels.force_progress",{amount:n,call_data:r,contract_id:a,abi_version:i,gas_price:s,gas:o}),{handler:async(e,t,n)=>"channels.sign.force_progress_tx"!==t.method?nu(0,t,n):(await tu(this,"channels.force_progress_sign",t.params.data,(async e=>n.sign(e,{updates:t.params.data.updates}))),{handler:(e,t,n)=>{var r;return"channels.on_chain_tx"===t.method&&(null===(r=n.onOnChainTx)||void 0===r||r.call(n,t.params.data.tx),Hl(this,"onChainTx",t.params.data.tx,{info:t.params.data.info,type:t.params.data.type}),n.resolve({accepted:!0,tx:t.params.data.tx})),nu(0,t,n)},state:n}),state:{sign:t,onOnChainTx:c}})))}async callContractStatic(e){let{amount:t,callData:n,contract:r,abiVersion:a}=e;return gu(await eu(this,"channels.dry_run.call_contract",{amount:t,call_data:n,contract_id:r,abi_version:a}))}async getContractCall(e){let{caller:t,contract:n,round:r}=e;return gu(await eu(this,"channels.get.contract_call",{caller_id:t,contract_id:n,round:r}))}async getContractState(e){const t=await eu(this,"channels.get.contract",{pubkey:e});return gu({...t,contract:gu(t.contract)})}async cleanContractCalls(){return this.enqueueAction((()=>(Wl(this,"channels.clean_contract_calls"),{handler(e,t,n){return"channels.calls_pruned.reply"===t.method?(n.resolve(),{handler:lu}):(n.reject(new Y("Unexpected message received")),{handler:mu})}})))}}var Cu=(e,t)=>(e.connect((e=>t.sendMessage(e)),(()=>t.disconnect())),t.connect((t=>e.sendMessage(t)),(()=>e.disconnect())),()=>{e.disconnect(),t.disconnect()});class wu{constructor(e){let{debug:t=!1}=e;this.debug=t}connect(e,t){if(this.isConnected())throw new ke("You already connected")}disconnect(){if(!this.isConnected())throw new Oe("You dont have connection. Please connect before")}receiveMessage(e){this.debug&&console.log("Receive message:",e)}sendMessage(e){this.debug&&console.log("Send message:",e)}}function bu(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}var Su=new WeakMap,xu=new WeakMap,vu=new WeakMap;class Tu extends wu{constructor(){let{target:e,self:t=window,origin:n,sendDirection:r,receiveDirection:a=Ys.to_aepp,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(i),bu(this,Su,{writable:!0,value:void 0}),bu(this,xu,{writable:!0,value:void 0}),bu(this,vu,{writable:!0,value:void 0}),Nr(this,xu,e),Nr(this,vu,t),this.origin=n,this.sendDirection=r,this.receiveDirection=a}isConnected(){return null!=this.listener}connect(e,t){super.connect(e,t),this.listener=t=>{var n,r;if("object"!=typeof t.data||"2.0"!==(null!==(n=t.data.jsonrpc)&&void 0!==n?n:null===(r=t.data.data)||void 0===r?void 0:r.jsonrpc))return;if(null!=this.origin&&this.origin!==t.origin)return;if(null!=gr(this,xu)&&gr(this,xu)!==t.source)return;this.receiveMessage(t);let{data:a}=t;if(null!=a.type){if(t.data.type!==this.receiveDirection)return;a=a.data}e(a,t.origin,t.source)},gr(this,vu).addEventListener("message",this.listener),Nr(this,Su,t)}disconnect(){if(super.disconnect(),null==this.listener||null==gr(this,Su))throw new B("Expected to not happen, required for TS");gr(this,vu).removeEventListener("message",this.listener),delete this.listener,gr(this,Su).call(this),Nr(this,Su,void 0)}sendMessage(e){var t;if(null==gr(this,xu))throw new Me("Can't send messages without target");const n=null!=this.sendDirection?{type:this.sendDirection,data:e}:e;super.sendMessage(n),gr(this,xu).postMessage(n,null!==(t=this.origin)&&void 0!==t?t:"*")}}var _u=(e,t)=>{if(null==window)throw new I("Window object not found, you can run wallet detector only in browser");const n={};return e.connect(((e,r,a)=>{let{method:i,params:o}=e;if(i!==Zs.readyToConnect||null!=n[o.id])return;const s={info:o,getConnection(){const e="extension"===o.type;return new Tu({sendDirection:e?Ys.to_waellet:void 0,receiveDirection:e?Ys.to_aepp:void 0,target:a,origin:e?window.origin:o.origin})}};n[s.info.id]=s,t({wallets:n,newWallet:s})}),(()=>{})),Object.keys(n).length>0&&t({wallets:n}),()=>e.disconnect()};class zu extends wu{constructor(e){let{port:t,...n}=e;super(n),this.port=t}disconnect(){super.disconnect(),this.port.disconnect()}connect(e,t){super.connect(e,t),this.port.onMessage.addListener(((t,n)=>{var r,a;this.receiveMessage(t),e(t,null!==(r=null===(a=n.sender)||void 0===a?void 0:a.url)&&void 0!==r?r:"",n)})),this.port.onDisconnect.addListener(t)}sendMessage(e){super.sendMessage(e),this.port.postMessage(e)}isConnected(){return this.port.onMessage.hasListeners()}}}(),w}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@azure/core-rest-pipeline"),require("buffer"),require("rlp"),require("bignumber.js"),require("bs58"),require("tweetnacl"),require("varuint-bitcoin"),require("@azure/core-client"),require("@aeternity/uuid"),require("@aeternity/argon2"),require("tweetnacl-auth"),require("bip32-path"),require("aes-js"),require("@aeternity/aepp-calldata"),require("json-bigint"),require("events"),require("websocket")):"function"==typeof define&&define.amd?define(["@azure/core-rest-pipeline","buffer","rlp","bignumber.js","bs58","tweetnacl","varuint-bitcoin","@azure/core-client","@aeternity/uuid","@aeternity/argon2","tweetnacl-auth","bip32-path","aes-js","@aeternity/aepp-calldata","json-bigint","events","websocket"],t):"object"==typeof exports?exports.Aeternity=t(require("@azure/core-rest-pipeline"),require("buffer"),require("rlp"),require("bignumber.js"),require("bs58"),require("tweetnacl"),require("varuint-bitcoin"),require("@azure/core-client"),require("@aeternity/uuid"),require("@aeternity/argon2"),require("tweetnacl-auth"),require("bip32-path"),require("aes-js"),require("@aeternity/aepp-calldata"),require("json-bigint"),require("events"),require("websocket")):e.Aeternity=t(e["@azure/core-rest-pipeline"],e.buffer,e.rlp,e["bignumber.js"],e.bs58,e.tweetnacl,e["varuint-bitcoin"],e["@azure/core-client"],e["@aeternity/uuid"],e["@aeternity/argon2"],e["tweetnacl-auth"],e["bip32-path"],e["aes-js"],e["@aeternity/aepp-calldata"],e["json-bigint"],e.events,e.websocket)}(self,(function(e,t,n,r,a,i,o,s,c,u,l,d,p,m,h,f,y){return function(){var g={8442:function(e,t,n){const r=n(9488);function a(e,t,n){const r=e[t]+e[n];let a=e[t+1]+e[n+1];r>=4294967296&&a++,e[t]=r,e[t+1]=a}function i(e,t,n,r){let a=e[t]+n;n<0&&(a+=4294967296);let i=e[t+1]+r;a>=4294967296&&i++,e[t]=a,e[t+1]=i}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function s(e,t,n,r,o,s){const c=d[o],u=d[o+1],p=d[s],m=d[s+1];a(l,e,t),i(l,e,c,u);let h=l[r]^l[e],f=l[r+1]^l[e+1];l[r]=f,l[r+1]=h,a(l,n,r),h=l[t]^l[n],f=l[t+1]^l[n+1],l[t]=h>>>24^f<<8,l[t+1]=f>>>24^h<<8,a(l,e,t),i(l,e,p,m),h=l[r]^l[e],f=l[r+1]^l[e+1],l[r]=h>>>16^f<<16,l[r+1]=f>>>16^h<<16,a(l,n,r),h=l[t]^l[n],f=l[t+1]^l[n+1],l[t]=f>>>31^h<<1,l[t+1]=h>>>31^f<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),l=new Uint32Array(32),d=new Uint32Array(32);function p(e,t){let n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=c[n];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,t&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)d[n]=o(e.b,4*n);for(n=0;n<12;n++)s(0,8,16,24,u[16*n+0],u[16*n+1]),s(2,10,18,26,u[16*n+2],u[16*n+3]),s(4,12,20,28,u[16*n+4],u[16*n+5]),s(6,14,22,30,u[16*n+6],u[16*n+7]),s(0,10,20,30,u[16*n+8],u[16*n+9]),s(2,12,22,24,u[16*n+10],u[16*n+11]),s(4,14,16,26,u[16*n+12],u[16*n+13]),s(6,8,18,28,u[16*n+14],u[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}const m=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function h(e,t,n,r){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&16!==n.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(r&&16!==r.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const a={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};m.fill(0),m[0]=e,t&&(m[1]=t.length),m[2]=1,m[3]=1,n&&m.set(n,32),r&&m.set(r,48);for(let e=0;e<16;e++)a.h[e]=c[e]^o(m,4*e);return t&&(f(a,t),a.c=128),a}function f(e,t){for(let n=0;n<t.length;n++)128===e.c&&(e.t+=e.c,p(e,!1),e.c=0),e.b[e.c++]=t[n]}function y(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;p(e,!0);const t=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)t[n]=e.h[n>>2]>>8*(3&n);return t}function g(e,t,n,a,i){n=n||64,e=r.normalizeInput(e),a&&(a=r.normalizeInput(a)),i&&(i=r.normalizeInput(i));const o=h(n,t,a,i);return f(o,e),y(o)}e.exports={blake2b:g,blake2bHex:function(e,t,n,a,i){const o=g(e,t,n,a,i);return r.toHex(o)},blake2bInit:h,blake2bUpdate:f,blake2bFinal:y}},9488:function(e){function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,n,r){let a="\n"+e+" = ";for(let i=0;i<n.length;i+=2){if(32===r)a+=t(n[i]).toUpperCase(),a+=" ",a+=t(n[i+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);a+=t(n[i+1]).toUpperCase(),a+=t(n[i]).toUpperCase()}i%6==4?a+="\n"+new Array(e.length+4).join(" "):i<n.length-2&&(a+=" ")}console.log(a)},testSpeed:function(e,t,n){let r=(new Date).getTime();const a=new Uint8Array(t);for(let e=0;e<t;e++)a[e]=e%256;const i=(new Date).getTime();console.log("Generated random input in "+(i-r)+"ms"),r=i;for(let i=0;i<n;i++){const n=e(a),i=(new Date).getTime(),o=i-r;r=i,console.log("Hashed in "+o+"ms: "+n.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(o/1e3)*100)/100+" MB PER SECOND")}}}},3536:function(e,t,n){var r=n(1910);e.exports=r},281:function(e,t,n){var r=n(2547);n(3975),e.exports=r},31:function(e,t,n){var r=n(6509);e.exports=r},7487:function(e,t,n){var r=n(5774);e.exports=r},8171:function(e,t,n){n(6450);var r=n(4058).Object,a=e.exports=function(e,t,n){return r.defineProperty(e,t,n)};r.defineProperty.sham&&(a.sham=!0)},7473:function(e,t,n){n(5906),n(5967),n(5824),n(8555),n(2615),n(1732),n(5903),n(1825),n(8394),n(5915),n(1766),n(2737),n(9911),n(4315),n(3131),n(4714),n(659),n(9120),n(5327),n(1502);var r=n(4058);e.exports=r.Symbol},4227:function(e,t,n){n(6274),n(5967),n(7971),n(1825);var r=n(1477);e.exports=r.f("iterator")},2978:function(e,t,n){n(8084),n(3131);var r=n(1477);e.exports=r.f("toPrimitive")},3685:function(e,t,n){e.exports=n(621)},6600:function(e,t,n){e.exports=n(2201)},9759:function(e,t,n){e.exports=n(7398)},1384:function(e,t,n){e.exports=n(6189)},621:function(e,t,n){var r=n(3536);e.exports=r},2201:function(e,t,n){var r=n(281);n(8783),n(2731),n(5605),n(5799),n(1943),n(6774),n(5414),n(620),n(6172),e.exports=r},7398:function(e,t,n){var r=n(31);e.exports=r},6189:function(e,t,n){var r=n(7487);e.exports=r},4883:function(e,t,n){var r=n(7475),a=n(9826),i=TypeError;e.exports=function(e){if(r(e))return e;throw i(a(e)+" is not a function")}},1851:function(e,t,n){var r=n(7475),a=String,i=TypeError;e.exports=function(e){if("object"==typeof e||r(e))return e;throw i("Can't set "+a(e)+" as a prototype")}},8479:function(e){e.exports=function(){}},6059:function(e,t,n){var r=n(941),a=String,i=TypeError;e.exports=function(e){if(r(e))return e;throw i(a(e)+" is not an object")}},1692:function(e,t,n){var r=n(4529),a=n(9413),i=n(623),o=function(e){return function(t,n,o){var s,c=r(t),u=i(c),l=a(o,u);if(e&&n!=n){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},3610:function(e,t,n){var r=n(6843),a=n(5329),i=n(7026),o=n(9678),s=n(623),c=n(4692),u=a([].push),l=function(e){var t=1==e,n=2==e,a=3==e,l=4==e,d=6==e,p=7==e,m=5==e||d;return function(h,f,y,g){for(var w,N,v=o(h),C=i(v),S=r(f,y),b=s(C),x=0,T=g||c,z=t?T(h,b):n||p?T(h,0):void 0;b>x;x++)if((m||x in C)&&(N=S(w=C[x],x,v),e))if(t)z[x]=N;else if(N)switch(e){case 3:return!0;case 5:return w;case 6:return x;case 2:u(z,w)}else switch(e){case 4:return!1;case 7:u(z,w)}return d?-1:a||l?l:z}};e.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},568:function(e,t,n){var r=n(5981),a=n(9813),i=n(3385),o=a("species");e.exports=function(e){return i>=51||!r((function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},5790:function(e,t,n){var r=n(9413),a=n(623),i=n(5449),o=Array,s=Math.max;e.exports=function(e,t,n){for(var c=a(e),u=r(t,c),l=r(void 0===n?c:n,c),d=o(s(l-u,0)),p=0;u<l;u++,p++)i(d,p,e[u]);return d.length=p,d}},3765:function(e,t,n){var r=n(5329);e.exports=r([].slice)},5693:function(e,t,n){var r=n(1052),a=n(4284),i=n(941),o=n(9813)("species"),s=Array;e.exports=function(e){var t;return r(e)&&(t=e.constructor,(a(t)&&(t===s||r(t.prototype))||i(t)&&null===(t=t[o]))&&(t=void 0)),void 0===t?s:t}},4692:function(e,t,n){var r=n(5693);e.exports=function(e,t){return new(r(e))(0===t?0:t)}},2532:function(e,t,n){var r=n(5329),a=r({}.toString),i=r("".slice);e.exports=function(e){return i(a(e),8,-1)}},9697:function(e,t,n){var r=n(2885),a=n(7475),i=n(2532),o=n(9813)("toStringTag"),s=Object,c="Arguments"==i(function(){return arguments}());e.exports=r?i:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),o))?n:c?i(t):"Object"==(r=i(t))&&a(t.callee)?"Arguments":r}},4160:function(e,t,n){var r=n(5981);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},3538:function(e){e.exports=function(e,t){return{value:e,done:t}}},2029:function(e,t,n){var r=n(5746),a=n(5988),i=n(1887);e.exports=r?function(e,t,n){return a.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},1887:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},5449:function(e,t,n){"use strict";var r=n(3894),a=n(5988),i=n(1887);e.exports=function(e,t,n){var o=r(t);o in e?a.f(e,o,i(0,n)):e[o]=n}},9202:function(e,t,n){var r=n(5988);e.exports=function(e,t,n){return r.f(e,t,n)}},5929:function(e,t,n){var r=n(2029);e.exports=function(e,t,n,a){return a&&a.enumerable?e[t]=n:r(e,t,n),e}},5609:function(e,t,n){var r=n(1899),a=Object.defineProperty;e.exports=function(e,t){try{a(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},5746:function(e,t,n){var r=n(5981);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},6616:function(e){var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},1333:function(e,t,n){var r=n(1899),a=n(941),i=r.document,o=a(i)&&a(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},6796:function(e){var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},3281:function(e){e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},2861:function(e){e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},3385:function(e,t,n){var r,a,i=n(1899),o=n(2861),s=i.process,c=i.Deno,u=s&&s.versions||c&&c.version,l=u&&u.v8;l&&(a=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!a&&o&&(!(r=o.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/))&&(a=+r[1]),e.exports=a},6759:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6887:function(e,t,n){"use strict";var r=n(1899),a=n(9730),i=n(7484),o=n(7475),s=n(9677).f,c=n(7252),u=n(4058),l=n(6843),d=n(2029),p=n(953),m=function(e){var t=function(n,r,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(n);case 2:return new e(n,r)}return new e(n,r,i)}return a(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var n,a,h,f,y,g,w,N,v,C=e.target,S=e.global,b=e.stat,x=e.proto,T=S?r:b?r[C]:(r[C]||{}).prototype,z=S?u:u[C]||d(u,C,{})[C],_=z.prototype;for(f in t)a=!(n=c(S?f:C+(b?".":"#")+f,e.forced))&&T&&p(T,f),g=z[f],a&&(w=e.dontCallGetSet?(v=s(T,f))&&v.value:T[f]),y=a&&w?w:t[f],a&&typeof g==typeof y||(N=e.bind&&a?l(y,r):e.wrap&&a?m(y):x&&o(y)?i(y):y,(e.sham||y&&y.sham||g&&g.sham)&&d(N,"sham",!0),d(z,f,N),x&&(p(u,h=C+"Prototype")||d(u,h,{}),d(u[h],f,y),e.real&&_&&(n||!_[f])&&d(_,f,y)))}},5981:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},9730:function(e,t,n){var r=n(8285),a=Function.prototype,i=a.apply,o=a.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?o.bind(i):function(){return o.apply(i,arguments)})},6843:function(e,t,n){var r=n(7484),a=n(4883),i=n(8285),o=r(r.bind);e.exports=function(e,t){return a(e),void 0===t?e:i?o(e,t):function(){return e.apply(t,arguments)}}},8285:function(e,t,n){var r=n(5981);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},8834:function(e,t,n){var r=n(8285),a=Function.prototype.call;e.exports=r?a.bind(a):function(){return a.apply(a,arguments)}},9417:function(e,t,n){var r=n(5746),a=n(953),i=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,s=a(i,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&o(i,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},5526:function(e,t,n){var r=n(5329),a=n(4883);e.exports=function(e,t,n){try{return r(a(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},7484:function(e,t,n){var r=n(2532),a=n(5329);e.exports=function(e){if("Function"===r(e))return a(e)}},5329:function(e,t,n){var r=n(8285),a=Function.prototype,i=a.call,o=r&&a.bind.bind(i,i);e.exports=r?o:function(e){return function(){return i.apply(e,arguments)}}},626:function(e,t,n){var r=n(4058),a=n(1899),i=n(7475),o=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(r[e])||o(a[e]):r[e]&&r[e][t]||a[e]&&a[e][t]}},3323:function(e,t,n){var r=n(5329),a=n(1052),i=n(7475),o=n(2532),s=n(5803),c=r([].push);e.exports=function(e){if(i(e))return e;if(a(e)){for(var t=e.length,n=[],r=0;r<t;r++){var u=e[r];"string"==typeof u?c(n,u):"number"!=typeof u&&"Number"!=o(u)&&"String"!=o(u)||c(n,s(u))}var l=n.length,d=!0;return function(e,t){if(d)return d=!1,t;if(a(this))return t;for(var r=0;r<l;r++)if(n[r]===e)return t}}}},4229:function(e,t,n){var r=n(4883),a=n(2119);e.exports=function(e,t){var n=e[t];return a(n)?void 0:r(n)}},1899:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},953:function(e,t,n){var r=n(5329),a=n(9678),i=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return i(a(e),t)}},7748:function(e){e.exports={}},5463:function(e,t,n){var r=n(626);e.exports=r("document","documentElement")},2840:function(e,t,n){var r=n(5746),a=n(5981),i=n(1333);e.exports=!r&&!a((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},7026:function(e,t,n){var r=n(5329),a=n(5981),i=n(2532),o=Object,s=r("".split);e.exports=a((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"==i(e)?s(e,""):o(e)}:o},1302:function(e,t,n){var r=n(5329),a=n(7475),i=n(3030),o=r(Function.toString);a(i.inspectSource)||(i.inspectSource=function(e){return o(e)}),e.exports=i.inspectSource},5402:function(e,t,n){var r,a,i,o=n(7093),s=n(1899),c=n(941),u=n(2029),l=n(953),d=n(3030),p=n(4262),m=n(7748),h="Object already initialized",f=s.TypeError,y=s.WeakMap;if(o||d.state){var g=d.state||(d.state=new y);g.get=g.get,g.has=g.has,g.set=g.set,r=function(e,t){if(g.has(e))throw f(h);return t.facade=e,g.set(e,t),t},a=function(e){return g.get(e)||{}},i=function(e){return g.has(e)}}else{var w=p("state");m[w]=!0,r=function(e,t){if(l(e,w))throw f(h);return t.facade=e,u(e,w,t),t},a=function(e){return l(e,w)?e[w]:{}},i=function(e){return l(e,w)}}e.exports={set:r,get:a,has:i,enforce:function(e){return i(e)?a(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=a(t)).type!==e)throw f("Incompatible receiver, "+e+" required");return n}}}},1052:function(e,t,n){var r=n(2532);e.exports=Array.isArray||function(e){return"Array"==r(e)}},7475:function(e,t,n){var r=n(6616),a=r.all;e.exports=r.IS_HTMLDDA?function(e){return"function"==typeof e||e===a}:function(e){return"function"==typeof e}},4284:function(e,t,n){var r=n(5329),a=n(5981),i=n(7475),o=n(9697),s=n(626),c=n(1302),u=function(){},l=[],d=s("Reflect","construct"),p=/^\s*(?:class|function)\b/,m=r(p.exec),h=!p.exec(u),f=function(e){if(!i(e))return!1;try{return d(u,l,e),!0}catch(e){return!1}},y=function(e){if(!i(e))return!1;switch(o(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!m(p,c(e))}catch(e){return!0}};y.sham=!0,e.exports=!d||a((function(){var e;return f(f.call)||!f(Object)||!f((function(){e=!0}))||e}))?y:f},7252:function(e,t,n){var r=n(5981),a=n(7475),i=/#|\.prototype\./,o=function(e,t){var n=c[s(e)];return n==l||n!=u&&(a(t)?r(t):!!t)},s=o.normalize=function(e){return String(e).replace(i,".").toLowerCase()},c=o.data={},u=o.NATIVE="N",l=o.POLYFILL="P";e.exports=o},2119:function(e){e.exports=function(e){return null==e}},941:function(e,t,n){var r=n(7475),a=n(6616),i=a.all;e.exports=a.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===i}:function(e){return"object"==typeof e?null!==e:r(e)}},2529:function(e){e.exports=!0},6664:function(e,t,n){var r=n(626),a=n(7475),i=n(7046),o=n(2302),s=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return a(t)&&i(t.prototype,s(e))}},3847:function(e,t,n){"use strict";var r=n(5143).IteratorPrototype,a=n(9290),i=n(1887),o=n(904),s=n(2077),c=function(){return this};e.exports=function(e,t,n,u){var l=t+" Iterator";return e.prototype=a(r,{next:i(+!u,n)}),o(e,l,!1,!0),s[l]=c,e}},5105:function(e,t,n){"use strict";var r=n(6887),a=n(8834),i=n(2529),o=n(9417),s=n(7475),c=n(3847),u=n(249),l=n(8929),d=n(904),p=n(2029),m=n(5929),h=n(9813),f=n(2077),y=n(5143),g=o.PROPER,w=o.CONFIGURABLE,N=y.IteratorPrototype,v=y.BUGGY_SAFARI_ITERATORS,C=h("iterator"),S="keys",b="values",x="entries",T=function(){return this};e.exports=function(e,t,n,o,h,y,z){c(n,t,o);var _,A,q,P=function(e){if(e===h&&M)return M;if(!v&&e in k)return k[e];switch(e){case S:case b:case x:return function(){return new n(this,e)}}return function(){return new n(this)}},E=t+" Iterator",I=!1,k=e.prototype,O=k[C]||k["@@iterator"]||h&&k[h],M=!v&&O||P(h),B="Array"==t&&k.entries||O;if(B&&(_=u(B.call(new e)))!==Object.prototype&&_.next&&(i||u(_)===N||(l?l(_,N):s(_[C])||m(_,C,T)),d(_,E,!0,!0),i&&(f[E]=T)),g&&h==b&&O&&O.name!==b&&(!i&&w?p(k,"name",b):(I=!0,M=function(){return a(O,this)})),h)if(A={values:P(b),keys:y?M:P(S),entries:P(x)},z)for(q in A)(v||I||!(q in k))&&m(k,q,A[q]);else r({target:t,proto:!0,forced:v||I},A);return i&&!z||k[C]===M||m(k,C,M,{name:h}),f[t]=M,A}},5143:function(e,t,n){"use strict";var r,a,i,o=n(5981),s=n(7475),c=n(941),u=n(9290),l=n(249),d=n(5929),p=n(9813),m=n(2529),h=p("iterator"),f=!1;[].keys&&("next"in(i=[].keys())?(a=l(l(i)))!==Object.prototype&&(r=a):f=!0),!c(r)||o((function(){var e={};return r[h].call(e)!==e}))?r={}:m&&(r=u(r)),s(r[h])||d(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:f}},2077:function(e){e.exports={}},623:function(e,t,n){var r=n(3057);e.exports=function(e){return r(e.length)}},5331:function(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},9290:function(e,t,n){var r,a=n(6059),i=n(9938),o=n(6759),s=n(7748),c=n(5463),u=n(1333),l=n(4262),d="prototype",p="script",m=l("IE_PROTO"),h=function(){},f=function(e){return"<"+p+">"+e+"</"+p+">"},y=function(e){e.write(f("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;g="undefined"!=typeof document?document.domain&&r?y(r):(t=u("iframe"),n="java"+p+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(f("document.F=Object")),e.close(),e.F):y(r);for(var a=o.length;a--;)delete g[d][o[a]];return g()};s[m]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[d]=a(e),n=new h,h[d]=null,n[m]=e):n=g(),void 0===t?n:i.f(n,t)}},9938:function(e,t,n){var r=n(5746),a=n(3937),i=n(5988),o=n(6059),s=n(4529),c=n(4771);t.f=r&&!a?Object.defineProperties:function(e,t){o(e);for(var n,r=s(t),a=c(t),u=a.length,l=0;u>l;)i.f(e,n=a[l++],r[n]);return e}},5988:function(e,t,n){var r=n(5746),a=n(2840),i=n(3937),o=n(6059),s=n(3894),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d="enumerable",p="configurable",m="writable";t.f=r?i?function(e,t,n){if(o(e),t=s(t),o(n),"function"==typeof e&&"prototype"===t&&"value"in n&&m in n&&!n[m]){var r=l(e,t);r&&r[m]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:d in n?n[d]:r[d],writable:!1})}return u(e,t,n)}:u:function(e,t,n){if(o(e),t=s(t),o(n),a)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},9677:function(e,t,n){var r=n(5746),a=n(8834),i=n(6760),o=n(1887),s=n(4529),c=n(3894),u=n(953),l=n(2840),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),l)try{return d(e,t)}catch(e){}if(u(e,t))return o(!a(i.f,e,t),e[t])}},684:function(e,t,n){var r=n(2532),a=n(4529),i=n(946).f,o=n(5790),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"Window"==r(e)?function(e){try{return i(e)}catch(e){return o(s)}}(e):i(a(e))}},946:function(e,t,n){var r=n(5629),a=n(6759).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,a)}},7857:function(e,t){t.f=Object.getOwnPropertySymbols},249:function(e,t,n){var r=n(953),a=n(7475),i=n(9678),o=n(4262),s=n(4160),c=o("IE_PROTO"),u=Object,l=u.prototype;e.exports=s?u.getPrototypeOf:function(e){var t=i(e);if(r(t,c))return t[c];var n=t.constructor;return a(n)&&t instanceof n?n.prototype:t instanceof u?l:null}},7046:function(e,t,n){var r=n(5329);e.exports=r({}.isPrototypeOf)},5629:function(e,t,n){var r=n(5329),a=n(953),i=n(4529),o=n(1692).indexOf,s=n(7748),c=r([].push);e.exports=function(e,t){var n,r=i(e),u=0,l=[];for(n in r)!a(s,n)&&a(r,n)&&c(l,n);for(;t.length>u;)a(r,n=t[u++])&&(~o(l,n)||c(l,n));return l}},4771:function(e,t,n){var r=n(5629),a=n(6759);e.exports=Object.keys||function(e){return r(e,a)}},6760:function(e,t){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,a=r&&!n.call({1:2},1);t.f=a?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},8929:function(e,t,n){var r=n(5526),a=n(6059),i=n(1851);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return a(n),i(r),t?e(n,r):n.__proto__=r,n}}():void 0)},5623:function(e,t,n){"use strict";var r=n(2885),a=n(9697);e.exports=r?{}.toString:function(){return"[object "+a(this)+"]"}},9811:function(e,t,n){var r=n(8834),a=n(7475),i=n(941),o=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&a(n=e.toString)&&!i(s=r(n,e)))return s;if(a(n=e.valueOf)&&!i(s=r(n,e)))return s;if("string"!==t&&a(n=e.toString)&&!i(s=r(n,e)))return s;throw o("Can't convert object to primitive value")}},4058:function(e){e.exports={}},8219:function(e,t,n){var r=n(2119),a=TypeError;e.exports=function(e){if(r(e))throw a("Can't call method on "+e);return e}},904:function(e,t,n){var r=n(2885),a=n(5988).f,i=n(2029),o=n(953),s=n(5623),c=n(9813)("toStringTag");e.exports=function(e,t,n,u){if(e){var l=n?e:e.prototype;o(l,c)||a(l,c,{configurable:!0,value:t}),u&&!r&&i(l,"toString",s)}}},4262:function(e,t,n){var r=n(8726),a=n(9418),i=r("keys");e.exports=function(e){return i[e]||(i[e]=a(e))}},3030:function(e,t,n){var r=n(1899),a=n(5609),i="__core-js_shared__",o=r[i]||a(i,{});e.exports=o},8726:function(e,t,n){var r=n(2529),a=n(3030);(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.29.0",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE",source:"https://github.com/zloirock/core-js"})},4620:function(e,t,n){var r=n(5329),a=n(2435),i=n(5803),o=n(8219),s=r("".charAt),c=r("".charCodeAt),u=r("".slice),l=function(e){return function(t,n){var r,l,d=i(o(t)),p=a(n),m=d.length;return p<0||p>=m?e?"":void 0:(r=c(d,p))<55296||r>56319||p+1===m||(l=c(d,p+1))<56320||l>57343?e?s(d,p):r:e?u(d,p,p+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},3405:function(e,t,n){var r=n(3385),a=n(5981);e.exports=!!Object.getOwnPropertySymbols&&!a((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},9630:function(e,t,n){var r=n(8834),a=n(626),i=n(9813),o=n(5929);e.exports=function(){var e=a("Symbol"),t=e&&e.prototype,n=t&&t.valueOf,s=i("toPrimitive");t&&!t[s]&&o(t,s,(function(e){return r(n,this)}),{arity:1})}},4680:function(e,t,n){var r=n(3405);e.exports=r&&!!Symbol.for&&!!Symbol.keyFor},9413:function(e,t,n){var r=n(2435),a=Math.max,i=Math.min;e.exports=function(e,t){var n=r(e);return n<0?a(n+t,0):i(n,t)}},4529:function(e,t,n){var r=n(7026),a=n(8219);e.exports=function(e){return r(a(e))}},2435:function(e,t,n){var r=n(5331);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},3057:function(e,t,n){var r=n(2435),a=Math.min;e.exports=function(e){return e>0?a(r(e),9007199254740991):0}},9678:function(e,t,n){var r=n(8219),a=Object;e.exports=function(e){return a(r(e))}},6935:function(e,t,n){var r=n(8834),a=n(941),i=n(6664),o=n(4229),s=n(9811),c=n(9813),u=TypeError,l=c("toPrimitive");e.exports=function(e,t){if(!a(e)||i(e))return e;var n,c=o(e,l);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!a(n)||i(n))return n;throw u("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},3894:function(e,t,n){var r=n(6935),a=n(6664);e.exports=function(e){var t=r(e,"string");return a(t)?t:t+""}},2885:function(e,t,n){var r={};r[n(9813)("toStringTag")]="z",e.exports="[object z]"===String(r)},5803:function(e,t,n){var r=n(9697),a=String;e.exports=function(e){if("Symbol"===r(e))throw TypeError("Cannot convert a Symbol value to a string");return a(e)}},9826:function(e){var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},9418:function(e,t,n){var r=n(5329),a=0,i=Math.random(),o=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++a+i,36)}},2302:function(e,t,n){var r=n(3405);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3937:function(e,t,n){var r=n(5746),a=n(5981);e.exports=r&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},7093:function(e,t,n){var r=n(1899),a=n(7475),i=r.WeakMap;e.exports=a(i)&&/native code/.test(String(i))},3464:function(e,t,n){var r=n(4058),a=n(953),i=n(1477),o=n(5988).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});a(t,e)||o(t,e,{value:i.f(e)})}},1477:function(e,t,n){var r=n(9813);t.f=r},9813:function(e,t,n){var r=n(1899),a=n(8726),i=n(953),o=n(9418),s=n(3405),c=n(2302),u=r.Symbol,l=a("wks"),d=c?u.for||u:u&&u.withoutSetter||o;e.exports=function(e){return i(l,e)||(l[e]=s&&i(u,e)?u[e]:d("Symbol."+e)),l[e]}},5906:function(e,t,n){"use strict";var r=n(6887),a=n(5981),i=n(1052),o=n(941),s=n(9678),c=n(623),u=n(6796),l=n(5449),d=n(4692),p=n(568),m=n(9813),h=n(3385),f=m("isConcatSpreadable"),y=h>=51||!a((function(){var e=[];return e[f]=!1,e.concat()[0]!==e})),g=function(e){if(!o(e))return!1;var t=e[f];return void 0!==t?!!t:i(e)};r({target:"Array",proto:!0,arity:1,forced:!y||!p("concat")},{concat:function(e){var t,n,r,a,i,o=s(this),p=d(o,0),m=0;for(t=-1,r=arguments.length;t<r;t++)if(g(i=-1===t?o:arguments[t]))for(a=c(i),u(m+a),n=0;n<a;n++,m++)n in i&&l(p,m,i[n]);else u(m+1),l(p,m++,i);return p.length=m,p}})},6274:function(e,t,n){"use strict";var r=n(4529),a=n(8479),i=n(2077),o=n(5402),s=n(5988).f,c=n(5105),u=n(3538),l=n(2529),d=n(5746),p="Array Iterator",m=o.set,h=o.getterFor(p);e.exports=c(Array,"Array",(function(e,t){m(this,{type:p,target:r(e),index:0,kind:t})}),(function(){var e=h(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,u(void 0,!0)):u("keys"==n?r:"values"==n?t[r]:[r,t[r]],!1)}),"values");var f=i.Arguments=i.Array;if(a("keys"),a("values"),a("entries"),!l&&d&&"values"!==f.name)try{s(f,"name",{value:"values"})}catch(e){}},8084:function(){},2619:function(e,t,n){var r=n(6887),a=n(626),i=n(9730),o=n(8834),s=n(5329),c=n(5981),u=n(7475),l=n(6664),d=n(3765),p=n(3323),m=n(3405),h=String,f=a("JSON","stringify"),y=s(/./.exec),g=s("".charAt),w=s("".charCodeAt),N=s("".replace),v=s(1..toString),C=/[\uD800-\uDFFF]/g,S=/^[\uD800-\uDBFF]$/,b=/^[\uDC00-\uDFFF]$/,x=!m||c((function(){var e=a("Symbol")();return"[null]"!=f([e])||"{}"!=f({a:e})||"{}"!=f(Object(e))})),T=c((function(){return'"\\udf06\\ud834"'!==f("\udf06\ud834")||'"\\udead"'!==f("\udead")})),z=function(e,t){var n=d(arguments),r=p(t);if(u(r)||void 0!==e&&!l(e))return n[1]=function(e,t){if(u(r)&&(t=o(r,this,h(e),t)),!l(t))return t},i(f,null,n)},_=function(e,t,n){var r=g(n,t-1),a=g(n,t+1);return y(S,e)&&!y(b,a)||y(b,e)&&!y(S,r)?"\\u"+v(w(e,0),16):e};f&&r({target:"JSON",stat:!0,arity:3,forced:x||T},{stringify:function(e,t,n){var r=d(arguments),a=i(x?z:f,null,r);return T&&"string"==typeof a?N(a,C,_):a}})},9120:function(e,t,n){var r=n(1899);n(904)(r.JSON,"JSON",!0)},5327:function(){},6450:function(e,t,n){var r=n(6887),a=n(5746),i=n(5988).f;r({target:"Object",stat:!0,forced:Object.defineProperty!==i,sham:!a},{defineProperty:i})},7144:function(e,t,n){var r=n(6887),a=n(3405),i=n(5981),o=n(7857),s=n(9678);r({target:"Object",stat:!0,forced:!a||i((function(){o.f(1)}))},{getOwnPropertySymbols:function(e){var t=o.f;return t?t(s(e)):[]}})},5967:function(){},1502:function(){},7971:function(e,t,n){"use strict";var r=n(4620).charAt,a=n(5803),i=n(5402),o=n(5105),s=n(3538),c="String Iterator",u=i.set,l=i.getterFor(c);o(String,"String",(function(e){u(this,{type:c,string:a(e),index:0})}),(function(){var e,t=l(this),n=t.string,a=t.index;return a>=n.length?s(void 0,!0):(e=r(n,a),t.index+=e.length,s(e,!1))}))},8555:function(e,t,n){n(3464)("asyncIterator")},8616:function(e,t,n){"use strict";var r=n(6887),a=n(1899),i=n(8834),o=n(5329),s=n(2529),c=n(5746),u=n(3405),l=n(5981),d=n(953),p=n(7046),m=n(6059),h=n(4529),f=n(3894),y=n(5803),g=n(1887),w=n(9290),N=n(4771),v=n(946),C=n(684),S=n(7857),b=n(9677),x=n(5988),T=n(9938),z=n(6760),_=n(5929),A=n(9202),q=n(8726),P=n(4262),E=n(7748),I=n(9418),k=n(9813),O=n(1477),M=n(3464),B=n(9630),R=n(904),j=n(5402),D=n(3610).forEach,F=P("hidden"),$="Symbol",U="prototype",V=j.set,H=j.getterFor($),L=Object[U],G=a.Symbol,W=G&&G[U],K=a.TypeError,Q=a.QObject,J=b.f,Y=x.f,X=C.f,Z=z.f,ee=o([].push),te=q("symbols"),ne=q("op-symbols"),re=q("wks"),ae=!Q||!Q[U]||!Q[U].findChild,ie=c&&l((function(){return 7!=w(Y({},"a",{get:function(){return Y(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=J(L,t);r&&delete L[t],Y(e,t,n),r&&e!==L&&Y(L,t,r)}:Y,oe=function(e,t){var n=te[e]=w(W);return V(n,{type:$,tag:e,description:t}),c||(n.description=t),n},se=function(e,t,n){e===L&&se(ne,t,n),m(e);var r=f(t);return m(n),d(te,r)?(n.enumerable?(d(e,F)&&e[F][r]&&(e[F][r]=!1),n=w(n,{enumerable:g(0,!1)})):(d(e,F)||Y(e,F,g(1,{})),e[F][r]=!0),ie(e,r,n)):Y(e,r,n)},ce=function(e,t){m(e);var n=h(t),r=N(n).concat(pe(n));return D(r,(function(t){c&&!i(ue,n,t)||se(e,t,n[t])})),e},ue=function(e){var t=f(e),n=i(Z,this,t);return!(this===L&&d(te,t)&&!d(ne,t))&&(!(n||!d(this,t)||!d(te,t)||d(this,F)&&this[F][t])||n)},le=function(e,t){var n=h(e),r=f(t);if(n!==L||!d(te,r)||d(ne,r)){var a=J(n,r);return!a||!d(te,r)||d(n,F)&&n[F][r]||(a.enumerable=!0),a}},de=function(e){var t=X(h(e)),n=[];return D(t,(function(e){d(te,e)||d(E,e)||ee(n,e)})),n},pe=function(e){var t=e===L,n=X(t?ne:h(e)),r=[];return D(n,(function(e){!d(te,e)||t&&!d(L,e)||ee(r,te[e])})),r};u||(G=function(){if(p(W,this))throw K("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?y(arguments[0]):void 0,t=I(e),n=function(e){this===L&&i(n,ne,e),d(this,F)&&d(this[F],t)&&(this[F][t]=!1),ie(this,t,g(1,e))};return c&&ae&&ie(L,t,{configurable:!0,set:n}),oe(t,e)},_(W=G[U],"toString",(function(){return H(this).tag})),_(G,"withoutSetter",(function(e){return oe(I(e),e)})),z.f=ue,x.f=se,T.f=ce,b.f=le,v.f=C.f=de,S.f=pe,O.f=function(e){return oe(k(e),e)},c&&(A(W,"description",{configurable:!0,get:function(){return H(this).description}}),s||_(L,"propertyIsEnumerable",ue,{unsafe:!0}))),r({global:!0,constructor:!0,wrap:!0,forced:!u,sham:!u},{Symbol:G}),D(N(re),(function(e){M(e)})),r({target:$,stat:!0,forced:!u},{useSetter:function(){ae=!0},useSimple:function(){ae=!1}}),r({target:"Object",stat:!0,forced:!u,sham:!c},{create:function(e,t){return void 0===t?w(e):ce(w(e),t)},defineProperty:se,defineProperties:ce,getOwnPropertyDescriptor:le}),r({target:"Object",stat:!0,forced:!u},{getOwnPropertyNames:de}),B(),R(G,$),E[F]=!0},2615:function(){},4523:function(e,t,n){var r=n(6887),a=n(626),i=n(953),o=n(5803),s=n(8726),c=n(4680),u=s("string-to-symbol-registry"),l=s("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!c},{for:function(e){var t=o(e);if(i(u,t))return u[t];var n=a("Symbol")(t);return u[t]=n,l[n]=t,n}})},1732:function(e,t,n){n(3464)("hasInstance")},5903:function(e,t,n){n(3464)("isConcatSpreadable")},1825:function(e,t,n){n(3464)("iterator")},5824:function(e,t,n){n(8616),n(4523),n(8608),n(2619),n(7144)},8608:function(e,t,n){var r=n(6887),a=n(953),i=n(6664),o=n(9826),s=n(8726),c=n(4680),u=s("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!c},{keyFor:function(e){if(!i(e))throw TypeError(o(e)+" is not a symbol");if(a(u,e))return u[e]}})},5915:function(e,t,n){n(3464)("matchAll")},8394:function(e,t,n){n(3464)("match")},1766:function(e,t,n){n(3464)("replace")},2737:function(e,t,n){n(3464)("search")},9911:function(e,t,n){n(3464)("species")},4315:function(e,t,n){n(3464)("split")},3131:function(e,t,n){var r=n(3464),a=n(9630);r("toPrimitive"),a()},4714:function(e,t,n){var r=n(626),a=n(3464),i=n(904);a("toStringTag"),i(r("Symbol"),"Symbol")},659:function(e,t,n){n(3464)("unscopables")},8783:function(e,t,n){n(3464)("asyncDispose")},3975:function(e,t,n){n(3464)("dispose")},2731:function(e,t,n){var r=n(6887),a=n(626),i=n(5329),o=a("Symbol"),s=o.keyFor,c=i(o.prototype.valueOf);r({target:"Symbol",stat:!0},{isRegistered:function(e){try{return void 0!==s(c(e))}catch(e){return!1}}})},5605:function(e,t,n){for(var r=n(6887),a=n(8726),i=n(626),o=n(5329),s=n(6664),c=n(9813),u=i("Symbol"),l=u.isWellKnown,d=i("Object","getOwnPropertyNames"),p=o(u.prototype.valueOf),m=a("wks"),h=0,f=d(u),y=f.length;h<y;h++)try{var g=f[h];s(u[g])&&c(g)}catch(e){}r({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(e){if(l&&l(e))return!0;try{for(var t=p(e),n=0,r=d(m),a=r.length;n<a;n++)if(m[r[n]]==t)return!0}catch(e){}return!1}})},5799:function(e,t,n){n(3464)("matcher")},1943:function(e,t,n){n(3464)("metadataKey")},5414:function(e,t,n){n(3464)("metadata")},6774:function(e,t,n){n(3464)("observable")},620:function(e,t,n){n(3464)("patternMatch")},6172:function(e,t,n){n(3464)("replaceAll")},7634:function(e,t,n){n(6274);var r=n(3281),a=n(1899),i=n(9697),o=n(2029),s=n(2077),c=n(9813)("toStringTag");for(var u in r){var l=a[u],d=l&&l.prototype;d&&i(d)!==c&&o(d,c,u),s[u]=s.Array}},1910:function(e,t,n){var r=n(8171);e.exports=r},2547:function(e,t,n){var r=n(7473);n(7634),e.exports=r},6509:function(e,t,n){var r=n(4227);n(7634),e.exports=r},5774:function(e,t,n){var r=n(2978);e.exports=r},5717:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},9509:function(e,t,n){var r=n(9408),a=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return a(e,t,n)}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=o),o.prototype=Object.create(a.prototype),i(a,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return a(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=a(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return a(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},4189:function(e,t,n){var r=n(9509).Buffer;function a(e,t){this._block=r.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}a.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=r.from(e,t));for(var n=this._block,a=this._blockSize,i=e.length,o=this._len,s=0;s<i;){for(var c=o%a,u=Math.min(i-s,a-c),l=0;l<u;l++)n[c+l]=e[s+l];s+=u,(o+=u)%a==0&&this._update(n)}return this._len+=i,this},a.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,a=(n-r)/4294967296;this._block.writeUInt32BE(a,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},a.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=a},7499:function(e,t,n){var r=n(5717),a=n(4189),i=n(9509).Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function c(){this.init(),this._w=s,a.call(this,64,56)}function u(e,t,n){return n^e&(t^n)}function l(e,t,n){return e&t|n&(e|t)}function d(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function p(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function m(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}r(c,a),c.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},c.prototype._update=function(e){for(var t,n=this._w,r=0|this._a,a=0|this._b,i=0|this._c,s=0|this._d,c=0|this._e,h=0|this._f,f=0|this._g,y=0|this._h,g=0;g<16;++g)n[g]=e.readInt32BE(4*g);for(;g<64;++g)n[g]=0|(((t=n[g-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[g-7]+m(n[g-15])+n[g-16];for(var w=0;w<64;++w){var N=y+p(c)+u(c,h,f)+o[w]+n[w]|0,v=d(r)+l(r,a,i)|0;y=f,f=h,h=c,c=s+N|0,s=i,i=a,a=r,r=N+v|0}this._a=r+this._a|0,this._b=a+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=c+this._e|0,this._f=h+this._f|0,this._g=f+this._g|0,this._h=y+this._h|0},c.prototype._hash=function(){var e=i.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=c},7946:function(e){"use strict";e.exports=m},7417:function(e){"use strict";e.exports=u},3983:function(e){"use strict";e.exports=c},4711:function(e){"use strict";e.exports=s},5039:function(t){"use strict";t.exports=e},8236:function(e){"use strict";e.exports=p},5192:function(e){"use strict";e.exports=r},1986:function(e){"use strict";e.exports=d},3783:function(e){"use strict";e.exports=a},9408:function(e){"use strict";e.exports=t},3735:function(e){"use strict";e.exports=f},2716:function(e){"use strict";e.exports=h},3485:function(e){"use strict";e.exports=n},79:function(e){"use strict";e.exports=i},9882:function(e){"use strict";e.exports=l},7480:function(e){"use strict";e.exports=o},8079:function(e){"use strict";e.exports=y},7445:function(e,t,n){e.exports=n(3685)},2472:function(e,t,n){e.exports=n(6600)},8994:function(e,t,n){e.exports=n(9759)},24:function(e,t,n){e.exports=n(1384)}},w={};function N(e){var t=w[e];if(void 0!==t)return t.exports;var n=w[e]={exports:{}};return g[e](n,n.exports,N),n.exports}N.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return N.d(t,{a:t}),t},N.d=function(e,t){for(var n in t)N.o(t,n)&&!N.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},N.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),N.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},N.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var v={};return function(){"use strict";N.r(v),N.d(v,{AE_AMOUNT_FORMATS:function(){return Ie},AbiVersion:function(){return Ut},AccountBase:function(){return rs},AccountError:function(){return d},AccountGeneralized:function(){return Xu},AccountLedger:function(){return tl},AccountLedgerFactory:function(){return rl},AeSdk:function(){return uu},AeSdkAepp:function(){return Hu},AeSdkBase:function(){return cu},AeSdkMethods:function(){return su},AeSdkWallet:function(){return Ju},AensError:function(){return p},AensPointerContextError:function(){return D},AeppError:function(){return m},AlreadyConnectedError:function(){return qe},AmbiguousEventDefinitionError:function(){return de},ArgumentCountMismatchError:function(){return T},ArgumentError:function(){return b},BaseError:function(){return l},BrowserRuntimeConnection:function(){return Ud},BrowserWindowMessageConnection:function(){return Dd},BytecodeMismatchError:function(){return ee},CLIENT_TTL:function(){return It},CallReturnType:function(){return Gr},Channel:function(){return Id},ChannelCallError:function(){return W},ChannelConnectionError:function(){return K},ChannelError:function(){return h},ChannelIncomingMessageError:function(){return Y},ChannelPingTimedOutError:function(){return Q},CompilerBase:function(){return al},CompilerError:function(){return f},CompilerHttp:function(){return Zl},ConsensusProtocolVersion:function(){return Ft},Contract:function(){return kc},ContractError:function(){return y},CryptographyError:function(){return g},DRY_RUN_ACCOUNT:function(){return Lr},DecodeError:function(){return ve},DerivationError:function(){return ec},DryRunError:function(){return Se},DuplicateContractError:function(){return te},DuplicateNodeError:function(){return we},Encoding:function(){return Xe},IllegalArgumentError:function(){return x},IllegalBidFeeError:function(){return be},InactiveContractError:function(){return ne},InsufficientBalanceError:function(){return z},InsufficientNameFeeError:function(){return F},InternalError:function(){return B},InvalidAensNameError:function(){return $},InvalidAuthDataError:function(){return Z},InvalidChecksumError:function(){return pe},InvalidMethodInvocationError:function(){return re},InvalidPasswordError:function(){return me},InvalidRpcMessageError:function(){return U},InvalidSignatureError:function(){return xe},InvalidTxError:function(){return ys},MAX_AUTH_FUN_GAS:function(){return At},MESSAGE_DIRECTION:function(){return lu},METHODS:function(){return mu},MIN_GAS_PRICE:function(){return kt},MemoryAccount:function(){return ss},MerkleTreeHashMismatchError:function(){return he},MissingCallbackError:function(){return V},MissingContractAddressError:function(){return ae},MissingContractDefError:function(){return ie},MissingEventDefinitionError:function(){return le},MissingFunctionNameError:function(){return oe},MissingNodeInTreeError:function(){return fe},MissingParamError:function(){return _},NAME_BID_MAX_LENGTH:function(){return jt},NAME_BID_RANGES:function(){return Dt},NAME_BID_TIMEOUT_BLOCKS:function(){return Bt},NAME_FEE_BID_INCREMENT:function(){return Mt},NAME_FEE_MULTIPLIER:function(){return Ot},NAME_MAX_CLIENT_TTL:function(){return Et},NAME_MAX_LENGTH_FEE:function(){return Rt},NAME_MAX_TTL:function(){return Pt},NAME_TTL:function(){return qt},NoSerializerFoundError:function(){return A},NoSuchContractFunctionError:function(){return ce},NoWalletConnectedError:function(){return Pe},Node:function(){return ts},NodeError:function(){return w},NodeInvocationError:function(){return se},NodeNotFoundError:function(){return Ne},NotImplementedError:function(){return O},NotPayableFunctionError:function(){return ue},ORACLE_TTL:function(){return Ur},ORACLE_TTL_TYPES:function(){return $r},PayloadLengthError:function(){return Ce},PrefixNotFoundError:function(){return Te},QUERY_TTL:function(){return Vr},RESPONSE_TTL:function(){return Hr},RPC_STATUS:function(){return hu},RequestTimedOutError:function(){return q},RpcBroadcastError:function(){return wu},RpcConnectionDenyError:function(){return Cu},RpcConnectionError:function(){return Ee},RpcError:function(){return yu},RpcInternalError:function(){return xu},RpcInvalidTransactionError:function(){return gu},RpcMethodNotFoundError:function(){return Tu},RpcNotAuthorizeError:function(){return Su},RpcPermissionDenyError:function(){return bu},RpcRejectedByUserError:function(){return Nu},RpcUnsupportedProtocolError:function(){return vu},SUBSCRIPTION_TYPES:function(){return pu},SchemaNotFoundError:function(){return ze},Tag:function(){return Vt},TagNotFoundError:function(){return _e},TransactionError:function(){return C},TxNotInChainError:function(){return Ae},TxTimedOutError:function(){return P},TypeError:function(){return E},UnAuthorizedAccountError:function(){return H},UnavailableAccountError:function(){return j},UnexpectedChannelMessageError:function(){return J},UnexpectedTsError:function(){return R},UnknownChannelStateError:function(){return X},UnknownNodeLengthError:function(){return ye},UnknownPathNibbleError:function(){return ge},UnknownRpcClientError:function(){return L},UnsubscribedAccountError:function(){return G},UnsupportedPlatformError:function(){return I},UnsupportedProtocolError:function(){return k},UnsupportedVersionError:function(){return M},VmVersion:function(){return $t},WALLET_TYPE:function(){return du},WalletError:function(){return S},_getPollInterval:function(){return fs},aensBid:function(){return wc},aensClaim:function(){return yc},aensPreclaim:function(){return gc},aensQuery:function(){return fc},aensRevoke:function(){return pc},aensTransfer:function(){return hc},aensUpdate:function(){return mc},awaitHeight:function(){return Ns},buildAuthTxHash:function(){return Wc},buildAuthTxHashByGaMetaTx:function(){return Kc},buildContractId:function(){return on},buildContractIdByContractTx:function(){return ua},buildTx:function(){return ia},buildTxAsync:function(){return oa},buildTxHash:function(){return ca},commitmentHash:function(){return un},computeAuctionEndBlock:function(){return gn},computeBidFee:function(){return yn},connectionProxy:function(){return kd},createGeneralizedAccount:function(){return Gc},decode:function(){return dt},deriveChild:function(){return rc},derivePathFromKey:function(){return ac},derivePathFromSeed:function(){return oc},dump:function(){return Ls},encode:function(){return pt},encodeContractAddress:function(){return Nt},encodeUnsigned:function(){return gt},extendOracleTtl:function(){return jc},formatAmount:function(){return Oe},genSalt:function(){return yt},generateKeyPair:function(){return Ct},generateKeyPairFromSecret:function(){return vt},generateSaveHDWalletFromSeed:function(){return uc},getAccount:function(){return Ss},getAddressFromPriv:function(){return ht},getBalance:function(){return bs},getContract:function(){return ks},getContractByteCode:function(){return Is},getCurrentGeneration:function(){return xs},getDefaultPointerKey:function(){return hn},getExecutionCost:function(){return cs},getExecutionCostBySignedTx:function(){return us},getExecutionCostUsingNode:function(){return ls},getGeneration:function(){return Ts},getHdWalletAccountFromSeed:function(){return dc},getHeight:function(){return gs},getKeyBlock:function(){return _s},getKeyPair:function(){return cc},getMasterKeyFromSeed:function(){return ic},getMicroBlockHeader:function(){return As},getMicroBlockTransactions:function(){return zs},getMinimumNameFee:function(){return fn},getName:function(){return Os},getOracleObject:function(){return Fc},getQueryObject:function(){return Bc},getSaveHDWalletAccounts:function(){return lc},getTransactionSignerAddress:function(){return ns},hash:function(){return wt},isAddressValid:function(){return ft},isAuctionName:function(){return wn},isNameValid:function(){return pn},isValidKeypair:function(){return _t},messageToHash:function(){return xt},oracleQueryId:function(){return sn},payForTransaction:function(){return Hc},poll:function(){return ws},pollForQueries:function(){return Oc},pollForQueryResponse:function(){return Mc},postQueryToOracle:function(){return Rc},produceNameId:function(){return cn},readInt:function(){return ln},recover:function(){return Hs},registerOracle:function(){return $c},resolveName:function(){return Ms},respondToQuery:function(){return Dc},sendTransaction:function(){return Cs},sign:function(){return St},signMessage:function(){return Tt},spend:function(){return Uc},toAe:function(){return Me},toAettos:function(){return Be},toBytes:function(){return Xt},transferFunds:function(){return Vc},txDryRun:function(){return Es},unpackTx:function(){return sa},verify:function(){return bt},verifyMessage:function(){return zt},verifyTransaction:function(){return hs},waitForTxConfirm:function(){return vs},walletDetector:function(){return Fd}});var e={};N.r(e),N.d(e,{Account:function(){return Oa},ByteCode:function(){return Ja},Channel:function(){return ni},ChannelCloseMutualTx:function(){return bi},ChannelCloseSoloTx:function(){return xi},ChannelCreateTx:function(){return Ni},ChannelDepositTx:function(){return vi},ChannelForceProgressTx:function(){return Si},ChannelSetDelegatesTx:function(){return Ai},ChannelSettleTx:function(){return zi},ChannelSlashTx:function(){return Ti},ChannelSnapshotSoloTx:function(){return _i},ChannelWithdrawTx:function(){return Ci},CheckTxInPoolResponse:function(){return Ui},CommitmentId:function(){return gi},ContractCallObject:function(){return Va},ContractCallTx:function(){return Bi},ContractCreateTx:function(){return Mi},ContractObject:function(){return Qa},CountResponse:function(){return Ia},CreateContractUnsignedTx:function(){return Ki},Delegates:function(){return _a},DryRunAccount:function(){return Ra},DryRunCallContext:function(){return Fa},DryRunCallReq:function(){return Da},DryRunInput:function(){return Ba},DryRunInputItem:function(){return ja},DryRunResult:function(){return Ua},DryRunResults:function(){return $a},EncodedTx:function(){return Wa},ErrorModel:function(){return Na},Event:function(){return Ha},GAAttachTx:function(){return Di},GAMetaTx:function(){return Fi},GAObject:function(){return Ga},Generation:function(){return ka},HashResponse:function(){return Ca},Header:function(){return wa},HeightResponse:function(){return Sa},KeyBlock:function(){return va},MicroBlockHeader:function(){return ba},NameClaimTx:function(){return mi},NameEntry:function(){return ti},NameHash:function(){return wi},NamePointer:function(){return Ea},NamePreclaimTx:function(){return pi},NameRevokeTx:function(){return yi},NameTransferTx:function(){return fi},NameUpdateTx:function(){return hi},NextNonceResponse:function(){return Ma},OffChainCallContract:function(){return Wi},OffChainDeposit:function(){return Li},OffChainNewContract:function(){return Gi},OffChainTransfer:function(){return Vi},OffChainUpdate:function(){return Aa},OffChainWithdrawal:function(){return Hi},OracleExtendTx:function(){return ui},OracleQueries:function(){return Za},OracleQuery:function(){return ei},OracleQueryTx:function(){return li},OracleRegisterTx:function(){return ci},OracleRespondTx:function(){return di},PayingForTx:function(){return $i},PeerConnections:function(){return oi},PeerCount:function(){return Ii},PeerCountAvailable:function(){return Oi},PeerCountConnected:function(){return ki},PeerDetails:function(){return Pi},PeerPubKey:function(){return ri},Peers:function(){return Ei},PoI:function(){return Ya},PostTxResponse:function(){return Ka},Protocol:function(){return ii},PubKey:function(){return qi},RegisteredOracle:function(){return Xa},RelativeTTL:function(){return qa},SignedTx:function(){return Ta},SignedTxs:function(){return xa},SpendTx:function(){return si},Status:function(){return ai},TokenSupply:function(){return ji},Ttl:function(){return Pa},Tx:function(){return za},TxInfoObject:function(){return La},UnsignedTx:function(){return Ri},discriminators:function(){return Qi}});var t={};N.r(t),N.d(t,{InvalidTxError:function(){return ys},_getPollInterval:function(){return fs},awaitHeight:function(){return Ns},getAccount:function(){return Ss},getBalance:function(){return bs},getContract:function(){return ks},getContractByteCode:function(){return Is},getCurrentGeneration:function(){return xs},getGeneration:function(){return Ts},getHeight:function(){return gs},getKeyBlock:function(){return _s},getMicroBlockHeader:function(){return As},getMicroBlockTransactions:function(){return zs},getName:function(){return Os},poll:function(){return ws},resolveName:function(){return Ms},sendTransaction:function(){return Cs},txDryRun:function(){return Es},waitForTxConfirm:function(){return vs}});var n={};N.r(n),N.d(n,{aensBid:function(){return wc},aensClaim:function(){return yc},aensPreclaim:function(){return gc},aensQuery:function(){return fc},aensRevoke:function(){return pc},aensTransfer:function(){return hc},aensUpdate:function(){return mc}});var r={};N.r(r),N.d(r,{extendOracleTtl:function(){return jc},getOracleObject:function(){return Fc},getQueryObject:function(){return Bc},pollForQueries:function(){return Oc},pollForQueryResponse:function(){return Mc},postQueryToOracle:function(){return Rc},registerOracle:function(){return $c},respondToQuery:function(){return Dc}});var a={};N.r(a),N.d(a,{payForTransaction:function(){return Hc},spend:function(){return Uc},transferFunds:function(){return Vc}});var i={};N.r(i),N.d(i,{buildAuthTxHash:function(){return Wc},buildAuthTxHashByGaMetaTx:function(){return Kc},createGeneralizedAccount:function(){return Gc}});var o={};N.r(o),N.d(o,{Aci:function(){return sl},ApiVersion:function(){return xl},ByteCodeInput:function(){return vl},BytecodeCallResultInput:function(){return pl},Calldata:function(){return fl},CompileOpts:function(){return ol},CompileResult:function(){return ll},CompilerError:function(){return cl},CompilerVersion:function(){return bl},Contract:function(){return il},DecodeCalldataBytecode:function(){return yl},DecodeCalldataSource:function(){return Nl},DecodedCalldata:function(){return gl},DecodedCallresult:function(){return ml},ErrorModel:function(){return wl},ErrorPos:function(){return ul},FateAssembler:function(){return Cl},FunctionCallInput:function(){return hl},SophiaBinaryData:function(){return Tl},SophiaCallResultInput:function(){return dl},SophiaJsonData:function(){return zl},ValidateByteCodeInput:function(){return Sl}});var s=N(5192),c=N.n(s);const u=e=>e.integerValue(c().ROUND_CEIL);class l extends Error{constructor(e){super(e),this.name="BaseError"}}class d extends l{constructor(e){super(e),this.name="AccountError"}}class p extends l{constructor(e){super(e),this.name="AensError"}}class m extends l{constructor(e){super(e),this.name="AeppError"}}class h extends l{constructor(e){super(e),this.name="ChannelError"}}class f extends l{constructor(e){super(e),this.name="CompilerError"}}class y extends l{constructor(e){super(e),this.name="ContractError"}}class g extends l{constructor(e){super(e),this.name="CryptographyError"}}class w extends l{constructor(e){super(e),this.name="NodeError"}}class C extends l{constructor(e){super(e),this.name="TransactionError"}}class S extends l{constructor(e){super(e),this.name="WalletError"}}class b extends l{constructor(e,t,n){super(`${e} should be ${t}, got ${n} instead`),this.name="ArgumentError"}}class x extends g{constructor(e){super(e),this.name="IllegalArgumentError"}}class T extends l{constructor(e,t,n){super(`${e} expects ${t} arguments, got ${n} instead`),this.name="ArgumentCountMismatchError"}}class z extends l{constructor(e){super(e),this.name="InsufficientBalanceError"}}class _ extends l{constructor(e){super(e),this.name="MissingParamError"}}class A extends l{constructor(){super("Byte serialization not supported"),this.name="NoSerializerFoundError"}}class q extends l{constructor(e){super(`Giving up at height ${e}`),this.name="RequestTimedOutError"}}class P extends l{constructor(e,t){super([`Giving up after ${e} blocks mined`,`transaction hash: ${t}`].join(", ")),this.name="TxTimedOutError"}}class E extends l{constructor(e){super(e),this.name="TypeError"}}class I extends l{constructor(e){super(e),this.name="UnsupportedPlatformError"}}class k extends l{constructor(e){super(e),this.name="UnsupportedProtocolError"}}class O extends l{constructor(e){super(e),this.name="NotImplementedError"}}class M extends l{constructor(e,t,n,r){super(`Unsupported ${e} version ${t}. Supported: >= ${n} < ${r}`),this.name="UnsupportedVersionError"}}class B extends l{constructor(e){super(e),this.name="InternalError"}}class R extends B{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Expected to not happen, required for TS"),this.name="UnexpectedTsError"}}class j extends d{constructor(e){super(`Account for ${e} not available`),this.name="UnavailableAccountError"}}class D extends p{constructor(e,t){super(`Name ${e} don't have pointers for ${t}`),this.name="AensPointerContextError"}}class F extends p{constructor(e,t){super(`the provided fee ${e.toString()} is not enough to execute the claim, required: ${t.toString()}`),this.name="InsufficientNameFeeError"}}class $ extends p{constructor(e){super(e),this.name="InvalidAensNameError"}}class U extends m{constructor(e){super(`Received invalid message: ${e}`),this.name="InvalidRpcMessageError"}}class V extends m{constructor(e){super(`Can't find callback for this messageId ${e}`),this.name="MissingCallbackError"}}class H extends m{constructor(e){super(`You do not have access to account ${e}`),this.name="UnAuthorizedAccountError"}}class L extends m{constructor(e){super(`RpcClient with id ${e} do not exist`),this.name="UnknownRpcClientError"}}class G extends m{constructor(){super("You are not subscribed for an account."),this.name="UnsubscribedAccountError"}}class W extends h{constructor(e){super(e),this.name="ChannelCallError"}}class K extends h{constructor(e){super(e),this.name="ChannelConnectionError"}}class Q extends h{constructor(){super("Server pong timed out"),this.name="ChannelPingTimedOutError"}}class J extends h{constructor(e){super(e),this.name="UnexpectedChannelMessageError"}}class Y extends h{constructor(e,t){super(e.message),this.handlerError=e,this.incomingMessage=t,this.name="ChannelIncomingMessageError"}}class X extends h{constructor(){super("State Channels FSM entered unknown state"),this.name="UnknownChannelStateError"}}class Z extends f{constructor(e){super(e),this.name="InvalidAuthDataError"}}class ee extends y{constructor(e){super(`Contract ${e} do not correspond to the bytecode deployed on the chain`),this.name="BytecodeMismatchError"}}class te extends y{constructor(){super("Contract already deployed"),this.name="DuplicateContractError"}}class ne extends y{constructor(e){super(`Contract with address ${e} not active`),this.name="InactiveContractError"}}class re extends y{constructor(e){super(e),this.name="InvalidMethodInvocationError"}}class ae extends y{constructor(e){super(e),this.name="MissingContractAddressError"}}class ie extends y{constructor(){super("Either ACI or source code is required"),this.name="MissingContractDefError"}}class oe extends y{constructor(){super("Function name is required"),this.name="MissingFunctionNameError"}}class se extends y{constructor(e,t){super("Invocation failed"+(null==e?"":`: "${e}"`)),this.name="NodeInvocationError",this.transaction=t}}class ce extends y{constructor(e){super(`Function ${e} doesn't exist in contract`),this.name="NoSuchContractFunctionError"}}class ue extends y{constructor(e,t){super(`You try to pay "${e}" to function "${t}" which is not payable. Only payable function can accept coins`),this.name="NotPayableFunctionError"}}class le extends y{constructor(e,t){super(`Can't find definition of ${e} event emitted by ${t} (use omitUnknown option to ignore events like this)`),this.name="MissingEventDefinitionError"}}class de extends y{constructor(e,t){super(`Found multiple definitions of "${t[0][1]}" event with different types emitted by ${e} in ${t.map((e=>{let[t]=e;return`"${t}"`})).join(", ")} contracts (use contractAddressToName option to specify contract name corresponding to address)`),this.name="AmbiguousEventDefinitionError"}}class pe extends g{constructor(){super("Invalid checksum"),this.name="InvalidChecksumError"}}class me extends g{constructor(){super("Invalid password or nonce"),this.name="InvalidPasswordError"}}class he extends g{constructor(){super("Node hash is not equal to provided one"),this.name="MerkleTreeHashMismatchError"}}class fe extends g{constructor(e){super(e),this.name="MissingNodeInTreeError"}}class ye extends g{constructor(e){super(`Unknown node length: ${e}`),this.name="UnknownNodeLengthError"}}class ge extends g{constructor(e){super(`Unknown path nibble: ${e}`),this.name="UnknownPathNibbleError"}}class we extends w{constructor(e){super(`Node with name ${e} already exist`),this.name="DuplicateNodeError"}}class Ne extends w{constructor(e){super(e),this.name="NodeNotFoundError"}}class ve extends C{constructor(e){super(e),this.name="DecodeError"}}class Ce extends C{constructor(e){super(e),this.name="PayloadLengthError"}}class Se extends C{constructor(e){super(e),this.name="DryRunError"}}class be extends C{constructor(e){super(e),this.name="IllegalBidFeeError"}}class xe extends C{constructor(e){super(e),this.name="InvalidSignatureError"}}class Te extends C{constructor(e){super(`Prefix for id-tag ${e} not found.`),this.name="PrefixNotFoundError"}}class ze extends C{constructor(e,t){super(`Transaction schema not implemented for tag ${e} version ${t}`),this.name="SchemaNotFoundError"}}class _e extends C{constructor(e){super(`Id tag for prefix ${e} not found.`),this.name="DecodeError"}}class Ae extends C{constructor(e){super(`Transaction ${e} is removed from chain`),this.name="TxNotInChainError"}}class qe extends S{constructor(e){super(e),this.name="AlreadyConnectedError"}}class Pe extends S{constructor(e){super(e),this.name="NoWalletConnectedError"}}class Ee extends S{constructor(e){super(e),this.name="RpcConnectionError"}}let Ie;!function(e){e.AE="ae",e.MILI_AE="miliAE",e.MICRO_AE="microAE",e.NANO_AE="nanoAE",e.PICO_AE="picoAE",e.FEMTO_AE="femtoAE",e.AETTOS="aettos"}(Ie||(Ie={}));const ke={[Ie.AE]:0,[Ie.MILI_AE]:-3,[Ie.MICRO_AE]:-6,[Ie.NANO_AE]:-9,[Ie.PICO_AE]:-12,[Ie.FEMTO_AE]:-15,[Ie.AETTOS]:-18},Oe=(e,t)=>{let{denomination:n=Ie.AETTOS,targetDenomination:r=Ie.AETTOS}=t;if("bigint"!=typeof(a=e)&&(!["number","object","string"].includes(typeof a)||isNaN(a)&&!Number.isInteger(a)&&!c().isBigNumber(a)))throw new b("value","a number",e);var a;return new(c())("bigint"==typeof e?e.toString():e).shiftedBy(ke[n]-ke[r]).toFixed()},Me=function(e){let{denomination:t=Ie.AETTOS}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Oe(e,{denomination:t,targetDenomination:Ie.AE})},Be=function(e){let{denomination:t=Ie.AE}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Oe(e,{denomination:t})};var Re=N(79),je=N.n(Re),De=N(8442),Fe=N(7480),$e=N(5039),Ue=N(9408).Buffer;const Ve=async e=>new Promise((t=>{setTimeout(t,e)})),He=(e,t)=>Object.fromEntries(Object.entries(e).map(t)),Le=(()=>{try{return Ue.concat([Uint8Array.from([])]),!1}catch(e){return!0}})()?(e,t)=>Ue.concat(e.map((e=>Ue.from(e))),t):Ue.concat;function Ge(e,t){return e in t}function We(e,t){return t.includes(e)}function Ke(e){return e instanceof $e.RestError&&404===e.statusCode&&e.message.includes("Account not found")}var Qe=N(3783),Je=N(7499),Ye=N.n(Je);let Xe;!function(e){e.KeyBlockHash="kh",e.MicroBlockHash="mh",e.BlockPofHash="bf",e.BlockTxHash="bx",e.BlockStateHash="bs",e.Channel="ch",e.ContractAddress="ct",e.ContractBytearray="cb",e.ContractStoreKey="ck",e.ContractStoreValue="cv",e.Transaction="tx",e.TxHash="th",e.OracleAddress="ok",e.OracleQuery="ov",e.OracleQueryId="oq",e.OracleResponse="or",e.AccountAddress="ak",e.Signature="sg",e.Commitment="cm",e.PeerPubkey="pp",e.Name="nm",e.State="st",e.Poi="pi",e.StateTrees="ss",e.CallStateTree="cs",e.Bytearray="ba"}(Xe||(Xe={}));var Ze=N(9408).Buffer;function et(e){return(new(Ye())).update(e).digest()}const tt=[Xe.ContractBytearray,Xe.ContractStoreKey,Xe.ContractStoreValue,Xe.Transaction,Xe.OracleQuery,Xe.OracleResponse,Xe.State,Xe.Poi,Xe.StateTrees,Xe.CallStateTree,Xe.Bytearray],nt=[Xe.KeyBlockHash,Xe.MicroBlockHash,Xe.BlockPofHash,Xe.BlockTxHash,Xe.BlockStateHash,Xe.Channel,Xe.ContractAddress,Xe.TxHash,Xe.OracleAddress,Xe.OracleQueryId,Xe.AccountAddress,Xe.Signature,Xe.Commitment,Xe.PeerPubkey,Xe.Name],rt={[Xe.KeyBlockHash]:32,[Xe.MicroBlockHash]:32,[Xe.BlockPofHash]:32,[Xe.BlockTxHash]:32,[Xe.BlockStateHash]:32,[Xe.Channel]:32,[Xe.ContractAddress]:32,[Xe.TxHash]:32,[Xe.OracleAddress]:32,[Xe.OracleQueryId]:32,[Xe.AccountAddress]:32,[Xe.Signature]:64,[Xe.Commitment]:32,[Xe.PeerPubkey]:32,[Xe.State]:32};function at(e,t){if(!Ge(t,rt))return;const n=rt[t];if(null!=n&&e.length!==n)throw new Ce(`Payload should be ${n} bytes, got ${e.length} instead`)}const it=e=>et(et(e)).slice(0,4),ot=e=>Le([e,it(e)]);function st(e){const t=e.slice(0,-4);if(!it(t).equals(e.slice(-4)))throw new pe;return t}const ct={encode:e=>ot(e).toString("base64"),decode:e=>st(Ze.from(e,"base64"))},ut={encode:e=>(0,Qe.encode)(ot(e)),decode:e=>st(Ze.from((0,Qe.decode)(e)))},lt=e=>{const t=tt.find((t=>t===e));if(null!=t)return[t,ct];const n=nt.find((t=>t===e));if(null!=n)return[n,ut];throw new b("prefix",`one of ${[...nt,...tt].join(", ")}`,e)};function dt(e){const[t,n,r]=e.split("_");if(null==n)throw new ve(`Encoded string missing payload: ${e}`);if(null!=r)throw new ve(`Encoded string have extra parts: ${e}`);const[a,i]=lt(t),o=i.decode(n);return at(o,a),o}function pt(e,t){const[,n]=lt(t);return at(e,t),`${t}_${n.encode(e)}`}var mt=N(9408).Buffer;function ht(e){const t="string"==typeof e?mt.from(e,"hex"):e;return pt(je().sign.keyPair.fromSecretKey(t).publicKey,Xe.AccountAddress)}function ft(e){arguments.length>1&&void 0!==arguments[1]||Xe.AccountAddress;try{return dt(e),!0}catch(e){return!1}}function yt(){const[e]=new BigUint64Array(je().randomBytes(8).buffer);return Number(e%BigInt(Number.MAX_SAFE_INTEGER))}function gt(e){const t=mt.allocUnsafe(4);return t.writeUInt32BE(e),t.slice(t.findIndex((e=>0!==e)))}function wt(e){return mt.from((0,De.blake2b)(e,void 0,32))}function Nt(e,t){const n=dt(e);return pt(wt(Le([n,gt(t)])),Xe.ContractAddress)}function vt(e){return je().sign.keyPair.fromSecretKey(e)}function Ct(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=je().sign.keyPair(),n=mt.from(t.publicKey),r=mt.from(t.secretKey);return e?{publicKey:n,secretKey:r}:{publicKey:pt(n,Xe.AccountAddress),secretKey:r.toString("hex")}}function St(e,t){return je().sign.detached(mt.from(e),mt.from(t))}function bt(e,t,n){return je().sign.detached.verify(e,t,dt(n))}function xt(e){const t=mt.from("aeternity Signed Message:\n","utf8"),n=mt.from(e,"utf8");return wt(Le([(0,Fe.encode)(t.length),t,(0,Fe.encode)(n.length),n]))}function Tt(e,t){return St(xt(e),t)}function zt(e,t,n){return bt(xt(e),t,n)}function _t(e,t){const n=mt.from("TheMessage");return bt(n,St(n,e),pt("string"==typeof t?mt.from(t,"hex"):t,Xe.AccountAddress))}const At=5e4,qt=18e4,Pt=36e3,Et=84600,It=Et,kt=1e9,Ot=1e14,Mt=.05,Bt=480,Rt=31,jt=12,Dt=He({31:3,30:5,29:8,28:13,27:21,26:34,25:55,24:89,23:144,22:233,21:377,20:610,19:987,18:1597,17:2584,16:4181,15:6765,14:10946,13:17711,12:28657,11:46368,10:75025,9:121393,8:196418,7:317811,6:514229,5:832040,4:1346269,3:2178309,2:3524578,1:5702887},(e=>{let[t,n]=e;return[t,new(c())(n).times(Ot)]}));let Ft,$t,Ut,Vt;!function(e){e[e.Iris=5]="Iris",e[e.Ceres=6]="Ceres"}(Ft||(Ft={})),function(e){e[e.NoVm=0]="NoVm",e[e.Sophia=1]="Sophia",e[e.SophiaImprovementsMinerva=3]="SophiaImprovementsMinerva",e[e.SophiaImprovementsFortuna=4]="SophiaImprovementsFortuna",e[e.Fate=5]="Fate",e[e.SophiaImprovementsLima=6]="SophiaImprovementsLima",e[e.Fate2=7]="Fate2"}($t||($t={})),function(e){e[e.NoAbi=0]="NoAbi",e[e.Sophia=1]="Sophia",e[e.Fate=3]="Fate"}(Ut||(Ut={})),function(e){e[e.Account=10]="Account",e[e.SignedTx=11]="SignedTx",e[e.SpendTx=12]="SpendTx",e[e.Oracle=20]="Oracle",e[e.OracleRegisterTx=22]="OracleRegisterTx",e[e.OracleQueryTx=23]="OracleQueryTx",e[e.OracleResponseTx=24]="OracleResponseTx",e[e.OracleExtendTx=25]="OracleExtendTx",e[e.Name=30]="Name",e[e.NameClaimTx=32]="NameClaimTx",e[e.NamePreclaimTx=33]="NamePreclaimTx",e[e.NameUpdateTx=34]="NameUpdateTx",e[e.NameRevokeTx=35]="NameRevokeTx",e[e.NameTransferTx=36]="NameTransferTx",e[e.Contract=40]="Contract",e[e.ContractCall=41]="ContractCall",e[e.ContractCreateTx=42]="ContractCreateTx",e[e.ContractCallTx=43]="ContractCallTx",e[e.ChannelCreateTx=50]="ChannelCreateTx",e[e.ChannelDepositTx=51]="ChannelDepositTx",e[e.ChannelWithdrawTx=52]="ChannelWithdrawTx",e[e.ChannelForceProgressTx=521]="ChannelForceProgressTx",e[e.ChannelCloseMutualTx=53]="ChannelCloseMutualTx",e[e.ChannelCloseSoloTx=54]="ChannelCloseSoloTx",e[e.ChannelSlashTx=55]="ChannelSlashTx",e[e.ChannelSettleTx=56]="ChannelSettleTx",e[e.ChannelOffChainTx=57]="ChannelOffChainTx",e[e.ChannelOffChainUpdateTransfer=570]="ChannelOffChainUpdateTransfer",e[e.ChannelOffChainUpdateDeposit=571]="ChannelOffChainUpdateDeposit",e[e.ChannelOffChainUpdateWithdraw=572]="ChannelOffChainUpdateWithdraw",e[e.ChannelOffChainUpdateCreateContract=573]="ChannelOffChainUpdateCreateContract",e[e.ChannelOffChainUpdateCallContract=574]="ChannelOffChainUpdateCallContract",e[e.ChannelClientReconnectTx=575]="ChannelClientReconnectTx",e[e.Channel=58]="Channel",e[e.ChannelSnapshotSoloTx=59]="ChannelSnapshotSoloTx",e[e.TreesPoi=60]="TreesPoi",e[e.StateTrees=62]="StateTrees",e[e.Mtree=63]="Mtree",e[e.MtreeValue=64]="MtreeValue",e[e.ContractsMtree=621]="ContractsMtree",e[e.CallsMtree=622]="CallsMtree",e[e.ChannelsMtree=623]="ChannelsMtree",e[e.NameserviceMtree=624]="NameserviceMtree",e[e.OraclesMtree=625]="OraclesMtree",e[e.AccountsMtree=626]="AccountsMtree",e[e.GaAttachTx=80]="GaAttachTx",e[e.GaMetaTx=81]="GaMetaTx",e[e.PayingForTx=82]="PayingForTx",e[e.GaMetaTxAuthData=810]="GaMetaTxAuthData"}(Vt||(Vt={}));var Ht=N(9408).Buffer;const Lt={[Ft.Iris]:{"contract-create":{vmVersion:[$t.Fate2],abiVersion:[Ut.Fate]},"contract-call":{vmVersion:[],abiVersion:[Ut.Fate,Ut.Sophia]},"oracle-call":{vmVersion:[],abiVersion:[Ut.NoAbi,Ut.Fate]}},[Ft.Ceres]:{"contract-create":{vmVersion:[$t.Fate2],abiVersion:[Ut.Fate]},"contract-call":{vmVersion:[],abiVersion:[Ut.Fate]},"oracle-call":{vmVersion:[],abiVersion:[Ut.NoAbi,Ut.Fate]}}};function Gt(e,t){var n;const r=Lt[e][t];return{vmVersion:null!==(n=r.vmVersion[0])&&void 0!==n?n:$t.Fate2,abiVersion:r.abiVersion[0]}}var Wt={serialize(e,t,n){var r;let{consensusProtocolVersion:a=Ft.Iris}=n;return null!==(r=e)&&void 0!==r||(e=Gt(a,"contract-create")),Ht.from([e.vmVersion,0,e.abiVersion])},async prepare(e,t,n){return null!=e?e:null==n.consensusProtocolVersion&&2!==Object.keys(Ft).length&&null!=n.onNode?Gt((await n.onNode.getNodeInfo()).consensusProtocolVersion,"contract-create"):void 0},deserialize(e){const[t,,n]=e;return{vmVersion:+t,abiVersion:+n}}},Kt=N(3485),Qt=N(9408).Buffer,Jt={_getProtocolDetails(e,t){return Gt(e,Vt.ContractCallTx===t||Vt.GaMetaTx===t?"contract-call":"oracle-call").abiVersion},serialize(e,t,n){let{tag:r}=t,{consensusProtocolVersion:a=Ft.Iris}=n;const i=null!=e?e:this._getProtocolDetails(a,r);return Qt.from([i])},async prepare(e,t,n){let{tag:r}=t;return null!=e?e:null==n.consensusProtocolVersion&&2!==Object.keys(Ft).length&&null!=n.onNode?this._getProtocolDetails((await n.onNode.getNodeInfo()).consensusProtocolVersion,r):void 0},deserialize(e){return e[0]}},Yt=N(9408).Buffer;function Xt(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==e)return Yt.from([]);if(Number.isInteger(e)||c().isBigNumber(e)||t){if(c().isBigNumber(e)||(e=new(c())(e)),!e.isInteger())throw new E(`Unexpected not integer value: ${e.toFixed()}`);let t=e.toString(16);return t.length%2==1&&(t=`0${t}`),Yt.from(t,"hex")}if("string"==typeof e)return Yt.from(e);throw new A}var Zt=N(9408).Buffer;const en=[Xe.AccountAddress,Xe.Name,Xe.Commitment,Xe.OracleAddress,Xe.ContractAddress,Xe.Channel];function tn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return{serialize(e){const n=e.slice(0,2);if(!We(n,en))throw new _e(n);if(!We(n,t))throw new b("Address encoding",t.join(", "),n);const r=en.indexOf(n)+1;return Zt.from([...Xt(r),...dt(e)])},deserialize(e){const n=Zt.from(e).readUIntBE(0,1),r=en[n-1];if(null==r)throw new Te(n);if(!We(r,t))throw new b("Address encoding",t.join(", "),r);return pt(e.subarray(1),r)}}}var nn=N(9408).Buffer,rn={serialize(e){return nn.from([e?1:0])},deserialize(e){return 1===e[0]}},an=N(9408).Buffer;function on(e,t){return pt(wt(an.from([...dt(e),...Xt(t)])),Xe.ContractAddress)}function sn(e,t,n){return pt(wt(an.from([...dt(e),...function(e){const t=Xt(e,!0);return Le([an.alloc(32-t.length),t])}(t),...dt(n)])),Xe.OracleQueryId)}function cn(e){return pt(wt(e.toLowerCase()),Xe.Name)}function un(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yt();return pt(wt(Le([an.from(e.toLowerCase()),an.from(t.toString(16).padStart(64,"0"),"hex")])),Xe.Commitment)}function ln(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:an.from([]);return new(c())(an.from(e).toString("hex"),16).toString(10)}const dn=".chain";function pn(e){return e.endsWith(dn)}const mn=[[Xe.AccountAddress,"account_pubkey"],[Xe.OracleAddress,"oracle_pubkey"],[Xe.ContractAddress,"contract_pubkey"],[Xe.Channel,"channel"]];function hn(e){dt(e);const t=e.substring(0,2),n=mn.find((e=>{let[n]=e;return n===t}))?.[1];if(null!=n)return n;throw new b("identifier",`prefixed with one of ${mn.map((e=>{let[t]=e;return`${t}_`})).join(", ")}`,e)}function fn(e){const t=e.length-dn.length;return Dt[Math.min(t,Rt)]}function yn(e){let{startFee:t,increment:n=Mt}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Number(n)!==n||n%1==0)throw new be(`Increment must be float. Current increment ${n}`);if(n<Mt)throw new be(`minimum increment percentage is ${Mt}`);return u(new(c())(null!=t?t:fn(e)).times(new(c())(Mt).plus(1)))}function gn(e,t){var n,r,a;const i=e.length-dn.length;return(null!==(n=null!==(r=null!==(a=i<=4?62*Bt:null)&&void 0!==a?a:i<=8?31*Bt:null)&&void 0!==r?r:i<=12?Bt:null)&&void 0!==n?n:0)+t}function wn(e){return e.length<13+dn.length}var Nn={serialize(e){if(e<0)throw new b("value","greater or equal to 0",e);return Xt(e,!0)},deserialize(e){return ln(e)}},vn={...Nn,serializeAettos(e){return null!=e?e:"0"},serialize(e,t,n){let{denomination:r=Ie.AETTOS}=n;return Nn.serialize(this.serializeAettos(null!=e?Oe(e,{denomination:r}):e,t))}},Cn={...vn,serialize(e,t,n){var r;if(null!==(r=e)&&void 0!==r||(e=0),0!=+e)throw new x(`Contract deposit is not refundable, so it should be equal 0, got ${e.toString()} instead`);return vn.serialize(e,t,n)}},Sn=N(9408).Buffer,bn=N(9408).Buffer,xn=N(9408).Buffer;const Tn=e=>{var t;const n=null!==(t={[Vt.ChannelForceProgressTx]:30,[Vt.ChannelOffChainTx]:0,[Vt.ChannelOffChainUpdateCallContract]:0,[Vt.ChannelOffChainUpdateCreateContract]:0,[Vt.ChannelOffChainUpdateDeposit]:0,[Vt.ChannelOffChainUpdateWithdraw]:0,[Vt.ChannelOffChainUpdateTransfer]:0,[Vt.ContractCreateTx]:5,[Vt.ContractCallTx]:12,[Vt.GaAttachTx]:5,[Vt.GaMetaTx]:5,[Vt.PayingForTx]:.2}[e])&&void 0!==t?t:1;return new(c())(15e3*n)},zn=(e,t,n)=>{let{relativeTtl:r,innerTxSize:a}=n;switch(e){case Vt.OracleRegisterTx:case Vt.OracleExtendTx:case Vt.OracleQueryTx:case Vt.OracleResponseTx:return new(c())(t).times(20).plus(Math.ceil(32e3*r/Math.floor(175200)));case Vt.GaMetaTx:case Vt.PayingForTx:return new(c())(t).minus(a).times(20);default:return new(c())(t).times(20)}};function _n(e){const t={[Vt.OracleRegisterTx]:"oracleTtlValue",[Vt.OracleExtendTx]:"oracleTtlValue",[Vt.OracleQueryTx]:"queryTtlValue",[Vt.OracleResponseTx]:"responseTtlValue"},{tag:n}=e;return Ge(n,t)?e[t[n]]:1}function An(e,t,n){const{length:r}=dt(e),a=t(e);let i=0;return a.tag!==Vt.GaMetaTx&&a.tag!==Vt.PayingForTx||(i=dt(n(a.tx.encodedTx)).length),Tn(a.tag).plus(zn(a.tag,r,{relativeTtl:_n(a),innerTxSize:i})).times(kt)}var qn={...vn,serializeAettos(e,t){let{rebuildTx:n,unpackTx:r,buildTx:a,_computingMinFee:i,_pickBiggerFee:o}=t;if(null!=i)return i.toFixed();const s=function(e,t,n){let r,a=new(c())(0);do{r=a,a=An(e(a),t,n)}while(!a.eq(r));return a}((e=>n({_computingMinFee:e})),r,a),u=new(c())(null!=e?e:s);if(s.gt(u)){if(!0===o)return s.toFixed();throw new x(`Fee ${u.toString()} must be bigger then ${s}`)}return u.toFixed()}},Pn={serialize(e){return Nn.serialize(e)},deserialize(e){return+Nn.deserialize(e)}},En={...Pn,serialize(e,t,n){let{tag:r,rebuildTx:a,unpackTx:i,buildTx:o,_computingGasLimit:s}=t,{gasMax:c=6e6}=n;if(null!=s)return Pn.serialize(s);const u=r===Vt.GaMetaTx?At:function(e,t,n,r){return e-+An(t(e),n,r).dividedBy(kt)}(c,(e=>a({_computingGasLimit:e,_pickBiggerFee:!0})),i,o),l=null!=e?e:u;if(l>u)throw new x(`Gas limit ${l} must be less or equal to ${u}`);return Pn.serialize(l)}},In={...vn,serializeAettos(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:kt.toString();if(+e<kt)throw new x(`Gas price ${e.toString()} must be bigger then ${kt}`);return e}};function kn(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function On(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,kn(e,t,"set"),n),n}function Mn(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,kn(e,t,"get"))}var Bn,Rn=N(9408).Buffer;function jn(e,t){Fn(e,t),t.add(e)}function Dn(e,t,n){Fn(e,t),t.set(e,n)}function Fn(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $n(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}function Un(e,t,n){return function(e,t){if(e!==t)throw new TypeError("Private static access of wrong provenance")}(e,t),n}!function(e){e[e.Branch=0]="Branch",e[e.Extension=1]="Extension",e[e.Leaf=2]="Leaf"}(Bn||(Bn={}));var Vn=new WeakMap,Hn=new WeakMap,Ln=new WeakMap,Gn=new WeakMap,Wn=new WeakMap,Kn=new WeakMap,Qn=new WeakSet,Jn=new WeakSet;class Yn{get isComplete(){return Mn(this,Hn)}constructor(e,t,n,r){if(jn(this,Jn),jn(this,Qn),Dn(this,Vn,{writable:!0,value:void 0}),Dn(this,Hn,{writable:!0,value:!0}),Dn(this,Ln,{writable:!0,value:void 0}),Dn(this,Gn,{writable:!0,value:void 0}),Dn(this,Wn,{writable:!0,value:void 0}),Dn(this,Kn,{writable:!0,value:void 0}),On(this,Gn,t),On(this,Wn,n),On(this,Kn,r),On(this,Vn,e[0].toString("hex")),On(this,Ln,Object.fromEntries(e[1].map((e=>[e[0].toString("hex"),e[1]])))),null!=Mn(this,Ln)[Mn(this,Vn)])Object.entries(Mn(this,Ln)).forEach((e=>{let[t,n]=e;if(Un(Yn,Yn,Xn).call(Yn,n)!==t)throw new he;const{type:r}=Un(Yn,Yn,Zn).call(Yn,n);switch(r){case Bn.Branch:n.slice(0,16).filter((e=>e.length)).forEach((e=>{null==Mn(this,Ln)[e.toString("hex")]&&On(this,Hn,!1)}));break;case Bn.Extension:if(null==Mn(this,Ln)[n[1].toString("hex")])throw new fe("Can't find a node by hash in extension node");break;case Bn.Leaf:break;default:throw new B(`Unknown MPTree node type: ${r}`)}}));else{if(0!==Object.keys(Mn(this,Ln)).length)throw new fe("Can't find a node by root hash");On(this,Hn,!1)}}isEqual(e){return Mn(this,Vn)===Mn(e,Vn)}serialize(){return[Rn.from(Mn(this,Vn),"hex"),Object.entries(Mn(this,Ln)).map((e=>{let[t,n]=e;return[Rn.from(t,"hex"),n]}))]}get(e){const t=$n(this,Qn,er).call(this,dt(e).toString("hex"));return null==t?t:Mn(this,Kn).call(this,pt(t,Xe.Transaction),Mn(this,Wn))}toObject(){return Object.fromEntries($n(this,Jn,tr).call(this).filter((e=>{let[t]=e;return Mn(this,Gn)!==Xe.ContractAddress||66!==t.length})).map((e=>{let[t,n]=e;return[pt(Rn.from(t,"hex"),Mn(this,Gn)),Mn(this,Kn).call(this,pt(n,Xe.Transaction),Mn(this,Wn))]})))}}function Xn(e){return Rn.from(wt((0,Kt.encode)(e))).toString("hex")}function Zn(e){switch(e.length){case 17:return{type:Bn.Branch,...0!==e[16].length&&{value:e[16]}};case 2:{const t=e[0][0]>>4;if(t>3)throw new ge(t);const n=t<=1?Bn.Extension:Bn.Leaf,r=[0,2].includes(t)?2:1;return{type:n,...n===Bn.Leaf&&{value:e[1]},path:e[0].toString("hex").slice(r)}}default:throw new ye(e.length)}}function er(e){let t=Mn(this,Vn),n=e;for(;;){const e=Mn(this,Ln)[t];if(null==e){if(!this.isComplete)return;throw new B("Can't find node in complete tree")}const{type:r,value:a,path:i}=Un(Yn,Yn,Zn).call(Yn,e);switch(r){case Bn.Branch:if(0===n.length)return a;t=e[+`0x${n[0]}`].toString("hex"),n=n.substring(1);break;case Bn.Extension:if(n.substring(0,i?.length)!==i)return;t=e[1].toString("hex"),n=n.substring(i.length);break;case Bn.Leaf:if(i!==n)return;return a;default:throw new B(`Unknown MPTree node type: ${r}`)}}}function tr(){const e=[],t=(n,r)=>{const a=Mn(this,Ln)[n];if(null==a){if(!this.isComplete)return;throw new B("Can't find node in complete tree")}const{type:i,value:o,path:s}=Un(Yn,Yn,Zn).call(Yn,a);switch(i){case Bn.Branch:a.slice(0,16).map(((e,t)=>[e,t])).filter((e=>{let[t]=e;return t.length})).forEach((e=>{let[n,a]=e;return t(n.toString("hex"),r+a.toString(16))})),null!=o&&e.push([r,o]);break;case Bn.Extension:t(a[1].toString("hex"),r+s);break;case Bn.Leaf:if(null==o)throw new R;e.push([r+s,o]);break;default:throw new B(`Unknown MPTree node type: ${i}`)}};return t(Mn(this,Vn),""),e}var nr=N(9408).Buffer,rr={serialize(e){return nr.from(e)},deserialize(e){return e.toString()}},ar={serialize(e){return rr.serialize(e)},deserialize(e){return rr.deserialize(e)}},ir={...vn,serializeAettos(e,t){const n=fn(t.name),r=new(c())(null!=e?e:n);if(n.gt(r))throw new F(r,n);return r.toFixed()},serialize(e,t,n){return vn.serialize.call(this,e,t,n)}};const or=tn(Xe.Name);var sr={...or,serialize(e){return or.serialize(pn(e)?cn(e):e)}};const cr=tn(...en);var ur={serialize(e){if(e.length>32)throw new x(`Expected 32 pointers or less, got ${e.length} instead`);return e.map((e=>[Xt(e.key),cr.serialize(e.id)]))},deserialize(e){return e.map((e=>{let[t,n]=e;return{key:t.toString(),id:cr.deserialize(n)}}))}},lr=N(9408).Buffer,dr={serialize(e){return lr.from(e)},deserialize(e){return e}},pr={serialize(e){return Xt(e)},deserialize(e){return e.toString()}},mr={...Pn,serialize(e){return Pn.serialize(null!=e?e:0)},async prepare(e,t,n){let{onNode:r,absoluteTtl:a}=n;if(!0!==a&&0!==e&&null!=e){if(null==r)throw new b("onNode","provided",r);e+=(await r.getCurrentKeyBlock()).height}return e}};const hr=Jt,fr=tn,yr=function(e){return{serialize(t,n){return t.map((t=>e.serialize(t,n)))},deserialize(t,n){return t.map((t=>e.deserialize(t,n)))}}},gr=rn,wr=vn,Nr=Wt,vr=Cn,Cr=function(e,t){return{serialize(e){if(null==e){if(!0===t)return Sn.from([]);throw new b("Encoded data","provided",e)}return dt(e)},deserialize(t){return pt(t,e)}}},Sr=function(e){return{serialize(t,n){let{buildTx:r}=n;return ArrayBuffer.isView(t)?bn.from(t):"string"==typeof t&&t.startsWith("tx_")?dt(t):dt(r({...t,...null!=e&&{tag:e}}))},deserialize(t,n){let{unpackTx:r}=n;const a=r(pt(t,Xe.Transaction));if(null!=e&&a.tag!==e)throw new b("Tag",e,a.tag);return a}}},br=function(e){const t=Object.values(e).filter((e=>"number"==typeof e));return{serialize(e){if("number"!=typeof e)throw new b("value","to be a number",e);if(e>255)throw new b("value","to be less than 256",e);if(!We(e,t))throw new b("value","to be a value of Enum",e);return xn.from([e])},deserialize(e){if(1!==e.length)throw new b("buffer","to have single element",e.length);const n=e[0];if(!We(n,t))throw new b("value","to be a value of Enum",n);return n}}},xr=qn,Tr=En,zr=In,_r=function(e,t){return{serialize(e,n){let{buildTx:r}=n;return dt(r({tag:Vt.Mtree,values:Object.entries(e).map((e=>{let[n,a]=e;return{tag:Vt.MtreeValue,key:dt(n),value:dt(r({...a,tag:t}))}}))}))},deserialize(n,r){let{unpackTx:a}=r;const{values:i}=a(pt(n,Xe.Transaction),Vt.Mtree);return Object.fromEntries(i.filter((t=>{let{key:n}=t;return e!==Xe.ContractAddress||32===n.length})).map((n=>{let{key:r,value:i}=n;return[pt(r,e),a(pt(i,Xe.Transaction),t)]})))},recursiveType:!0}},Ar=function(e,t){return{serialize(e){return e.serialize()},deserialize(n,r){let{unpackTx:a}=r;return new Yn(n,e,t,a)}}},qr=ar,Pr=ir,Er=sr,Ir=function(e){return{...Pn,async prepare(t,n,r){if(null!=t)return t;const{onNode:a,strategy:i}=r,o=r[e],s="provided (or provide `nonce` instead)";if(null==a)throw new b("onNode",s,a);if(null==o)throw new b("senderId",s,o);return(await a.getAccountNextNonce(o.replace(/^ok_/,"ak_"),{strategy:i}).catch((e=>{if(!Ke(e))throw e;return{nextNonce:1}}))).nextNonce},senderKey:e}},kr=ur,Or=dr,Mr=Pn,Br=function(e,t){return{serialize(n){if((!0!==t||null!=n)&&n!==e)throw new b("ShortUIntConst",e,n);return Pn.serialize(e)},deserialize(t){const n=Pn.deserialize(t);if(n!==e)throw new b("ShortUIntConst",e,n);return e},constValue:e,constValueOptional:!0===t}},Rr=pr,jr=mr,Dr=Nn,Fr=function(e){return{serialize(t,n){let{buildTx:r}=n;return dt(r({tag:e,payload:t}))},deserialize(t,n){let{unpackTx:r}=n;return r(pt(t,Xe.Transaction),e).payload},recursiveType:!0}};let $r;!function(e){e[e.delta=0]="delta",e[e.block=1]="block"}($r||($r={}));const Ur={type:$r.delta,value:500},Vr={type:$r.delta,value:10},Hr={type:$r.delta,value:10},Lr={pub:"ak_11111111111111111111111111111111273Yts",amount:100000000000000000000000000000000000n};let Gr;!function(e){e[e.Ok=0]="Ok",e[e.Error=1]="Error",e[e.Revert=2]="Revert"}(Gr||(Gr={}));const Wr=Sr(),Kr=Sr(Vt.SignedTx),Qr=yr(Sr(Vt.MtreeValue)),Jr=Sr(Vt.TreesPoi),Yr=_r(Xe.ContractAddress,Vt.Contract),Xr=_r(Xe.AccountAddress,Vt.Account),Zr=_r(Xe.Bytearray,Vt.ContractCall),ea=_r(Xe.Channel,Vt.Channel),ta=_r(Xe.Name,Vt.Name),na=_r(Xe.OracleAddress,Vt.Oracle),ra=[{tag:Br(Vt.Account),version:Br(1),nonce:Mr,balance:Dr},{tag:Br(Vt.Account),version:Br(2,!0),flags:Dr,nonce:Mr,balance:Dr,gaContract:fr(Xe.ContractAddress,Xe.Name),gaAuthFun:Cr(Xe.ContractBytearray)},{tag:Br(Vt.SignedTx),version:Br(1,!0),signatures:yr(Or),encodedTx:Wr},{tag:Br(Vt.SpendTx),version:Br(1,!0),senderId:fr(Xe.AccountAddress),recipientId:fr(Xe.AccountAddress,Xe.Name),amount:wr,fee:xr,ttl:jr,nonce:Ir("senderId"),payload:Cr(Xe.Bytearray,!0)},{tag:Br(Vt.Name),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nameTtl:Mr,status:Or,clientTtl:Mr,pointers:kr},{tag:Br(Vt.NamePreclaimTx),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),commitmentId:fr(Xe.Commitment),fee:xr,ttl:jr},{tag:Br(Vt.NameClaimTx),version:Br(2,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),name:qr,nameSalt:Dr,nameFee:Pr,fee:xr,ttl:jr},{tag:Br(Vt.NameUpdateTx),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),nameId:Er,nameTtl:Mr,pointers:kr,clientTtl:Mr,fee:xr,ttl:jr},{tag:Br(Vt.NameTransferTx),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),nameId:Er,recipientId:fr(Xe.AccountAddress,Xe.Name),fee:xr,ttl:jr},{tag:Br(Vt.NameRevokeTx),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),nameId:Er,fee:xr,ttl:jr},{tag:Br(Vt.Contract),version:Br(1,!0),owner:fr(Xe.AccountAddress),ctVersion:Nr,code:Cr(Xe.ContractBytearray),log:Cr(Xe.ContractBytearray),active:gr,referers:yr(fr(Xe.AccountAddress)),deposit:vr},{tag:Br(Vt.ContractCreateTx),version:Br(1,!0),ownerId:fr(Xe.AccountAddress),nonce:Ir("ownerId"),code:Cr(Xe.ContractBytearray),ctVersion:Nr,fee:xr,ttl:jr,deposit:vr,amount:wr,gasLimit:Tr,gasPrice:zr,callData:Cr(Xe.ContractBytearray)},{tag:Br(Vt.ContractCallTx),version:Br(1,!0),callerId:fr(Xe.AccountAddress),nonce:Ir("callerId"),contractId:fr(Xe.ContractAddress,Xe.Name),abiVersion:hr,fee:xr,ttl:jr,amount:wr,gasLimit:Tr,gasPrice:zr,callData:Cr(Xe.ContractBytearray)},{tag:Br(Vt.ContractCall),version:Br(2,!0),callerId:fr(Xe.AccountAddress),callerNonce:Mr,height:Mr,contractId:fr(Xe.ContractAddress),gasPrice:Dr,gasUsed:Mr,returnValue:Cr(Xe.ContractBytearray),returnType:br(Gr),log:yr(Or)},{tag:Br(Vt.Oracle),version:Br(1,!0),accountId:fr(Xe.AccountAddress),queryFormat:Rr,responseFormat:Rr,queryFee:wr,oracleTtlValue:Mr,abiVersion:hr},{tag:Br(Vt.OracleRegisterTx),version:Br(1,!0),accountId:fr(Xe.AccountAddress),nonce:Ir("accountId"),queryFormat:Rr,responseFormat:Rr,queryFee:wr,oracleTtlType:br($r),oracleTtlValue:Mr,fee:xr,ttl:jr,abiVersion:hr},{tag:Br(Vt.OracleExtendTx),version:Br(1,!0),oracleId:fr(Xe.OracleAddress,Xe.Name),nonce:Ir("oracleId"),oracleTtlType:br($r),oracleTtlValue:Mr,fee:xr,ttl:jr},{tag:Br(Vt.OracleQueryTx),version:Br(1,!0),senderId:fr(Xe.AccountAddress),nonce:Ir("senderId"),oracleId:fr(Xe.OracleAddress,Xe.Name),query:Rr,queryFee:wr,queryTtlType:br($r),queryTtlValue:Mr,responseTtlType:br($r),responseTtlValue:Mr,fee:xr,ttl:jr},{tag:Br(Vt.OracleResponseTx),version:Br(1,!0),oracleId:fr(Xe.OracleAddress),nonce:Ir("oracleId"),queryId:Cr(Xe.OracleQueryId),response:Rr,responseTtlType:br($r),responseTtlValue:Mr,fee:xr,ttl:jr},{tag:Br(Vt.ChannelCreateTx),version:Br(2,!0),initiator:fr(Xe.AccountAddress),initiatorAmount:Dr,responder:fr(Xe.AccountAddress),responderAmount:Dr,channelReserve:Dr,lockPeriod:Dr,ttl:jr,fee:xr,initiatorDelegateIds:yr(fr(...en)),responderDelegateIds:yr(fr(...en)),stateHash:Cr(Xe.State),nonce:Ir("initiator")},{tag:Br(Vt.ChannelCloseMutualTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),initiatorAmountFinal:Dr,responderAmountFinal:Dr,ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelCloseSoloTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),payload:Cr(Xe.Transaction),poi:Jr,ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelSlashTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),payload:Cr(Xe.Transaction),poi:Jr,ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelDepositTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),amount:Dr,ttl:jr,fee:xr,stateHash:Cr(Xe.State),round:Mr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelWithdrawTx),version:Br(1,!0),channelId:fr(Xe.Channel),toId:fr(Xe.AccountAddress),amount:Dr,ttl:jr,fee:xr,stateHash:Cr(Xe.State),round:Mr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelSettleTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),initiatorAmountFinal:Dr,responderAmountFinal:Dr,ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelForceProgressTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),payload:Cr(Xe.Transaction),round:Mr,update:Cr(Xe.ContractBytearray),stateHash:Cr(Xe.State),offChainTrees:Cr(Xe.StateTrees),ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelOffChainTx),version:Br(2,!0),channelId:fr(Xe.Channel),round:Mr,stateHash:Cr(Xe.State)},{tag:Br(Vt.Channel),version:Br(3,!0),initiator:fr(Xe.AccountAddress),responder:fr(Xe.AccountAddress),channelAmount:Dr,initiatorAmount:Dr,responderAmount:Dr,channelReserve:Dr,initiatorDelegateIds:yr(fr(...en)),responderDelegateIds:yr(fr(...en)),stateHash:Cr(Xe.State),round:Mr,soloRound:Dr,lockPeriod:Dr,lockedUntil:Dr,initiatorAuth:Cr(Xe.ContractBytearray),responderAuth:Cr(Xe.ContractBytearray)},{tag:Br(Vt.ChannelSnapshotSoloTx),version:Br(1,!0),channelId:fr(Xe.Channel),fromId:fr(Xe.AccountAddress),payload:Cr(Xe.Transaction),ttl:jr,fee:xr,nonce:Ir("fromId")},{tag:Br(Vt.ChannelOffChainUpdateTransfer),version:Br(1,!0),from:fr(Xe.AccountAddress),to:fr(Xe.AccountAddress),amount:Dr},{tag:Br(Vt.ChannelOffChainUpdateDeposit),version:Br(1,!0),from:fr(Xe.AccountAddress),amount:Dr},{tag:Br(Vt.ChannelOffChainUpdateWithdraw),version:Br(1,!0),from:fr(Xe.AccountAddress),amount:Dr},{tag:Br(Vt.ChannelOffChainUpdateCreateContract),version:Br(1,!0),owner:fr(Xe.AccountAddress),ctVersion:Nr,code:Cr(Xe.ContractBytearray),deposit:Dr,callData:Cr(Xe.ContractBytearray)},{tag:Br(Vt.ChannelOffChainUpdateCallContract),version:Br(1,!0),caller:fr(Xe.AccountAddress),contract:fr(Xe.ContractAddress),abiVersion:hr,amount:Dr,callData:Cr(Xe.ContractBytearray),callStack:Or,gasPrice:zr,gasLimit:Tr},{tag:Br(Vt.ChannelClientReconnectTx),version:Br(1,!0),channelId:fr(Xe.Channel),round:Mr,role:Rr,pubkey:fr(Xe.AccountAddress)},{tag:Br(Vt.TreesPoi),version:Br(1,!0),accounts:yr(Ar(Xe.AccountAddress,Vt.Account)),calls:yr(Ar(Xe.Bytearray,Vt.ContractCall)),channels:yr(Ar(Xe.Channel,Vt.Channel)),contracts:yr(Ar(Xe.ContractAddress,Vt.Contract)),ns:yr(Ar(Xe.Name,Vt.Name)),oracles:yr(Ar(Xe.OracleAddress,Vt.Oracle))},{tag:Br(Vt.StateTrees),version:Br(0,!0),contracts:Fr(Vt.ContractsMtree),calls:Fr(Vt.CallsMtree),channels:Fr(Vt.ChannelsMtree),ns:Fr(Vt.NameserviceMtree),oracles:Fr(Vt.OraclesMtree),accounts:Fr(Vt.AccountsMtree)},{tag:Br(Vt.Mtree),version:Br(1,!0),values:Qr},{tag:Br(Vt.MtreeValue),version:Br(1,!0),key:Or,value:Or},{tag:Br(Vt.ContractsMtree),version:Br(1,!0),payload:Yr},{tag:Br(Vt.CallsMtree),version:Br(1,!0),payload:Zr},{tag:Br(Vt.ChannelsMtree),version:Br(1,!0),payload:ea},{tag:Br(Vt.NameserviceMtree),version:Br(1,!0),payload:ta},{tag:Br(Vt.OraclesMtree),version:Br(1,!0),payload:na},{tag:Br(Vt.AccountsMtree),version:Br(1,!0),payload:Xr},{tag:Br(Vt.GaAttachTx),version:Br(1,!0),ownerId:fr(Xe.AccountAddress),nonce:Ir("ownerId"),code:Cr(Xe.ContractBytearray),authFun:Or,ctVersion:Nr,fee:xr,ttl:jr,gasLimit:Tr,gasPrice:zr,callData:Cr(Xe.ContractBytearray)},{tag:Br(Vt.GaMetaTx),version:Br(2,!0),gaId:fr(Xe.AccountAddress),authData:Cr(Xe.ContractBytearray),abiVersion:hr,fee:xr,gasLimit:Tr,gasPrice:zr,tx:Kr},{tag:Br(Vt.PayingForTx),version:Br(1,!0),payerId:fr(Xe.AccountAddress),nonce:Ir("payerId"),fee:xr,tx:Kr},{tag:Br(Vt.GaMetaTxAuthData),version:Br(1,!0),fee:wr,gasPrice:zr,txHash:Cr(Xe.TxHash)}];function aa(e,t){var n;const r=ra.filter((t=>t.tag.constValue===e));if(0===r.length)throw new ze(`${Vt[e]} (${e})`,0);null!==(n=t)&&void 0!==n||(t=Math.max(...r.map((e=>e.version.constValue))));const a=r.find((e=>e.version.constValue===t));if(null==a)throw new ze(`${Vt[e]} (${e})`,t);return Object.entries(a)}function ia(e){let{prefix:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=aa(e.tag,e.version).map((t=>{let[n,r]=t;return r.serialize(e[n],{...e,unpackTx:sa,buildTx:ia,rebuildTx:t=>ia({...e,...t})},e)}));return pt((0,Kt.encode)(n),null!=t?t:Xe.Transaction)}async function oa(e){return await Promise.all(aa(e.tag,e.version).map((async t=>{let[n,r]=t;null!=r.prepare&&(e[n]=await r.prepare(e[n],e,e))}))),ia(e)}function sa(e,t){const n=(0,Kt.decode)(dt(e)),r=+ln(n[0]),a=aa(r,+ln(n[1]));if(null!=t&&t!==r)throw new ve(`Expected transaction to have ${Vt[t]} tag, got ${Vt[r]} instead`);if(n.length!==a.length)throw new b("Transaction RLP length",a.length,n.length);return a.reduce(((e,t,r)=>{let[a,i]=t;return{...e,[a]:i.deserialize(n[r],{unpackTx:sa})}}),{})}function ca(e){return pt(wt("string"==typeof e&&e.startsWith("tx_")?dt(e):e),Xe.TxHash)}function ua(e){const t=sa(e);if(Vt.ContractCreateTx!==t.tag&&Vt.GaAttachTx!==t.tag)throw new b("contractTx","a contractCreateTx or gaAttach",t.tag);return on(t.ownerId,t.nonce)}function la(e,t,n){const r=e=>e.split(/[-+]/)[0].split(".").map((e=>+e)),a=r(e),i=r(t),o=r(n),s=Math.max(...a,...i,...o)+1,c=e=>e.reverse().reduce(((e,t,n)=>e+t*s**n),0),u=c(a),l=c(i),d=c(o);return u>=l&&u<d}const da=()=>{const e=new Map;return{policy:{name:"request-queues",async sendRequest(t,n){var r;const a=t.headers.get("__queue");t.headers.delete("__queue");const i=async()=>n(t);if(null==a)return i();const o=(null!==(r=e.get(a))&&void 0!==r?r:Promise.resolve()).then(i,i);return e.set(a,o.then((async()=>Ve(750)))),o}},position:"perCall"}},pa=()=>{const e=new Map;return{policy:{name:"combine-get-requests",async sendRequest(t,n){var r;if("GET"!==t.method)return n(t);const a=JSON.stringify([t.url,t.body]),i=null!==(r=e.get(a))&&void 0!==r?r:n(t);e.set(a,i);try{return await i}finally{e.delete(a)}}},position:"perCall"}},ma=()=>{const e=new Map;return{policy:{name:"aggressive-cache-get-responses",async sendRequest(t,n){var r;if("GET"!==t.method)return n(t);const a=JSON.stringify([t.url,t.body]),i=null!==(r=e.get(a))&&void 0!==r?r:n(t);return e.set(a,i),i}},position:"perCall"}},ha=e=>({policy:{name:"error-formatter",async sendRequest(t,n){try{return await n(t)}catch(t){if(!(t instanceof $e.RestError)||null==t.request)throw t;if(null==t.response?.bodyAsText)throw t;let n;try{n=JSON.parse(t.response.bodyAsText)}catch(e){throw t}t.message=`${new URL(t.request.url).pathname.slice(1)} error`;const r=e(n);throw""!==r&&(t.message+=`:${r}`),t}}},position:"perCall"}),fa=(e,t,n,r,a)=>({name:"version-check",async sendRequest(i,o){if(new URL(i.url).pathname===t)return o(i);const s=await n;if(s instanceof Error)throw s;const c=[s,r,a];if(!la(...c))throw new M(e,...c);return o(i)}}),ya=(e,t)=>({policy:{name:"retry-on-failure",async sendRequest(n,r){const a=[200,400,403],i=new Array(e).fill(0).map(((t,n)=>((n+1)/e)**2)),o=i.reduce(((e,t)=>e+t)),s=i.map((e=>e/o*t));let c;for(let t=0;t<=e;t+=1){if(null!=c){var u;if(!(c instanceof $e.RestError)||a.includes(null!==(u=c.response?.status)&&void 0!==u?u:0))throw c;await Ve(s[t-1])}try{return await r(n)}catch(e){c=e}}if(null==c)throw new R;throw c}},position:"perCall"});var ga=N(4711);const wa={type:{name:"Composite",className:"Header",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},miner:{serializedName:"miner",type:{name:"String"}},beneficiary:{serializedName:"beneficiary",type:{name:"String"}},target:{serializedName:"target",type:{name:"String"}},pow:{constraints:{MinItems:42,MaxItems:42},serializedName:"pow",type:{name:"Sequence",element:{type:{name:"String"}}}},nonce:{serializedName:"nonce",type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},info:{serializedName:"info",type:{name:"String"}},pofHash:{serializedName:"pof_hash",type:{name:"String"}},txsHash:{serializedName:"txs_hash",type:{name:"String"}},signature:{serializedName:"signature",type:{name:"String"}}}}},Na={type:{name:"Composite",className:"ErrorModel",modelProperties:{reason:{serializedName:"reason",required:!0,type:{name:"String"}}}}},va={type:{name:"Composite",className:"KeyBlock",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},miner:{serializedName:"miner",required:!0,type:{name:"String"}},beneficiary:{serializedName:"beneficiary",required:!0,type:{name:"String"}},target:{serializedName:"target",required:!0,type:{name:"String"}},pow:{constraints:{MinItems:42,MaxItems:42},serializedName:"pow",type:{name:"Sequence",element:{type:{name:"String"}}}},nonce:{serializedName:"nonce",type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},info:{serializedName:"info",required:!0,type:{name:"String"}}}}},Ca={type:{name:"Composite",className:"HashResponse",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}}}}},Sa={type:{name:"Composite",className:"HeightResponse",modelProperties:{height:{serializedName:"height",required:!0,type:{name:"String"}}}}},ba={type:{name:"Composite",className:"MicroBlockHeader",modelProperties:{hash:{serializedName:"hash",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},pofHash:{serializedName:"pof_hash",required:!0,type:{name:"String"}},prevHash:{serializedName:"prev_hash",required:!0,type:{name:"String"}},prevKeyHash:{serializedName:"prev_key_hash",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},txsHash:{serializedName:"txs_hash",required:!0,type:{name:"String"}},signature:{serializedName:"signature",required:!0,type:{name:"String"}},time:{serializedName:"time",required:!0,type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}}}}},xa={type:{name:"Composite",className:"SignedTxs",modelProperties:{transactions:{serializedName:"transactions",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"SignedTx"}}}}}}},Ta={type:{name:"Composite",className:"SignedTx",modelProperties:{tx:{serializedName:"tx",type:{name:"Composite",className:"Tx"}},blockHeight:{serializedName:"block_height",required:!0,type:{name:"String"}},blockHash:{serializedName:"block_hash",required:!0,type:{name:"String"}},hash:{serializedName:"hash",required:!0,type:{name:"String"}},signatures:{serializedName:"signatures",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},za={serializedName:"Tx",type:{name:"Composite",className:"Tx",uberParent:"Tx",polymorphicDiscriminator:{serializedName:"type",clientName:"type"},modelProperties:{recipientId:{serializedName:"recipient_id",type:{name:"String"}},amount:{serializedName:"amount",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},payload:{serializedName:"payload",type:{name:"String"}},initiatorId:{serializedName:"initiator_id",type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",type:{name:"String"}},responderId:{serializedName:"responder_id",type:{name:"String"}},responderAmount:{serializedName:"responder_amount",type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",type:{name:"String"}},lockPeriod:{serializedName:"lock_period",type:{name:"String"}},stateHash:{serializedName:"state_hash",type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}},channelId:{serializedName:"channel_id",type:{name:"String"}},fromId:{serializedName:"from_id",type:{name:"String"}},round:{serializedName:"round",type:{name:"String"}},toId:{serializedName:"to_id",type:{name:"String"}},update:{serializedName:"update",type:{name:"Composite",className:"OffChainUpdate"}},offchainTrees:{serializedName:"offchain_trees",type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",type:{name:"String"}},poi:{serializedName:"poi",type:{name:"String"}},initiatorDelegateIds:{serializedName:"initiator_delegate_ids",type:{name:"Sequence",element:{type:{name:"String"}}}},responderDelegateIds:{serializedName:"responder_delegate_ids",type:{name:"Sequence",element:{type:{name:"String"}}}},queryFormat:{serializedName:"query_format",type:{name:"String"}},responseFormat:{serializedName:"response_format",type:{name:"String"}},queryFee:{serializedName:"query_fee",type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"RelativeTTL"}},accountId:{serializedName:"account_id",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}},oracleId:{serializedName:"oracle_id",type:{name:"String"}},query:{serializedName:"query",type:{name:"String"}},queryTtl:{serializedName:"query_ttl",type:{name:"Composite",className:"Ttl"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},queryId:{serializedName:"query_id",type:{name:"String"}},response:{serializedName:"response",type:{name:"String"}},commitmentId:{serializedName:"commitment_id",type:{name:"String"}},name:{serializedName:"name",type:{name:"String"}},nameSalt:{serializedName:"name_salt",type:{name:"String"}},nameFee:{serializedName:"name_fee",type:{name:"String"}},nameId:{serializedName:"name_id",type:{name:"String"}},nameTtl:{serializedName:"name_ttl",type:{name:"String"}},pointers:{serializedName:"pointers",type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}},clientTtl:{serializedName:"client_ttl",type:{name:"String"}},ownerId:{serializedName:"owner_id",type:{name:"String"}},code:{serializedName:"code",type:{name:"String"}},vmVersion:{serializedName:"vm_version",type:{name:"String"}},deposit:{serializedName:"deposit",type:{name:"String"}},gas:{serializedName:"gas",type:{name:"String"}},gasPrice:{serializedName:"gas_price",type:{name:"String"}},callData:{serializedName:"call_data",type:{name:"String"}},callerId:{serializedName:"caller_id",type:{name:"String"}},contractId:{serializedName:"contract_id",type:{name:"String"}},authFun:{constraints:{Pattern:new RegExp("^(0x|0X)?[a-fA-F0-9]+$")},serializedName:"auth_fun",type:{name:"String"}},gaId:{serializedName:"ga_id",type:{name:"String"}},authData:{serializedName:"auth_data",type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}},payerId:{serializedName:"payer_id",type:{name:"String"}},version:{serializedName:"version",required:!0,type:{name:"String"}},type:{serializedName:"type",required:!0,type:{name:"Enum",allowedValues:["SpendTx","ChannelCreateTx","ChannelDepositTx","ChannelWithdrawTx","ChannelForceProgressTx","ChannelCloseMutualTx","ChannelCloseSoloTx","ChannelSlashTx","ChannelSettleTx","ChannelSnapshotSoloTx","ChannelSetDelegatesTx","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleRespondTx","NamePreclaimTx","NameClaimTx","NameUpdateTx","NameTransferTx","NameRevokeTx","ContractCreateTx","ContractCallTx","GAAttachTx","GAMetaTx","PayingForTx"]}}}}},_a={type:{name:"Composite",className:"Delegates",modelProperties:{initiator:{serializedName:"initiator",type:{name:"Sequence",element:{type:{name:"String"}}}},responder:{serializedName:"responder",type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Aa={type:{name:"Composite",className:"OffChainUpdate",uberParent:"OffChainUpdate",polymorphicDiscriminator:{serializedName:"op",clientName:"op"},modelProperties:{op:{serializedName:"op",required:!0,type:{name:"String"}}}}},qa={type:{name:"Composite",className:"RelativeTTL",modelProperties:{type:{defaultValue:"delta",isConstant:!0,serializedName:"type",type:{name:"String"}},value:{serializedName:"value",required:!0,type:{name:"String"}}}}},Pa={type:{name:"Composite",className:"Ttl",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"Enum",allowedValues:["delta","block"]}},value:{serializedName:"value",required:!0,type:{name:"String"}}}}},Ea={type:{name:"Composite",className:"NamePointer",modelProperties:{key:{serializedName:"key",required:!0,type:{name:"String"}},id:{serializedName:"id",required:!0,type:{name:"String"}}}}},Ia={type:{name:"Composite",className:"CountResponse",modelProperties:{count:{serializedName:"count",required:!0,type:{name:"String"}}}}},ka={type:{name:"Composite",className:"Generation",modelProperties:{keyBlock:{serializedName:"key_block",type:{name:"Composite",className:"KeyBlock"}},microBlocks:{serializedName:"micro_blocks",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Oa={type:{name:"Composite",className:"Account",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},balance:{serializedName:"balance",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},payable:{serializedName:"payable",type:{name:"Boolean"}},kind:{serializedName:"kind",type:{name:"Enum",allowedValues:["basic","generalized"]}},contractId:{serializedName:"contract_id",type:{name:"String"}},authFun:{serializedName:"auth_fun",type:{name:"String"}}}}},Ma={type:{name:"Composite",className:"NextNonceResponse",modelProperties:{nextNonce:{serializedName:"next_nonce",required:!0,type:{name:"String"}}}}},Ba={type:{name:"Composite",className:"DryRunInput",modelProperties:{top:{serializedName:"top",type:{name:"String"}},accounts:{serializedName:"accounts",type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunAccount"}}}},txs:{serializedName:"txs",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunInputItem"}}}},txEvents:{defaultValue:!1,serializedName:"tx_events",type:{name:"Boolean"}}}}},Ra={type:{name:"Composite",className:"DryRunAccount",modelProperties:{pubKey:{serializedName:"pub_key",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},ja={type:{name:"Composite",className:"DryRunInputItem",modelProperties:{tx:{serializedName:"tx",type:{name:"String"}},callReq:{serializedName:"call_req",type:{name:"Composite",className:"DryRunCallReq"}}}}},Da={type:{name:"Composite",className:"DryRunCallReq",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},contract:{serializedName:"contract",required:!0,type:{name:"String"}},amount:{serializedName:"amount",type:{name:"String"}},gas:{serializedName:"gas",type:{name:"String"}},caller:{serializedName:"caller",type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}},context:{serializedName:"context",type:{name:"Composite",className:"DryRunCallContext"}}}}},Fa={type:{name:"Composite",className:"DryRunCallContext",modelProperties:{tx:{serializedName:"tx",type:{name:"String"}},txHash:{serializedName:"tx_hash",type:{name:"String"}},stateful:{serializedName:"stateful",type:{name:"Boolean"}}}}},$a={type:{name:"Composite",className:"DryRunResults",modelProperties:{results:{serializedName:"results",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"DryRunResult"}}}},txEvents:{serializedName:"tx_events",type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}}}}},Ua={type:{name:"Composite",className:"DryRunResult",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"String"}},result:{serializedName:"result",required:!0,type:{name:"String"}},reason:{serializedName:"reason",type:{name:"String"}},callObj:{serializedName:"call_obj",type:{name:"Composite",className:"ContractCallObject"}}}}},Va={type:{name:"Composite",className:"ContractCallObject",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},callerNonce:{serializedName:"caller_nonce",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},gasUsed:{serializedName:"gas_used",required:!0,type:{name:"String"}},log:{serializedName:"log",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"Event"}}}},returnValue:{serializedName:"return_value",required:!0,type:{name:"String"}},returnType:{serializedName:"return_type",required:!0,type:{name:"Enum",allowedValues:["ok","error","revert"]}}}}},Ha={type:{name:"Composite",className:"Event",modelProperties:{address:{serializedName:"address",required:!0,type:{name:"String"}},topics:{serializedName:"topics",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},data:{serializedName:"data",required:!0,type:{name:"String"}}}}},La={type:{name:"Composite",className:"TxInfoObject",modelProperties:{callInfo:{serializedName:"call_info",type:{name:"Composite",className:"ContractCallObject"}},gaInfo:{serializedName:"ga_info",type:{name:"Composite",className:"GAObject"}},txInfo:{serializedName:"tx_info",type:{name:"String"}}}}},Ga={type:{name:"Composite",className:"GAObject",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},height:{serializedName:"height",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},gasUsed:{serializedName:"gas_used",required:!0,type:{name:"String"}},returnValue:{serializedName:"return_value",required:!0,type:{name:"String"}},returnType:{serializedName:"return_type",required:!0,type:{name:"Enum",allowedValues:["ok","error"]}},innerObject:{serializedName:"inner_object",type:{name:"Composite",className:"TxInfoObject"}}}}},Wa={type:{name:"Composite",className:"EncodedTx",modelProperties:{tx:{serializedName:"tx",required:!0,type:{name:"String"}}}}},Ka={type:{name:"Composite",className:"PostTxResponse",modelProperties:{txHash:{serializedName:"tx_hash",required:!0,type:{name:"String"}}}}},Qa={type:{name:"Composite",className:"ContractObject",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},active:{serializedName:"active",required:!0,type:{name:"Boolean"}},referrerIds:{serializedName:"referrer_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}}}}},Ja={type:{name:"Composite",className:"ByteCode",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},Ya={type:{name:"Composite",className:"PoI",modelProperties:{poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},Xa={type:{name:"Composite",className:"RegisteredOracle",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},queryFormat:{serializedName:"query_format",required:!0,type:{name:"String"}},responseFormat:{serializedName:"response_format",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}}}}},Za={type:{name:"Composite",className:"OracleQueries",modelProperties:{oracleQueries:{serializedName:"oracle_queries",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"OracleQuery"}}}}}}},ei={type:{name:"Composite",className:"OracleQuery",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},senderNonce:{serializedName:"sender_nonce",required:!0,type:{name:"String"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},query:{serializedName:"query",required:!0,type:{name:"String"}},response:{serializedName:"response",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"Ttl"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}}}}},ti={type:{name:"Composite",className:"NameEntry",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},owner:{serializedName:"owner",type:{name:"String"}},ttl:{serializedName:"ttl",required:!0,type:{name:"String"}},pointers:{serializedName:"pointers",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}}}}},ni={type:{name:"Composite",className:"Channel",modelProperties:{id:{serializedName:"id",required:!0,type:{name:"String"}},initiatorId:{serializedName:"initiator_id",required:!0,type:{name:"String"}},responderId:{serializedName:"responder_id",required:!0,type:{name:"String"}},channelAmount:{serializedName:"channel_amount",required:!0,type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",required:!0,type:{name:"String"}},responderAmount:{serializedName:"responder_amount",required:!0,type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",required:!0,type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},soloRound:{serializedName:"solo_round",required:!0,type:{name:"String"}},lockPeriod:{serializedName:"lock_period",required:!0,type:{name:"String"}},lockedUntil:{serializedName:"locked_until",required:!0,type:{name:"String"}}}}},ri={type:{name:"Composite",className:"PeerPubKey",modelProperties:{pubkey:{serializedName:"pubkey",required:!0,type:{name:"String"}}}}},ai={type:{name:"Composite",className:"Status",modelProperties:{genesisKeyBlockHash:{serializedName:"genesis_key_block_hash",required:!0,type:{name:"String"}},solutions:{serializedName:"solutions",required:!0,type:{name:"String"}},difficulty:{serializedName:"difficulty",required:!0,type:{name:"String"}},syncing:{serializedName:"syncing",required:!0,type:{name:"Boolean"}},syncProgress:{constraints:{InclusiveMaximum:100,InclusiveMinimum:0},serializedName:"sync_progress",type:{name:"Number"}},listening:{serializedName:"listening",required:!0,type:{name:"Boolean"}},protocols:{serializedName:"protocols",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"Protocol"}}}},nodeVersion:{serializedName:"node_version",required:!0,type:{name:"String"}},nodeRevision:{serializedName:"node_revision",required:!0,type:{name:"String"}},peerCount:{serializedName:"peer_count",required:!0,type:{name:"String"}},peerConnections:{serializedName:"peer_connections",type:{name:"Composite",className:"PeerConnections"}},pendingTransactionsCount:{serializedName:"pending_transactions_count",required:!0,type:{name:"String"}},networkId:{serializedName:"network_id",required:!0,type:{name:"String"}},peerPubkey:{serializedName:"peer_pubkey",required:!0,type:{name:"String"}},topKeyBlockHash:{serializedName:"top_key_block_hash",required:!0,type:{name:"String"}},topBlockHeight:{serializedName:"top_block_height",required:!0,type:{name:"String"}}}}},ii={type:{name:"Composite",className:"Protocol",modelProperties:{version:{serializedName:"version",required:!0,type:{name:"String"}},effectiveAtHeight:{serializedName:"effective_at_height",required:!0,type:{name:"String"}}}}},oi={type:{name:"Composite",className:"PeerConnections",modelProperties:{inbound:{serializedName:"inbound",required:!0,type:{name:"String"}},outbound:{serializedName:"outbound",required:!0,type:{name:"String"}}}}},si={type:{name:"Composite",className:"SpendTx",modelProperties:{recipientId:{serializedName:"recipient_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}}}}},ci={type:{name:"Composite",className:"OracleRegisterTx",modelProperties:{queryFormat:{serializedName:"query_format",required:!0,type:{name:"String"}},responseFormat:{serializedName:"response_format",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"Ttl"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},abiVersion:{serializedName:"abi_version",type:{name:"String"}}}}},ui={type:{name:"Composite",className:"OracleExtendTx",modelProperties:{fee:{serializedName:"fee",required:!0,type:{name:"String"}},oracleTtl:{serializedName:"oracle_ttl",type:{name:"Composite",className:"RelativeTTL"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}}}}},li={type:{name:"Composite",className:"OracleQueryTx",modelProperties:{oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},query:{serializedName:"query",required:!0,type:{name:"String"}},queryFee:{serializedName:"query_fee",required:!0,type:{name:"String"}},queryTtl:{serializedName:"query_ttl",type:{name:"Composite",className:"Ttl"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},senderId:{serializedName:"sender_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},di={type:{name:"Composite",className:"OracleRespondTx",modelProperties:{queryId:{serializedName:"query_id",required:!0,type:{name:"String"}},response:{serializedName:"response",required:!0,type:{name:"String"}},responseTtl:{serializedName:"response_ttl",type:{name:"Composite",className:"RelativeTTL"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},oracleId:{serializedName:"oracle_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},pi={type:{name:"Composite",className:"NamePreclaimTx",modelProperties:{commitmentId:{serializedName:"commitment_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},mi={type:{name:"Composite",className:"NameClaimTx",modelProperties:{name:{serializedName:"name",required:!0,type:{name:"String"}},nameSalt:{serializedName:"name_salt",required:!0,type:{name:"String"}},nameFee:{serializedName:"name_fee",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},hi={type:{name:"Composite",className:"NameUpdateTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},nameTtl:{serializedName:"name_ttl",required:!0,type:{name:"String"}},pointers:{serializedName:"pointers",required:!0,type:{name:"Sequence",element:{type:{name:"Composite",className:"NamePointer"}}}},clientTtl:{serializedName:"client_ttl",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},fi={type:{name:"Composite",className:"NameTransferTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},recipientId:{serializedName:"recipient_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},yi={type:{name:"Composite",className:"NameRevokeTx",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},accountId:{serializedName:"account_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},gi={type:{name:"Composite",className:"CommitmentId",modelProperties:{commitmentId:{serializedName:"commitment_id",required:!0,type:{name:"String"}}}}},wi={type:{name:"Composite",className:"NameHash",modelProperties:{nameId:{serializedName:"name_id",required:!0,type:{name:"String"}}}}},Ni={type:{name:"Composite",className:"ChannelCreateTx",modelProperties:{initiatorId:{serializedName:"initiator_id",required:!0,type:{name:"String"}},initiatorAmount:{serializedName:"initiator_amount",required:!0,type:{name:"String"}},responderId:{serializedName:"responder_id",required:!0,type:{name:"String"}},responderAmount:{serializedName:"responder_amount",required:!0,type:{name:"String"}},channelReserve:{serializedName:"channel_reserve",required:!0,type:{name:"String"}},lockPeriod:{serializedName:"lock_period",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},delegateIds:{serializedName:"delegate_ids",type:{name:"Composite",className:"Delegates"}}}}},vi={type:{name:"Composite",className:"ChannelDepositTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}}}}},Ci={type:{name:"Composite",className:"ChannelWithdrawTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},toId:{serializedName:"to_id",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}}}}},Si={type:{name:"Composite",className:"ChannelForceProgressTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},update:{serializedName:"update",type:{name:"Composite",className:"OffChainUpdate"}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},offchainTrees:{serializedName:"offchain_trees",type:{name:"String"}}}}},bi={type:{name:"Composite",className:"ChannelCloseMutualTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",required:!0,type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}}}}},xi={type:{name:"Composite",className:"ChannelCloseSoloTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},Ti={type:{name:"Composite",className:"ChannelSlashTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},poi:{serializedName:"poi",required:!0,type:{name:"String"}}}}},zi={type:{name:"Composite",className:"ChannelSettleTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorAmountFinal:{serializedName:"initiator_amount_final",required:!0,type:{name:"String"}},responderAmountFinal:{serializedName:"responder_amount_final",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",required:!0,type:{name:"String"}}}}},_i={type:{name:"Composite",className:"ChannelSnapshotSoloTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},Ai={type:{name:"Composite",className:"ChannelSetDelegatesTx",modelProperties:{channelId:{serializedName:"channel_id",required:!0,type:{name:"String"}},fromId:{serializedName:"from_id",required:!0,type:{name:"String"}},initiatorDelegateIds:{serializedName:"initiator_delegate_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},responderDelegateIds:{serializedName:"responder_delegate_ids",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},stateHash:{serializedName:"state_hash",required:!0,type:{name:"String"}},round:{serializedName:"round",required:!0,type:{name:"String"}},payload:{serializedName:"payload",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}}}}},qi={type:{name:"Composite",className:"PubKey",modelProperties:{pubKey:{serializedName:"pub_key",required:!0,type:{name:"String"}}}}},Pi={type:{name:"Composite",className:"PeerDetails",modelProperties:{host:{serializedName:"host",required:!0,type:{name:"String"}},port:{serializedName:"port",required:!0,type:{name:"String"}},firstSeen:{serializedName:"first_seen",required:!0,type:{name:"String"}},lastSeen:{serializedName:"last_seen",required:!0,type:{name:"String"}},genesisHash:{serializedName:"genesis_hash",required:!0,type:{name:"String"}},topHash:{serializedName:"top_hash",required:!0,type:{name:"String"}},topDifficulty:{serializedName:"top_difficulty",required:!0,type:{name:"String"}},networkId:{serializedName:"network_id",type:{name:"String"}},nodeVersion:{serializedName:"node_version",type:{name:"String"}},nodeRevision:{serializedName:"node_revision",type:{name:"String"}},nodeVendor:{serializedName:"node_vendor",type:{name:"String"}},nodeOs:{serializedName:"node_os",type:{name:"String"}}}}},Ei={type:{name:"Composite",className:"Peers",modelProperties:{peers:{serializedName:"peers",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}},blocked:{serializedName:"blocked",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},Ii={type:{name:"Composite",className:"PeerCount",modelProperties:{connected:{serializedName:"connected",type:{name:"Composite",className:"PeerCountConnected"}},available:{serializedName:"available",type:{name:"Composite",className:"PeerCountAvailable"}},blocked:{serializedName:"blocked",required:!0,type:{name:"String"}}}}},ki={type:{name:"Composite",className:"PeerCountConnected",modelProperties:{inbound:{serializedName:"inbound",type:{name:"String"}},outbound:{serializedName:"outbound",type:{name:"String"}}}}},Oi={type:{name:"Composite",className:"PeerCountAvailable",modelProperties:{verified:{serializedName:"verified",type:{name:"String"}},unverified:{serializedName:"unverified",type:{name:"String"}}}}},Mi={type:{name:"Composite",className:"ContractCreateTx",modelProperties:{ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},code:{serializedName:"code",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Bi={type:{name:"Composite",className:"ContractCallTx",modelProperties:{callerId:{serializedName:"caller_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Ri={type:{name:"Composite",className:"UnsignedTx",modelProperties:{tx:{serializedName:"tx",required:!0,type:{name:"String"}}}}},ji={type:{name:"Composite",className:"TokenSupply",modelProperties:{accounts:{serializedName:"accounts",type:{name:"String"}},contracts:{serializedName:"contracts",type:{name:"String"}},contractOracles:{serializedName:"contract_oracles",type:{name:"String"}},locked:{serializedName:"locked",type:{name:"String"}},oracles:{serializedName:"oracles",type:{name:"String"}},oracleQueries:{serializedName:"oracle_queries",type:{name:"String"}},pendingRewards:{serializedName:"pending_rewards",type:{name:"String"}},total:{serializedName:"total",type:{name:"String"}}}}},Di={type:{name:"Composite",className:"GAAttachTx",modelProperties:{ownerId:{serializedName:"owner_id",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},code:{serializedName:"code",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}},authFun:{constraints:{Pattern:new RegExp("^(0x|0X)?[a-fA-F0-9]+$")},serializedName:"auth_fun",required:!0,type:{name:"String"}}}}},Fi={type:{name:"Composite",className:"GAMetaTx",modelProperties:{gaId:{serializedName:"ga_id",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},ttl:{serializedName:"ttl",type:{name:"String"}},authData:{serializedName:"auth_data",required:!0,type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}}}}},$i={type:{name:"Composite",className:"PayingForTx",modelProperties:{payerId:{serializedName:"payer_id",required:!0,type:{name:"String"}},fee:{serializedName:"fee",required:!0,type:{name:"String"}},nonce:{serializedName:"nonce",type:{name:"String"}},tx:{serializedName:"tx",type:{name:"Composite",className:"SignedTx"}}}}},Ui={type:{name:"Composite",className:"CheckTxInPoolResponse",modelProperties:{status:{serializedName:"status",required:!0,type:{name:"String"}}}}},Vi={serializedName:"OffChainTransfer",type:{name:"Composite",className:"OffChainTransfer",uberParent:"OffChainUpdate",polymorphicDiscriminator:Aa.type.polymorphicDiscriminator,modelProperties:{...Aa.type.modelProperties,from:{serializedName:"from",required:!0,type:{name:"String"}},to:{serializedName:"to",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Hi={serializedName:"OffChainWithdrawal",type:{name:"Composite",className:"OffChainWithdrawal",uberParent:"OffChainUpdate",polymorphicDiscriminator:Aa.type.polymorphicDiscriminator,modelProperties:{...Aa.type.modelProperties,to:{serializedName:"to",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Li={serializedName:"OffChainDeposit",type:{name:"Composite",className:"OffChainDeposit",uberParent:"OffChainUpdate",polymorphicDiscriminator:Aa.type.polymorphicDiscriminator,modelProperties:{...Aa.type.modelProperties,from:{serializedName:"from",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}}}}},Gi={serializedName:"OffChainNewContract",type:{name:"Composite",className:"OffChainNewContract",uberParent:"OffChainUpdate",polymorphicDiscriminator:Aa.type.polymorphicDiscriminator,modelProperties:{...Aa.type.modelProperties,owner:{serializedName:"owner",required:!0,type:{name:"String"}},vmVersion:{serializedName:"vm_version",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},code:{serializedName:"code",type:{name:"Composite",className:"ByteCode"}},deposit:{serializedName:"deposit",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Wi={serializedName:"OffChainCallContract",type:{name:"Composite",className:"OffChainCallContract",uberParent:"OffChainUpdate",polymorphicDiscriminator:Aa.type.polymorphicDiscriminator,modelProperties:{...Aa.type.modelProperties,caller:{serializedName:"caller",required:!0,type:{name:"String"}},contract:{serializedName:"contract",required:!0,type:{name:"String"}},abiVersion:{serializedName:"abi_version",required:!0,type:{name:"String"}},amount:{serializedName:"amount",required:!0,type:{name:"String"}},gas:{serializedName:"gas",required:!0,type:{name:"String"}},gasPrice:{serializedName:"gas_price",required:!0,type:{name:"String"}},callData:{serializedName:"call_data",required:!0,type:{name:"String"}}}}},Ki={type:{name:"Composite",className:"CreateContractUnsignedTx",modelProperties:{...Ri.type.modelProperties,contractId:{serializedName:"contract_id",required:!0,type:{name:"String"}}}}};let Qi={"Tx.Tx":za,OffChainUpdate:Aa,"OffChainUpdate.OffChainTransfer":Vi,"OffChainUpdate.OffChainWithdrawal":Hi,"OffChainUpdate.OffChainDeposit":Li,"OffChainUpdate.OffChainNewContract":Gi,"OffChainUpdate.OffChainCallContract":Wi};const Ji={parameterPath:"accept",mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Accept",type:{name:"String"}}},Yi={parameterPath:"$host",mapper:{serializedName:"$host",required:!0,type:{name:"String"}},skipEncoding:!0},Xi={parameterPath:"intAsString",mapper:{defaultValue:!1,serializedName:"int-as-string",type:{name:"Boolean"}}},Zi={parameterPath:"hash",mapper:{serializedName:"hash",required:!0,type:{name:"String"}}},eo={parameterPath:"height",mapper:{constraints:{InclusiveMaximum:0x10000000000000000,InclusiveMinimum:0},serializedName:"height",required:!0,type:{name:"Number"}}},to={parameterPath:"pubkey",mapper:{serializedName:"pubkey",required:!0,type:{name:"String"}}},no={parameterPath:["options","contentType"],mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Content-Type",type:{name:"String"}}},ro={parameterPath:"body",mapper:Ba},ao={parameterPath:"body",mapper:Wa};class io extends ga.ServiceClient{constructor(e,t){var n,r;if(void 0===e)throw new Error("'$host' cannot be null");t||(t={});const a="azsdk-js-node/1.0.0-beta.1",i=t.userAgentOptions&&t.userAgentOptions.userAgentPrefix?`${t.userAgentOptions.userAgentPrefix} ${a}`:`${a}`;super({requestContentType:"application/json; charset=utf-8",...t,userAgentOptions:{userAgentPrefix:i},endpoint:null!==(n=null!==(r=t.endpoint)&&void 0!==r?r:t.baseUri)&&void 0!==n?n:"{$host}"}),this.$host=e}getTopHeader(e){return this.sendOperationRequest({options:e},so)}getCurrentKeyBlock(e){return this.sendOperationRequest({options:e},co)}getCurrentKeyBlockHash(e){return this.sendOperationRequest({options:e},uo)}getCurrentKeyBlockHeight(e){return this.sendOperationRequest({options:e},lo)}getPendingKeyBlock(e){return this.sendOperationRequest({options:e},po)}getKeyBlockByHash(e,t){return this.sendOperationRequest({hash:e,options:t},mo)}getKeyBlockByHeight(e,t){return this.sendOperationRequest({height:e,options:t},ho)}getMicroBlockHeaderByHash(e,t){return this.sendOperationRequest({hash:e,options:t},fo)}getMicroBlockTransactionsByHash(e,t){return this.sendOperationRequest({hash:e,options:t},yo)}getMicroBlockTransactionByHashAndIndex(e,t,n){return this.sendOperationRequest({hash:e,index:t,options:n},go)}getMicroBlockTransactionsCountByHash(e,t){return this.sendOperationRequest({hash:e,options:t},wo)}getCurrentGeneration(e){return this.sendOperationRequest({options:e},No)}getGenerationByHash(e,t){return this.sendOperationRequest({hash:e,options:t},vo)}getGenerationByHeight(e,t){return this.sendOperationRequest({height:e,options:t},Co)}getAccountByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},So)}getAccountByPubkeyAndHeight(e,t,n){return this.sendOperationRequest({pubkey:e,height:t,options:n},bo)}getAccountByPubkeyAndHash(e,t,n){return this.sendOperationRequest({pubkey:e,hash:t,options:n},xo)}getPendingAccountTransactionsByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},To)}getAccountNextNonce(e,t){return this.sendOperationRequest({pubkey:e,options:t},zo)}protectedDryRunTxs(e,t){return this.sendOperationRequest({body:e,options:t},_o)}getTransactionByHash(e,t){return this.sendOperationRequest({hash:e,options:t},Ao)}getTransactionInfoByHash(e,t){return this.sendOperationRequest({hash:e,options:t},qo)}postTransaction(e,t){return this.sendOperationRequest({body:e,options:t},Po)}getContract(e,t){return this.sendOperationRequest({pubkey:e,options:t},Eo)}getContractCode(e,t){return this.sendOperationRequest({pubkey:e,options:t},Io)}getContractPoI(e,t){return this.sendOperationRequest({pubkey:e,options:t},ko)}getOracleByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Oo)}getOracleQueriesByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},Mo)}getOracleQueryByPubkeyAndQueryId(e,t,n){return this.sendOperationRequest({pubkey:e,queryId:t,options:n},Bo)}getNameEntryByName(e,t){return this.sendOperationRequest({name:e,options:t},Ro)}getChannelByPubkey(e,t){return this.sendOperationRequest({pubkey:e,options:t},jo)}getPeerPubkey(e){return this.sendOperationRequest({options:e},Do)}getStatus(e){return this.sendOperationRequest({options:e},Fo)}getChainEnds(e){return this.sendOperationRequest({options:e},$o)}}const oo=ga.createSerializer(e,!1),so={path:"/v3/headers/top",httpMethod:"GET",responses:{200:{bodyMapper:wa},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},co={path:"/v3/key-blocks/current",httpMethod:"GET",responses:{200:{bodyMapper:va},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},uo={path:"/v3/key-blocks/current/hash",httpMethod:"GET",responses:{200:{bodyMapper:Ca},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},lo={path:"/v3/key-blocks/current/height",httpMethod:"GET",responses:{200:{bodyMapper:Sa},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},po={path:"/v3/key-blocks/pending",httpMethod:"GET",responses:{200:{bodyMapper:va},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},mo={path:"/v3/key-blocks/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:va},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},ho={path:"/v3/key-blocks/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:va},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,eo],headerParameters:[Ji],serializer:oo},fo={path:"/v3/micro-blocks/hash/{hash}/header",httpMethod:"GET",responses:{200:{bodyMapper:ba},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},yo={path:"/v3/micro-blocks/hash/{hash}/transactions",httpMethod:"GET",responses:{200:{bodyMapper:xa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},go={path:"/v3/micro-blocks/hash/{hash}/transactions/index/{index}",httpMethod:"GET",responses:{200:{bodyMapper:Ta},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi,{parameterPath:"index",mapper:{constraints:{InclusiveMinimum:1},serializedName:"index",required:!0,type:{name:"Number"}}}],headerParameters:[Ji],serializer:oo},wo={path:"/v3/micro-blocks/hash/{hash}/transactions/count",httpMethod:"GET",responses:{200:{bodyMapper:Ia},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},No={path:"/v3/generations/current",httpMethod:"GET",responses:{200:{bodyMapper:ka},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},vo={path:"/v3/generations/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:ka},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},Co={path:"/v3/generations/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:ka},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,eo],headerParameters:[Ji],serializer:oo},So={path:"/v3/accounts/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:Oa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},bo={path:"/v3/accounts/{pubkey}/height/{height}",httpMethod:"GET",responses:{200:{bodyMapper:Oa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,eo,to],headerParameters:[Ji],serializer:oo},xo={path:"/v3/accounts/{pubkey}/hash/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:Oa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi,to],headerParameters:[Ji],serializer:oo},To={path:"/v3/accounts/{pubkey}/transactions/pending",httpMethod:"GET",responses:{200:{bodyMapper:xa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},zo={path:"/v3/accounts/{pubkey}/next-nonce",httpMethod:"GET",responses:{200:{bodyMapper:Ma},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi,{parameterPath:["options","strategy"],mapper:{defaultValue:"max",serializedName:"strategy",type:{name:"Enum",allowedValues:["max","continuity"]}}}],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},_o={path:"/v3/dry-run",httpMethod:"POST",responses:{200:{bodyMapper:$a},403:{bodyMapper:Na,isError:!0}},requestBody:ro,queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji,no],mediaType:"json",serializer:oo},Ao={path:"/v3/transactions/{hash}",httpMethod:"GET",responses:{200:{bodyMapper:Ta},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},qo={path:"/v3/transactions/{hash}/info",httpMethod:"GET",responses:{200:{bodyMapper:La},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,Zi],headerParameters:[Ji],serializer:oo},Po={path:"/v3/transactions",httpMethod:"POST",responses:{200:{bodyMapper:Ka},400:{bodyMapper:Na,isError:!0}},requestBody:ao,queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji,no],mediaType:"json",serializer:oo},Eo={path:"/v3/contracts/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:Qa},400:{bodyMapper:Na,isError:!0},404:{isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},Io={path:"/v3/contracts/{pubkey}/code",httpMethod:"GET",responses:{200:{bodyMapper:Ja},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},ko={path:"/v3/contracts/{pubkey}/poi",httpMethod:"GET",responses:{200:{bodyMapper:Ya},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},Oo={path:"/v3/oracles/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:Xa},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},Mo={path:"/v3/oracles/{pubkey}/queries",httpMethod:"GET",responses:{200:{bodyMapper:Za},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi,{parameterPath:["options","from"],mapper:{serializedName:"from",type:{name:"String"}}},{parameterPath:["options","limit"],mapper:{defaultValue:20,constraints:{InclusiveMaximum:1e3,InclusiveMinimum:1},serializedName:"limit",type:{name:"Number"}}},{parameterPath:["options","type"],mapper:{defaultValue:"all",serializedName:"type",type:{name:"Enum",allowedValues:["open","closed","all"]}}}],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},Bo={path:"/v3/oracles/{pubkey}/queries/{query-id}",httpMethod:"GET",responses:{200:{bodyMapper:ei},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to,{parameterPath:"queryId",mapper:{serializedName:"query-id",required:!0,type:{name:"String"}}}],headerParameters:[Ji],serializer:oo},Ro={path:"/v3/names/{name}",httpMethod:"GET",responses:{200:{bodyMapper:ti},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,{parameterPath:"name",mapper:{serializedName:"name",required:!0,type:{name:"String"}}}],headerParameters:[Ji],serializer:oo},jo={path:"/v3/channels/{pubkey}",httpMethod:"GET",responses:{200:{bodyMapper:ni},400:{bodyMapper:Na,isError:!0},404:{bodyMapper:Na,isError:!0}},queryParameters:[Xi],urlParameters:[Yi,to],headerParameters:[Ji],serializer:oo},Do={path:"/v3/peers/pubkey",httpMethod:"GET",responses:{200:{bodyMapper:ri}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},Fo={path:"/v3/status",httpMethod:"GET",responses:{200:{bodyMapper:ai}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo},$o={path:"/v3/status/chain-ends",httpMethod:"GET",responses:{200:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"String"}}}}}},queryParameters:[Xi],urlParameters:[Yi],headerParameters:[Ji],serializer:oo};function Uo(e,t){Vo(e,t),t.add(e)}function Vo(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ho(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}const Lo=["balance","queryFee","fee","amount","nameFee","channelAmount","initiatorAmount","responderAmount","channelReserve","initiatorAmountFinal","responderAmountFinal","gasPrice","deposit"],Go=["time","gas","gasUsed","nameSalt","nonce","nextNonce","height","blockHeight","topBlockHeight","ttl","nameTtl","clientTtl","inbound","outbound","peerCount","pendingTransactionsCount","effectiveAtHeight","version","solutions","round"];var Wo=new WeakSet,Ko=new WeakSet,Qo=new WeakSet;class Jo extends io{constructor(){super(...arguments),Uo(this,Qo),Uo(this,Ko),Uo(this,Wo)}async sendOperationRequest(e,t){const n=He(e,(e=>{let[t,n]=e;return[t,Ho(this,Ko,Xo).call(this,n)]}));return Ho(this,Qo,Zo).call(this,await super.sendOperationRequest(n,t))}}function Yo(e,t){return Array.isArray(e)?e.map((e=>Ho(this,Wo,Yo).call(this,e,t))):null!=e&&"object"==typeof e?He(e,(e=>{let[n,r]=e;return null==r?[n,r]:Lo.some((e=>e===n))?[n,t.bigInt(r)]:Go.some((e=>e===n))?[n,t.number(r)]:[n,Ho(this,Wo,Yo).call(this,r,t)]})):e}function Xo(e){return Ho(this,Wo,Yo).call(this,e,{bigInt:e=>e instanceof c()?e.toFixed():e.toString(),number:e=>e.toString()})}function Zo(e){return Ho(this,Wo,Yo).call(this,e,{bigInt:e=>BigInt(e),number:e=>+e})}var es=new WeakMap;class ts extends Jo{constructor(e){let{ignoreVersion:t=!1,retryCount:n=3,retryOverallDelay:r=800,...a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,o;if(super(e,{allowInsecureConnection:!0,additionalPolicies:[da(),pa(),ya(n,r),ha((e=>` ${e.reason}`))],...a}),o={writable:!0,value:void 0},Vo(this,i=es),i.set(this,o),!t){const e=this.getStatus(),t=e.then((e=>{let{nodeVersion:t}=e;return t}),(e=>e));On(this,es,e.then((e=>{let{networkId:t}=e;return t}),(e=>e))),this.pipeline.addPolicy(fa("node","/v3/status",t,"6.2.0","7.0.0"))}this.intAsString=!0}async getNetworkId(){var e;null!==(e=Mn(this,es))&&void 0!==e||On(this,es,this.getStatus().then((e=>{let{networkId:t}=e;return t})));const t=await Mn(this,es);if(t instanceof Error)throw t;return t}async getNodeInfo(){const{nodeVersion:e,networkId:t,protocols:n,topBlockHeight:r}=await this.getStatus(),a=n.filter((e=>{let{effectiveAtHeight:t}=e;return r>=t})).reduce(((e,t)=>t.effectiveAtHeight>e.effectiveAtHeight?t:e),{effectiveAtHeight:-1,version:0}).version;return{url:this.$host,nodeNetworkId:t,version:e,consensusProtocolVersion:a}}}function ns(e){const t=sa(e);switch(t.tag){case Vt.SignedTx:return ns(ia(t.encodedTx));case Vt.GaMetaTx:return t.gaId}const n=aa(t.tag,t.version).find((e=>{let[t]=e;return"nonce"===t}))?.[1];if(null==n)throw new C(`Transaction doesn't have nonce: ${Vt[t.tag]}`);if(!("senderKey"in n))throw new R;return t[n.senderKey].replace(/^ok_/,"ak_")}class rs{}var as=N(9408).Buffer;const is=new WeakMap;function os(e,t,n){const r=[t];n&&r.push("inner_tx");const a=dt(e);return Le([as.from(r.join("-")),wt(a)])}class ss extends rs{constructor(e){if(super(),64!==(e="string"==typeof e?as.from(e,"hex"):e).length)throw new b("secretKey","64 bytes",e.length);is.set(this,e),this.address=pt(vt(is.get(this)).publicKey,Xe.AccountAddress)}static generate(){return new ss(Ct().secretKey)}async sign(e,t){return St(e,is.get(this))}async signTransaction(e){let{innerTx:t,networkId:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==n)throw new b("networkId","provided",n);const a=dt(e),i=os(e,n,!0===t),o=[await this.sign(i,r)];return ia({tag:Vt.SignedTx,encodedTx:a,signatures:o})}async signMessage(e,t){return this.sign(xt(e),t)}}function cs(e){let{innerTx:t,gasUsed:n,queryFee:r,isInitiator:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=sa(e);if(i.tag===Vt.SignedTx)throw new x("Transaction shouldn't be a SignedTx, use `getExecutionCostBySignedTx` instead");let o=0n;return"fee"in i&&"freeloader"!==t&&(o+=BigInt(i.fee)),i.tag===Vt.NameClaimTx&&(o+=BigInt(i.nameFee)),i.tag===Vt.OracleQueryTx&&(o+=BigInt(i.queryFee)),i.tag===Vt.OracleResponseTx&&(o-=BigInt(null!=r?r:0)),i.tag===Vt.ChannelSettleTx&&(!0===a&&(o-=BigInt(i.initiatorAmountFinal)),!1===a&&(o-=BigInt(i.responderAmountFinal))),(i.tag===Vt.SpendTx&&i.senderId!==i.recipientId||i.tag===Vt.ContractCreateTx||i.tag===Vt.ContractCallTx||i.tag===Vt.ChannelDepositTx)&&"fee-payer"!==t&&(o+=BigInt(i.amount)),i.tag===Vt.ContractCreateTx&&(o+=BigInt(i.deposit)),i.tag!==Vt.ContractCreateTx&&i.tag!==Vt.ContractCallTx&&i.tag!==Vt.GaAttachTx&&i.tag!==Vt.GaMetaTx||"freeloader"===t||(o+=BigInt(i.gasPrice)*BigInt(null!=n?n:i.gasLimit)),i.tag!==Vt.GaMetaTx&&i.tag!==Vt.PayingForTx||(o+=cs(ia(i.tx.encodedTx),i.tag===Vt.PayingForTx?{innerTx:"fee-payer"}:{})),o}function us(e,t,n){const r=sa(e,Vt.SignedTx);if(r.encodedTx.tag===Vt.GaMetaTx)return cs(ia(r.encodedTx),n);const a=ia(r.encodedTx),i=ns(a),[o,s]=[!0,!1].map((e=>bt(os(a,t,e),r.signatures[0],i)));if(!o&&!s)throw new C("Can't verify signature");return cs(ia(r.encodedTx),{...o&&{innerTx:"freeloader"},...n})}async function ls(e,t){let{isMined:n,...r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=sa(e);const i=a.tag===Vt.SignedTx,o=i&&!0===n&&ca(e);if(a.tag===Vt.SignedTx&&(a=a.encodedTx),null==r.gasUsed&&!1!==o&&[Vt.ContractCreateTx,Vt.ContractCallTx,Vt.GaAttachTx,Vt.GaMetaTx].includes(a.tag)){const{callInfo:e,gaInfo:n}=await t.getTransactionInfoByHash(o),a=null!=e?e:n;if(null==a)throw new B(`callInfo and gaInfo is not available for transaction ${o}`);r.gasUsed=a.gasUsed}if(null==r.queryFee&&Vt.OracleResponseTx===a.tag&&(r.queryFee=(await t.getOracleByPubkey(a.oracleId)).queryFee.toString()),null==r.isInitiator&&Vt.ChannelSettleTx===a.tag&&!0!==n){const{initiatorId:e}=await t.getChannelByPubkey(a.channelId);r.isInitiator=a.fromId===e}return i?us(e,await t.getNetworkId(),r):cs(e,r)}var ds=N(9408).Buffer;const ps=[];async function ms(e,t,n){const r=ns(ia(e)),[a,{height:i},{consensusProtocolVersion:o,nodeNetworkId:s}]=await Promise.all([t.getAccountByPubkey(r).catch((e=>{if(!Ke(e))throw e;return{id:r,balance:0n,nonce:0}})).then((e=>({...e,id:e.id}))),t.getCurrentKeyBlockHeight(),t.getNodeInfo()]);return(await Promise.all(ps.map((async r=>r(e,{node:t,account:a,height:i,consensusProtocolVersion:o,nodeNetworkId:s,parentTxTypes:n}))))).flat()}async function hs(e,t){const n=new ts(t.$host,{ignoreVersion:!0,pipeline:t.pipeline.clone(),additionalPolicies:[ma()]});return ms(sa(e),n,[])}function fs(e,t){let{_expectedMineRate:n=18e4,_microBlockCycle:r=3e3,_maxPollInterval:a=5e3}=t;const i={block:n,microblock:r}[e];return Math.min(i/3,a)}ps.push(((e,t)=>{let{account:n,nodeNetworkId:r,parentTxTypes:a}=t;if(e.tag!==Vt.SignedTx)return[];const{encodedTx:i,signatures:o}=e;if(null==(null!=i?i:o))return[];if(1!==o.length)return[];const s=ds.from([r,...a.includes(Vt.PayingForTx)?["inner_tx"]:[]].join("-")),c=dt(ia(i)),u=Le([s,c]),l=Le([s,wt(c)]);return bt(u,o[0],n.id)||bt(l,o[0],n.id)?[]:[{message:"Signature cannot be verified, please ensure that you transaction have the correct prefix and the correct private key for the sender address",key:"InvalidSignature",checkedKeys:["encodedTx","signatures"]}]}),(async(e,t)=>{let n,{node:r,parentTxTypes:a}=t;return"encodedTx"in e&&(n=e.encodedTx),"tx"in e&&(n=e.tx),null==n?[]:ms(n,r,[...a,e.tag])}),((e,t)=>{let{height:n}=t;return"ttl"in e?0===e.ttl||e.ttl>=n?[]:[{message:`TTL ${e.ttl} is already expired, current height is ${n}`,key:"ExpiredTTL",checkedKeys:["ttl"]}]:[]}),(async(e,t)=>{let{account:n,parentTxTypes:r,node:a}=t;if(0!==r.length)return[];const i=await ls(ia(e),a).catch((()=>0n));return i<=n.balance?[]:[{message:`Account balance ${n.balance} is not enough to execute the transaction that costs ${i}`,key:"InsufficientBalance",checkedKeys:["amount","fee","nameFee","gasLimit","gasPrice"]}]}),((e,t)=>{let n,{account:r}=t;return e.tag===Vt.SignedTx&&"generalized"===r.kind&&0!==e.signatures.length&&(n="Generalized account can't be used to generate SignedTx with signatures"),e.tag===Vt.GaMetaTx&&"basic"===r.kind&&(n="Basic account can't be used to generate GaMetaTx"),null==n?[]:[{message:n,key:"InvalidAccountType",checkedKeys:["tag"]}]}),((e,t)=>{var n,r;let{consensusProtocolVersion:a}=t;const i=Vt.Oracle===e.tag||Vt.OracleRegisterTx===e.tag,o=Vt.ContractCreateTx===e.tag||Vt.GaAttachTx===e.tag,s=Vt.ContractCallTx===e.tag||Vt.GaMetaTx===e.tag,c=null!==(n=null!==(r=i?"oracle-call":null)&&void 0!==r?r:o?"contract-create":null)&&void 0!==n?n:s?"contract-call":null;if(null==c)return[];const u=Lt[a][c];let l;if("abiVersion"in e&&(l={abiVersion:e.abiVersion}),"ctVersion"in e&&(l=e.ctVersion),null==l)throw new R;return!u.abiVersion.includes(l.abiVersion)||o&&!u.vmVersion.includes(l.vmVersion)?[{message:`ABI/VM version ${JSON.stringify(l)} is wrong, supported is: ${JSON.stringify(u)}`,key:"VmAndAbiVersionMismatch",checkedKeys:["ctVersion","abiVersion"]}]:[]}),(async(e,t)=>{let{node:n}=t;if(Vt.ContractCallTx!==e.tag)return[];try{const{active:t}=await n.getContract(e.contractId);return t?[]:[{message:`Contract ${e.contractId} is not active`,key:"ContractNotActive",checkedKeys:["contractId"]}]}catch(e){if(null==e.response?.parsedBody?.reason)throw e;return[{message:e.response.parsedBody.reason,key:"ContractNotFound",checkedKeys:["contractId"]}]}}));class ys extends C{constructor(e,t,n){super(e),this.name="InvalidTxError",this.validation=t,this.transaction=n}}async function gs(e){let{onNode:t}=e;return(await t.getCurrentKeyBlockHeight()).height}async function ws(e,t){var n;let{blocks:r=10,interval:a,onNode:i,...o}=t;null!==(n=a)&&void 0!==n||(a=fs("microblock",o));const s=await gs({onNode:i})+r;do{const t=await i.getTransactionByHash(e);if(-1!==t.blockHeight)return t;await Ve(a)}while(await gs({onNode:i})<s);throw new P(r,e)}async function Ns(e,t){var n;let r,{interval:a,onNode:i,...o}=t;null!==(n=a)&&void 0!==n||(a=fs("block",o));do{null!=r&&await Ve(a),r=(await i.getCurrentKeyBlockHeight()).height}while(r<e);return r}async function vs(e,t){let{confirm:n=3,onNode:r,...a}=t;const{blockHeight:i}=await r.getTransactionByHash(e),o=await Ns(i+n,{onNode:r,...a}),{blockHeight:s}=await r.getTransactionByHash(e);switch(s){case-1:throw new Ae(e);case i:return o;default:return vs(e,{onNode:r,confirm:n,...a})}}async function Cs(e,t){let{onNode:n,onAccount:r,verify:a=!0,waitMined:i=!0,confirm:o,innerTx:s,...c}=t;const u=await r.signTransaction(e,{...c,onNode:n,innerTx:s,networkId:await n.getNetworkId()});if(!0===s)return{hash:ca(u),rawTx:u};if(a){const e=await hs(u,n);if(e.length>0){const t=`Transaction verification errors: ${e.map((e=>e.message)).join(", ")}`;throw new ys(t,e,u)}}try{let e;try{e=null!=r?`tx-${r.address}`:null}catch(t){e=null}const{txHash:t}=await n.postTransaction({tx:u},null!=e?{requestOptions:{customHeaders:{__queue:e}}}:{});if(i){const e=await ws(t,{onNode:n,...c}),r={...e,hash:e.hash,rawTx:u};if(null!=o&&(!0===o||o>0)){const e="boolean"==typeof o?void 0:o;return{...r,confirmationHeight:await vs(t,{onNode:n,confirm:e,...c})}}return r}return{hash:t,rawTx:u}}catch(e){throw Object.assign(e,{rawTx:u,verifyTx:async()=>hs(u,n)})}}async function Ss(e,t){let{height:n,hash:r,onNode:a}=t;return null!=n?a.getAccountByPubkeyAndHeight(e,n):null!=r?a.getAccountByPubkeyAndHash(e,r):a.getAccountByPubkey(e)}async function bs(e,t){let{format:n=Ie.AETTOS,...r}=t;const a=e.startsWith("ok_")?pt(dt(e),Xe.AccountAddress):e,{balance:i}=await Ss(a,r).catch((e=>{if(!Ke(e))throw e;return{balance:0n}}));return Oe(i,{targetDenomination:n})}async function xs(e){let{onNode:t}=e;return t.getCurrentGeneration()}async function Ts(e,t){let{onNode:n}=t;return"number"==typeof e?n.getGenerationByHeight(e):n.getGenerationByHash(e)}async function zs(e,t){let{onNode:n}=t;return(await n.getMicroBlockTransactionsByHash(e)).transactions}async function _s(e,t){let{onNode:n}=t;return"number"==typeof e?n.getKeyBlockByHeight(e):n.getKeyBlockByHash(e)}async function As(e,t){let{onNode:n}=t;return n.getMicroBlockHeaderByHash(e)}const qs=new Map;async function Ps(e,t){const n=qs.get(e);if(qs.delete(e),null==n)throw new B("Can't get dry-run request");let r;try{const e="number"==typeof n[0].top?(await _s(n[0].top,{onNode:t})).hash:n[0].top;r=await t.protectedDryRunTxs({top:e,txEvents:n[0].txEvents,txs:n.map((e=>({tx:e.tx}))),accounts:Array.from(new Set(n.map((e=>e.accountAddress)))).map((e=>({pubKey:e,amount:Lr.amount})))})}catch(e){return void n.forEach((t=>{let{reject:n}=t;return n(e)}))}const{results:a,txEvents:i}=r;a.forEach(((e,t)=>{let{result:r,reason:a,...o}=e;const{resolve:s,reject:c,tx:u,accountAddress:l}=n[t];"ok"===r?s({...o,txEvents:i}):c(Object.assign(new Se(a),{tx:u,accountAddress:l}))}))}async function Es(e,t,n){var r;let{top:a,txEvents:i,combine:o,onNode:s}=n;const c=!0===o?[a,i].join():"immediate",u=null!==(r=qs.get(c))&&void 0!==r?r:[];return qs.set(c,u),new Promise(((n,r)=>{var l;u.push({tx:e,accountAddress:t,top:a,txEvents:i,resolve:n,reject:r}),!0===o?null!==(l=u.timeout)&&void 0!==l||(u.timeout=setTimeout((()=>{Ps(c,s)}))):Ps(c,s)}))}async function Is(e,t){let{onNode:n}=t;return n.getContractCode(e)}async function ks(e,t){let{onNode:n}=t;return n.getContract(e)}async function Os(e,t){let{onNode:n}=t;return n.getNameEntryByName(e)}async function Ms(e,t,n){let{verify:r=!0,resolveByNode:a=!1,onNode:i}=n;if(pn(e)){if(r||a){const n=(await i.getNameEntryByName(e)).pointers.find((e=>e.key===t));if(null==n)throw new D(e,t);if(a)return n.id}return cn(e)}try{return dt(e),e}catch(t){throw new $(`Invalid name or address: ${e}`)}}var Bs=N(3983),Rs=N(7417),js=N(9408).Buffer;const Ds={async argon2id(e,t,n){const{memlimit_kib:r,opslimit:a}=n;return(0,Rs.hash)(e,{hashLength:32,salt:t,timeCost:a,memoryCost:r,type:Rs.argon2id})}},Fs={"xsalsa20-poly1305":{encrypt:je().secretbox,decrypt(){const e=je().secretbox.open(...arguments);if(null==e)throw new me;return e}}},$s={secret_type:"ed25519",symmetric_alg:"xsalsa20-poly1305",kdf:"argon2id",kdf_params:{memlimit_kib:65536,opslimit:3,parallelism:1}};function Us(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$s.symmetric_alg;return Fs[r].encrypt(e,n,t)}async function Vs(e,t,n,r){return Ds[n](e,t,r)}async function Hs(e,t){let{crypto:n}=t;const r=js.from(n.kdf_params.salt,"hex");return js.from(function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$s.symmetric_alg;return Fs[r].decrypt(e,n,t)}(js.from(n.ciphertext,"hex"),await Vs(e,r,n.kdf,n.kdf_params),js.from(n.cipher_params.nonce,"hex"),n.symmetric_alg)).toString("hex")}async function Ls(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:je().randomBytes(24),a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:je().randomBytes(16),i=arguments.length>5?arguments[5]:void 0;const o={...$s,...i},s=await Vs(t,a,o.kdf,o.kdf_params),c="string"==typeof n?js.from(n,"hex"):n;return{name:e,version:1,public_key:ht(c),id:(0,Bs.v4)(),crypto:{secret_type:o.secret_type,symmetric_alg:o.symmetric_alg,ciphertext:js.from(Us(c,s,r,o.symmetric_alg)).toString("hex"),cipher_params:{nonce:js.from(r).toString("hex")},kdf:o.kdf,kdf_params:{...o.kdf_params,salt:js.from(a).toString("hex")}}}}var Gs=N(9882),Ws=N(1986),Ks=N(8236),Qs=N.n(Ks),Js=N(9408).Buffer;const Ys=Qs().ModeOfOperation.ecb;function Xs(e,t){const n=et(e);return new Ys(n).encrypt(t)}function Zs(e,t){const n=Js.from(t),r=et(e);return new Ys(r).decrypt(n)}class ec extends g{constructor(e){super(e),this.name="DerivationError"}}const tc=Js.from("ed25519 seed"),nc=2147483648;function rc(e,t){let{secretKey:n,chainCode:r}=e;if(t<nc)throw new ec(`Segment ${t} is not hardened`);const a=Js.allocUnsafe(4);a.writeUInt32BE(t,0);const i=Le([Js.alloc(1,0),n,a]),o=(0,Gs.full)(i,r);return{secretKey:o.slice(0,32),chainCode:o.slice(32)}}function ac(e,t){const n=""===e?[]:(0,Ws.fromString)(e).toPathArray();return n.forEach(((e,t)=>{if(e<nc)throw new ec(`Segment #${t+1} is not hardened`)})),n.reduce(((e,t)=>rc(e,t)),t)}function ic(e){const t=(0,Gs.full)(e,tc);return{secretKey:t.slice(0,32),chainCode:t.slice(32)}}function oc(e,t){if(!["m","m/"].includes(e.slice(0,2)))throw new ec("Root element is required");const n=ic(t);return ac(e.slice(2),n)}function sc(e){const{secretKey:t,publicKey:n}=e;return{secretKey:Js.from(t).toString("hex"),publicKey:pt(n,Xe.AccountAddress)}}function cc(e){return je().sign.keyPair.fromSeed(e)}function uc(e,t){const n=oc("m/44h/457h",e);return{secretKey:Js.from(Xs(t,n.secretKey)).toString("hex"),chainCode:Js.from(Xs(t,n.chainCode)).toString("hex")}}function lc(e,t,n){const r={secretKey:Zs(t,Js.from(e.secretKey,"hex")),chainCode:Zs(t,Js.from(e.chainCode,"hex"))};return new Array(n).fill(void 0).map(((e,t)=>sc(cc(ac(`${t}h/0h/0h`,r).secretKey))))}const dc=(e,t)=>({...sc(cc(ac(`${t}h/0h/0h`,oc("m/44h/457h",e)).secretKey)),idx:t});async function pc(e,t){return Cs(await oa({...t,tag:Vt.NameRevokeTx,nameId:e,accountId:t.onAccount.address}),t)}async function mc(e,t,n){let{extendPointers:r,...a}=n;const i={...!0===r&&Object.fromEntries((await Os(e,a)).pointers.map((e=>{let{key:t,id:n}=e;return[t,n]}))),...t};return Cs(await oa({clientTtl:It,nameTtl:qt,...a,tag:Vt.NameUpdateTx,nameId:e,accountId:a.onAccount.address,pointers:Object.entries(i).map((e=>{let[t,n]=e;return{key:t,id:n}}))}),a)}async function hc(e,t,n){return Cs(await oa({...n,tag:Vt.NameTransferTx,nameId:e,accountId:n.onAccount.address,recipientId:t}),n)}async function fc(e,t){const n=await Os(e,t);return Object.freeze({...n,id:n.id,owner:n.owner,async update(n,r){return{...await mc(e,n,{...t,...r}),...await fc(e,{...t,...r})}},async transfer(n,r){return{...await hc(e,n,{...t,...r}),...await fc(e,{...t,...r})}},async revoke(n){return pc(e,{...t,...n})},async extendTtl(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n>qt||n<=0)throw new b("nameTtl",`a number between 1 and ${qt} blocks`,n);return{...await mc(e,{},{...t,...r,nameTtl:n,extendPointers:!0}),...await fc(e,{...t,...r})}}})}async function yc(e,t,n){const r=await oa({...n,tag:Vt.NameClaimTx,accountId:n.onAccount.address,nameSalt:t,name:e}),a=await Cs(r,n);if(!wn(e)){const t=null!=a.blockHeight&&a.blockHeight>0?await fc(e,n):{};return Object.assign(a,t)}return a}async function gc(e,t){const n=yt(),r=un(e,n),a=await oa({...t,tag:Vt.NamePreclaimTx,accountId:t.onAccount.address,commitmentId:r});return Object.freeze({...await Cs(a,t),salt:n,commitmentId:r,async claim(r){const{version:a,...i}=t;return yc(e,n,{...i,...r})}})}async function wc(e,t,n){return yc(e,0,{...n,nameFee:t})}var Nc=N(7946);function vc(e,t){Cc(e,t),t.add(e)}function Cc(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Sc(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var bc=new WeakSet,xc=new WeakSet,Tc=new WeakSet,zc=new WeakSet,_c=new WeakMap;function Ac(e,t,n,r){let a,{returnType:i,returnValue:o,log:s}=e;switch(i){case"ok":{const e=Sc(this,Tc,Pc).call(this,t);return{decodedResult:this._calldata.decode(this._name,e.name,o),decodedEvents:this.$decodeEvents(s,r)}}case"revert":a=this._calldata.decodeFateString(o);break;case"error":a=dt(o).toString();break;default:throw new B(`Unknown return type: ${i}`)}throw new se(a,n)}async function qc(e,t,n){const r=await Cs(e,{...this.$options,...n});return{hash:r.hash,tx:sa(r.rawTx),txData:r,rawTx:r.rawTx,...null!=r.blockHeight&&await this.$getCallResultByTxHash(r.hash,t,n)}}function Pc(e){const t=Mn(this,_c).functions.find((t=>t.name===e));if(null!=t)return t;if("init"===e)return{arguments:[],name:"init",payable:!1,returns:"unit",stateful:!0};throw new ce(`Function ${e} doesn't exist in contract`)}function Ec(e,t,n){let{contractAddressToName:r}=n;const a={...this.$options.contractAddressToName,...r};if(null!=a[e])return a[e];const i=this._aci.map((e=>{let{contract:t}=e;return t})).filter((e=>e?.event)).map((e=>[e.name,e.event.variant])).map((e=>{let[t,n]=e;return n.map((e=>[t,Object.keys(e)[0],Object.values(e)[0]]))})).flat().filter((e=>{let[,n]=e;return BigInt(`0x${wt(n).toString("hex")}`)===t})).filter(((e,t,n)=>{let[,,r]=e;return!n.slice(0,t).some((e=>{return t=e[2],n=r,JSON.stringify(t)===JSON.stringify(n);var t,n}))}));switch(i.length){case 0:throw new le(t.toString(),e);case 1:return i[0][0];default:throw new de(e,i)}}const Ic=class{async $compile(){if(null!=this.$options.bytecode)return this.$options.bytecode;if(null==this.$options.sourceCode)throw new x("Can't compile without source code");if(null==this.$options.onCompiler)throw new x("Can't compile without compiler");return this.$options.bytecode=(await this.$options.onCompiler.compileBySourceCode(this.$options.sourceCode,this.$options.fileSystem)).bytecode,this.$options.bytecode}async $getCallResultByTxHash(e,t,n){const{callInfo:r}=await this.$options.onNode.getTransactionInfoByHash(e);if(null==r)throw new y(`callInfo is not available for transaction ${e}`);const a=r;return{...Sc(this,bc,Ac).call(this,a,t,void 0,n),result:a}}async _estimateGas(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{result:r}=await this.$call(e,t,{...n,callStatic:!0});if(null==r)throw new R;const{gasUsed:a}=r;return Math.floor(1.25*a)}async $deploy(e,t){var n;const{callStatic:r,...a}={...this.$options,...t};if(null==this.$options.bytecode&&await this.$compile(),!0===r)return this.$call("init",e,{...a,callStatic:r});if(null!=this.$options.address)throw new te;if(null==a.onAccount)throw new x("Can't deploy without account");const i=a.onAccount.address;if(null==this.$options.bytecode)throw new x("Can't deploy without bytecode");const o=await oa({...a,tag:Vt.ContractCreateTx,gasLimit:null!==(n=a.gasLimit)&&void 0!==n?n:await this._estimateGas("init",e,a),callData:this._calldata.encode(this._name,"init",e),code:this.$options.bytecode,ownerId:i});this.$options.address=ua(o);const{hash:s,...c}=await Sc(this,xc,qc).call(this,o,"init",{...a,onAccount:a.onAccount});return{...c,...null!=c.result?.log&&{decodedEvents:this.$decodeEvents(c.result.log,a)},owner:i,transaction:s,address:this.$options.address}}async $call(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{callStatic:a,top:i,...o}={...this.$options,...r},s=Sc(this,Tc,Pc).call(this,e),c=this.$options.address,{onNode:u}=o;if(null==e)throw new oe;if("init"===e&&!0!==a)throw new re('"init" can be called only via dryRun');if("init"!==e&&null!=o.amount&&o.amount>0&&!s.payable)throw new ue(o.amount,e);let l;try{if(null==o.onAccount)throw new B("Use fallback account");l=o.onAccount.address}catch(e){if(!0!==a||!(e instanceof E&&"Account should be an address (ak-prefixed string), or instance of AccountBase, got undefined instead"===e.message||e instanceof Pe))throw e;l=Lr.pub}const d=this._calldata.encode(this._name,e,t);if(!0===a){if(null==o.nonce&&null!=i){const e="number"==typeof i?"height":"hash";o.nonce=(await Ss(l,{[e]:i,onNode:u})).nonce+1}const t={...o,onNode:u,callData:d};let n;if("init"===e){if(null==this.$options.bytecode)throw new x('Can\'t dry-run "init" without bytecode');n=await oa({...t,tag:Vt.ContractCreateTx,code:this.$options.bytecode,ownerId:l})}else{if(null==c)throw new ae("Can't dry-run contract without address");n=await oa({...t,tag:Vt.ContractCallTx,callerId:l,contractId:c})}const{callObj:r,...a}=await Es(n,l,{...o,top:i});if(null==r)throw new B(`callObj is not available for transaction ${n}`);const s=r;return{...a,...Sc(this,bc,Ac).call(this,s,e,n,o),tx:sa(n),result:s,rawTx:n,hash:ca(n),txData:void 0}}if(null!=i)throw new x("Can't handle `top` option in on-chain contract call");if(null==c)throw new ae("Can't call contract without address");const p=await oa({...o,tag:Vt.ContractCallTx,gasLimit:null!==(n=o.gasLimit)&&void 0!==n?n:await this._estimateGas(e,t,o),callerId:l,contractId:c,callData:d});if(null==o.onAccount)throw new x("Can't call contract on chain without account");return Sc(this,xc,qc).call(this,p,e,{...o,onAccount:o.onAccount})}$decodeEvents(e){let{omitUnknown:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.map((e=>{const r=e.topics.map((e=>BigInt(e)));let a;try{a=Sc(this,zc,Ec).call(this,e.address,r[0],n)}catch(e){if(null!=t&&t&&e instanceof le)return null;throw e}const i=this._calldata.decodeEvent(a,e.data,r),[o,s]=Object.entries(i)[0];return{name:o,args:s,contract:{name:a,address:e.address}}})).filter((e=>null!=e))}static async initialize(e){let{onCompiler:t,onNode:n,bytecode:r,aci:a,address:i,sourceCodePath:o,sourceCode:s,fileSystem:c,validateBytecode:u,...l}=e;if(null==a&&null!=t){let e;var d;null!=o&&(e=await t.compile(o)),null!=s&&(e=await t.compileBySourceCode(s,c)),null!=e&&(a=e.aci,null!==(d=r)&&void 0!==d||(r=e.bytecode))}if(null==a)throw new ie;if(null!=i&&(i=await Ms(i,"contract_pubkey",{resolveByNode:!0,onNode:n})),null==i&&null==s&&null==r)throw new ae("Can't create instance by ACI without address");if(null!=i&&null==(await ks(i,{onNode:n})).active)throw new ne(i);if(!0===u){if(null==i)throw new ae("Can't validate bytecode without contract address");const e=(await Is(i,{onNode:n})).bytecode;let a=!1;if(null!=r)a=r===e;else if(null!=s){if(null==t)throw new x("Can't validate bytecode without compiler");a=await t.validateBySourceCode(e,s,c)}if(!a)throw new ee(null!=s?"source code":"bytecode")}return new Ic({onCompiler:t,onNode:n,sourceCode:s,bytecode:r,aci:a,address:i,fileSystem:c,...l})}constructor(e){var t=this;let{aci:n,...r}=e;var a,i;vc(this,zc),vc(this,Tc),vc(this,xc),vc(this,bc),i={writable:!0,value:void 0},Cc(this,a=_c),a.set(this,i),this._aci=n;const o=n[n.length-1];if(null==o.contract)throw new x(`The last 'aci' item should have 'contract' key, got ${Object.keys(o)} keys instead`);On(this,_c,o.contract),this._name=Mn(this,_c).name,this._calldata=new Nc.Encoder(n),this.$options=r,Object.assign(this,Object.fromEntries(Mn(this,_c).functions.map((e=>{let{name:n,arguments:r,stateful:a}=e;const i="init"!==n&&!a;return[n,async function(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];const s=a.length===r.length+1?a.pop():{};if("object"!=typeof s)throw new E(`Options should be an object: ${s}`);return"init"===n?t.$deploy(a,{callStatic:i,...s}):t.$call(n,a,{callStatic:i,...s})}]}))))}};var kc=Ic;function Oc(e,t,n){var r;let{interval:a,onNode:i,...o}=n;null!==(r=a)&&void 0!==r||(a=fs("microblock",o));const s=new Set,c=async()=>{var n;(null!==(n=(await i.getOracleQueriesByPubkey(e)).oracleQueries)&&void 0!==n?n:[]).filter((e=>{let{id:t}=e;return!s.has(t)})).forEach((e=>{s.add(e.id),t(e)}))};let u=!1;return(async()=>{for(;!u;)await c().catch(console.error),await Ve(a)})(),()=>{u=!0}}async function Mc(e,t,n){var r;let a,i,o,{interval:s,onNode:c,...u}=n;null!==(r=s)&&void 0!==r||(s=fs("microblock",u));do{({response:o,ttl:i}=await c.getOracleQueryByPubkeyAndQueryId(e,t));const n=dt(o);if(n.length>0)return n.toString();await Ve(s),a=await gs({onNode:c})}while(i>=a);throw new q(a)}async function Bc(e,t,n){const r=await n.onNode.getOracleQueryByPubkeyAndQueryId(e,t);return{...r,decodedQuery:dt(r.query).toString(),decodedResponse:dt(r.response).toString(),respond:async(e,r)=>Dc(t,e,{...n,...r}),pollForResponse:async r=>Mc(e,t,{...n,...r})}}async function Rc(e,t,n){var r;null!==(r=n.queryFee)&&void 0!==r||(n.queryFee=(await n.onNode.getOracleByPubkey(e)).queryFee.toString());const a=n.onAccount.address,i=await oa({queryTtlType:Vr.type,queryTtlValue:Vr.value,responseTtlType:Hr.type,responseTtlValue:Hr.value,...n,tag:Vt.OracleQueryTx,oracleId:e,senderId:a,query:t}),{nonce:o}=sa(i,Vt.OracleQueryTx),s=sn(a,o,e);return{...await Cs(i,n),...await Bc(e,s,n)}}async function jc(e){const t=pt(dt(e.onAccount.address),Xe.OracleAddress),n=await oa({oracleTtlType:Ur.type,oracleTtlValue:Ur.value,...e,tag:Vt.OracleExtendTx,oracleId:t});return{...await Cs(n,e),...await Fc(t,e)}}async function Dc(e,t,n){const r=pt(dt(n.onAccount.address),Xe.OracleAddress),a=await oa({responseTtlType:Hr.type,responseTtlValue:Hr.value,...n,tag:Vt.OracleResponseTx,oracleId:r,queryId:e,response:t});return{...await Cs(a,n),...await Fc(r,n)}}async function Fc(e,t){return{...await t.onNode.getOracleByPubkey(e),queries:(await t.onNode.getOracleQueriesByPubkey(e)).oracleQueries,...He({pollQueries:Oc,postQuery:Rc,respondToQuery:Dc,extendOracle:jc,getQuery:Bc},(n=>{let[r,a]=n;return[r,function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];const s=i[i.length-1];return null!=s&&"object"==typeof s&&s.constructor===Object?Object.assign(s,{...t,...s}):i.push(t),a(...["extendOracle","respondToQuery"].includes(r)?[]:[e],...i)}]}))}}async function $c(e,t,n){const r=n.onAccount.address,a=await oa({oracleTtlValue:Ur.value,oracleTtlType:Ur.type,...n,tag:Vt.OracleRegisterTx,accountId:r,queryFormat:e,responseFormat:t});return{...await Cs(a,n),...await Fc(pt(dt(r),Xe.OracleAddress),n)}}async function Uc(e,t,n){return Cs(await oa({...n,tag:Vt.SpendTx,senderId:n.onAccount.address,recipientId:await Ms(t,"account_pubkey",n),amount:e}),n)}async function Vc(e,t,n){if(e<0||e>1)throw new b("fraction","a number between 0 and 1",e);const r=await Ms(t,"account_pubkey",n),a=n.onAccount.address,i=new(c())(await bs.bind(n.onAccount)(a,n)),o=i.times(e).integerValue(c().ROUND_HALF_UP),{fee:s}=sa(await oa({...n,tag:Vt.SpendTx,senderId:a,recipientId:r,amount:o}),Vt.SpendTx),u=o.plus(s).gt(i)?i.minus(s):o;return Cs(await oa({...n,tag:Vt.SpendTx,senderId:a,recipientId:r,amount:u}),n)}async function Hc(e,t){return Cs(await oa({...t,tag:Vt.PayingForTx,payerId:t.onAccount.address,tx:e}),t)}var Lc=N(9408).Buffer;async function Gc(e,t,n){var r;let{onAccount:a,onCompiler:i,onNode:o,bytecode:s,aci:c,sourceCodePath:u,sourceCode:l,fileSystem:d,...p}=n;const m=a.address;if("generalized"===(await Ss(m,{onNode:o})).kind)throw new x(`Account ${m} is already GA`);const h=await kc.initialize({onAccount:a,onCompiler:i,onNode:o,bytecode:s,aci:c,sourceCodePath:u,sourceCode:l,fileSystem:d}),f=await oa({...p,tag:Vt.GaAttachTx,onNode:o,code:await h.$compile(),gasLimit:null!==(r=p.gasLimit)&&void 0!==r?r:await h._estimateGas("init",t,p),ownerId:m,callData:h._calldata.encode(h._name,"init",t),authFun:wt(e)}),y=ua(f),{hash:g,rawTx:w}=await Cs(f,{onNode:o,onAccount:a,onCompiler:i,...p});return Object.freeze({owner:m,transaction:g,rawTx:w,gaContractId:y})}async function Wc(e,t){let{fee:n,gasPrice:r,onNode:a}=t;const{nodeNetworkId:i,consensusProtocolVersion:o}=await a.getNodeInfo();let s=wt(Le([Lc.from(i),dt(e)]));if(o===Ft.Ceres){if(null==n)throw new b("fee","provided (in Ceres)",n);if(null==r)throw new b("gasPrice","provided (in Ceres)",r);s=wt(dt(ia({tag:Vt.GaMetaTxAuthData,fee:n,gasPrice:r,txHash:pt(s,Xe.TxHash)})))}return s}async function Kc(e,t){let{onNode:n}=t;const r=sa(e,Vt.SignedTx);if(r.encodedTx.tag!==Vt.GaMetaTx)throw new b("transaction","to include GaMetaTx",Vt[r.encodedTx.tag]);return Wc(ia(r.encodedTx.tx.encodedTx),{fee:r.encodedTx.fee,gasPrice:r.encodedTx.gasPrice,onNode:n})}var Qc=N(7445),Jc=N(2472),Yc=N(8994);function Xc(e){return Xc="function"==typeof Jc&&"symbol"==typeof Yc?function(e){return typeof e}:function(e){return e&&"function"==typeof Jc&&e.constructor===Jc&&e!==Jc.prototype?"symbol":typeof e},Xc(e)}var Zc=N(24);function eu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Xc(e)||null===e)return e;var n=e[Zc];if(void 0!==n){var r=n.call(e,"string");if("object"!==Xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Xc(t)?t:String(t)}(t))in e?Qc(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var tu=N(9408).Buffer;function nu(e){return new Proxy({},{...Object.fromEntries(["apply","construct","defineProperty","deleteProperty","getOwnPropertyDescriptor","getPrototypeOf","isExtensible","ownKeys","preventExtensions","set","setPrototypeOf"].map((e=>[e,()=>{throw new O(`${e} proxy request`)}]))),get(t,n,r){const a=e(),i=Reflect.get(a,n,r);return"function"==typeof i?i.bind(a):i},has(t,n){return Reflect.has(e(),n)}})}const{InvalidTxError:ru,...au}=t,iu={...au,...n,...a,...r,createDelegationSignature:async function(e,t,n){return n.onAccount.sign(Le([tu.from(await n.onNode.getNetworkId()),...!0===n.omitAddress?[]:[dt(n.onAccount.address)],...t.map((e=>pn(e)?cn(e):e)).map((e=>dt(e))),dt(e)]),n)},...i};class ou{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};eu(this,"_options",{}),Object.assign(this._options,e)}_resolveAccount(e){if("string"==typeof e)throw new O("Address in AccountResolver");if("object"==typeof e)return e;throw new E(`Account should be an address (ak-prefixed string), or instance of AccountBase, got ${String(e)} instead`)}_getOptions(){return{...this._options,onAccount:nu((()=>this._resolveAccount()))}}async buildTx(e){return oa({...this._getOptions(),...e})}async initializeContract(e){const{onNode:t,onCompiler:n,...r}=this._getOptions();if(null==n||null==t)throw new b("onCompiler, onNode","provided",null);return kc.initialize({...r,onNode:t,onCompiler:n,...e})}}Object.assign(ou.prototype,He(iu,(e=>{let[t,n]=e;return[t,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.length=n.length;const a=t[t.length-1];return t[t.length-1]={...this._getOptions(),...a,...null!=a?.onAccount&&{onAccount:this._resolveAccount(a.onAccount)}},n(...t)}]})));var su=ou;class cu extends su{constructor(){let{nodes:e=[],...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),eu(this,"pool",new Map),e.forEach(((e,t)=>{let{name:n,instance:r}=e;return this.addNode(n,r,0===t)}))}get compilerApi(){if(null==this._options.onCompiler)throw new f("You can't use Compiler API. Compiler is not ready!");return this._options.onCompiler}get api(){return this.ensureNodeConnected(),this.pool.get(this.selectedNodeName)}addNode(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.pool.has(e))throw new we(e);this.pool.set(e,t),(n||null==this.selectedNodeName)&&this.selectNode(e)}selectNode(e){if(!this.pool.has(e))throw new Ne(`Node with name ${e} not in pool`);this.selectedNodeName=e}isNodeConnected(){return null!=this.selectedNodeName}ensureNodeConnected(){if(!this.isNodeConnected())throw new Ne("You can't use Node API. Node is not connected or not defined!")}async getNodeInfo(){return this.ensureNodeConnected(),{name:this.selectedNodeName,...await this.api.getNodeInfo()}}async getNodesInPool(){return Promise.all(Array.from(this.pool.entries()).map((async e=>{let[t,n]=e;return{name:t,...await n.getNodeInfo()}})))}addresses(){return[]}get address(){return this._resolveAccount().address}async sign(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._resolveAccount(t).sign(e,n)}async signTransaction(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=null!==this.selectedNodeName?await this.api.getNetworkId():void 0;return this._resolveAccount(t).signTransaction(e,{networkId:r,...n})}async signMessage(e){let{onAccount:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._resolveAccount(t).signMessage(e,n)}_getOptions(){return{...super._getOptions(),onNode:nu((()=>this.api)),onCompiler:nu((()=>this.compilerApi))}}}class uu extends cu{constructor(){let{accounts:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(t),eu(this,"accounts",{}),e?.forEach(((e,t)=>this.addAccount(e,{select:0===t})))}_resolveAccount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectedAddress;if("string"==typeof e){const t=e;if(dt(t),null==this.accounts[t])throw new j(e);e=this.accounts[t]}return super._resolveAccount(e)}addresses(){return Object.keys(this.accounts)}addAccount(e){let{select:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{address:n}=e;this.accounts[n]=e,!0===t&&this.selectAccount(n)}removeAccount(e){if(null==this.accounts[e])throw new j(e);delete this.accounts[e],this.selectedAddress===e&&delete this.selectedAddress}selectAccount(e){if(dt(e),null==this.accounts[e])throw new j(e);this.selectedAddress=e}}let lu,du,pu,mu,hu;!function(e){e.to_waellet="to_waellet",e.to_aepp="to_aepp"}(lu||(lu={})),function(e){e.window="window",e.extension="extension"}(du||(du={})),function(e){e.subscribe="subscribe",e.unsubscribe="unsubscribe"}(pu||(pu={})),function(e){e.readyToConnect="connection.announcePresence",e.updateAddress="address.update",e.address="address.get",e.connect="connection.open",e.sign="transaction.sign",e.signMessage="message.sign",e.subscribeAddress="address.subscribe",e.updateNetwork="networkId.update",e.closeConnection="connection.close"}(mu||(mu={})),function(e){e.CONNECTED="CONNECTED",e.DISCONNECTED="DISCONNECTED",e.WAITING_FOR_CONNECTION_REQUEST="WAITING_FOR_CONNECTION_REQUEST"}(hu||(hu={}));const fu=[];class yu extends l{toJSON(){return{code:this.code,message:this.message,data:this.data}}static deserialize(e){const t=fu.find((t=>t.code===e.code));if(null==t)throw new B(`Can't find RpcError with code: ${e.code}`);return new t(e.data)}}class gu extends yu{constructor(e){super("Invalid transaction"),eu(this,"code",2),this.data=e,this.name="RpcInvalidTransactionError"}}eu(gu,"code",2),fu.push(gu);class wu extends yu{constructor(e){super("Broadcast failed"),eu(this,"code",3),this.data=e,this.name="RpcBroadcastError"}}eu(wu,"code",3),fu.push(wu);class Nu extends yu{constructor(e){super("Operation rejected by user"),eu(this,"code",4),this.data=e,this.name="RpcRejectedByUserError"}}eu(Nu,"code",4),fu.push(Nu);class vu extends yu{constructor(){super("Unsupported Protocol Version"),eu(this,"code",5),this.name="RpcUnsupportedProtocolError"}}eu(vu,"code",5),fu.push(vu);class Cu extends yu{constructor(e){super("Wallet deny your connection request"),eu(this,"code",9),this.data=e,this.name="RpcConnectionDenyError"}}eu(Cu,"code",9),fu.push(Cu);class Su extends yu{constructor(){super("You are not connected to the wallet"),eu(this,"code",10),this.name="RpcNotAuthorizeError"}}eu(Su,"code",10),fu.push(Su);class bu extends yu{constructor(e){super(`You are not subscribed for account ${e}`),eu(this,"code",11),this.data=e,this.name="RpcPermissionDenyError"}}eu(bu,"code",11),fu.push(bu);class xu extends yu{constructor(){super("The peer failed to execute your request due to unknown error"),eu(this,"code",12),this.name="RpcInternalError"}}eu(xu,"code",12),fu.push(xu);class Tu extends yu{constructor(){super("Method not found"),eu(this,"code",-32601),this.name="RpcMethodNotFoundError"}}eu(Tu,"code",-32601),fu.push(Tu);var zu=N(9408).Buffer;class _u extends rs{constructor(e,t){super(),this._rpcClient=e,this.address=t}async sign(){throw new O("RAW signing using wallet")}async signTransaction(e){let{innerTx:t,networkId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t)throw new O("innerTx option in AccountRpc");if(null==n)throw new b("networkId","provided",n);const r=await this._rpcClient.request(mu.sign,{onAccount:this.address,tx:e,returnSigned:!0,networkId:n});if(null==r.signedTransaction)throw new k("signedTransaction is missed in wallet response");return r.signedTransaction}async signMessage(e){const{signature:t}=await this._rpcClient.request(mu.signMessage,{onAccount:this.address,message:e});return zu.from(t,"hex")}}function Au(e,t){Pu(e,t),t.add(e)}function qu(e,t,n){Pu(e,t),t.set(e,n)}function Pu(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Eu(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}var Iu=new WeakMap,ku=new WeakMap,Ou=new WeakMap,Mu=new WeakSet,Bu=new WeakSet,Ru=new WeakSet,ju=new WeakSet;class Du{constructor(e,t,n){Au(this,ju),Au(this,Ru),Au(this,Bu),Au(this,Mu),qu(this,Iu,{writable:!0,value:new Map}),qu(this,ku,{writable:!0,value:0}),qu(this,Ou,{writable:!0,value:void 0}),this.connection=e,On(this,Ou,n),e.connect(Eu(this,Mu,Fu).bind(this),t)}async request(e,t){return Eu(this,Bu,$u).call(this,On(this,ku,Mn(this,ku)+1),e,t),new Promise(((e,t)=>{Mn(this,Iu).set(Mn(this,ku),{resolve:e,reject:t})}))}notify(e,t){Eu(this,Bu,$u).call(this,void 0,e,t)}}async function Fu(e,t){if("2.0"!==e?.jsonrpc)throw new U(JSON.stringify(e));if("result"in e||"error"in e)return void Eu(this,ju,Vu).call(this,e);const n=e;let r,a;try{if(!(n.method in Mn(this,Ou)))throw new Tu;const e=n.method;r=await Mn(this,Ou)[e](n.params,t)}catch(e){a=e instanceof yu?e:new xu}null!=n.id&&Eu(this,Ru,Uu).call(this,n.id,n.method,r,a)}function $u(e,t,n){this.connection.sendMessage({jsonrpc:"2.0",...null!=e?{id:e}:{},method:t,...null!=n?{params:n}:{}})}function Uu(e,t,n,r){this.connection.sendMessage({jsonrpc:"2.0",id:e,method:t,...null!=r?{error:r.toJSON()}:{result:n}})}function Vu(e){let{id:t,error:n,result:r}=e;const a=Mn(this,Iu).get(t);if(null==a)throw new V(t);null!=n?a.reject(yu.deserialize(n)):a.resolve(r),Mn(this,Iu).delete(t)}class Hu extends cu{constructor(e){let{name:t,onAddressChange:n=(()=>{}),onDisconnect:r=(()=>{}),onNetworkChange:a=(()=>{}),...i}=e;super(i),this.onAddressChange=n,this.onDisconnect=r,this.onNetworkChange=a,this.name=t}_resolveAccount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.addresses()[0];if("string"==typeof e){const t=e;if(dt(t),!this.addresses().includes(t))throw new H(t);this._ensureConnected(),e=new _u(this.rpcClient,t)}return null==e&&this._ensureAccountAccess(),super._resolveAccount(e)}addresses(){if(null==this._accounts)return[];const e=Object.keys(this._accounts.current)[0];return[...null!=e?[e]:[],...Object.keys(this._accounts.connected)]}async connectToWallet(e){let t,{connectNode:n=!1,name:r="wallet-node",select:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=this.rpcClient)throw new qe("You are already connected to wallet");const i=new Du(e,(()=>{delete this.rpcClient,delete this._accounts,this.onDisconnect(t)}),{[mu.updateAddress]:e=>{this._accounts=e,this.onAddressChange(e)},[mu.updateNetwork]:e=>{const{node:t}=e;null!=t&&this.addNode(t.name,new ts(t.url),!0),this.onNetworkChange(e)},[mu.closeConnection]:e=>{t=e,i.connection.disconnect()},[mu.readyToConnect]:()=>{}}),{node:o,...s}=await i.request(mu.connect,{name:this.name,version:1,connectNode:n});if(n){if(null==o)throw new Ee("Missing URLs of the Node");this.addNode(r,new ts(o.url),a)}return this.rpcClient=i,s}disconnectWallet(){this._ensureConnected(),this.rpcClient.notify(mu.closeConnection,{reason:"bye"}),this.rpcClient.connection.disconnect()}async askAddresses(){return this._ensureAccountAccess(),this.rpcClient.request(mu.address,void 0)}async subscribeAddress(e,t){this._ensureConnected();const n=await this.rpcClient.request(mu.subscribeAddress,{type:e,value:t});return this._accounts=n.address,n}_ensureConnected(){if(null==this.rpcClient)throw new Pe("You are not connected to Wallet")}_ensureAccountAccess(){if(this._ensureConnected(),0===this.addresses().length)throw new G}}var Lu=N(2716);const Gu=N.n(Lu)()({storeAsString:!0}),Wu=e=>{if("object"==typeof e&&null!==e&&e.constructor===Object)return He(e,(e=>{let[t,n]=e;return[t,Wu(n)]}));if(Array.isArray(e))return e.map((e=>Wu(e)));if("string"==typeof e&&new(c())(e).toString(10)===e){const t=new(c())(e);return t.toJSON=()=>t.toString(10),t}return e};var Ku={stringify:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Gu.stringify(Wu(t[0]),...t.slice(1))},parse:Gu.parse},Qu=N(9408).Buffer;class Ju extends uu{constructor(e){let{name:t,id:n,type:r,onConnection:a,onSubscription:i,onDisconnect:o,onAskAccounts:s,...c}=e;super(c),eu(this,"_clients",new Map),this.onConnection=a,this.onSubscription=i,this.onDisconnect=o,this.onAskAccounts=s,this.name=t,this.id=n,this._type=r}_pushAccountsToApps(){null!=this._clients&&Array.from(this._clients.keys()).filter((e=>this._isRpcClientSubscribed(e))).map((e=>this._getClient(e).rpc)).forEach((e=>e.notify(mu.updateAddress,this.getAccounts())))}selectAccount(e){super.selectAccount(e),this._pushAccountsToApps()}addAccount(e,t){super.addAccount(e,t),this._pushAccountsToApps()}_getNode(){return this.ensureNodeConnected(),{node:{url:this.api.$host,name:this.selectedNodeName}}}async selectNode(e){super.selectNode(e);const t=await this.api.getNetworkId();Array.from(this._clients.keys()).filter((e=>this._isRpcClientConnected(e))).map((e=>this._getClient(e))).forEach((e=>{e.rpc.notify(mu.updateNetwork,{networkId:t,...e.connectNode&&this._getNode()})}))}_getClient(e){const t=this._clients.get(e);if(null==t)throw new L(e);return t}_isRpcClientSubscribed(e){return this._isRpcClientConnected(e)&&0!==this._getClient(e).addressSubscription.size}_isRpcClientConnected(e){return hu.CONNECTED===this._getClient(e).status&&this._getClient(e).rpc.connection.isConnected()}_disconnectRpcClient(e){const t=this._getClient(e);t.rpc.connection.disconnect(),t.status=hu.DISCONNECTED,t.addressSubscription=new Set}removeRpcClient(e){this._disconnectRpcClient(e),this._clients.delete(e)}addRpcClient(e){const t=(0,Bs.v4)();let n;const r={id:t,status:hu.WAITING_FOR_CONNECTION_REQUEST,addressSubscription:new Set,connectNode:!1,rpc:new Du(e,(()=>{this._clients.delete(t),this.onDisconnect(t,n)}),{[mu.closeConnection]:e=>{n=e,this._disconnectRpcClient(t)},[mu.connect]:async(e,n)=>{let{name:a,version:i,icons:o,connectNode:s}=e;if(1!==i)throw new vu;return await this.onConnection(t,{name:a,icons:o,connectNode:s},n),r.status=hu.CONNECTED,r.connectNode=s,{...await this.getWalletInfo(),...s&&this._getNode()}},[mu.subscribeAddress]:async(e,n)=>{let{type:a,value:i}=e;if(!this._isRpcClientConnected(t))throw new Su;switch(await this.onSubscription(t,{type:a,value:i},n),a){case pu.subscribe:r.addressSubscription.add(i);break;case pu.unsubscribe:r.addressSubscription.delete(i);break;default:throw new B(`Unknown subscription type: ${a}`)}return{subscription:Array.from(r.addressSubscription),address:this.getAccounts()}},[mu.address]:async(e,n)=>{if(!this._isRpcClientSubscribed(t))throw new Su;return await this.onAskAccounts(t,e,n),this.addresses()},[mu.sign]:async(e,n)=>{let{tx:r,onAccount:a=this.address,returnSigned:i}=e;if(!this._isRpcClientConnected(t))throw new Su;if(!this.addresses().includes(a))throw new bu(a);const o={onAccount:a,aeppOrigin:n,aeppRpcClientId:t};if(i)return{signedTransaction:await this.signTransaction(r,o)};try{return Ku.parse(Ku.stringify({transactionHash:await this.sendTransaction(r,{...o,verify:!1})}))}catch(e){const t=await hs(r,this.api);if(t.length>0)throw new gu(t);throw new wu(e.message)}},[mu.signMessage]:async(e,n)=>{let{message:r,onAccount:a=this.address}=e;if(!this._isRpcClientConnected(t))throw new Su;if(!this.addresses().includes(a))throw new bu(a);const i={onAccount:a,aeppOrigin:n,aeppRpcClientId:t};return{signature:Qu.from(await this.signMessage(r,i)).toString("hex")}}})};return this._clients.set(t,r),t}async shareWalletInfo(e){this._getClient(e).rpc.notify(mu.readyToConnect,await this.getWalletInfo())}async getWalletInfo(){return{id:this.id,name:this.name,networkId:await this.api.getNetworkId(),origin:window.location.origin,type:this._type}}getAccounts(){return{current:null!=this.selectedAddress?{[this.selectedAddress]:{}}:{},connected:this.addresses().filter((e=>e!==this.selectedAddress)).reduce(((e,t)=>({...e,[t]:{}})),{})}}}var Yu=new WeakMap;class Xu extends rs{constructor(e){var t,n,r;super(),r={writable:!0,value:void 0},function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t=this,n=Yu),n.set(t,r),dt(e),this.address=e}async sign(){throw new O("Can't sign using generalized account")}async signMessage(){throw new O("Can't sign using generalized account")}async signTransaction(e,t){let{authData:n,onCompiler:r,onNode:a}=t;if(null==n||null==r||null==a)throw new b("authData, onCompiler, onNode","provided",null);const{callData:i,sourceCode:o,args:s,fee:c,gasLimit:u,gasPrice:l}="function"==typeof n?await n(e):n,d=null!=i?i:await(async()=>{if(null==Mn(this,Yu)){const e=await Ss(this.address,{onNode:a});if("generalized"!==e.kind)throw new b("account kind","generalized",e.kind);On(this,Yu,e.authFun)}if(null==Mn(this,Yu))throw new B("Account in generalised, but authFun not provided");if(null==o||null==s)throw new Z("Auth data must contain source code and arguments.");const e=await kc.initialize({onCompiler:r,onNode:a,sourceCode:o});return e._calldata.encode(e._name,Mn(this,Yu),s)})(),p=await oa({tag:Vt.GaMetaTx,tx:{tag:Vt.SignedTx,encodedTx:dt(e),signatures:[]},gaId:this.address,authData:d,fee:c,gasLimit:u,gasPrice:l,onNode:a});return ia({tag:Vt.SignedTx,encodedTx:dt(p),signatures:[]})}}var Zu=N(9408).Buffer;const el=224;class tl extends rs{constructor(e,t,n){super(),this.transport=e,this.index=t,this.address=n,e.decorateAppAPIMethods(this,["signTransaction","signMessage"],"w0w")}async sign(){throw new O("RAW signing using Ledger HW")}async signTransaction(e){let{innerTx:t,networkId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t)throw new O("innerTx option in AccountLedger");if(null==n)throw new b("networkId","provided",n);const r=dt(e);let a=0;const i=Zu.from(n),o=[];for(;a!==r.length;){const e=0===a?141-i.length:150,t=a+e>r.length?r.length-a:e,n=Zu.alloc(0===a?9+i.length+t:t);if(0===a){let e=n.writeUInt32BE(this.index,0);e=n.writeUInt32BE(r.length,e),e=n.writeUInt8(i.length,e),e+=i.copy(n,e,0,i.length),r.copy(n,e,0,150-e)}else r.copy(n,0,a,a+t);o.push(n),a+=t}const s=[(await o.reduce((async(e,t,n)=>(await e,this.transport.send(el,4,0===n?0:128,0,t))),Promise.resolve(Zu.alloc(0)))).subarray(0,64)];return ia({tag:Vt.SignedTx,encodedTx:r,signatures:s})}async signMessage(e){let t=0;const n=Zu.from(e),r=[];for(;t!==n.length;){const e=0===t?142:150,a=t+e>n.length?n.length-t:e,i=Zu.alloc(0===t?8+a:a);0===t?(i.writeUInt32BE(this.index,0),i.writeUInt32BE(n.length,4),n.copy(i,8,t,t+a)):n.copy(i,0,t,t+a),r.push(i),t+=a}return(await r.reduce((async(e,t,n)=>(await e,this.transport.send(el,8,0===n?0:128,0,t))),Promise.resolve(Zu.alloc(0)))).subarray(0,64)}}var nl=N(9408).Buffer;class rl{constructor(e){this.transport=e,this.versionCheckPromise=this.getAppConfiguration().then((e=>{let{version:t}=e;const n=[t,"0.4.4","0.5.0"];if(!la(...n))throw new M("app on ledger",...n)})),e.decorateAppAPIMethods(this,["getAddress","getAppConfiguration"],"w0w")}async getAppConfiguration(){await this.versionCheckPromise;const e=await this.transport.send(el,6,0,0);return{version:[e[1],e[2],e[3]].join(".")}}async getAddress(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];await this.versionCheckPromise;const n=nl.alloc(4);n.writeUInt32BE(e,0);const r=await this.transport.send(el,2,t?1:0,0,n),a=r[0];return r.subarray(1,1+a).toString("ascii")}async initialize(e){return await this.versionCheckPromise,new tl(this.transport,e,await this.getAddress(e))}async discover(e){let t=0;const n=[];let r;do{null!=r&&n.push(r),r=await this.initialize(t),t+=1}while(await e.getAccountByPubkey(r.address).then((()=>!0),(()=>!1)));return n}}class al{}const il={type:{name:"Composite",className:"Contract",modelProperties:{code:{serializedName:"code",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}}}}},ol={type:{name:"Composite",className:"CompileOpts",modelProperties:{fileSystem:{serializedName:"file_system",type:{name:"Dictionary",value:{type:{name:"any"}}}},srcFile:{serializedName:"src_file",type:{name:"String"}}}}},sl={type:{name:"Composite",className:"Aci",modelProperties:{encodedAci:{serializedName:"encoded_aci",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}},externalEncodedAci:{serializedName:"external_encoded_aci",type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}},interface:{serializedName:"interface",required:!0,type:{name:"String"}}}}},cl={type:{name:"Composite",className:"CompilerError",modelProperties:{type:{serializedName:"type",required:!0,type:{name:"String"}},pos:{serializedName:"pos",type:{name:"Composite",className:"ErrorPos"}},message:{serializedName:"message",required:!0,type:{name:"String"}},context:{serializedName:"context",type:{name:"String"}}}}},ul={type:{name:"Composite",className:"ErrorPos",modelProperties:{file:{serializedName:"file",type:{name:"String"}},line:{serializedName:"line",required:!0,type:{name:"Number"}},col:{serializedName:"col",required:!0,type:{name:"Number"}}}}},ll={type:{name:"Composite",className:"CompileResult",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}},aci:{serializedName:"aci",required:!0,type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}}}}},dl={type:{name:"Composite",className:"SophiaCallResultInput",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},function:{serializedName:"function",required:!0,type:{name:"String"}},callResult:{serializedName:"call-result",required:!0,type:{name:"String"}},callValue:{serializedName:"call-value",required:!0,type:{name:"String"}}}}},pl={type:{name:"Composite",className:"BytecodeCallResultInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}},function:{serializedName:"function",required:!0,type:{name:"String"}},callResult:{serializedName:"call-result",required:!0,type:{name:"String"}},callValue:{serializedName:"call-value",required:!0,type:{name:"String"}}}}},ml={type:{name:"Composite",className:"DecodedCallresult",modelProperties:{function:{serializedName:"function",required:!0,type:{name:"String"}},result:{serializedName:"result",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}}}}},hl={type:{name:"Composite",className:"FunctionCallInput",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},function:{serializedName:"function",required:!0,type:{name:"String"}},arguments:{serializedName:"arguments",required:!0,type:{name:"Sequence",element:{type:{name:"String"}}}}}}},fl={type:{name:"Composite",className:"Calldata",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}}}}},yl={type:{name:"Composite",className:"DecodeCalldataBytecode",modelProperties:{calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},gl={type:{name:"Composite",className:"DecodedCalldata",modelProperties:{function:{serializedName:"function",required:!0,type:{name:"String"}},arguments:{serializedName:"arguments",required:!0,type:{name:"Sequence",element:{type:{name:"Dictionary",value:{type:{name:"any"}}}}}}}}},wl={type:{name:"Composite",className:"ErrorModel",modelProperties:{reason:{serializedName:"reason",required:!0,type:{name:"String"}}}}},Nl={type:{name:"Composite",className:"DecodeCalldataSource",modelProperties:{source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}},calldata:{serializedName:"calldata",required:!0,type:{name:"String"}},function:{serializedName:"function",required:!0,type:{name:"String"}}}}},vl={type:{name:"Composite",className:"ByteCodeInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}}}}},Cl={type:{name:"Composite",className:"FateAssembler",modelProperties:{fateAssembler:{serializedName:"fate-assembler",required:!0,type:{name:"String"}}}}},Sl={type:{name:"Composite",className:"ValidateByteCodeInput",modelProperties:{bytecode:{serializedName:"bytecode",required:!0,type:{name:"String"}},source:{serializedName:"source",required:!0,type:{name:"String"}},options:{serializedName:"options",type:{name:"Composite",className:"CompileOpts"}}}}},bl={type:{name:"Composite",className:"CompilerVersion",modelProperties:{version:{serializedName:"version",required:!0,type:{name:"String"}}}}},xl={type:{name:"Composite",className:"ApiVersion",modelProperties:{apiVersion:{serializedName:"api-version",required:!0,type:{name:"String"}}}}},Tl={type:{name:"Composite",className:"SophiaBinaryData",modelProperties:{sophiaType:{serializedName:"sophia-type",required:!0,type:{name:"String"}},data:{serializedName:"data",required:!0,type:{name:"String"}}}}},zl={type:{name:"Composite",className:"SophiaJsonData",modelProperties:{data:{serializedName:"data",required:!0,type:{name:"Dictionary",value:{type:{name:"any"}}}}}}},_l={parameterPath:["options","contentType"],mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Content-Type",type:{name:"String"}}},Al={parameterPath:"body",mapper:il},ql={parameterPath:"accept",mapper:{defaultValue:"application/json",isConstant:!0,serializedName:"Accept",type:{name:"String"}}},Pl={parameterPath:"$host",mapper:{serializedName:"$host",required:!0,type:{name:"String"}},skipEncoding:!0},El={parameterPath:"body",mapper:dl},Il={parameterPath:"body",mapper:pl},kl={parameterPath:"body",mapper:hl},Ol={parameterPath:"body",mapper:yl},Ml={parameterPath:"body",mapper:Nl},Bl={parameterPath:"body",mapper:vl},Rl={parameterPath:"body",mapper:Sl};class jl extends ga.ServiceClient{constructor(e,t){var n,r;if(void 0===e)throw new Error("'$host' cannot be null");t||(t={});const a="azsdk-js-compiler/1.0.0-beta.1",i=t.userAgentOptions&&t.userAgentOptions.userAgentPrefix?`${t.userAgentOptions.userAgentPrefix} ${a}`:`${a}`;super({requestContentType:"application/json; charset=utf-8",...t,userAgentOptions:{userAgentPrefix:i},endpoint:null!==(n=null!==(r=t.endpoint)&&void 0!==r?r:t.baseUri)&&void 0!==n?n:"{$host}"}),this.$host=e}generateACI(e,t){return this.sendOperationRequest({body:e,options:t},Fl)}compileContract(e,t){return this.sendOperationRequest({body:e,options:t},$l)}decodeCallResult(e,t){return this.sendOperationRequest({body:e,options:t},Ul)}decodeCallResultBytecode(e,t){return this.sendOperationRequest({body:e,options:t},Vl)}encodeCalldata(e,t){return this.sendOperationRequest({body:e,options:t},Hl)}decodeCalldataBytecode(e,t){return this.sendOperationRequest({body:e,options:t},Ll)}decodeCalldataSource(e,t){return this.sendOperationRequest({body:e,options:t},Gl)}getFateAssemblerCode(e,t){return this.sendOperationRequest({body:e,options:t},Wl)}validateByteCode(e,t){return this.sendOperationRequest({body:e,options:t},Kl)}getCompilerVersion(e,t){return this.sendOperationRequest({body:e,options:t},Ql)}version(e){return this.sendOperationRequest({options:e},Jl)}apiVersion(e){return this.sendOperationRequest({options:e},Yl)}api(e){return this.sendOperationRequest({options:e},Xl)}}const Dl=ga.createSerializer(o,!1),Fl={path:"/aci",httpMethod:"POST",responses:{200:{bodyMapper:sl},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Al,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},$l={path:"/compile",httpMethod:"POST",responses:{200:{bodyMapper:ll},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Al,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Ul={path:"/decode-call-result",httpMethod:"POST",responses:{200:{bodyMapper:{type:{name:"any"}}},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:El,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Vl={path:"/decode-call-result/bytecode",httpMethod:"POST",responses:{200:{bodyMapper:ml},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Il,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Hl={path:"/encode-calldata",httpMethod:"POST",responses:{200:{bodyMapper:fl},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:kl,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Ll={path:"/decode-calldata/bytecode",httpMethod:"POST",responses:{200:{bodyMapper:gl},400:{bodyMapper:wl,isError:!0}},requestBody:Ol,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Gl={path:"/decode-calldata/source",httpMethod:"POST",responses:{200:{bodyMapper:gl},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Ml,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Wl={path:"/fate-assembler",httpMethod:"POST",responses:{200:{bodyMapper:Cl},400:{bodyMapper:wl,isError:!0}},requestBody:Bl,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Kl={path:"/validate-byte-code",httpMethod:"POST",responses:{200:{},400:{bodyMapper:{type:{name:"Sequence",element:{type:{name:"Composite",className:"CompilerError"}}}},isError:!0}},requestBody:Rl,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Ql={path:"/compiler-version",httpMethod:"POST",responses:{200:{bodyMapper:bl},400:{bodyMapper:wl,isError:!0}},requestBody:Bl,urlParameters:[Pl],headerParameters:[_l,ql],mediaType:"json",serializer:Dl},Jl={path:"/version",httpMethod:"GET",responses:{200:{bodyMapper:bl},500:{bodyMapper:wl,isError:!0}},urlParameters:[Pl],headerParameters:[ql],serializer:Dl},Yl={path:"/api-version",httpMethod:"GET",responses:{200:{bodyMapper:xl},500:{bodyMapper:wl,isError:!0}},urlParameters:[Pl],headerParameters:[ql],serializer:Dl},Xl={path:"/api",httpMethod:"GET",responses:{200:{bodyMapper:{type:{name:"Dictionary",value:{type:{name:"any"}}}}},400:{bodyMapper:wl,isError:!0}},urlParameters:[Pl],headerParameters:[ql],serializer:Dl};class Zl extends al{constructor(e){let{ignoreVersion:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(),this.api=new jl(e,{allowInsecureConnection:!0,additionalPolicies:[ha((e=>{let t="";return"reason"in e&&(t+=` ${e.reason}${null!=e.parameter?` in ${e.parameter}`:""}${null!=e.info?` (${JSON.stringify(e.info)})`:""}`),Array.isArray(e)&&(t+=`\n${e.map((e=>`${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${null!=e.context?` (${e.context})`:""}`)).join("\n")}`),t}))]}),!0!==t){const e=this.api.apiVersion().then((e=>{let{apiVersion:t}=e;return t}),(e=>e));this.api.pipeline.addPolicy(fa("compiler","/api-version",e,"7.1.1","8.0.0"))}}async compileBySourceCode(e,t){try{return await this.api.compileContract({code:e,options:{fileSystem:t}})}catch(e){if(e instanceof $e.RestError&&400===e.statusCode)throw new f(e.message.replace(/^aci error:/,"compile error:"));throw e}}async compile(e){throw new O("File system access, use CompilerHttpNode instead")}async validateBySourceCode(e,t,n){try{return await this.api.validateByteCode({bytecode:e,source:t,options:{fileSystem:n}}),!0}catch{return!1}}async validate(e,t){throw new O("File system access, use CompilerHttpNode instead")}async version(){return(await this.api.version()).version}}function ed(e){return e.replace(/_./g,(e=>e[1].toUpperCase()))}var td=N(8079);const nd=1e4,rd=15e3;function ad(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const[a,...i]=n;e._eventEmitter.emit(a,...i)}function id(e,t){if(null==t)throw new X;e._fsm=t,null!=t?.handler?.enter&&t.handler.enter(e),ld(e)}function od(e,t){t!==e._status&&(e._status=t,ad(e,"statusChanged",t))}function sd(e,t){e._state=t,ad(e,"stateChanged",t)}function cd(e,t){e._options.debug&&console.log("Send message: ",t),e._websocket.send(Ku.stringify({jsonrpc:"2.0",...t}))}function ud(e,t){cd(e,{method:t,params:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}})}async function ld(e){if(e._isActionQueueLocked)return;const t=e._actionQueue;if(0===t.length)return;const n=t.findIndex((t=>t.guard(e,e._fsm)));if(-1===n)return;e._actionQueue=t.filter(((e,t)=>n!==t)),e._isActionQueueLocked=!0;const r=await t[n].action(e,e._fsm);e._isActionQueueLocked=!1,id(e,r)}async function dd(e,t){const{handler:n,state:r}=e._fsm,a=await Promise.resolve(n(e,t,r));if(id(e,a),"OffChainNewContract"===t?.params?.data?.updates?.[0]?.op&&"channelOpen"===a?.handler.name){const n=e.round();if(null==n)throw new R("Round is null");const r=t?.params?.data?.updates?.[0]?.owner;ad(e,"newContract",Nt(r,n+1))}}function pd(e){e._websocket.close(),clearTimeout(e._pingTimeoutId)}function md(e){clearTimeout(e._pingTimeoutId),e._pingTimeoutId=setTimeout((()=>{ud(e,"channels.system",{action:"ping"}),e._pingTimeoutId=setTimeout((()=>{pd(e),ad(e,"error",new Q)}),rd)}),nd)}async function hd(e,t,n){return new Promise(((r,a)=>{const i=e._nextRpcMessageId;e._nextRpcMessageId+=1,e._rpcCallbacks.set(i,(e=>{if(null!=e.error){var t;const n=null!==(t=e.error.data[0].message)&&void 0!==t?t:"";a(new W(e.error.message+n))}else r(e.result)})),cd(e,{method:t,id:i,params:n})}))}async function fd(e,t,n,r){var a;let i;if(null!=n.tx)i=await r(n.tx);else{if(null==n.signed_tx)throw new h("Can't find transaction in message");i=await async function(e,t){const{signatures:n,encodedTx:r}=sa(e,Vt.SignedTx),a=ia(r),i=await t(a);if("string"==typeof i){const{signatures:e}=sa(i,Vt.SignedTx);return ia({tag:Vt.SignedTx,signatures:n.concat(e),encodedTx:dt(a)})}return i}(n.signed_tx,r)}const o="string"!=typeof i,s=null!=n.tx?"tx":"signed_tx";return ud(e,t,o?{error:null!==(a=i)&&void 0!==a?a:1}:{[s]:i}),o}function yd(e,t,n){return n?.reject?.(Object.assign(new J(`Unexpected message received:\n\n${JSON.stringify(t)}`),{wsMessage:t})),{handler:bd}}function gd(e,t,n,r){if(null!=r&&"channels.update"===t.method)return r(e,t,n);if("channels.conflict"===t.method)return n.resolve({accepted:!1,errorCode:t.params.data.error_code,errorMessage:t.params.data.error_msg}),{handler:bd};if("channels.info"===t.method&&"aborted_update"===t.params.data.event)return n.resolve({accepted:!1}),{handler:bd};if(null!=t.error){const e=t.error.data.map((e=>e.code));return e.includes(1001)?n.reject(new z("Insufficient balance")):e.includes(1002)?n.reject(new x("Amount cannot be negative")):n.reject(new K(t.error.message)),{handler:bd}}return yd(0,t,n)}function wd(e,t){if("channels.info"===t.method){const n=t.params.data.event;let r=null;return"channel_accept"===n&&(r="accepted"),"funding_created"===n&&(r="halfSigned"),null!=r?(od(e,r),{handler:vd}):"channel_reestablished"===t.params.data.event?{handler:Sd}:"fsm_up"===t.params.data.event?(e._fsmId=t.params.data.fsm_id,{handler:wd}):{handler:wd}}if("channels.error"===t.method)return ad(e,"error",new K(t?.payload?.message)),{handler:_d}}async function Nd(e,t,n){if("channels.info"===t.method&&"fsm_up"===t.params.data.event){e._fsmId=t.params.data.fsm_id;const{signedTx:n}=await e.state();return sd(e,null==n?"":ia(n)),{handler:bd}}return yd(0,t,n)}async function vd(e,t){const n="initiator"===e._options.role?"initiator_sign":"responder_sign";if(t.method===`channels.sign.${n}`)return await fd(e,`channels.${n}`,t.params.data,(async t=>e._options.sign(n,t))),{handler:Cd}}function Cd(e,t){if("channels.on_chain_tx"===t.method){const{info:n}=t.params.data,{role:r}=e._options;if("funding_signed"===n&&"initiator"===r||"funding_created"===n&&"responder"===r)return{handler:function t(n,r){if("channels.info"===r.method)switch(r.params.data.event){case"funding_created":case"own_funding_locked":return{handler:t};case"funding_locked":return{handler:Sd}}if("channels.on_chain_tx"===r.method)return ad(e,"onChainTx",r.params.data.tx,{info:r.params.data.info,type:r.params.data.type}),{handler:t}}}}if("channels.info"===t.method&&"funding_signed"===t.params.data.event&&"initiator"===e._options.role)return e._channelId=t.params.channel_id,od(e,"signed"),{handler:Cd}}function Sd(e,t){if("channels.info"===t.method&&"open"===t.params.data.event)return e._channelId=t.params.channel_id,{handler(t,n){if("channels.update"===n.method)return sd(e,n.params.data.state),{handler:bd}}}}async function bd(e,t,n){switch(t.method){case"channels.info":switch(t.params.data.event){case"update":case"withdraw_created":case"deposit_created":return{handler:xd};case"own_withdraw_locked":case"withdraw_locked":case"own_deposit_locked":case"deposit_locked":case"peer_disconnected":case"channel_reestablished":case"open":return ad(e,ed(t.params.data.event)),{handler:bd};case"fsm_up":return e._fsmId=t.params.data.fsm_id,{handler:bd};case"timeout":case"close_mutual":case"shutdown":return{handler:bd};case"closing":return od(e,"closing"),{handler:bd};case"closed_confirmed":return od(e,"closed"),{handler:_d};case"died":return od(e,"died"),{handler:_d}}break;case"channels.on_chain_tx":return ad(e,"onChainTx",t.params.data.tx,{info:t.params.data.info,type:t.params.data.type}),{handler:bd};case"channels.leave":return{handler:bd};case"channels.update":return sd(e,t.params.data.state),{handler:bd};case"channels.sign.shutdown_sign_ack":return xd(e,t,n)}}async function xd(e,t,n){var r;const[,a]=null!==(r=t.method.match(/^channels\.sign\.([^.]+)$/))&&void 0!==r?r:[];return null==a?yd(0,t,n):await fd(e,`channels.${a}`,t.params.data,(async n=>e._options.sign(a,n,{updates:t.params.data.updates})))?{handler:function e(t,r){return null!=r.error?{handler:e,state:n}:"channels.conflict"===r.method?{handler:bd}:yd(0,r,n)},state:n}:{handler:bd}}async function Td(e,t,n){return"channels.sign.shutdown_sign"!==t.method?yd(0,t,n):(await fd(e,"channels.shutdown_sign",t.params.data,(async e=>n.sign(e))),{handler(e,t){return"channels.on_chain_tx"!==t.method?yd(0,t,n):{handler:_d,state:n}},state:n})}function zd(e,t,n){return"channels.leave"===t.method?(n.resolve({channelId:t.params.channel_id,signedTx:t.params.data.state}),pd(e),{handler:_d}):"channels.error"===t.method?(n.reject(new K(t.data.message)),{handler:bd}):yd(0,t,n)}function _d(e,t,n){return null==n?{handler:_d}:"closing"===t.params.data.event?{handler:_d,state:n}:"channel_closed"===t.params.data.info?(n.closeTx=t.params.data.tx,{handler:_d,state:n}):"closed_confirmed"===t.params.data.event?(n.resolve(n.closeTx),{handler:_d}):{handler:_d,state:n}}bd.enter=e=>{od(e,"open")};var Ad=N(3735);class qd{constructor(){eu(this,"_eventEmitter",new Ad.EventEmitter),eu(this,"_nextRpcMessageId",0),eu(this,"_rpcCallbacks",new Map),eu(this,"_messageQueue",[]),eu(this,"_isMessageQueueLocked",!1),eu(this,"_actionQueue",[]),eu(this,"_isActionQueueLocked",!1),eu(this,"_status","disconnected"),eu(this,"_state","")}static async initialize(e){return qd._initialize(new qd,e)}static async _initialize(e,t){return await async function(e,t,n,r){let{url:a,...i}=r;e._options={url:a,...i},e._fsm={handler:t};const o=new URL(a);Object.entries(i).filter((e=>{let[t]=e;return!["sign","debug"].includes(t)})).forEach((e=>{let[t,n]=e;return o.searchParams.set(t.replace(/[A-Z]/g,(e=>`_${e.toLowerCase()}`)),n.toString())})),o.searchParams.set("protocol","json-rpc"),od(e,"connecting"),e._websocket=new td.w3cwebsocket(o.toString()),await new Promise(((t,r)=>{Object.assign(e._websocket,{onerror:r,onopen:async()=>{if(t(),od(e,"connected"),null!=i.reconnectTx){id(e,{handler:n});const{signedTx:t}=await e.state();if(null==t)throw new h("`signedTx` missed in state while reconnection");sd(e,ia(t))}md(e)},onclose:()=>{od(e,"disconnected"),clearTimeout(e._pingTimeoutId)},onmessage:t=>{let{data:n}=t;return function(e,t){const n=Ku.parse(t);if(e._options.debug&&console.log("Receive message: ",n),null==n.id)"channels.message"!==n.method?"channels.system.pong"!==n.method?(e._messageQueue.push(n),async function(e){if(!e._isMessageQueueLocked){for(e._isMessageQueueLocked=!0;e._messageQueue.length>0;){const t=e._messageQueue.shift();if(null==t)throw new R;try{await dd(e,t)}catch(n){ad(e,"error",new Y(n,t))}}e._isMessageQueueLocked=!1}}(e)):n.params.channel_id!==e._channelId&&null!=e._channelId||md(e):ad(e,"message",n.params.data.message);else{const t=e._rpcCallbacks.get(n.id);if(null==t)return void ad(e,"error",new h(`Can't find callback by id: ${n.id}`));try{t(n)}finally{e._rpcCallbacks.delete(n.id)}}}(e,n)}})}))}(e,null!=t.existingFsmId?Nd:wd,bd,t),e}on(e,t){this._eventEmitter.on(e,t)}off(e,t){this._eventEmitter.removeListener(e,t)}disconnect(){return pd(this)}status(){return this._status}async state(){const e=(t=await hd(this,"channels.get.offchain_state",{}),Object.entries(t).reduce(((e,t)=>{let[n,r]=t;return{...e,[ed(n)]:r}}),{}));var t;return{calls:sa(e.calls,Vt.CallsMtree),...""!==e.halfSignedTx&&{halfSignedTx:sa(e.halfSignedTx,Vt.SignedTx)},...""!==e.signedTx&&{signedTx:sa(e.signedTx,Vt.SignedTx)},trees:sa(e.trees,Vt.StateTrees)}}round(){if(""===this._state)return null;const e=sa(this._state,Vt.SignedTx).encodedTx;switch(e.tag){case Vt.ChannelCreateTx:return 1;case Vt.ChannelOffChainTx:case Vt.ChannelWithdrawTx:case Vt.ChannelDepositTx:return e.round;default:return null}}id(){if(null==this._channelId)throw new h("Channel is not initialized");return this._channelId}fsmId(){if(null==this._fsmId)throw new h("Channel is not initialized");return this._fsmId}async enqueueAction(e){return async function(e,t,n){const r=new Promise(((r,a)=>{e._actionQueue.push({guard:t,action(){const e=n();return{...e,state:{...e.state,resolve:r,reject:a}}}})}));return ld(e),r}(this,((e,t)=>t?.handler===bd),e)}async leave(){return this.enqueueAction((()=>(ud(this,"channels.leave"),{handler:zd})))}async shutdown(e){return this.enqueueAction((()=>(ud(this,"channels.shutdown"),{handler:Td,state:{sign:e}})))}static async reconnect(e,t){const{sign:n}=e;return qd.initialize({...e,reconnectTx:await n("reconnect",ia({...t,tag:Vt.ChannelClientReconnectTx}))})}}class Pd extends qd{async update(e,t,n,r){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.enqueueAction((()=>{ud(this,"channels.update.new",{from:e,to:t,amount:n,meta:a});const i=async(e,t,n)=>"channels.sign.update"===t.method?await fd(this,"channels.update",t.params.data,(async e=>r(e,{updates:t.params.data.updates})))?{handler:i,state:n}:{handler:(e,t)=>gd(this,t,n,(()=>(sd(this,t.params.data.state),n.resolve({accepted:!0,signedTx:t.params.data.state}),{handler:bd}))),state:n}:"channels.error"===t.method?(n.reject(new K(t.data.message)),{handler:bd}):gd(this,t,n);return{handler:i}}))}async poi(e){let{accounts:t,contracts:n}=e;return sa((await hd(this,"channels.get.poi",{accounts:t,contracts:n})).poi,Vt.TreesPoi)}async balances(e){return Object.fromEntries((await hd(this,"channels.get.balances",{accounts:e})).map((e=>[e.account,e.balance])))}async awaitingActionTx(e,t,n){if(t.method!==`channels.sign.${e}_tx`)return yd(0,t,n);const r=(t,a)=>{if("channels.on_chain_tx"===a.method)return n.onOnChainTx?.(a.params.data.tx),{handler:r,state:n};if("channels.info"===a.method&&[`own_${e}_locked`,`${e}_locked`].includes(a.params.data.event)){const t="deposit"===e?"Deposit":"Withdraw",i=a.params.data.event.startsWith("own_");return n[`on${i?"Own":""}${t}Locked`]?.(),{handler:r,state:n}}return gd(this,a,n,(()=>(sd(this,a.params.data.state),n.resolve({accepted:!0,signedTx:a.params.data.state}),{handler:bd})))},{sign:a}=n;return await fd(this,`channels.${e}_tx`,t.params.data,(async e=>a(e,{updates:t.params.data.updates}))),{handler:r,state:n}}async withdraw(e,t){let{onOnChainTx:n,onOwnWithdrawLocked:r,onWithdrawLocked:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(ud(this,"channels.withdraw",{amount:e}),{handler:async(e,t,n)=>this.awaitingActionTx("withdraw",t,n),state:{sign:t,onOnChainTx:n,onOwnWithdrawLocked:r,onWithdrawLocked:a}})))}async deposit(e,t){let{onOnChainTx:n,onOwnDepositLocked:r,onDepositLocked:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(ud(this,"channels.deposit",{amount:e}),{handler:async(e,t,n)=>this.awaitingActionTx("deposit",t,n),state:{sign:t,onOnChainTx:n,onOwnDepositLocked:r,onDepositLocked:a}})))}async sendMessage(e,t){const n="object"==typeof e?JSON.stringify(e):e;"connecting"===this.status()&&(await new Promise((e=>{const t=n=>{"connecting"!==n&&(e(),this.off("statusChanged",t))};this.on("statusChanged",t)})),await Ve(500)),ud(this,"channels.message",{info:n,to:t})}}function Ed(e){return Object.entries(e).reduce(((e,t)=>{let[n,r]=t;return{...e,[ed(n)]:r}}),{})}class Id extends Pd{static async initialize(e){return qd._initialize(new Id,e)}async createContract(e,t){let{code:n,callData:r,deposit:a,vmVersion:i,abiVersion:o}=e;return this.enqueueAction((()=>(ud(this,"channels.update.new_contract",{code:n,call_data:r,deposit:a,vm_version:i,abi_version:o}),{handler:async(e,t,n)=>"channels.sign.update"!==t.method?yd(0,t,n):(await fd(this,"channels.update",t.params.data,(async e=>n.sign(e))),{handler:(e,t,n)=>gd(this,t,n,(()=>{const e=sa(t.params.data.state,Vt.SignedTx).encodedTx;if(e.tag!==Vt.ChannelOffChainTx)throw new h(`Tag should be ${Vt[Vt.ChannelOffChainTx]}, got ${Vt[e.tag]} instead`);const r="initiator"===this._options.role?"initiatorId":"responderId",a=this._options[r];sd(this,t.params.data.state);const i=Nt(a,e.round);return ad(this,"newContract",i),n.resolve({accepted:!0,address:i,signedTx:t.params.data.state}),{handler:bd}})),state:n}),state:{sign:t}})))}async callContract(e,t){let{amount:n,callData:r,contract:a,abiVersion:i}=e;return this.enqueueAction((()=>(ud(this,"channels.update.call_contract",{amount:n,call_data:r,contract_id:a,abi_version:i}),{handler:async(e,t,n)=>"channels.sign.update"!==t.method?yd(0,t,n):(await fd(this,"channels.update",t.params.data,(async e=>n.sign(e,{updates:t.params.data.updates}))),{handler:(e,t,n)=>gd(this,t,n,(()=>(sd(this,t.params.data.state),n.resolve({accepted:!0,signedTx:t.params.data.state}),{handler:bd}))),state:n}),state:{sign:t}})))}async forceProgress(e,t){let{amount:n,callData:r,contract:a,abiVersion:i,gasLimit:o=1e6,gasPrice:s=kt}=e,{onOnChainTx:c}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.enqueueAction((()=>(ud(this,"channels.force_progress",{amount:n,call_data:r,contract_id:a,abi_version:i,gas_price:s,gas:o}),{handler:async(e,t,n)=>"channels.sign.force_progress_tx"!==t.method?yd(0,t,n):(await fd(this,"channels.force_progress_sign",t.params.data,(async e=>n.sign(e,{updates:t.params.data.updates}))),{handler:(e,t,n)=>("channels.on_chain_tx"===t.method&&(n.onOnChainTx?.(t.params.data.tx),ad(this,"onChainTx",t.params.data.tx,{info:t.params.data.info,type:t.params.data.type}),n.resolve({accepted:!0,tx:t.params.data.tx})),yd(0,t,n)),state:n}),state:{sign:t,onOnChainTx:c}})))}async callContractStatic(e){let{amount:t,callData:n,contract:r,abiVersion:a}=e;return Ed(await hd(this,"channels.dry_run.call_contract",{amount:t,call_data:n,contract_id:r,abi_version:a}))}async getContractCall(e){let{caller:t,contract:n,round:r}=e;return Ed(await hd(this,"channels.get.contract_call",{caller_id:t,contract_id:n,round:r}))}async getContractState(e){const t=await hd(this,"channels.get.contract",{pubkey:e});return Ed({...t,contract:Ed(t.contract)})}async cleanContractCalls(){return this.enqueueAction((()=>(ud(this,"channels.clean_contract_calls"),{handler(e,t,n){return"channels.calls_pruned.reply"===t.method?(n.resolve(),{handler:bd}):(n.reject(new J("Unexpected message received")),{handler:_d})}})))}}var kd=(e,t)=>(e.connect((e=>t.sendMessage(e)),(()=>t.disconnect())),t.connect((t=>e.sendMessage(t)),(()=>e.disconnect())),()=>{e.disconnect(),t.disconnect()});class Od{constructor(e){let{debug:t=!1}=e;this.debug=t}connect(e,t){if(this.isConnected())throw new qe("You already connected")}disconnect(){if(!this.isConnected())throw new Pe("You dont have connection. Please connect before")}receiveMessage(e){this.debug&&console.log("Receive message:",e)}sendMessage(e){this.debug&&console.log("Send message:",e)}}function Md(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}var Bd=new WeakMap,Rd=new WeakMap,jd=new WeakMap;class Dd extends Od{constructor(){let{target:e,self:t=window,origin:n,sendDirection:r,receiveDirection:a=lu.to_aepp,...i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(i),Md(this,Bd,{writable:!0,value:void 0}),Md(this,Rd,{writable:!0,value:void 0}),Md(this,jd,{writable:!0,value:void 0}),On(this,Rd,e),On(this,jd,t),this.origin=n,this.sendDirection=r,this.receiveDirection=a}isConnected(){return null!=this.listener}connect(e,t){super.connect(e,t),this.listener=t=>{var n;if("object"!=typeof t.data||"2.0"!==(null!==(n=t.data.jsonrpc)&&void 0!==n?n:t.data.data?.jsonrpc))return;if(null!=this.origin&&this.origin!==t.origin)return;if(null!=Mn(this,Rd)&&Mn(this,Rd)!==t.source)return;this.receiveMessage(t);let{data:r}=t;if(null!=r.type){if(t.data.type!==this.receiveDirection)return;r=r.data}e(r,t.origin,t.source)},Mn(this,jd).addEventListener("message",this.listener),On(this,Bd,t)}disconnect(){if(super.disconnect(),null==this.listener||null==Mn(this,Bd))throw new B("Expected to not happen, required for TS");Mn(this,jd).removeEventListener("message",this.listener),delete this.listener,Mn(this,Bd).call(this),On(this,Bd,void 0)}sendMessage(e){var t;if(null==Mn(this,Rd))throw new Ee("Can't send messages without target");const n=null!=this.sendDirection?{type:this.sendDirection,data:e}:e;super.sendMessage(n),Mn(this,Rd).postMessage(n,null!==(t=this.origin)&&void 0!==t?t:"*")}}var Fd=(e,t)=>{if(null==window)throw new I("Window object not found, you can run wallet detector only in browser");const n={};return e.connect(((e,r,a)=>{let{method:i,params:o}=e;if(i!==mu.readyToConnect||null!=n[o.id])return;const s={info:o,getConnection(){const e="extension"===o.type;return new Dd({sendDirection:e?lu.to_waellet:void 0,receiveDirection:e?lu.to_aepp:void 0,target:a,origin:e?window.origin:o.origin})}};n[s.info.id]=s,t({wallets:n,newWallet:s})}),(()=>{})),Object.keys(n).length>0&&t({wallets:n}),()=>e.disconnect()};var $d=new WeakMap;class Ud extends Od{constructor(e){let{port:t,...n}=e;var r,a,i;super(n),i={writable:!0,value:void 0},function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(r=this,a=$d),a.set(r,i),this.port=t}disconnect(){if(super.disconnect(),this.port.disconnect(),null==Mn(this,$d))throw new R;this.port.onMessage.removeListener(Mn(this,$d)[0]),this.port.onDisconnect.removeListener(Mn(this,$d)[1]),On(this,$d,void 0)}connect(e,t){super.connect(e,t),On(this,$d,[(t,n)=>{var r;this.receiveMessage(t),e(t,null!==(r=n.sender?.url)&&void 0!==r?r:"",n)},t]),this.port.onMessage.addListener(Mn(this,$d)[0]),this.port.onDisconnect.addListener(Mn(this,$d)[1])}sendMessage(e){super.sendMessage(e),this.port.postMessage(e)}isConnected(){return null!=Mn(this,$d)}}}(),v}()}));
3
3
  //# sourceMappingURL=aepp-sdk.browser.js.map