@aeternity/aepp-sdk 11.0.1 → 12.0.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 (376) hide show
  1. package/LICENSE +1 -1
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +12 -19
  4. package/dist/aepp-sdk.browser-script.js.map +1 -1
  5. package/dist/aepp-sdk.browser.js +1 -1
  6. package/dist/aepp-sdk.browser.js.map +1 -1
  7. package/dist/aepp-sdk.js +1 -1
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/AeSdk.d.ts +37 -0
  10. package/es/AeSdk.mjs +81 -0
  11. package/es/AeSdk.mjs.map +1 -0
  12. package/es/AeSdkAepp.d.ts +69 -0
  13. package/es/AeSdkAepp.mjs +175 -0
  14. package/es/AeSdkAepp.mjs.map +1 -0
  15. package/es/AeSdkBase.d.ts +212 -0
  16. package/es/AeSdkBase.mjs +310 -0
  17. package/es/AeSdkBase.mjs.map +1 -0
  18. package/es/AeSdkWallet.d.ts +103 -0
  19. package/es/AeSdkWallet.mjs +322 -0
  20. package/es/AeSdkWallet.mjs.map +1 -0
  21. package/es/Node.d.ts +44 -0
  22. package/es/Node.mjs +141 -0
  23. package/es/Node.mjs.map +1 -0
  24. package/es/account/Base.d.ts +65 -0
  25. package/es/account/Base.mjs +123 -0
  26. package/es/account/Base.mjs.map +1 -0
  27. package/es/account/Memory.d.ts +25 -0
  28. package/es/account/Memory.mjs +81 -0
  29. package/es/account/Memory.mjs.map +1 -0
  30. package/es/account/Rpc.d.ts +27 -0
  31. package/es/account/Rpc.mjs +79 -0
  32. package/es/account/Rpc.mjs.map +1 -0
  33. package/es/aens.d.ts +209 -0
  34. package/es/aens.mjs +332 -0
  35. package/es/aens.mjs.map +1 -0
  36. package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
  37. package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  39. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  42. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  45. package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
  46. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
  47. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  48. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  51. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  52. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  54. package/es/aepp-wallet-communication/schema.d.ts +90 -46
  55. package/es/aepp-wallet-communication/schema.mjs +214 -0
  56. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  57. package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
  58. package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  60. package/es/apis/compiler/compiler.d.ts +92 -0
  61. package/es/apis/compiler/compiler.mjs +576 -0
  62. package/es/apis/compiler/compiler.mjs.map +1 -0
  63. package/es/apis/compiler/index.d.ts +2 -0
  64. package/es/apis/compiler/index.mjs +3 -0
  65. package/es/apis/compiler/index.mjs.map +1 -0
  66. package/es/apis/compiler/models/index.d.ts +248 -0
  67. package/es/apis/compiler/models/index.mjs +48 -0
  68. package/es/apis/compiler/models/index.mjs.map +1 -0
  69. package/es/apis/compiler/models/mappers.d.ts +23 -0
  70. package/es/apis/compiler/models/mappers.mjs +585 -0
  71. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  72. package/es/apis/compiler/models/parameters.d.ts +13 -0
  73. package/es/apis/compiler/models/parameters.mjs +71 -0
  74. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  75. package/es/apis/node/index.d.ts +2 -0
  76. package/es/apis/node/index.mjs +3 -0
  77. package/es/apis/node/index.mjs.map +1 -0
  78. package/es/apis/node/models/index.d.ts +1061 -0
  79. package/es/apis/node/models/index.mjs +2 -0
  80. package/es/apis/node/models/index.mjs.map +1 -0
  81. package/es/apis/node/models/mappers.d.ts +95 -0
  82. package/es/apis/node/models/mappers.mjs +4164 -0
  83. package/es/apis/node/models/mappers.mjs.map +1 -0
  84. package/es/apis/node/models/parameters.d.ts +17 -0
  85. package/es/apis/node/models/parameters.mjs +165 -0
  86. package/es/apis/node/models/parameters.mjs.map +1 -0
  87. package/es/apis/node/node.d.ts +215 -0
  88. package/es/apis/node/node.mjs +1165 -0
  89. package/es/apis/node/node.mjs.map +1 -0
  90. package/es/chain.d.ts +220 -0
  91. package/es/chain.mjs +524 -0
  92. package/es/chain.mjs.map +1 -0
  93. package/es/channel/handlers.d.ts +34 -0
  94. package/es/channel/handlers.mjs +147 -112
  95. package/es/channel/handlers.mjs.map +1 -1
  96. package/es/channel/index.d.ts +634 -0
  97. package/es/channel/index.mjs +898 -900
  98. package/es/channel/index.mjs.map +1 -1
  99. package/es/channel/internal.d.ts +100 -0
  100. package/es/channel/internal.mjs +97 -51
  101. package/es/channel/internal.mjs.map +1 -1
  102. package/es/contract/Compiler.d.ts +17 -0
  103. package/es/contract/Compiler.mjs +67 -0
  104. package/es/contract/Compiler.mjs.map +1 -0
  105. package/es/contract/aci.d.ts +125 -0
  106. package/es/contract/aci.mjs +199 -180
  107. package/es/contract/aci.mjs.map +1 -1
  108. package/es/contract/ga.d.ts +68 -0
  109. package/es/contract/ga.mjs +190 -0
  110. package/es/contract/ga.mjs.map +1 -0
  111. package/es/contract/methods.d.ts +68 -0
  112. package/es/contract/methods.mjs +101 -0
  113. package/es/contract/methods.mjs.map +1 -0
  114. package/es/index.d.ts +32 -0
  115. package/es/index.mjs +32 -40
  116. package/es/index.mjs.map +1 -1
  117. package/es/oracle.d.ts +154 -0
  118. package/es/oracle.mjs +288 -0
  119. package/es/oracle.mjs.map +1 -0
  120. package/es/spend.d.ts +61 -0
  121. package/es/spend.mjs +122 -0
  122. package/es/spend.mjs.map +1 -0
  123. package/es/tx/builder/constants.d.ts +41 -0
  124. package/es/tx/builder/constants.mjs +11 -19
  125. package/es/tx/builder/constants.mjs.map +1 -1
  126. package/es/tx/builder/field-types.d.ts +62 -0
  127. package/es/tx/builder/field-types.mjs +62 -10
  128. package/es/tx/builder/field-types.mjs.map +1 -1
  129. package/es/tx/builder/helpers.d.ts +131 -0
  130. package/es/tx/builder/helpers.mjs +71 -169
  131. package/es/tx/builder/helpers.mjs.map +1 -1
  132. package/es/tx/builder/index.d.ts +75 -0
  133. package/es/tx/builder/index.mjs +141 -323
  134. package/es/tx/builder/index.mjs.map +1 -1
  135. package/es/tx/builder/schema.d.ts +350 -0
  136. package/es/tx/builder/schema.mjs +173 -510
  137. package/es/tx/builder/schema.mjs.map +1 -1
  138. package/es/tx/index.d.ts +63 -0
  139. package/es/tx/index.mjs +171 -265
  140. package/es/tx/index.mjs.map +1 -1
  141. package/es/tx/min-fee.d.ts +20 -0
  142. package/es/tx/min-fee.mjs +148 -0
  143. package/es/tx/min-fee.mjs.map +1 -0
  144. package/es/tx/validator.d.ts +19 -0
  145. package/es/tx/validator.mjs +64 -71
  146. package/es/tx/validator.mjs.map +1 -1
  147. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  148. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  149. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  150. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  151. package/es/typings/bip32-path/index.d.mjs +2 -0
  152. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  153. package/es/typings/blakejs/index.d.mjs.map +1 -1
  154. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  155. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  156. package/es/utils/amount-formatter.d.ts +42 -0
  157. package/es/utils/amount-formatter.mjs +28 -41
  158. package/es/utils/amount-formatter.mjs.map +1 -1
  159. package/es/utils/autorest.d.ts +6 -0
  160. package/es/utils/autorest.mjs +97 -0
  161. package/es/utils/autorest.mjs.map +1 -0
  162. package/es/utils/bignumber.d.ts +13 -0
  163. package/es/utils/bignumber.mjs +10 -8
  164. package/es/utils/bignumber.mjs.map +1 -1
  165. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  166. package/es/utils/bytes.mjs +10 -14
  167. package/es/utils/bytes.mjs.map +1 -1
  168. package/es/utils/crypto.d.ts +103 -0
  169. package/es/utils/crypto.mjs +60 -68
  170. package/es/utils/crypto.mjs.map +1 -1
  171. package/es/utils/encoder.d.ts +26 -0
  172. package/es/utils/encoder.mjs +47 -51
  173. package/es/utils/encoder.mjs.map +1 -1
  174. package/es/{errors.d.ts → utils/errors.d.ts} +254 -57
  175. package/es/utils/errors.mjs +318 -125
  176. package/es/utils/errors.mjs.map +1 -1
  177. package/es/utils/hd-wallet.d.ts +34 -0
  178. package/es/utils/hd-wallet.mjs +27 -16
  179. package/es/utils/hd-wallet.mjs.map +1 -1
  180. package/es/utils/json-big.d.ts +5 -0
  181. package/es/utils/json-big.mjs +10 -14
  182. package/es/utils/json-big.mjs.map +1 -1
  183. package/es/utils/keystore.d.ts +51 -0
  184. package/es/utils/keystore.mjs +98 -193
  185. package/es/utils/keystore.mjs.map +1 -1
  186. package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
  187. package/es/utils/mptree.mjs +13 -14
  188. package/es/utils/mptree.mjs.map +1 -1
  189. package/es/utils/other.d.ts +14 -0
  190. package/es/utils/other.mjs +21 -36
  191. package/es/utils/other.mjs.map +1 -1
  192. package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
  193. package/es/utils/semver-satisfies.mjs.map +1 -1
  194. package/es/utils/string.d.ts +24 -0
  195. package/es/utils/string.mjs +8 -10
  196. package/es/utils/string.mjs.map +1 -1
  197. package/package.json +49 -39
  198. package/src/AeSdk.ts +65 -0
  199. package/src/AeSdkAepp.ts +167 -0
  200. package/src/AeSdkBase.ts +320 -0
  201. package/src/AeSdkWallet.ts +332 -0
  202. package/src/Node.ts +167 -0
  203. package/src/account/Base.ts +114 -0
  204. package/src/account/Memory.ts +83 -0
  205. package/src/account/Rpc.ts +67 -0
  206. package/src/aens.ts +391 -0
  207. package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
  208. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
  209. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
  210. package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +16 -17
  211. package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
  212. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  213. package/src/aepp-wallet-communication/schema.ts +181 -0
  214. package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
  215. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  216. package/src/apis/compiler/compiler.ts +585 -0
  217. package/src/apis/compiler/index.ts +2 -0
  218. package/src/apis/compiler/models/index.ts +301 -0
  219. package/src/apis/compiler/models/mappers.ts +583 -0
  220. package/src/apis/compiler/models/parameters.ts +93 -0
  221. package/src/apis/node/code-model-v4.yaml +10046 -0
  222. package/src/apis/node/index.ts +2 -0
  223. package/src/apis/node/models/index.ts +1253 -0
  224. package/src/apis/node/models/mappers.ts +4278 -0
  225. package/src/apis/node/models/parameters.ts +188 -0
  226. package/src/apis/node/node.ts +1299 -0
  227. package/src/chain.ts +444 -0
  228. package/src/channel/{handlers.js → handlers.ts} +220 -128
  229. package/src/channel/index.ts +991 -0
  230. package/src/channel/internal.ts +345 -0
  231. package/src/contract/Compiler.ts +66 -0
  232. package/src/contract/aci.ts +529 -0
  233. package/src/contract/ga.ts +178 -0
  234. package/src/contract/methods.ts +118 -0
  235. package/src/index.ts +51 -0
  236. package/src/oracle.ts +342 -0
  237. package/src/spend.ts +152 -0
  238. package/src/tx/builder/{constants.js → constants.ts} +12 -16
  239. package/src/tx/builder/field-types.ts +111 -0
  240. package/src/tx/builder/helpers.ts +253 -0
  241. package/src/tx/builder/index.ts +394 -0
  242. package/src/tx/builder/schema.ts +771 -0
  243. package/src/tx/index.ts +199 -0
  244. package/src/tx/min-fee.ts +136 -0
  245. package/src/tx/validator.ts +226 -0
  246. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  247. package/src/typings/@aeternity__uuid/index.d.ts +3 -0
  248. package/src/typings/bip32-path/index.d.ts +33 -0
  249. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  250. package/src/utils/amount-formatter.ts +29 -42
  251. package/src/utils/autorest.ts +90 -0
  252. package/src/utils/bignumber.ts +9 -11
  253. package/src/utils/bytes.ts +12 -14
  254. package/src/utils/crypto.ts +217 -0
  255. package/src/utils/encoder.ts +52 -55
  256. package/src/utils/errors.ts +268 -134
  257. package/src/utils/hd-wallet.ts +134 -0
  258. package/src/utils/json-big.ts +26 -0
  259. package/src/utils/keystore.ts +179 -0
  260. package/src/utils/mptree.ts +14 -14
  261. package/src/utils/other.ts +28 -43
  262. package/src/utils/string.ts +8 -10
  263. package/es/account/base.mjs +0 -179
  264. package/es/account/base.mjs.map +0 -1
  265. package/es/account/memory.mjs +0 -99
  266. package/es/account/memory.mjs.map +0 -1
  267. package/es/account/multiple.mjs +0 -179
  268. package/es/account/multiple.mjs.map +0 -1
  269. package/es/ae/aens.mjs +0 -404
  270. package/es/ae/aens.mjs.map +0 -1
  271. package/es/ae/aepp.mjs +0 -45
  272. package/es/ae/aepp.mjs.map +0 -1
  273. package/es/ae/contract.mjs +0 -159
  274. package/es/ae/contract.mjs.map +0 -1
  275. package/es/ae/index.mjs +0 -207
  276. package/es/ae/index.mjs.map +0 -1
  277. package/es/ae/oracle.mjs +0 -339
  278. package/es/ae/oracle.mjs.map +0 -1
  279. package/es/ae/universal.mjs +0 -45
  280. package/es/ae/universal.mjs.map +0 -1
  281. package/es/ae/wallet.mjs +0 -50
  282. package/es/ae/wallet.mjs.map +0 -1
  283. package/es/amount-formatter.d.ts +0 -58
  284. package/es/bignumber.d.ts +0 -18
  285. package/es/chain/index.mjs +0 -272
  286. package/es/chain/index.mjs.map +0 -1
  287. package/es/chain/node.mjs +0 -442
  288. package/es/chain/node.mjs.map +0 -1
  289. package/es/contract/compiler.mjs +0 -115
  290. package/es/contract/compiler.mjs.map +0 -1
  291. package/es/contract/ga/helpers.mjs +0 -30
  292. package/es/contract/ga/helpers.mjs.map +0 -1
  293. package/es/contract/ga/index.mjs +0 -178
  294. package/es/contract/ga/index.mjs.map +0 -1
  295. package/es/crypto-ts.d.ts +0 -9
  296. package/es/encoder.d.ts +0 -26
  297. package/es/node-pool/index.mjs +0 -188
  298. package/es/node-pool/index.mjs.map +0 -1
  299. package/es/node.mjs +0 -133
  300. package/es/node.mjs.map +0 -1
  301. package/es/other.d.ts +0 -31
  302. package/es/string.d.ts +0 -26
  303. package/es/tx/tx-object.mjs +0 -283
  304. package/es/tx/tx-object.mjs.map +0 -1
  305. package/es/tx/tx.mjs +0 -938
  306. package/es/tx/tx.mjs.map +0 -1
  307. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
  308. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
  309. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
  310. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
  311. package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
  312. package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
  313. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
  314. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
  315. package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
  316. package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
  317. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
  318. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
  319. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
  320. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
  321. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
  322. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
  323. package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
  324. package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
  325. package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
  326. package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
  327. package/es/utils/async-init.mjs +0 -64
  328. package/es/utils/async-init.mjs.map +0 -1
  329. package/es/utils/crypto-ts.mjs.map +0 -1
  330. package/es/utils/swagger.mjs +0 -164
  331. package/es/utils/swagger.mjs.map +0 -1
  332. package/src/account/base.js +0 -153
  333. package/src/account/memory.js +0 -83
  334. package/src/account/multiple.js +0 -162
  335. package/src/ae/aens.js +0 -361
  336. package/src/ae/aepp.js +0 -45
  337. package/src/ae/contract.js +0 -148
  338. package/src/ae/index.js +0 -168
  339. package/src/ae/oracle.js +0 -311
  340. package/src/ae/universal.js +0 -47
  341. package/src/ae/wallet.js +0 -50
  342. package/src/chain/index.js +0 -269
  343. package/src/chain/node.js +0 -320
  344. package/src/channel/index.js +0 -903
  345. package/src/channel/internal.js +0 -236
  346. package/src/contract/aci.js +0 -376
  347. package/src/contract/compiler.js +0 -100
  348. package/src/contract/ga/helpers.js +0 -19
  349. package/src/contract/ga/index.js +0 -150
  350. package/src/index.js +0 -89
  351. package/src/node-pool/index.js +0 -172
  352. package/src/node.js +0 -116
  353. package/src/tx/builder/field-types.js +0 -61
  354. package/src/tx/builder/helpers.js +0 -334
  355. package/src/tx/builder/index.js +0 -465
  356. package/src/tx/builder/schema.js +0 -1100
  357. package/src/tx/index.js +0 -301
  358. package/src/tx/tx-object.js +0 -187
  359. package/src/tx/tx.js +0 -631
  360. package/src/tx/validator.js +0 -181
  361. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
  362. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
  363. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  364. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
  365. package/src/utils/aepp-wallet-communication/helpers.js +0 -60
  366. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
  367. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
  368. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
  369. package/src/utils/aepp-wallet-communication/schema.ts +0 -80
  370. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
  371. package/src/utils/async-init.js +0 -45
  372. package/src/utils/crypto.js +0 -219
  373. package/src/utils/hd-wallet.js +0 -100
  374. package/src/utils/json-big.js +0 -26
  375. package/src/utils/keystore.js +0 -219
  376. package/src/utils/swagger.js +0 -156
@@ -0,0 +1,634 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { SignTx, ChannelOptions, ChannelState, ChannelMessage } from './internal';
3
+ import { EncodedData } from '../utils/encoder';
4
+ declare type EventCallback = (...args: any[]) => void;
5
+ interface CallContractOptions {
6
+ amount?: number | BigNumber;
7
+ callData?: string;
8
+ abiVersion?: number;
9
+ contract?: string;
10
+ returnValue?: any;
11
+ gasUsed?: number | BigNumber;
12
+ gasPrice?: number | BigNumber;
13
+ height?: number;
14
+ callerNonce?: number;
15
+ log?: any;
16
+ returnType?: string;
17
+ }
18
+ interface Contract {
19
+ abiVersion: number;
20
+ active: boolean;
21
+ deposit: number | BigNumber;
22
+ id: string;
23
+ ownerId: string;
24
+ referrerIds: string[];
25
+ vmVersion: number;
26
+ }
27
+ /**
28
+ * Channel
29
+ * @example
30
+ * ```js
31
+ * await Channel.initialize({
32
+ * url: 'ws://localhost:3001',
33
+ * role: 'initiator'
34
+ * initiatorId: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
35
+ * responderId: 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E',
36
+ * initiatorAmount: 1e18,
37
+ * responderAmount: 1e18,
38
+ * pushAmount: 0,
39
+ * channelReserve: 0,
40
+ * ttl: 1000,
41
+ * host: 'localhost',
42
+ * port: 3002,
43
+ * lockPeriod: 10,
44
+ * async sign (tag, tx) => await account.signTransaction(tx)
45
+ * })
46
+ * ```
47
+ */
48
+ export default class Channel {
49
+ /**
50
+ * @param options - Channel params
51
+ * @param options.url - Channel url (for example: "ws://localhost:3001")
52
+ * @param options.role - Participant role ("initiator" or "responder")
53
+ * @param options.initiatorId - Initiator's public key
54
+ * @param options.responderId - Responder's public key
55
+ * @param options.pushAmount - Initial deposit in favour of the responder by the initiator
56
+ * @param options.initiatorAmount - Amount of coins the initiator has committed to
57
+ * the channel
58
+ * @param options.responderAmount - Amount of coins the responder has committed to
59
+ * the channel
60
+ * @param options.channelReserve - The minimum amount both peers need to maintain
61
+ * @param options.ttl - Minimum block height to include the channel_create_tx
62
+ * @param options.host - Host of the responder's node
63
+ * @param options.port - The port of the responders node
64
+ * @param options.lockPeriod - Amount of blocks for disputing a solo close
65
+ * @param options.existingChannelId - Existing channel id (required if reestablishing a
66
+ * channel)
67
+ * @param options.offchainTx - Offchain transaction (required if reestablishing
68
+ * a channel)
69
+ * @param options.timeoutIdle - The time waiting for a new event to be initiated
70
+ * (default: 600000)
71
+ * @param options.timeoutFundingCreate - The time waiting for the initiator to produce
72
+ * the create channel transaction after the noise session had been established (default: 120000)
73
+ * @param options.timeoutFundingSign - The time frame the other client has to sign an
74
+ * off-chain update after our client had initiated and signed it. This applies only for double
75
+ * signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc.
76
+ * (default: 120000)
77
+ * @param options.timeoutFundingLock - The time frame the other client has to confirm an
78
+ * on-chain transaction reaching maturity (passing minimum depth) after the local node has
79
+ * detected this. This applies only for double signed on-chain intended updates: channel create
80
+ * transaction, deposit, withdrawal and etc. (default: 360000)
81
+ * @param options.timeoutSign - The time frame the client has to return a signed
82
+ * off-chain update or to decline it. This applies for all off-chain updates (default: 500000)
83
+ * @param options.timeoutAccept - The time frame the other client has to react to an
84
+ * event. This applies for all off-chain updates that are not meant to land on-chain, as well as
85
+ * some special cases: opening a noise connection, mutual closing acknowledgement and
86
+ * reestablishing an existing channel (default: 120000)
87
+ * @param options.timeoutInitialized - the time frame the responder has to accept an
88
+ * incoming noise session. Applicable only for initiator (default: timeout_accept's value)
89
+ * @param options.timeoutAwaitingOpen - The time frame the initiator has to start an
90
+ * outgoing noise session to the responder's node. Applicable only for responder (default:
91
+ * timeout_idle's value)
92
+ * @param options.debug=false - Log websocket communication
93
+ * @param options.sign - Function which verifies and signs transactions
94
+ */
95
+ static initialize(options: ChannelOptions): Promise<Channel>;
96
+ /**
97
+ * Register event listener function
98
+ *
99
+ * Possible events:
100
+ *
101
+ * - "error"
102
+ * - "onChainTx"
103
+ * - "ownWithdrawLocked"
104
+ * - "withdrawLocked"
105
+ * - "ownDepositLocked"
106
+ * - "depositLocked"
107
+ *
108
+ * TODO: the event list looks outdated
109
+ *
110
+ * @param eventName - Event name
111
+ * @param callback - Callback function
112
+ */
113
+ on(eventName: string, callback: EventCallback): void;
114
+ /**
115
+ * Remove event listener function
116
+ * @param eventName - Event name
117
+ * @param callback - Callback function
118
+ */
119
+ off(eventName: string, callback: EventCallback): void;
120
+ /**
121
+ * Close the connection
122
+ */
123
+ disconnect(): void;
124
+ /**
125
+ * Get current status
126
+ *
127
+ */
128
+ status(): string;
129
+ /**
130
+ * Get current state
131
+ */
132
+ state(): Promise<ChannelState>;
133
+ /**
134
+ * Get current round
135
+ *
136
+ * If round cannot be determined (for example when channel has not been opened)
137
+ * it will return `null`.
138
+ *
139
+ */
140
+ round(): number | null;
141
+ /**
142
+ * Get channel id
143
+ *
144
+ */
145
+ id(): string;
146
+ /**
147
+ * Get channel's fsm id
148
+ *
149
+ */
150
+ fsmId(): string;
151
+ /**
152
+ * Trigger a transfer update
153
+ *
154
+ * The transfer update is moving coins from one channel account to another.
155
+ * The update is a change to be applied on top of the latest state.
156
+ *
157
+ * Sender and receiver are the channel parties. Both the initiator and responder
158
+ * can take those roles. Any public key outside of the channel is considered invalid.
159
+ *
160
+ * @param from - Sender's public address
161
+ * @param to - Receiver's public address
162
+ * @param amount - Transaction amount
163
+ * @param sign - Function which verifies and signs offchain transaction
164
+ * @param metadata - Metadata
165
+
166
+ * @example
167
+ * ```js
168
+ * channel.update(
169
+ * 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
170
+ * 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E',
171
+ * 10,
172
+ * async (tx) => await account.signTransaction(tx)
173
+ * ).then(({ accepted, signedTx }) =>
174
+ * if (accepted) {
175
+ * console.log('Update has been accepted')
176
+ * }
177
+ * )
178
+ * ```
179
+ */
180
+ update(from: string, to: string, amount: number | BigNumber, sign: SignTx, metadata?: string[]): Promise<{
181
+ accepted: boolean;
182
+ signedTx?: string;
183
+ errorCode?: number;
184
+ errorMessage?: string;
185
+ }>;
186
+ /**
187
+ * Get proof of inclusion
188
+ *
189
+ * If a certain address of an account or a contract is not found
190
+ * in the state tree - the response is an error.
191
+ *
192
+ * @param addresses - Addresses
193
+ * @param addresses.accounts - List of account addresses to include in poi
194
+ * @param addresses.contracts - List of contract addresses to include in poi
195
+ * @example
196
+ * ```js
197
+ * channel.poi({
198
+ * accounts: [
199
+ * 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
200
+ * 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E'
201
+ * ],
202
+ * contracts: ['ct_2dCUAWYZdrWfACz3a2faJeKVTVrfDYxCQHCqAt5zM15f3u2UfA']
203
+ * }).then(poi => console.log(poi))
204
+ * ```
205
+ */
206
+ poi({ accounts, contracts }: {
207
+ accounts: string[];
208
+ contracts?: string[];
209
+ }): Promise<EncodedData<'pi'>>;
210
+ /**
211
+ * Get balances
212
+ *
213
+ * The accounts paramcontains a list of addresses to fetch balances of.
214
+ * Those can be either account balances or a contract ones, encoded as an account addresses.
215
+ *
216
+ * If a certain account address had not being found in the state tree - it is simply
217
+ * skipped in the response.
218
+ *
219
+ * @param accounts - List of addresses to fetch balances from
220
+ * @example
221
+ * ```js
222
+ * channel.balances([
223
+ * 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
224
+ * 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E'
225
+ * 'ct_2dCUAWYZdrWfACz3a2faJeKVTVrfDYxCQHCqAt5zM15f3u2UfA'
226
+ * ]).then(balances =>
227
+ * console.log(balances['ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH'])
228
+ * )
229
+ * ```
230
+ */
231
+ balances(accounts: Array<EncodedData<'ak'>>): Promise<{
232
+ [key: EncodedData<'ak'>]: string;
233
+ }>;
234
+ /**
235
+ * Leave channel
236
+ *
237
+ * It is possible to leave a channel and then later reestablish the channel
238
+ * off-chain state and continue operation. When a leave method is called,
239
+ * the channel fsm passes it on to the peer fsm, reports the current mutually
240
+ * signed state and then terminates.
241
+ *
242
+ * The channel can be reestablished by instantiating another Channel instance
243
+ * with two extra params: existingChannelId and offchainTx (returned from leave
244
+ * method as channelId and signedTx respectively).
245
+ *
246
+ * @example
247
+ * ```js
248
+ * channel.leave().then(({ channelId, signedTx }) => {
249
+ * console.log(channelId)
250
+ * console.log(signedTx)
251
+ * })
252
+ * ```
253
+ */
254
+ leave(): Promise<{
255
+ channelId: string;
256
+ signedTx: string;
257
+ }>;
258
+ /**
259
+ * Trigger mutual close
260
+ *
261
+ * At any moment after the channel is opened, a closing procedure can be triggered.
262
+ * This can be done by either of the parties. The process is similar to the off-chain updates.
263
+ *
264
+ * @param sign - Function which verifies and signs mutual close transaction
265
+ * @example
266
+ * ```js
267
+ * channel.shutdown(
268
+ * async (tx) => await account.signTransaction(tx)
269
+ * ).then(tx => console.log('on_chain_tx', tx))
270
+ * ```
271
+ */
272
+ shutdown(sign: Function): Promise<string>;
273
+ /**
274
+ * Withdraw coins from the channel
275
+ *
276
+ * After the channel had been opened any of the participants can initiate a withdrawal.
277
+ * The process closely resembles the update. The most notable difference is that the
278
+ * transaction has been co-signed: it is channel_withdraw_tx and after the procedure
279
+ * is finished - it is being posted on-chain.
280
+ *
281
+ * Any of the participants can initiate a withdrawal. The only requirements are:
282
+ *
283
+ * - Channel is already opened
284
+ * - No off-chain update/deposit/withdrawal is currently being performed
285
+ * - Channel is not being closed or in a solo closing state
286
+ * - The withdrawal amount must be equal to or greater than zero, and cannot exceed
287
+ * the available balance on the channel (minus the channel_reserve)
288
+ *
289
+ * After the other party had signed the withdraw transaction, the transaction is posted
290
+ * on-chain and onOnChainTx callback is called with on-chain transaction as first argument.
291
+ * After computing transaction hash it can be tracked on the chain: entering the mempool,
292
+ * block inclusion and a number of confirmations.
293
+ *
294
+ * After the minimum_depth block confirmations onOwnWithdrawLocked callback is called
295
+ * (without any arguments).
296
+ *
297
+ * When the other party had confirmed that the block height needed is reached
298
+ * onWithdrawLocked callback is called (without any arguments).
299
+ *
300
+ * @param amount - Amount of coins to withdraw
301
+ * @param sign - Function which verifies and signs withdraw transaction
302
+ * @param callbacks - Callbacks
303
+ * @param callbacks.onOnChainTx - Called when withdraw transaction has been posted
304
+ * on chain
305
+ * @param callbacks.onOwnWithdrawLocked
306
+ * @param callbacks.onWithdrawLocked
307
+ * @example
308
+ * ```js
309
+ * channel.withdraw(
310
+ * 100,
311
+ * async (tx) => await account.signTransaction(tx),
312
+ * { onOnChainTx: (tx) => console.log('on_chain_tx', tx) }
313
+ * ).then(({ accepted, signedTx }) => {
314
+ * if (accepted) {
315
+ * console.log('Withdrawal has been accepted')
316
+ * } else {
317
+ * console.log('Withdrawal has been rejected')
318
+ * }
319
+ * })
320
+ * ```
321
+ */
322
+ withdraw(amount: number | BigNumber, sign: SignTx, { onOnChainTx, onOwnWithdrawLocked, onWithdrawLocked }?: {
323
+ onOnChainTx?: Function;
324
+ onOwnWithdrawLocked?: Function;
325
+ onWithdrawLocked?: Function;
326
+ }): Promise<{
327
+ accepted: boolean;
328
+ signedTx: string;
329
+ }>;
330
+ /**
331
+ * Deposit coins into the channel
332
+ *
333
+ * After the channel had been opened any of the participants can initiate a deposit.
334
+ * The process closely resembles the update. The most notable difference is that the
335
+ * transaction has been co-signed: it is channel_deposit_tx and after the procedure
336
+ * is finished - it is being posted on-chain.
337
+ *
338
+ * Any of the participants can initiate a deposit. The only requirements are:
339
+ *
340
+ * - Channel is already opened
341
+ * - No off-chain update/deposit/withdrawal is currently being performed
342
+ * - Channel is not being closed or in a solo closing state
343
+ * - The deposit amount must be equal to or greater than zero, and cannot exceed
344
+ * the available balance on the channel (minus the channel_reserve)
345
+ *
346
+ * After the other party had signed the deposit transaction, the transaction is posted
347
+ * on-chain and onOnChainTx callback is called with on-chain transaction as first argument.
348
+ * After computing transaction hash it can be tracked on the chain: entering the mempool,
349
+ * block inclusion and a number of confirmations.
350
+ *
351
+ * After the minimum_depth block confirmations onOwnDepositLocked callback is called
352
+ * (without any arguments).
353
+ *
354
+ * When the other party had confirmed that the block height needed is reached
355
+ * onDepositLocked callback is called (without any arguments).
356
+ *
357
+ * @param amount - Amount of coins to deposit
358
+ * @param sign - Function which verifies and signs deposit transaction
359
+ * @param callbacks - Callbacks
360
+ * @param callbacks.onOnChainTx - Called when deposit transaction has been posted
361
+ * on chain
362
+ * @param callbacks.onOwnDepositLocked
363
+ * @param callbacks.onDepositLocked
364
+ * @example
365
+ * ```js
366
+ * channel.deposit(
367
+ * 100,
368
+ * async (tx) => await account.signTransaction(tx),
369
+ * { onOnChainTx: (tx) => console.log('on_chain_tx', tx) }
370
+ * ).then(({ accepted, state }) => {
371
+ * if (accepted) {
372
+ * console.log('Deposit has been accepted')
373
+ * console.log('The new state is:', state)
374
+ * } else {
375
+ * console.log('Deposit has been rejected')
376
+ * }
377
+ * })
378
+ * ```
379
+ */
380
+ deposit(amount: number | BigNumber, sign: SignTx, { onOnChainTx, onOwnDepositLocked, onDepositLocked }?: {
381
+ onOnChainTx?: Function;
382
+ onOwnDepositLocked?: Function;
383
+ onDepositLocked?: Function;
384
+ }): Promise<{
385
+ accepted: boolean;
386
+ state: ChannelState;
387
+ }>;
388
+ /**
389
+ * Trigger create contract update
390
+ *
391
+ * The create contract update is creating a contract inside the channel's internal state tree.
392
+ * The update is a change to be applied on top of the latest state.
393
+ *
394
+ * That would create a contract with the poster being the owner of it. Poster commits initially
395
+ * a deposit amount of coins to the new contract.
396
+ *
397
+ * @param options - Options
398
+ * @param options.code - Api encoded compiled AEVM byte code
399
+ * @param options.callData - Api encoded compiled AEVM call data for the code
400
+ * @param options.deposit - Initial amount the owner of the contract commits to it
401
+ * @param options.vmVersion - Version of the Virtual Machine
402
+ * @param options.abiVersion - Version of the Application Binary Interface
403
+ * @param sign - Function which verifies and signs create contract transaction
404
+ * @example
405
+ * ```js
406
+ * channel.createContract({
407
+ * code: 'cb_HKtpipK4aCgYb17wZ...',
408
+ * callData: 'cb_1111111111111111...',
409
+ * deposit: 10,
410
+ * vmVersion: 3,
411
+ * abiVersion: 1
412
+ * }).then(({ accepted, signedTx, address }) => {
413
+ * if (accepted) {
414
+ * console.log('New contract has been created')
415
+ * console.log('Contract address:', address)
416
+ * } else {
417
+ * console.log('New contract has been rejected')
418
+ * }
419
+ * })
420
+ * ```
421
+ */
422
+ createContract({ code, callData, deposit, vmVersion, abiVersion }: {
423
+ code: string;
424
+ callData: string;
425
+ deposit: number | BigNumber;
426
+ vmVersion: number;
427
+ abiVersion: number;
428
+ }, sign: SignTx): Promise<{
429
+ accepted: boolean;
430
+ signedTx: string;
431
+ address: string;
432
+ }>;
433
+ /**
434
+ * Trigger call a contract update
435
+ *
436
+ * The call contract update is calling a preexisting contract inside the channel's
437
+ * internal state tree. The update is a change to be applied on top of the latest state.
438
+ *
439
+ * That would call a contract with the poster being the caller of it. Poster commits
440
+ * an amount of coins to the contract.
441
+ *
442
+ * The call would also create a call object inside the channel state tree. It contains
443
+ * the result of the contract call.
444
+ *
445
+ * It is worth mentioning that the gas is not consumed, because this is an off-chain
446
+ * contract call. It would be consumed if it were an on-chain one. This could happen
447
+ * if a call with a similar computation amount is to be forced on-chain.
448
+ *
449
+ * @param options - Options
450
+ * @param options.amount - Amount the caller of the contract commits to it
451
+ * @param options.callData - ABI encoded compiled AEVM call data for the code
452
+ * @param options.contract - Address of the contract to call
453
+ * @param options.abiVersion - Version of the ABI
454
+ * @param sign - Function which verifies and signs contract call transaction
455
+ * @example
456
+ * ```js
457
+ * channel.callContract({
458
+ * contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa',
459
+ * callData: 'cb_1111111111111111...',
460
+ * amount: 0,
461
+ * abiVersion: 1
462
+ * }).then(({ accepted, signedTx }) => {
463
+ * if (accepted) {
464
+ * console.log('Contract called succesfully')
465
+ * } else {
466
+ * console.log('Contract call has been rejected')
467
+ * }
468
+ * })
469
+ * ```
470
+ */
471
+ callContract({ amount, callData, contract, abiVersion }: CallContractOptions, sign: SignTx): Promise<{
472
+ accepted: boolean;
473
+ signedTx: string;
474
+ }>;
475
+ /**
476
+ * Trigger a force progress contract call
477
+ * This call is going on-chain
478
+ * @param options - Options
479
+ * @param options.amount - Amount the caller of the contract commits to it
480
+ * @param options.callData - ABI encoded compiled AEVM call data for the code
481
+ * @param options.contract - Address of the contract to call
482
+ * @param options.abiVersion - Version of the ABI
483
+ * @param options.gasPrice=1000000000]
484
+ * @param options.gasLimit=1000000]
485
+ * @param sign - Function which verifies and signs contract force progress transaction
486
+ * @param callbacks - Callbacks
487
+ * @example
488
+ * ```js
489
+ * channel.forceProgress({
490
+ * contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa',
491
+ * callData: 'cb_1111111111111111...',
492
+ * amount: 0,
493
+ * abiVersion: 1,
494
+ * gasPrice: 1000005554
495
+ * }).then(({ accepted, signedTx }) => {
496
+ * if (accepted) {
497
+ * console.log('Contract force progress call successful')
498
+ * } else {
499
+ * console.log('Contract force progress call has been rejected')
500
+ * }
501
+ * })
502
+ * ```
503
+ */
504
+ forceProgress({ amount, callData, contract, abiVersion, gasLimit, gasPrice }: {
505
+ amount: number;
506
+ callData: string;
507
+ contract: string;
508
+ abiVersion: number;
509
+ gasLimit?: number;
510
+ gasPrice?: number;
511
+ }, sign: SignTx, { onOnChainTx }?: {
512
+ onOnChainTx?: Function;
513
+ }): Promise<{
514
+ accepted: boolean;
515
+ signedTx: string;
516
+ tx: EncodedData<'tx'> | Uint8Array;
517
+ }>;
518
+ /**
519
+ * Call contract using dry-run
520
+ *
521
+ * In order to get the result of a potential contract call, one might need to
522
+ * dry-run a contract call. It takes the exact same arguments as a call would
523
+ * and returns the call object.
524
+ *
525
+ * The call is executed in the channel's state but it does not impact the state
526
+ * whatsoever. It uses as an environment the latest channel's state and the current
527
+ * top of the blockchain as seen by the node.
528
+ *
529
+ * @param options - Options
530
+ * @param options.amount - Amount the caller of the contract commits to it
531
+ * @param options.callData - ABI encoded compiled AEVM call data for the code
532
+ * @param options.contract - Address of the contract to call
533
+ * @param options.abiVersion - Version of the ABI
534
+ * @example
535
+ * ```js
536
+ * channel.callContractStatic({
537
+ * contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa',
538
+ * callData: 'cb_1111111111111111...',
539
+ * amount: 0,
540
+ * abiVersion: 1
541
+ * }).then(({ returnValue, gasUsed }) => {
542
+ * console.log('Returned value:', returnValue)
543
+ * console.log('Gas used:', gasUsed)
544
+ * })
545
+ * ```
546
+ */
547
+ callContractStatic({ amount, callData, contract, abiVersion }: {
548
+ amount: number;
549
+ callData: string;
550
+ contract: string;
551
+ abiVersion: number;
552
+ }): Promise<CallContractOptions>;
553
+ /**
554
+ * Get contract call result
555
+ *
556
+ * The combination of a caller, contract and a round of execution determines the
557
+ * contract call. Providing an incorrect set of those results in an error response.
558
+ *
559
+ * @param options - Options
560
+ * @param options.caller - Address of contract caller
561
+ * @param options.contract - Address of the contract
562
+ * @param options.round - Round when contract was called
563
+ * @example
564
+ * ```js
565
+ * channel.getContractCall({
566
+ * caller: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH',
567
+ * contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa',
568
+ * round: 3
569
+ * }).then(({ returnType, returnValue }) => {
570
+ * if (returnType === 'ok') console.log(returnValue)
571
+ * })
572
+ * ```
573
+ */
574
+ getContractCall({ caller, contract, round }: {
575
+ caller: string;
576
+ contract: string;
577
+ round: number;
578
+ }): Promise<{
579
+ returnType: string;
580
+ returnValue: string;
581
+ gasPrice: number | BigNumber;
582
+ gasUsed: number | BigNumber;
583
+ height: number;
584
+ log: string;
585
+ }>;
586
+ /**
587
+ * Get contract latest state
588
+ *
589
+ * @param contract - Address of the contract
590
+ * @example
591
+ * ```js
592
+ * channel.getContractState(
593
+ * 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa'
594
+ * ).then(({ contract }) => {
595
+ * console.log('deposit:', contract.deposit)
596
+ * })
597
+ * ```
598
+ */
599
+ getContractState(contract: string): Promise<{
600
+ contract: Contract;
601
+ contractState: object;
602
+ }>;
603
+ /**
604
+ * Clean up all locally stored contract calls
605
+ *
606
+ * Contract calls are kept locally in order for the participant to be able to look them up.
607
+ * They consume memory and in order for the participant to free it - one can prune all messages.
608
+ * This cleans up all locally stored contract calls and those will no longer be available for
609
+ * fetching and inspection.
610
+ */
611
+ cleanContractCalls(): Promise<void>;
612
+ /**
613
+ * Send generic message
614
+ *
615
+ * If message is an object it will be serialized into JSON string
616
+ * before sending.
617
+ *
618
+ * If there is ongoing update that has not yet been finished the message
619
+ * will be sent after that update is finalized.
620
+ *
621
+ * @param message - Message
622
+ * @param recipient - Address of the recipient
623
+ * @example
624
+ * ```js
625
+ * channel.sendMessage(
626
+ * 'hello world',
627
+ * 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH'
628
+ * )
629
+ * ```
630
+ */
631
+ sendMessage(message: string | ChannelMessage, recipient: string): void;
632
+ static reconnect(options: ChannelOptions, txParams: any): Promise<Channel>;
633
+ }
634
+ export {};