wapi-client 0.4.3 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/dist/api/auth/auth.enums.d.ts +4 -4
  2. package/dist/api/base-client.d.ts +389 -335
  3. package/dist/api/connection/connection.enums.d.ts +19 -7
  4. package/dist/api/http-client.d.ts +15 -0
  5. package/dist/api/index.d.ts +22 -16
  6. package/dist/api/jsonrpc/jsonrpc.enums.d.ts +53 -25
  7. package/dist/api/ws-client.d.ts +26 -25
  8. package/dist/client.d.ts +1740 -1714
  9. package/dist/db/consts.enums.d.ts +274 -272
  10. package/dist/db/index.d.ts +31 -31
  11. package/dist/db/token/token.enums.d.ts +148 -148
  12. package/dist/db/transfer/transfer.enums.d.ts +236 -236
  13. package/dist/db/transfer-group/transfer-group.enums.d.ts +160 -160
  14. package/dist/db/transfer-log/transfer-log.enums.d.ts +193 -193
  15. package/dist/db/wallet/wallet.enums.d.ts +148 -148
  16. package/dist/db/wallet-token-setting/wallet-token-setting.enums.d.ts +96 -96
  17. package/dist/db/wapi-setting/wapi-setting.enums.d.ts +88 -88
  18. package/dist/fns/aggregate-transfers/aggregate-transfers.d.ts +18 -18
  19. package/dist/fns/aggregate-transfers/aggregate-transfers.enums.d.ts +52 -52
  20. package/dist/fns/aggregate-transfers/aggregate-transfers.guards.d.ts +4 -4
  21. package/dist/fns/create-access-token/create-access-token.d.ts +8 -0
  22. package/dist/fns/create-access-token/create-access-token.enums.d.ts +21 -0
  23. package/dist/fns/create-access-token/create-access-token.guards.d.ts +4 -0
  24. package/dist/fns/create-contract/create-contract.d.ts +8 -8
  25. package/dist/fns/create-contract/create-contract.enums.d.ts +63 -63
  26. package/dist/fns/create-contract/create-contract.guards.d.ts +4 -4
  27. package/dist/fns/create-deposit/create-deposit.d.ts +9 -9
  28. package/dist/fns/create-deposit/create-deposit.enums.d.ts +63 -63
  29. package/dist/fns/create-deposit/create-deposit.guards.d.ts +4 -4
  30. package/dist/fns/create-exchange/create-exchange.d.ts +10 -10
  31. package/dist/fns/create-exchange/create-exchange.enums.d.ts +133 -133
  32. package/dist/fns/create-exchange/create-exchange.guards.d.ts +4 -4
  33. package/dist/fns/create-token/create-token.d.ts +9 -9
  34. package/dist/fns/create-token/create-token.enums.d.ts +46 -46
  35. package/dist/fns/create-token/create-token.guards.d.ts +4 -4
  36. package/dist/fns/create-transfer/create-transfer.d.ts +11 -11
  37. package/dist/fns/create-transfer/create-transfer.enums.d.ts +145 -145
  38. package/dist/fns/create-transfer/create-transfer.guards.d.ts +4 -4
  39. package/dist/fns/create-transfer-group/create-transfer-group.d.ts +12 -12
  40. package/dist/fns/create-transfer-group/create-transfer-group.enums.d.ts +142 -142
  41. package/dist/fns/create-transfer-group/create-transfer-group.guards.d.ts +4 -4
  42. package/dist/fns/create-transfers/create-transfers.d.ts +10 -10
  43. package/dist/fns/create-transfers/create-transfers.enums.d.ts +19 -19
  44. package/dist/fns/create-transfers/create-transfers.guards.d.ts +4 -4
  45. package/dist/fns/create-wallet/create-wallet.d.ts +9 -9
  46. package/dist/fns/create-wallet/create-wallet.enums.d.ts +41 -41
  47. package/dist/fns/create-wallet/create-wallet.guards.d.ts +4 -4
  48. package/dist/fns/create-withdrawal/create-withdrawal.d.ts +10 -10
  49. package/dist/fns/create-withdrawal/create-withdrawal.enums.d.ts +63 -63
  50. package/dist/fns/create-withdrawal/create-withdrawal.guards.d.ts +4 -4
  51. package/dist/fns/find-balances/find-balances.d.ts +17 -17
  52. package/dist/fns/find-balances/find-balances.enums.d.ts +30 -30
  53. package/dist/fns/find-balances/find-balances.guards.d.ts +4 -4
  54. package/dist/fns/find-tokens/find-tokens.d.ts +18 -18
  55. package/dist/fns/find-tokens/find-tokens.enums.d.ts +39 -39
  56. package/dist/fns/find-tokens/find-tokens.guards.d.ts +4 -4
  57. package/dist/fns/find-transfer-groups/find-transfer-groups.d.ts +17 -17
  58. package/dist/fns/find-transfer-groups/find-transfer-groups.enums.d.ts +52 -52
  59. package/dist/fns/find-transfer-groups/find-transfer-groups.guards.d.ts +4 -4
  60. package/dist/fns/find-transfers/find-transfers.d.ts +18 -18
  61. package/dist/fns/find-transfers/find-transfers.enums.d.ts +72 -72
  62. package/dist/fns/find-transfers/find-transfers.guards.d.ts +4 -4
  63. package/dist/fns/find-wallets/find-wallets.d.ts +18 -18
  64. package/dist/fns/find-wallets/find-wallets.enums.d.ts +48 -48
  65. package/dist/fns/find-wallets/find-wallets.guards.d.ts +4 -4
  66. package/dist/fns/fn-consts.enums.d.ts +14 -14
  67. package/dist/fns/get-balance/get-balance.d.ts +9 -9
  68. package/dist/fns/get-balance/get-balance.enums.d.ts +30 -30
  69. package/dist/fns/get-balance/get-balance.guards.d.ts +4 -4
  70. package/dist/fns/get-balance-history/get-balance-history.d.ts +9 -9
  71. package/dist/fns/get-balance-history/get-balance-history.enums.d.ts +29 -29
  72. package/dist/fns/get-balance-history/get-balance-history.guards.d.ts +4 -4
  73. package/dist/fns/get-flags/get-flags.d.ts +9 -9
  74. package/dist/fns/get-flags/get-flags.enums.d.ts +17 -17
  75. package/dist/fns/get-flags/get-flags.guards.d.ts +4 -4
  76. package/dist/fns/get-statistics/get-statistics.d.ts +9 -9
  77. package/dist/fns/get-statistics/get-statistics.enums.d.ts +24 -24
  78. package/dist/fns/get-statistics/get-statistics.guards.d.ts +4 -4
  79. package/dist/fns/get-token/get-token.d.ts +9 -9
  80. package/dist/fns/get-token/get-token.enums.d.ts +21 -21
  81. package/dist/fns/get-token/get-token.guards.d.ts +4 -4
  82. package/dist/fns/get-transfer/get-transfer.d.ts +9 -9
  83. package/dist/fns/get-transfer/get-transfer.enums.d.ts +25 -25
  84. package/dist/fns/get-transfer/get-transfer.guards.d.ts +4 -4
  85. package/dist/fns/get-transfer-group/get-transfer-group.d.ts +9 -9
  86. package/dist/fns/get-transfer-group/get-transfer-group.enums.d.ts +25 -25
  87. package/dist/fns/get-transfer-group/get-transfer-group.guards.d.ts +4 -4
  88. package/dist/fns/get-wallet/get-wallet.d.ts +9 -9
  89. package/dist/fns/get-wallet/get-wallet.enums.d.ts +25 -25
  90. package/dist/fns/get-wallet/get-wallet.guards.d.ts +4 -4
  91. package/dist/fns/import-data/import-data.d.ts +11 -11
  92. package/dist/fns/import-data/import-data.enums.d.ts +230 -230
  93. package/dist/fns/import-data/import-data.guards.d.ts +8 -8
  94. package/dist/fns/import-data/import-data.node.d.ts +11 -11
  95. package/dist/fns/index.d.ts +280 -273
  96. package/dist/fns/reverse-transfer/reverse-transfer.d.ts +10 -10
  97. package/dist/fns/reverse-transfer/reverse-transfer.enums.d.ts +48 -48
  98. package/dist/fns/reverse-transfer/reverse-transfer.guards.d.ts +4 -4
  99. package/dist/fns/reverse-transfer-group/reverse-transfer-group.d.ts +10 -10
  100. package/dist/fns/reverse-transfer-group/reverse-transfer-group.enums.d.ts +64 -64
  101. package/dist/fns/reverse-transfer-group/reverse-transfer-group.guards.d.ts +4 -4
  102. package/dist/fns/reverse-transfers/reverse-transfers.d.ts +16 -16
  103. package/dist/fns/reverse-transfers/reverse-transfers.enums.d.ts +55 -55
  104. package/dist/fns/reverse-transfers/reverse-transfers.guards.d.ts +4 -4
  105. package/dist/fns/set-flags/set-flags.d.ts +10 -10
  106. package/dist/fns/set-flags/set-flags.enums.d.ts +21 -21
  107. package/dist/fns/set-flags/set-flags.guards.d.ts +4 -4
  108. package/dist/fns/update-token/update-token.d.ts +8 -8
  109. package/dist/fns/update-token/update-token.enums.d.ts +43 -43
  110. package/dist/fns/update-token/update-token.guards.d.ts +4 -4
  111. package/dist/fns/update-transfer/update-transfer.d.ts +9 -9
  112. package/dist/fns/update-transfer/update-transfer.enums.d.ts +32 -32
  113. package/dist/fns/update-transfer/update-transfer.guards.d.ts +4 -4
  114. package/dist/fns/update-transfer-group/update-transfer-group.d.ts +9 -9
  115. package/dist/fns/update-transfer-group/update-transfer-group.enums.d.ts +46 -46
  116. package/dist/fns/update-transfer-group/update-transfer-group.guards.d.ts +4 -4
  117. package/dist/fns/update-transfer-groups/update-transfer-groups.d.ts +15 -15
  118. package/dist/fns/update-transfer-groups/update-transfer-groups.enums.d.ts +44 -44
  119. package/dist/fns/update-transfer-groups/update-transfer-groups.guards.d.ts +4 -4
  120. package/dist/fns/update-transfers/update-transfers.d.ts +15 -15
  121. package/dist/fns/update-transfers/update-transfers.enums.d.ts +52 -52
  122. package/dist/fns/update-transfers/update-transfers.guards.d.ts +4 -4
  123. package/dist/fns/update-wallet/update-wallet.d.ts +8 -8
  124. package/dist/fns/update-wallet/update-wallet.enums.d.ts +43 -43
  125. package/dist/fns/update-wallet/update-wallet.guards.d.ts +4 -4
  126. package/dist/index.d.ts +80 -73
  127. package/dist/lib/debug.d.ts +1 -1
  128. package/dist/lib/errors.d.ts +349 -310
  129. package/dist/lib/isomorphic/node/get-random-hex.d.ts +1 -1
  130. package/dist/lib/isomorphic/node/streams.d.ts +28 -29
  131. package/dist/lib/isomorphic/node/ws.d.ts +2 -2
  132. package/dist/lib/query-builder.d.ts +252 -252
  133. package/dist/lib/stream-promise-input.d.ts +33 -33
  134. package/dist/lib/stream-promise.d.ts +40 -40
  135. package/dist/lib/utils.d.ts +48 -48
  136. package/dist/lib/validator.d.ts +269 -253
  137. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.enums.d.ts +64 -64
  138. package/dist/txs/aggregate-transfer-many/aggregate-transfer-many.guards.d.ts +4 -4
  139. package/dist/txs/authentication-check/authentication-check.enums.d.ts +22 -0
  140. package/dist/txs/authentication-check/authentication-check.guards.d.ts +4 -0
  141. package/dist/txs/create-access-token/create-access-token.enums.d.ts +51 -0
  142. package/dist/txs/create-access-token/create-access-token.guards.d.ts +4 -0
  143. package/dist/txs/create-contract/create-contract.enums.d.ts +79 -79
  144. package/dist/txs/create-contract/create-contract.guards.d.ts +4 -4
  145. package/dist/txs/create-deposit/create-deposit.enums.d.ts +19 -19
  146. package/dist/txs/create-deposit/create-deposit.guards.d.ts +4 -4
  147. package/dist/txs/create-distribution/create-distribution.enums.d.ts +107 -104
  148. package/dist/txs/create-distribution/create-distribution.guards.d.ts +4 -4
  149. package/dist/txs/create-token/create-token.enums.d.ts +54 -54
  150. package/dist/txs/create-token/create-token.guards.d.ts +4 -4
  151. package/dist/txs/create-transfer/create-transfer.enums.d.ts +209 -209
  152. package/dist/txs/create-transfer/create-transfer.guards.d.ts +4 -4
  153. package/dist/txs/create-transfer-group/create-transfer-group.enums.d.ts +200 -200
  154. package/dist/txs/create-transfer-group/create-transfer-group.guards.d.ts +4 -4
  155. package/dist/txs/create-transfer-many/create-transfer-many.enums.d.ts +53 -53
  156. package/dist/txs/create-transfer-many/create-transfer-many.guards.d.ts +4 -4
  157. package/dist/txs/create-wallet/create-wallet.enums.d.ts +20 -20
  158. package/dist/txs/create-wallet/create-wallet.guards.d.ts +4 -4
  159. package/dist/txs/create-withdrawal/create-withdrawal.enums.d.ts +19 -19
  160. package/dist/txs/create-withdrawal/create-withdrawal.guards.d.ts +4 -4
  161. package/dist/txs/export-database/export-database.enums.d.ts +20 -0
  162. package/dist/txs/export-database/export-database.guards.d.ts +4 -0
  163. package/dist/txs/find-balance-many/find-balance-many.enums.d.ts +97 -97
  164. package/dist/txs/find-balance-many/find-balance-many.guards.d.ts +4 -4
  165. package/dist/txs/find-token-many/find-token-many.enums.d.ts +81 -81
  166. package/dist/txs/find-token-many/find-token-many.guards.d.ts +4 -4
  167. package/dist/txs/find-transfer-group-many/find-transfer-group-many.enums.d.ts +90 -90
  168. package/dist/txs/find-transfer-group-many/find-transfer-group-many.guards.d.ts +4 -4
  169. package/dist/txs/find-transfer-many/find-transfer-many.enums.d.ts +93 -93
  170. package/dist/txs/find-transfer-many/find-transfer-many.guards.d.ts +4 -4
  171. package/dist/txs/find-wallet-many/find-wallet-many.enums.d.ts +181 -179
  172. package/dist/txs/find-wallet-many/find-wallet-many.guards.d.ts +4 -4
  173. package/dist/txs/finish-transaction/finish-transaction.enums.d.ts +33 -29
  174. package/dist/txs/finish-transaction/finish-transaction.guards.d.ts +4 -4
  175. package/dist/txs/get-balance/get-balance.enums.d.ts +107 -107
  176. package/dist/txs/get-balance/get-balance.guards.d.ts +4 -4
  177. package/dist/txs/get-balance-history/get-balance-history.enums.d.ts +188 -188
  178. package/dist/txs/get-balance-history/get-balance-history.guards.d.ts +4 -4
  179. package/dist/txs/get-database-export-progress/get-database-export-progress.enums.d.ts +26 -0
  180. package/dist/txs/get-database-export-progress/get-database-export-progress.guards.d.ts +4 -0
  181. package/dist/txs/get-database-import-progress/get-database-import-progress.enums.d.ts +21 -0
  182. package/dist/txs/get-database-import-progress/get-database-import-progress.guards.d.ts +4 -0
  183. package/dist/txs/get-flags/get-flags.enums.d.ts +19 -19
  184. package/dist/txs/get-flags/get-flags.guards.d.ts +4 -4
  185. package/dist/txs/get-statistics/get-statistics.enums.d.ts +58 -58
  186. package/dist/txs/get-statistics/get-statistics.guards.d.ts +4 -4
  187. package/dist/txs/get-token/get-token.enums.d.ts +114 -114
  188. package/dist/txs/get-token/get-token.guards.d.ts +4 -4
  189. package/dist/txs/get-token-many/get-token-many.enums.d.ts +36 -36
  190. package/dist/txs/get-token-many/get-token-many.guards.d.ts +4 -4
  191. package/dist/txs/get-transfer/get-transfer.enums.d.ts +283 -283
  192. package/dist/txs/get-transfer/get-transfer.guards.d.ts +4 -4
  193. package/dist/txs/get-transfer-group/get-transfer-group.enums.d.ts +121 -121
  194. package/dist/txs/get-transfer-group/get-transfer-group.guards.d.ts +4 -4
  195. package/dist/txs/get-wallet/get-wallet.enums.d.ts +67 -67
  196. package/dist/txs/get-wallet/get-wallet.guards.d.ts +4 -4
  197. package/dist/txs/get-wallet-many/get-wallet-many.enums.d.ts +36 -36
  198. package/dist/txs/get-wallet-many/get-wallet-many.guards.d.ts +4 -4
  199. package/dist/txs/import-actions/import-actions.enums.d.ts +179 -206
  200. package/dist/txs/import-actions/import-actions.guards.d.ts +8 -8
  201. package/dist/txs/import-database/import-database.enums.d.ts +17 -0
  202. package/dist/txs/import-database/import-database.guards.d.ts +4 -0
  203. package/dist/txs/index.d.ts +301 -259
  204. package/dist/txs/list-database-backups/list-database-backups.enums.d.ts +15 -0
  205. package/dist/txs/list-database-backups/list-database-backups.guards.d.ts +4 -0
  206. package/dist/txs/query/query.enums.d.ts +30 -30
  207. package/dist/txs/query/query.guards.d.ts +4 -4
  208. package/dist/txs/query-logs/query-logs.enums.d.ts +54 -54
  209. package/dist/txs/query-logs/query-logs.guards.d.ts +4 -4
  210. package/dist/txs/reset-database/reset-database.enums.d.ts +34 -34
  211. package/dist/txs/reset-database/reset-database.guards.d.ts +4 -4
  212. package/dist/txs/reverse-transfer/reverse-transfer.enums.d.ts +72 -72
  213. package/dist/txs/reverse-transfer/reverse-transfer.guards.d.ts +4 -4
  214. package/dist/txs/reverse-transfer-group/reverse-transfer-group.enums.d.ts +95 -95
  215. package/dist/txs/reverse-transfer-group/reverse-transfer-group.guards.d.ts +4 -4
  216. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.enums.d.ts +77 -77
  217. package/dist/txs/reverse-transfer-group-many/reverse-transfer-group-many.guards.d.ts +4 -4
  218. package/dist/txs/reverse-transfer-many/reverse-transfer-many.enums.d.ts +58 -58
  219. package/dist/txs/reverse-transfer-many/reverse-transfer-many.guards.d.ts +4 -4
  220. package/dist/txs/set-flags/set-flags.enums.d.ts +24 -24
  221. package/dist/txs/set-flags/set-flags.guards.d.ts +4 -4
  222. package/dist/txs/start-transaction/start-transaction.enums.d.ts +18 -18
  223. package/dist/txs/start-transaction/start-transaction.guards.d.ts +4 -4
  224. package/dist/txs/tx-consts.enums.d.ts +236 -236
  225. package/dist/txs/update-token/update-token.enums.d.ts +51 -51
  226. package/dist/txs/update-token/update-token.guards.d.ts +4 -4
  227. package/dist/txs/update-transfer/update-transfer.enums.d.ts +78 -78
  228. package/dist/txs/update-transfer/update-transfer.guards.d.ts +4 -4
  229. package/dist/txs/update-transfer-group/update-transfer-group.enums.d.ts +91 -91
  230. package/dist/txs/update-transfer-group/update-transfer-group.guards.d.ts +4 -4
  231. package/dist/txs/update-transfer-group-many/update-transfer-group-many.enums.d.ts +40 -40
  232. package/dist/txs/update-transfer-group-many/update-transfer-group-many.guards.d.ts +4 -4
  233. package/dist/txs/update-transfer-many/update-transfer-many.enums.d.ts +36 -36
  234. package/dist/txs/update-transfer-many/update-transfer-many.guards.d.ts +4 -4
  235. package/dist/txs/update-wallet/update-wallet.enums.d.ts +54 -54
  236. package/dist/txs/update-wallet/update-wallet.guards.d.ts +4 -4
  237. package/dist/wapi-client.cjs.development.js +30536 -21458
  238. package/dist/wapi-client.cjs.js +17 -7
  239. package/package.json +9 -5
  240. package/dist/fns/import-data/import-data.web.d.ts +0 -11
  241. package/dist/lib/isomorphic/web/get-random-hex.d.ts +0 -1
  242. package/dist/lib/isomorphic/web/streams.d.ts +0 -26
  243. package/dist/lib/isomorphic/web/ws.d.ts +0 -18
  244. package/dist/wapi-client.cjs.development.js.map +0 -1
  245. package/dist/wapi-client.cjs.production.js +0 -2
  246. package/dist/wapi-client.cjs.production.js.map +0 -1
  247. package/dist/wapi-client.esm.js +0 -21336
  248. package/dist/wapi-client.esm.js.map +0 -1
package/dist/client.d.ts CHANGED
@@ -1,1714 +1,1740 @@
1
- import { WapiConnectionOptions, WsClient } from './api';
2
- import { ClientHooks, ISocketId } from './api/base-client';
3
- import { AggregateQueryBuilder, UpdateQueryBuilder, ReverseQueryBuilder, QueryBuilder } from './lib/query-builder';
4
- import { StreamPromise } from './lib/stream-promise';
5
- import { StreamPromiseInput } from './lib/stream-promise-input';
6
- import { AggregateTransfersFnInput, AggregateTransfersFnOutput, AggregateTransfersFnOptions, AggregateTransfersFnFields, AggregateTransfersFnMetadataFields, AggregateTransfersFnStringFields, AggregateTransfersFnGroupFields, CreateContractFnInput, CreateContractFnOutput, CreateContractFnOptions, CreateDepositFnInput, CreateDepositFnOutput, CreateDepositFnOptions, CreateExchangeFnInput, CreateExchangeFnOutput, CreateExchangeFnOptions, CreateTokenFnInput, CreateTokenFnOutput, CreateTokenFnOptions, CreateTransferFnInput, CreateTransferFnOutput, CreateTransferFnOptions, CreateTransferGroupFnInput, CreateTransferGroupFnOutput, CreateTransferGroupFnOptions, CreateTransfersFnInput, CreateTransfersFnOutput, CreateTransfersFnOptions, CreateWalletFnInput, CreateWalletFnOutput, CreateWalletFnOptions, CreateWithdrawalFnInput, CreateWithdrawalFnOutput, CreateWithdrawalFnOptions, FindBalancesFnInput, FindBalancesFnOutput, FindBalancesFnOptions, FindBalancesFnFields, FindBalancesFnMetadataFields, FindBalancesFnStringFields, FindBalancesFnResultFields, FindTokensFnInput, FindTokensFnOutput, FindTokensFnOptions, FindTokensFnFields, FindTokensFnMetadataFields, FindTokensFnStringFields, FindTokensFnResultFields, FindTransferGroupsFnInput, FindTransferGroupsFnOutput, FindTransferGroupsFnOptions, FindTransferGroupsFnFields, FindTransferGroupsFnMetadataFields, FindTransferGroupsFnStringFields, FindTransferGroupsFnResultFields, FindTransfersFnInput, FindTransfersFnOutput, FindTransfersFnOptions, FindTransfersFnFields, FindTransfersFnMetadataFields, FindTransfersFnStringFields, FindTransfersFnResultFields, FindWalletsFnInput, FindWalletsFnOutput, FindWalletsFnOptions, FindWalletsFnFields, FindWalletsFnMetadataFields, FindWalletsFnStringFields, FindWalletsFnResultFields, GetBalanceFnInput, GetBalanceFnOutput, GetBalanceFnOptions, GetBalanceHistoryFnInput, GetBalanceHistoryFnOutput, GetBalanceHistoryFnOptions, GetFlagsFnInput, GetFlagsFnOutput, GetFlagsFnOptions, GetStatisticsFnInput, GetStatisticsFnOutput, GetStatisticsFnOptions, GetTokenFnInput, GetTokenFnOutput, GetTokenFnOptions, GetTransferFnInput, GetTransferFnOutput, GetTransferFnOptions, GetTransferGroupFnInput, GetTransferGroupFnOutput, GetTransferGroupFnOptions, GetWalletFnInput, GetWalletFnOutput, GetWalletFnOptions, ImportDataFnInput, ImportDataFnOutput, ImportDataFnOptions, ImportDataFnStreamChunk, ReverseTransferFnInput, ReverseTransferFnOutput, ReverseTransferFnOptions, ReverseTransferGroupFnInput, ReverseTransferGroupFnOutput, ReverseTransferGroupFnOptions, ReverseTransfersFnInput, ReverseTransfersFnOutput, ReverseTransfersFnOptions, ReverseTransfersFnFields, ReverseTransfersFnMetadataFields, ReverseTransfersFnStringFields, ReverseTransfersFnModifications, SetFlagsFnInput, SetFlagsFnOutput, SetFlagsFnOptions, UpdateTokenFnInput, UpdateTokenFnOutput, UpdateTokenFnOptions, UpdateTransferFnInput, UpdateTransferFnOutput, UpdateTransferFnOptions, UpdateTransferGroupFnInput, UpdateTransferGroupFnOutput, UpdateTransferGroupFnOptions, UpdateTransferGroupsFnInput, UpdateTransferGroupsFnOutput, UpdateTransferGroupsFnOptions, UpdateTransferGroupsFnFields, UpdateTransferGroupsFnMetadataFields, UpdateTransferGroupsFnStringFields, UpdateTransferGroupsFnResultFields, UpdateTransferGroupsFnUpdateFields, UpdateTransfersFnInput, UpdateTransfersFnOutput, UpdateTransfersFnOptions, UpdateTransfersFnFields, UpdateTransfersFnMetadataFields, UpdateTransfersFnStringFields, UpdateTransfersFnResultFields, UpdateTransfersFnUpdateFields, UpdateWalletFnInput, UpdateWalletFnOutput, UpdateWalletFnOptions } from './fns';
7
- export interface ClientConfig {
8
- token?: number | string;
9
- hooks?: ClientHooks;
10
- }
11
- export declare class Client {
12
- /**
13
- * The BaseClient in use for communication with WAPI Server, manages the actual networking
14
- */
15
- api: WsClient;
16
- /**
17
- * Promise resolving to ID upon connection opening
18
- */
19
- $connect: Promise<ISocketId>;
20
- private config;
21
- /**
22
- * @internal
23
- */
24
- constructor(_apiClient: WsClient, initialConf?: ClientConfig);
25
- /**
26
- * Close connection to WAPI instance
27
- *
28
- * ```javascript
29
- *
30
- * await wapiClient.close();
31
- *
32
- * ```
33
- */
34
- close(): Promise<void>;
35
- /**
36
- * Returns WAPI client verion
37
- *
38
- * ```javascript
39
- *
40
- * wapiClient.version();
41
- *
42
- * ```
43
- */
44
- version(): string;
45
- /**
46
- * Set a hook function
47
- *
48
- * ```javascript
49
- *
50
- * wapiClient.setHook('disconnect', () => {
51
- * console.log('disconnected');
52
- * });
53
- *
54
- * ```
55
- * @param {ClientHooks} hookName
56
- * @param value
57
- */
58
- setHook(hookName: keyof ClientHooks, value: (input?: unknown) => boolean | void): this;
59
- /**
60
- * Overwrite client configuration (default token, hooks)
61
- *
62
- *
63
- * ```javascript
64
- *
65
- * wapiClient.configure({
66
- * token: 'EURO',
67
- * hooks: {
68
- * disconnect: () => {}
69
- * },
70
- * });
71
- *
72
- * ```
73
- * @param {ClientConfig} newConf
74
- */
75
- configure(newConf: Partial<ClientConfig>): this;
76
- /**
77
- * Get current config key value (token)
78
- * ```javascript
79
- *
80
- * const token = wapiClient.getConfig('token');
81
- *
82
- * ```
83
- */
84
- getConfig(key: 'token'): number | string | undefined;
85
- /**
86
- *
87
- * Aggregate Transfers using either a simple filter or queryBuilder
88
- *
89
- *
90
- * ```javascript
91
- *
92
- * const result = await wapiClient.aggregateTransfers()
93
- * .where({
94
- * type: 'deposit',
95
- * from_wallet: 'EUR',
96
- * to_wallet: 'house',
97
- * })
98
- * .whereMetadata('example', 'test')
99
- * .sum('to.amount as amount')
100
- * .count()
101
- * .groupBy(
102
- * 'metadata.even as type',
103
- * 'hour',
104
- * )
105
- * .options({
106
- * tracking_id: 'hello',
107
- * return_all_intervals: {
108
- * start_time: '2021-07-31 11:00:00',
109
- * end_time: '2021-07-31 13:00:00'
110
- * }
111
- * });
112
- *
113
- * expect(result).toEqual({
114
- * rows: [
115
- * {
116
- * amount: 25,
117
- * count: 5,
118
- * type: 'even',
119
- * hour: '2021-07-31 12',
120
- * },
121
- * {
122
- * amount: 30,
123
- * count: 5,
124
- * type: 'odd',
125
- * hour: '2021-07-31 12',
126
- * },
127
- * {
128
- * amount: null,
129
- * count: 0,
130
- * type: null,
131
- * hour: '2021-07-31 11',
132
- * },
133
- * {
134
- * amount: null,
135
- * count: 0,
136
- * type: null,
137
- * hour: '2021-07-31 13',
138
- * },
139
- * ],
140
- * metadata: {
141
- * aggregators: [
142
- * {
143
- * function: 'sum',
144
- * field: 'to.amount',
145
- * alias: 'amount',
146
- * },
147
- * {
148
- * function: 'count',
149
- * alias: 'count',
150
- * },
151
- * ],
152
- * groups: [
153
- * {
154
- * type: 'metadata_field',
155
- * field: 'even',
156
- * alias: 'type',
157
- * },
158
- * {
159
- * alias: 'hour',
160
- * field: 'hour',
161
- * type: 'period',
162
- * },
163
- * ],
164
- * },
165
- * });
166
- *
167
- * ```
168
- *
169
- * @param {AggregateTransfersFnInput} [input]
170
- * @param {AggregateTransfersFnOptions} [options]
171
- * @returns {StreamPromise<AggregateTransfersFnOutput>}
172
- *
173
- */
174
- aggregateTransfers(): AggregateQueryBuilder<AggregateTransfersFnFields, AggregateTransfersFnStringFields, AggregateTransfersFnMetadataFields, AggregateTransfersFnGroupFields, AggregateTransfersFnOutput>;
175
- aggregateTransfers(input: AggregateTransfersFnInput, options?: AggregateTransfersFnOptions): StreamPromise<AggregateTransfersFnOutput>;
176
- /**
177
- *
178
- *
179
- * ```javascript
180
- *
181
- * const result = await wapiClient.createContract({
182
- * foreign: 'MYContract',
183
- * metadata: {
184
- * cool: true,
185
- * },
186
- * value_token: 'EUR',
187
- * value_amount: 100,
188
- * owner: 'oppo',
189
- * buyer: {
190
- * wallet: WALLETS.withEURFunds0.foreign,
191
- * metadata: {
192
- * buying: true,
193
- * },
194
- * amount: 101,
195
- * token: 'EUR',
196
- * },
197
- * });
198
- *
199
- * ```
200
- *
201
- * @param {CreateContractFnInput} input
202
- * @param {CreateContractFnOptions} [options]
203
- * @returns {StreamPromise<CreateContractFnOutput>}
204
- *
205
- */
206
- createContract(input: CreateContractFnInput, options?: CreateContractFnOptions): StreamPromise<CreateContractFnOutput>;
207
- /**
208
- *
209
- * Create a deposit transaction into a wallet, by issuing new tokens to the system.
210
- *
211
- * ```javascript
212
- *
213
- * const result = await wapiClient.createDeposit({
214
- * identifier: 'mycustomId',
215
- * token: 'ForeignForToken',
216
- * wallet: 'ForeignForWallet',
217
- * amount: 10.01,
218
- * metadata: {
219
- * customJsonBlob: true,
220
- * },
221
- * status: 'finished',
222
- * // transfer_group: TransferGroup.identifier, // existing transfer group identifier
223
- * }, {
224
- * tracking_id: 'mylogId',
225
- * // transaction_id: Transaction.identifier, // created transaction identifier
226
- * create_wallet_if_not_exists: true,
227
- * return_balance: true,
228
- * });
229
- *
230
- * expect(result).toEqual({
231
- * transfer: jasmine.objectContaining({
232
- * identifier: 'mycustomId',
233
- * token_foreign: 'ForeignForToken',
234
- * to_wallet_foreign: 'ForeignForWallet',
235
- * amount: 10.01,
236
- * metadata: {
237
- * customJsonBlob: true,
238
- * },
239
- * status: 'finished',
240
- * // ... other fields
241
- * }),
242
- * to_balance: jasmine.objectContaining({
243
- * token_foreign: 'ForeignForToken',
244
- * wallet_foreign: 'ForeignForWallet',
245
- * pending_amount: 0,
246
- * finished_amount: 10.01,
247
- * amount: 10.01,
248
- * // ... other fields
249
- * }),
250
- * });
251
- *
252
- * ```
253
- *
254
- * @param {CreateDepositFnInput} input
255
- * @param {CreateDepositFnOptions} [options]
256
- * @returns {StreamPromise<CreateDepositFnOutput>}
257
- *
258
- */
259
- createDeposit(input: CreateDepositFnInput, options?: CreateDepositFnOptions): StreamPromise<CreateDepositFnOutput>;
260
- /**
261
- *
262
- * Create an exchange transfer group - change one token in certain amount for another token of certain amount
263
- * The transfers are connected and either fail or succeed both
264
- *
265
- * ```javascript
266
- *
267
- * const result = await wapiClient.createExchange({
268
- * identifier: 'exchange',
269
- * from_identifier: 'exchange1',
270
- * from_wallet: WALLETS.withEURFunds0.foreign,
271
- * from_token: 'EUR',
272
- * from_amount: 10,
273
- * to_identifier: 'exchange2',
274
- * to_token: 'USD',
275
- * to_wallet: WALLETS.withUSDFunds0.foreign,
276
- * to_amount: 20,
277
- * status: 'finished',
278
- * metadata: {
279
- * exchangeRate: 2,
280
- * },
281
- * }, {
282
- * tracking_id: 'mylogId',
283
- * // transaction_id: Transaction.identifier, // created transaction identifier
284
- * });
285
- * expect(result).toEqual({
286
- * transfer_group: jasmine.objectContaining({
287
- * identifier: 'exchange',
288
- * status: 'closed',
289
- * transfer_status: 'finished',
290
- * }),
291
- * transfers: [
292
- * jasmine.objectContaining({
293
- * status: 'finished',
294
- * amount: 10,
295
- * from_wallet_id: WALLETS.withEURFunds0.id,
296
- * to_wallet_id: WALLETS.withUSDFunds0.id,
297
- * token_id: TOKENS.EUR.id,
298
- * metadata: {
299
- * exchangeRate: 2,
300
- * },
301
- * identifier: 'exchange1',
302
- * }),
303
- * jasmine.objectContaining({
304
- * status: 'finished',
305
- * amount: 20,
306
- * to_wallet_id: WALLETS.withEURFunds0.id,
307
- * from_wallet_id: WALLETS.withUSDFunds0.id,
308
- * token_id: TOKENS.USD.id,
309
- * metadata: {
310
- * exchangeRate: 2,
311
- * },
312
- * identifier: 'exchange2',
313
- * }),
314
- * ],
315
- * });
316
- *
317
- * ```
318
- *
319
- * @param {CreateExchangeFnInput} input
320
- * @param {CreateExchangeFnOptions} [options]
321
- * @returns {StreamPromise<CreateExchangeFnOutput>}
322
- *
323
- */
324
- createExchange(input: CreateExchangeFnInput, options?: CreateExchangeFnOptions): StreamPromise<CreateExchangeFnOutput>;
325
- /**
326
- *
327
- * Create a new Token in the system which can then be transferred between wallets
328
- *
329
- * ```javascript
330
- *
331
- * const result = await wapiClient.createToken(
332
- * {
333
- * foreign: 'EURO',
334
- * divisor: 10,
335
- * limit: 10,
336
- * public: true,
337
- * metadata: {
338
- * customMetadata: true,
339
- * },
340
- * // belongs_to: 'EURO-wallet'
341
- * },
342
- * {
343
- * tracking_id: 'mylogId',
344
- * // transaction_id: Transaction.identifier, // created transaction identifier
345
- * },
346
- * );
347
- *
348
- * expect(result).toEqual({
349
- * token: jasmine.objectContaining({
350
- * foreign: 'EURO',
351
- * public: true,
352
- * metadata: {
353
- * customMetadata: true,
354
- * },
355
- * }),
356
- * wallet: jasmine.objectContaining({
357
- * default_allow_positive: false,
358
- * default_allow_negative: true,
359
- * foreign: 'EURO',
360
- * metadata: null,
361
- * type: 'token',
362
- * }),
363
- * });
364
- *
365
- * ```
366
- *
367
- * @param {CreateTokenFnInput} input
368
- * @param {CreateTokenFnOptions} [options]
369
- * @returns {StreamPromise<CreateTokenFnOutput>}
370
- *
371
- */
372
- createToken(input: CreateTokenFnInput, options?: CreateTokenFnOptions): StreamPromise<CreateTokenFnOutput>;
373
- /**
374
- *
375
- * Create a transfer of Token amount from one wallet to the other.
376
- *
377
- * ```javascript
378
- *
379
- * const result = await wapiClient.createTransfer({
380
- * identifier: 'mynewtransferid',
381
- * token: 'EUR',
382
- * from_wallet: WALLETS.withEURFunds0.foreign,
383
- * to_wallet: 'foreignForMbyExistingWallet',
384
- * amount: 10.01,
385
- * metadata: {
386
- * customJSON: true,
387
- * },
388
- * type: 'transfer',
389
- * status: 'pending',
390
- * // transfer_group: TransferGroup.identifier,
391
- * }, {
392
- * create_to_wallet_if_not_exists: true,
393
- * tracking_id: 'mylogId',
394
- * // transaction_id: Transaction.identifier, // created transaction identifier
395
- * });
396
- *
397
- * expect(result).toEqual({
398
- * transfer: jasmine.objectContaining({
399
- * identifier: 'mynewtransferid',
400
- * token_foreign: 'EUR',
401
- * from_wallet_foreign: WALLETS.withEURFunds0.foreign,
402
- * to_wallet_foreign: 'foreignForMbyExistingWallet',
403
- * amount: 10.01,
404
- * metadata: {
405
- * customJSON: true,
406
- * },
407
- * type: 'transfer',
408
- * status: 'pending',
409
- * // ...
410
- * }),
411
- * });
412
- *
413
- * ```
414
- *
415
- * @param {CreateTransferFnInput} [input]
416
- * @param {CreateTransferFnOptions} [options]
417
- * @returns {StreamPromise<CreateTransferFnOutput>}
418
- *
419
- */
420
- createTransfer(input?: CreateTransferFnInput, options?: CreateTransferFnOptions): StreamPromise<CreateTransferFnOutput>;
421
- /**
422
- *
423
- * Create a TransferGroup entity to group transfers into a logical or status locked group.
424
- * Can include the transfers in the same call or if non 'closed' TransferGroup, add the transfers later.
425
- * Can also include child TransferGroups to create a hierarchy
426
- *
427
- *
428
- * ```javascript
429
- *
430
- * const result = await wapiClient.createTransferGroup({
431
- * identifier: 'mytgIdentifier',
432
- * status: 'closed',
433
- * metadata: {
434
- * customJSON: true,
435
- * },
436
- * transfer_status: 'finished',
437
- * // transfer_group: ParentTransferGroup.identifier,
438
- * children: [
439
- * {
440
- * identifier: 'txIdentifier',
441
- * from_wallet: WALLETS.withEURFunds0.foreign,
442
- * to_wallet: 'newWalletForeign',
443
- * token: 'EUR',
444
- * amount: 10,
445
- * type: 'transfer',
446
- * latest_control_hash: WALLETS.withEURFunds0.latest_control_hash,
447
- * },
448
- * {
449
- * identifier: 'childTgTransferId',
450
- * from_wallet: 'newWalletForeign',
451
- * to_wallet: WALLETS.withEURFunds0.foreign,
452
- * token: 'EUR',
453
- * amount: 9,
454
- * type: 'transfer',
455
- * latest_control_hash: null, // not needed because we just transferred money there,
456
- * },
457
- * ],
458
- * }, {
459
- * validate_final_balance_only: true,
460
- * create_to_wallet_if_not_exists: true,
461
- * tracking_id: 'mylogId',
462
- * // transaction_id: Transaction.identifier, // created transaction identifier
463
- * });
464
- *
465
- * expect(result).toEqual(jasmine.objectContaining({
466
- * transfer_group: jasmine.objectContaining({
467
- * identifier: 'mytgIdentifier',
468
- * status: 'closed',
469
- * metadata: {
470
- * customJSON: true,
471
- * },
472
- * transfer_status: 'finished',
473
- * }),
474
- * transfers: [
475
- * jasmine.objectContaining({
476
- * identifier: 'txIdentifier',
477
- * from_wallet_foreign: WALLETS.withEURFunds0.foreign,
478
- * to_wallet_foreign: 'newWalletForeign',
479
- * token_foreign: 'EUR',
480
- * amount: 10,
481
- * type: 'transfer',
482
- * }),
483
- * jasmine.objectContaining({
484
- * identifier: 'childTgTransferId',
485
- * from_wallet_foreign: 'newWalletForeign',
486
- * to_wallet_foreign: WALLETS.withEURFunds0.foreign,
487
- * token_foreign: 'EUR',
488
- * amount: 9,
489
- * type: 'transfer',
490
- * }),
491
- * ],
492
- * }));
493
- *
494
- *
495
- * ```
496
- *
497
- * @param {CreateTransferGroupFnInput} input
498
- * @param {CreateTransferGroupFnOptions} [options]
499
- * @returns {StreamPromise<CreateTransferGroupFnOutput>}
500
- *
501
- */
502
- createTransferGroup(input: CreateTransferGroupFnInput, options?: CreateTransferGroupFnOptions): StreamPromise<CreateTransferGroupFnOutput>;
503
- /**
504
- *
505
- * Create multiple transfers with one call. Transfers are created in a transaction so it either succeeds or fails as one.
506
- * Will respect internal balance transfers to avoid latest_control_hash
507
- *
508
- * ```javascript
509
- *
510
- * const result = await wapiClient.createTransfers({
511
- * transfers: [{
512
- * type: 'deposit',
513
- * wallet: WALLETS.validForeign2,
514
- * token: 'EURO',
515
- * amount: 10.01,
516
- * }, {
517
- * from_wallet: WALLETS.validForeign2,
518
- * to_wallet: 'newWalletForeignMby',
519
- * token: 'EURO',
520
- * amount: 10.01,
521
- * latest_control_hash: null, // not required as we just transferred funds
522
- * }, {
523
- * type: 'withdrawal',
524
- * wallet: 'newWalletForeignMby',
525
- * token: 'EURO',
526
- * amount: 10.01,
527
- * latest_control_hash: null, // not required as we just transferred funds
528
- * }],
529
- * }, {
530
- * create_to_wallet_if_not_exists: true,
531
- * return_from_balance: true,
532
- * return_to_balance: true,
533
- * tracking_id: 'mylogId',
534
- * // transaction_id: Transaction.identifier, // created transaction identifier
535
- * });
536
- *
537
- * expect(result).toEqual(jasmine.objectContaining({
538
- * transfers: [
539
- * jasmine.objectContaining({
540
- * type: 'deposit',
541
- * token_foreign: 'EURO',
542
- * to_wallet_foreign: WALLETS.validForeign2,
543
- * amount: 10.01,
544
- * }),
545
- * jasmine.objectContaining({
546
- * type: 'transfer',
547
- * token_foreign: 'EURO',
548
- * from_wallet_foreign: WALLETS.validForeign2,
549
- * to_wallet_foreign: 'newWalletForeignMby',
550
- * amount: 10.01,
551
- * }),
552
- * jasmine.objectContaining({
553
- * type: 'withdrawal',
554
- * token_foreign: 'EURO',
555
- * from_wallet_foreign: 'newWalletForeignMby',
556
- * amount: 10.01,
557
- * }),
558
- * ],
559
- * // We are doing a 0 sum with 3 transactions so everything is back to 0
560
- * from_balances: [
561
- * jasmine.objectContaining({
562
- * token_foreign: 'EURO',
563
- * wallet_foreign: 'EURO',
564
- * amount: 0,
565
- * }),
566
- * jasmine.objectContaining({
567
- * token_foreign: 'EURO',
568
- * wallet_foreign: WALLETS.validForeign2,
569
- * amount: 0,
570
- * }),
571
- * jasmine.objectContaining({
572
- * token_foreign: 'EURO',
573
- * wallet_foreign: 'newWalletForeignMby',
574
- * amount: 0,
575
- * }),
576
- * ],
577
- * to_balances: [
578
- * jasmine.objectContaining({
579
- * token_foreign: 'EURO',
580
- * wallet_foreign: WALLETS.validForeign2,
581
- * amount: 0,
582
- * }),
583
- * jasmine.objectContaining({
584
- * token_foreign: 'EURO',
585
- * wallet_foreign: 'newWalletForeignMby',
586
- * amount: 0,
587
- * }),
588
- * jasmine.objectContaining({
589
- * token_foreign: 'EURO',
590
- * wallet_foreign: 'EURO',
591
- * amount: 0,
592
- * }),
593
- * ],
594
- * }));
595
- *
596
- *
597
- * ```
598
- *
599
- * @param {CreateTransfersFnInput} input
600
- * @param {CreateTransfersFnOptions} [options]
601
- * @returns {StreamPromise<CreateTransfersFnOutput>}
602
- *
603
- */
604
- createTransfers(input: CreateTransfersFnInput, options?: CreateTransfersFnOptions): StreamPromise<CreateTransfersFnOutput>;
605
- /**
606
- *
607
- * Create a Wallet entity which can then transfer amounts of Tokens.
608
- *
609
- * ```javascript
610
- *
611
- * const result = await wapiClient.createWallet({
612
- * foreign: 'test-wallet-2',
613
- * name: 'Irrelevant',
614
- * metadata: {
615
- * awesome: true,
616
- * invalid: false,
617
- * },
618
- * }, {
619
- * tracking_id: 'mylogId',
620
- * // transaction_id: Transaction.identifier, // created transaction identifier
621
- * });
622
- *
623
- * expect(result).toEqual({
624
- * wallet: jasmine.objectContaining({
625
- * foreign: 'test-wallet-2',
626
- * name: 'Irrelevant',
627
- * metadata: {
628
- * awesome: true,
629
- * invalid: false,
630
- * },
631
- * }),
632
- * });
633
- *
634
- *
635
- * ```
636
- *
637
- * @param {CreateWalletFnInput} input
638
- * @param {CreateWalletFnOptions} [options]
639
- * @returns {StreamPromise<CreateWalletFnOutput>}
640
- *
641
- */
642
- createWallet(input: CreateWalletFnInput, options?: CreateWalletFnOptions): StreamPromise<CreateWalletFnOutput>;
643
- /**
644
- *
645
- * Create a transfer withdrawing funds from a Wallet.
646
- * Will default to transferring funds to Token default Wallet.
647
- *
648
- * ```javascript
649
- *
650
- * const result = await wapiClient.createWithdrawal({
651
- * identifier: 'mycustomId',
652
- * token: 'ForeignForToken',
653
- * wallet: 'ForeignForWallet',
654
- * amount: 10.01,
655
- * metadata: {
656
- * customJsonBlob: true,
657
- * },
658
- * status: 'finished',
659
- * latest_control_hash: null,
660
- * // transfer_group: TransferGroup.identifier, // existing transfer group identifier
661
- * }, {
662
- * tracking_id: 'mylogId',
663
- * // transaction_id: Transaction.identifier, // created transaction identifier
664
- * return_balance: true,
665
- * });
666
- *
667
- * expect(result).toEqual({
668
- * transfer: jasmine.objectContaining({
669
- * identifier: 'mycustomId',
670
- * token_foreign: 'ForeignForToken',
671
- * from_wallet_foreign: 'ForeignForWallet',
672
- * amount: 10.01,
673
- * metadata: {
674
- * customJsonBlob: true,
675
- * },
676
- * status: 'finished',
677
- * // ... other fields
678
- * }),
679
- * from_balance: jasmine.objectContaining({
680
- * token_foreign: 'ForeignForToken',
681
- * wallet_foreign: 'ForeignForWallet',
682
- * pending_amount: 0,
683
- * finished_amount: 89.99,
684
- * amount: 89.99,
685
- * // ... other fields
686
- * }),
687
- * });
688
- *
689
- * ```
690
- *
691
- * @param {CreateWithdrawalFnInput} input
692
- * @param {CreateWithdrawalFnOptions} [options]
693
- * @returns {StreamPromise<CreateWithdrawalFnOutput>}
694
- *
695
- */
696
- createWithdrawal(input: CreateWithdrawalFnInput, options?: CreateWithdrawalFnOptions): StreamPromise<CreateWithdrawalFnOutput>;
697
- /**
698
- *
699
- * Search for Balances using either a simple filter or queryBuilder
700
- *
701
- *
702
- * ```javascript
703
- *
704
- * const result = await wapiClient.findBalances()
705
- * .where({
706
- * wallet: WALLETS.validId0,
707
- * })
708
- * .orWhere('amount', '>', 100)
709
- * .orWhere({
710
- * wallet: WALLETS.validId1,
711
- * token: 'USD',
712
- * })
713
- * .orWhere(builder => {
714
- * builder.where('updated_at', '<', '2020-01-01')
715
- * .where('amount', '<', -1000000);
716
- * })
717
- * .limit(5)
718
- * .offset(0)
719
- * .orderBy('amount', 'desc')
720
- * .options({
721
- * tracking_id: 'hello',
722
- * return_metadata_total: true,
723
- * });
724
- *
725
- * ```
726
- *
727
- * @param {FindBalancesFnInput} [input]
728
- * @param {FindBalancesFnOptions} [options]
729
- * @returns {StreamPromise<FindBalancesFnOutput>}
730
- *
731
- */
732
- findBalances(): QueryBuilder<FindBalancesFnFields, FindBalancesFnStringFields, FindBalancesFnMetadataFields, FindBalancesFnResultFields, FindBalancesFnOptions, FindBalancesFnOutput>;
733
- findBalances(input: FindBalancesFnInput, options?: FindBalancesFnOptions): StreamPromise<FindBalancesFnOutput>;
734
- /**
735
- *
736
- * Search for Tokens using either a simple filter or queryBuilder
737
- *
738
- *
739
- * ```javascript
740
- *
741
- * const result = await wapiClient.findTokens()
742
- * .where({
743
- * metadata: {
744
- * even: true,
745
- * example: 'test',
746
- * },
747
- * })
748
- * .orWhere({
749
- * foreign: 'token-example1',
750
- * })
751
- * .limit(5)
752
- * .offset(0)
753
- * .orderBy(['foreign', {column: 'id', order: 'desc'}])
754
- * .options({
755
- * tracking_id: 'hello',
756
- * return_metadata_total: true,
757
- * });
758
- *
759
- * ```
760
- *
761
- * @param {FindTokensFnInput} [input]
762
- * @param {FindTokensFnOptions} [options]
763
- * @returns {StreamPromise<FindTokensFnOutput>}
764
- *
765
- */
766
- findTokens(): QueryBuilder<FindTokensFnFields, FindTokensFnStringFields, FindTokensFnMetadataFields, FindTokensFnResultFields, FindTokensFnOptions, FindTokensFnOutput>;
767
- findTokens(input: FindTokensFnInput, options?: FindTokensFnOptions): StreamPromise<FindTokensFnOutput>;
768
- /**
769
- *
770
- * Search for TransferGroups using either a simple filter or queryBuilder
771
- *
772
- *
773
- * ```javascript
774
- *
775
- * const result = await wapiClient.findTransferGroups()
776
- * .where({
777
- * metadata: {
778
- * even: true,
779
- * example: 'test',
780
- * },
781
- * })
782
- * .orWhere({
783
- * identifier: 'reverser-example',
784
- * })
785
- * .orWhere(builder => {
786
- * builder.where({
787
- * metadata: {
788
- * kak: true,
789
- * },
790
- * })
791
- * .where('created_at', '>', '2020-01-01');
792
- * })
793
- * .limit(5)
794
- * .offset(0)
795
- * .orderBy('id', 'desc')
796
- * .select('id', 'type', 'identifier')
797
- * .options({
798
- * tracking_id: 'hello',
799
- * return_metadata_total: true,
800
- * });
801
- *
802
- * ```
803
- *
804
- * @param {FindTransferGroupsFnInput} [input]
805
- * @param {FindTransferGroupsFnOptions} [options]
806
- * @returns {StreamPromise<FindTransferGroupsFnOutput>}
807
- *
808
- */
809
- findTransferGroups(): QueryBuilder<FindTransferGroupsFnFields, FindTransferGroupsFnStringFields, FindTransferGroupsFnMetadataFields, FindTransferGroupsFnResultFields, FindTransferGroupsFnOptions, FindTransferGroupsFnOutput>;
810
- findTransferGroups(input: FindTransferGroupsFnInput, options?: FindTransferGroupsFnOptions): StreamPromise<FindTransferGroupsFnOutput>;
811
- /**
812
- *
813
- * Search for Transfers using either a simple filter or queryBuilder
814
- *
815
- *
816
- * ```javascript
817
- *
818
- * const result = await wapiClient.findTransfers()
819
- * .where({
820
- * metadata: {
821
- * example: true,
822
- * },
823
- * })
824
- * .where('id', '>', 1)
825
- * .where(builder => {
826
- * builder.where('status', 'finished')
827
- * .orWhere('type', 'deposit');
828
- * })
829
- * .limit(5)
830
- * .offset(0)
831
- * .orderBy(['token_id', {column: 'id', order: 'desc'}])
832
- * .select('id', 'type', 'from_wallet_foreign', 'to_wallet_foreign')
833
- * .options({
834
- * tracking_id: 'hello',
835
- * });
836
- *
837
- * ```
838
- *
839
- * @param {FindTransfersFnInput} [input]
840
- * @param {FindTransfersFnOptions} [options]
841
- * @returns {StreamPromise<FindTransfersFnOutput>}
842
- *
843
- */
844
- findTransfers(): QueryBuilder<FindTransfersFnFields, FindTransfersFnStringFields, FindTransfersFnMetadataFields, FindTransfersFnResultFields, FindTransfersFnOptions, FindTransfersFnOutput>;
845
- findTransfers(input: FindTransfersFnInput, options?: FindTransfersFnOptions): StreamPromise<FindTransfersFnOutput>;
846
- /**
847
- *
848
- * Search for Wallets using either a simple filter or queryBuilder
849
- *
850
- *
851
- * ```javascript
852
- *
853
- * const result = await wapiClient.findWallets()
854
- * .where({
855
- * metadata: {
856
- * general: true,
857
- * },
858
- * })
859
- * .where('id', '>', 1)
860
- * .where(builder => {
861
- * builder
862
- * .whereMetadata('tost', 10)
863
- * .orWhereMetadata('test', 1);
864
- * })
865
- * .limit(5)
866
- * .offset(0)
867
- * .orderBy(['status', {column: 'id', order: 'desc'}])
868
- * .select('id')
869
- * .options({
870
- * tracking_id: 'hello',
871
- * });
872
- *
873
- * ```
874
- *
875
- * @param {FindWalletsFnInput} [input]
876
- * @param {FindWalletsFnOptions} [options]
877
- * @returns {StreamPromise<FindWalletsFnOutput>}
878
- *
879
- */
880
- findWallets(): QueryBuilder<FindWalletsFnFields, FindWalletsFnStringFields, FindWalletsFnMetadataFields, FindWalletsFnResultFields, FindWalletsFnOptions, FindWalletsFnOutput>;
881
- findWallets(input: FindWalletsFnInput, options?: FindWalletsFnOptions): StreamPromise<FindWalletsFnOutput>;
882
- /**
883
- *
884
- * Get a specific token/wallet balance
885
- *
886
- * ```javascript
887
- *
888
- * const result = await wapiClient.getBalance({
889
- * wallet: 'myMbyExistingWallet',
890
- * token: 'MBYTOKEN',
891
- * datetime: '2020-01-01',
892
- * }, {
893
- * create_wallet_if_not_exists: true,
894
- * create_token_if_not_exists: true,
895
- * create_if_not_exists: true,
896
- * tracking_id: 'mylogId',
897
- * // transaction_id: Transaction.identifier, // created transaction identifier
898
- * });
899
- *
900
- * expect(result).toEqual({
901
- * balance: jasmine.objectContaining({
902
- * wallet_foreign: 'myMbyExistingWallet',
903
- * token_foreign: 'MBYTOKEN',
904
- * pending_amount: 0,
905
- * finished_amount: 0,
906
- * amount: 0,
907
- * latest_control_hash: null,
908
- * available_balance: 0,
909
- * // ...
910
- * }),
911
- * });
912
- *
913
- *
914
- * ```
915
- *
916
- * @param {GetBalanceFnInput} input
917
- * @param {GetBalanceFnOptions} [options]
918
- * @returns {StreamPromise<GetBalanceFnOutput>}
919
- *
920
- */
921
- getBalance(input: GetBalanceFnInput, options?: GetBalanceFnOptions): StreamPromise<GetBalanceFnOutput>;
922
- /**
923
- *
924
- * Get a list of changes to token/wallet balance
925
- *
926
- * ```javascript
927
- *
928
- * // setup
929
- * const deposit = await wapiClient.createDeposit({
930
- * wallet: 'newWallet',
931
- * amount: 10,
932
- * status: 'pending',
933
- * identifier: 'depositUSD',
934
- * token: 'USD',
935
- * }, {
936
- * create_wallet_if_not_exists: true,
937
- * });
938
- * const updatedTransfer = await wapiClient.updateTransfer({
939
- * transfer: 'depositUSD',
940
- * status: 'finished',
941
- * });
942
- *
943
- * const result = await wapiClient.getBalanceHistory({
944
- * wallet: 'newWallet',
945
- * token: 'USD',
946
- * }, {
947
- * create_token_if_not_exists: true,
948
- * create_wallet_if_not_exists: true,
949
- * limit: 5,
950
- * select: [
951
- * 'transfer_identifier',
952
- * 'pending_amount',
953
- * 'finished_amount',
954
- * 'pending_amount_from',
955
- * 'pending_amount_to',
956
- * 'amount',
957
- * // 'balance_id',
958
- * // 'transfer_id',
959
- * // 'transfer_control_hash',
960
- * // 'transfer_from_wallet_id',
961
- * // 'transfer_from_wallet_foreign',
962
- * // 'transfer_to_wallet_id',
963
- * // 'transfer_to_wallet_foreign',
964
- * // 'transfer_amount',
965
- * // 'transfer_type',
966
- * // 'transfer_status',
967
- * // 'transfer_force',
968
- * // 'transfer_created_at',
969
- * // 'transfer_updated_at',
970
- * // 'transfer_metadata',
971
- * // 'transfer_transfer_group_id',
972
- * // 'transfer_transfer_group_identifier',
973
- * // 'transfer_reverses_id',
974
- * // 'transfer_reverses_identifier',
975
- * // 'transfer_status_finalized_at',
976
- * // 'token_id',
977
- * // 'token_foreign',
978
- * // 'wallet_id',
979
- * // 'wallet_foreign',
980
- * // 'latest_control_hash',
981
- * // 'updated_at',
982
- * ],
983
- * offset: 0,
984
- * order: 'desc',
985
- * return_metadata_total: true,
986
- * tracking_id: 'mylogId',
987
- * // transaction_id: Transaction.identifier, // created transaction identifier
988
- * });
989
- * expect(result).toEqual({
990
- * balances: [
991
- * {
992
- * transfer_identifier: 'depositUSD',
993
- * pending_amount: 0,
994
- * finished_amount: 10,
995
- * pending_amount_to: 0,
996
- * pending_amount_from: 0,
997
- * amount: 10,
998
- * },
999
- * {
1000
- * transfer_identifier: 'depositUSD',
1001
- * pending_amount: 10,
1002
- * finished_amount: 0,
1003
- * pending_amount_to: 10,
1004
- * pending_amount_from: 0,
1005
- * amount: 10,
1006
- * },
1007
- * ],
1008
- * metadata: {
1009
- * limit: 5,
1010
- * offset: 0,
1011
- * total: 2,
1012
- * more_rows: false,
1013
- * },
1014
- * });
1015
- *
1016
- * ```
1017
- *
1018
- * @param {GetBalanceHistoryFnInput} input
1019
- * @param {GetBalanceHistoryFnOptions} [options]
1020
- * @returns {StreamPromise<GetBalanceHistoryFnOutput>}
1021
- *
1022
- */
1023
- getBalanceHistory(input: GetBalanceHistoryFnInput, options?: GetBalanceHistoryFnOptions): StreamPromise<GetBalanceHistoryFnOutput>;
1024
- /**
1025
- *
1026
- * Retrieve the current state of configurable Flags for your WAPI instance
1027
- *
1028
- * ```javascript
1029
- *
1030
- * const result = await wapiClient.getFlags();
1031
- * expect(result.flags).toEqual({
1032
- * production: true,
1033
- * allow_timestamps: false,
1034
- * });
1035
- *
1036
- * ```
1037
- *
1038
- * @param {GetFlagsFnInput} [input]
1039
- * @param {GetFlagsFnOptions} [options]
1040
- * @returns {StreamPromise<GetFlagsFnOutput>}
1041
- *
1042
- */
1043
- getFlags(input?: GetFlagsFnInput, options?: GetFlagsFnOptions): StreamPromise<GetFlagsFnOutput>;
1044
- /**
1045
- *
1046
- * Get aggregated statistics about WAPI entities
1047
- *
1048
- * ```javascript
1049
- *
1050
- * const result = await wapiClient.getStatistics({
1051
- * model: 'Transfer',
1052
- * aggregator: 'count',
1053
- * groups: [{
1054
- * type: 'period',
1055
- * field: {
1056
- * period: 'month',
1057
- * timezone: 'Europe/Tallinn',
1058
- * },
1059
- * }],
1060
- * filter: {
1061
- * end_time: (new Date(`${new Date().getFullYear() + 1}-01-01`)).toISOString(),
1062
- * start_time: (new Date(`${new Date().getFullYear()}-01-01`)).toISOString(),
1063
- * },
1064
- * }, {
1065
- * tracking_id: 'mylogId',
1066
- * // transaction_id: Transaction.identifier, // created transaction identifier
1067
- * });
1068
- *
1069
- * expect(result).toEqual({
1070
- * rows: [
1071
- * {
1072
- * aggregate: 3,
1073
- * period: `${new Date().getFullYear()}-${(new Date().getMonth() + 1 + '').padStart(2, '0')}`,
1074
- * },
1075
- * ],
1076
- * });
1077
- *
1078
- * ```
1079
- *
1080
- * @param {GetStatisticsFnInput} [input]
1081
- * @param {GetStatisticsFnOptions} [options]
1082
- * @returns {StreamPromise<GetStatisticsFnOutput>}
1083
- *
1084
- */
1085
- getStatistics(input?: GetStatisticsFnInput, options?: GetStatisticsFnOptions): StreamPromise<GetStatisticsFnOutput>;
1086
- /**
1087
- *
1088
- * Get information about token
1089
- *
1090
- * ```javascript
1091
- *
1092
- * const result = await wapiClient.getToken({
1093
- * foreign: 'EURO',
1094
- * }, {
1095
- * create_if_not_exists: true,
1096
- * // return_only_id: true, // for example purposes we want more than id
1097
- * ignore_cache: true,
1098
- * tracking_id: 'mylogId',
1099
- * // transaction_id: Transaction.identifier, // created transaction identifier
1100
- * });
1101
- *
1102
- * expect(result).toEqual({
1103
- * token: jasmine.objectContaining({
1104
- * foreign: 'EURO',
1105
- * metadata: null,
1106
- * }),
1107
- * });
1108
- *
1109
- * ```
1110
- *
1111
- * @param {GetTokenFnInput} [input]
1112
- * @param {GetTokenFnOptions} [options]
1113
- * @returns {StreamPromise<GetTokenFnOutput>}
1114
- *
1115
- */
1116
- getToken(input?: GetTokenFnInput, options?: GetTokenFnOptions): StreamPromise<GetTokenFnOutput>;
1117
- /**
1118
- *
1119
- * Get information about a specific transfer
1120
- *
1121
- * ```javascript
1122
- *
1123
- * const result = await wapiClient.getTransfer({
1124
- * transfer: 'get-transfer-test',
1125
- * }, {
1126
- * tracking_id: 'mylogId',
1127
- * // transaction_id: Transaction.identifier, // created transaction identifier
1128
- * });
1129
- * expect(result).toEqual({
1130
- * transfer: jasmine.objectContaining({
1131
- * identifier: 'get-transfer-test',
1132
- * // ...
1133
- * }),
1134
- * });
1135
- *
1136
- * ```
1137
- *
1138
- * @param {GetTransferFnInput} input
1139
- * @param {GetTransferFnOptions} [options]
1140
- * @returns {StreamPromise<GetTransferFnOutput>}
1141
- *
1142
- */
1143
- getTransfer(input: GetTransferFnInput, options?: GetTransferFnOptions): StreamPromise<GetTransferFnOutput>;
1144
- /**
1145
- *
1146
- * Get TransferGroup information
1147
- *
1148
- * ```javascript
1149
- *
1150
- * const result = await wapiClient.getTransferGroup({
1151
- * transfer_group: 'customIdentifier',
1152
- * }, {
1153
- * create_if_not_exists: true,
1154
- * // return_only_id: true, // example requires more than just ID
1155
- * tracking_id: 'mylogId',
1156
- * // transaction_id: Transaction.identifier, // created transaction identifier
1157
- * });
1158
- * expect(result).toEqual({
1159
- * transfer_group: jasmine.objectContaining({
1160
- * identifier: 'customIdentifier',
1161
- * metadata: null,
1162
- * status: 'open',
1163
- * transfer_status: 'pending',
1164
- * status_finalized_at: null,
1165
- * transfer_status_finalized_at: null,
1166
- * reverses_id: null,
1167
- * }),
1168
- * });
1169
- *
1170
- * ```
1171
- *
1172
- * @param {GetTransferGroupFnInput} input
1173
- * @param {GetTransferGroupFnOptions} [options]
1174
- * @returns {StreamPromise<GetTransferGroupFnOutput>}
1175
- *
1176
- */
1177
- getTransferGroup(input: GetTransferGroupFnInput, options?: GetTransferGroupFnOptions): StreamPromise<GetTransferGroupFnOutput>;
1178
- /**
1179
- *
1180
- * Get information about wallet
1181
- *
1182
- * ```javascript
1183
- *
1184
- * const result = await wapiClient.getWallet({
1185
- * wallet: WALLETS.withEURFunds0.foreign,
1186
- * }, {
1187
- * tracking_id: 'mylogId',
1188
- * // transaction_id: Transaction.identifier, // created transaction identifier
1189
- * ignore_cache: true,
1190
- * create_if_not_exists: true,
1191
- * return_only_id: false,
1192
- * });
1193
- * expect(result).toEqual({
1194
- * wallet: jasmine.objectContaining({
1195
- * foreign: WALLETS.withEURFunds0.foreign,
1196
- * }),
1197
- * });
1198
- *
1199
- * ```
1200
- *
1201
- * @param {GetWalletFnInput} input
1202
- * @param {GetWalletFnOptions} [options]
1203
- * @returns {StreamPromise<GetWalletFnOutput>}
1204
- *
1205
- */
1206
- getWallet(input: GetWalletFnInput, options?: GetWalletFnOptions): StreamPromise<GetWalletFnOutput>;
1207
- /**
1208
- *
1209
- *
1210
- * ```javascript
1211
- *
1212
- * const result = await wapiClient.importData().input(async (stream) => {
1213
- * const fileStream = createReadStream(join(__dirname, '../lib/short-import.txt'));
1214
- *
1215
- * const rl = createInterface({
1216
- * input: fileStream,
1217
- * crlfDelay: Infinity
1218
- * });
1219
- * for await (const line of rl) {
1220
- * // Each line in input.txt will be successively available here as `line`.
1221
- * if (!line) {
1222
- * continue;
1223
- * }
1224
- * const obj = JSON.parse(line);
1225
- * stream.write(obj);
1226
- * }
1227
- * stream.end();
1228
- * });
1229
- *
1230
- * ```
1231
- *
1232
- * @param {ImportDataFnInput} [input]
1233
- * @param {ImportDataFnOptions} [options]
1234
- * @returns {StreamPromise<ImportDataFnOutput>}
1235
- *
1236
- */
1237
- importData(options?: ImportDataFnOptions): StreamPromiseInput<ImportDataFnOutput, ImportDataFnStreamChunk>;
1238
- importData(input: ImportDataFnInput, options?: ImportDataFnOptions): StreamPromise<ImportDataFnOutput>;
1239
- /**
1240
- *
1241
- * Reverse a transfer of value between two wallets
1242
- * will cancel pending transfers and create opposite transfers for finished ones.
1243
- *
1244
- * ```javascript
1245
- *
1246
- * const result = await wapiClient.reverseTransfer({
1247
- * transfer: 'MYDEPOSIT',
1248
- * status: 'finished',
1249
- * identifier: 'MYREVERSEDEPOSIT',
1250
- * force: true,
1251
- * // metadata: {},
1252
- * metadata: {
1253
- * extraCustomJSON: true,
1254
- * },
1255
- * }, {
1256
- * reverse_deposit: true,
1257
- * reverse_withdrawal: true,
1258
- * return_to_balance: true,
1259
- * return_from_balance: true,
1260
- * metadata_action: 'extend',
1261
- * tracking_id: 'mylogId',
1262
- * // transaction_id: Transaction.identifier, // created transaction identifier
1263
- * });
1264
- * expect(result).toEqual({
1265
- * transfer: jasmine.objectContaining({
1266
- * identifier: 'MYREVERSEDEPOSIT',
1267
- * amount: 10.01,
1268
- * type: 'withdrawal',
1269
- * status: 'finished',
1270
- * force: true,
1271
- * metadata: {
1272
- * customJSON: true,
1273
- * extraCustomJSON: true,
1274
- * },
1275
- * transfer_group_id: null,
1276
- * reverses_id: DEPOSIT.id,
1277
- * from_wallet_foreign: DEPOSIT.to_wallet_foreign,
1278
- * to_wallet_foreign: DEPOSIT.from_wallet_foreign,
1279
- * token_foreign: DEPOSIT.token_foreign,
1280
- * // ...
1281
- * }),
1282
- * to_balance: jasmine.objectContaining({
1283
- * token_foreign: DEPOSIT.token_foreign,
1284
- * wallet_foreign: DEPOSIT.from_wallet_foreign,
1285
- * // ...
1286
- * }),
1287
- * from_balance: jasmine.objectContaining({
1288
- * token_foreign: DEPOSIT.token_foreign,
1289
- * wallet_foreign: DEPOSIT.to_wallet_foreign,
1290
- * // ...
1291
- * }),
1292
- * });
1293
- *
1294
- * ```
1295
- *
1296
- * @param {ReverseTransferFnInput} input
1297
- * @param {ReverseTransferFnOptions} [options]
1298
- * @returns {StreamPromise<ReverseTransferFnOutput>}
1299
- *
1300
- */
1301
- reverseTransfer(input: ReverseTransferFnInput, options?: ReverseTransferFnOptions): StreamPromise<ReverseTransferFnOutput>;
1302
- /**
1303
- *
1304
- * Similar to reverseTransfer will reverse value transfers, however it will reverse the whole
1305
- * group with its children by creating a new group with opposite transfers.
1306
- *
1307
- * ```javascript
1308
- *
1309
- * // Should succeed if flag is set
1310
- * const result = await wapiClient.reverseTransferGroup({
1311
- * transfer_group: 'myCustom',
1312
- * identifier: 'myCustomReverse',
1313
- * metadata: {
1314
- * extraCustomJSON: true,
1315
- * },
1316
- * transfer_status: 'finished',
1317
- * }, {
1318
- * validate_final_balance_only: true,
1319
- * reverse_deposit: true,
1320
- * reverse_withdrawal: true,
1321
- * return_transfers: true,
1322
- * metadata_action: 'extend',
1323
- * transfer_metadata_action: 'extend',
1324
- * tracking_id: 'mylogId',
1325
- * // transaction_id: Transaction.identifier, // created transaction identifier
1326
- * });
1327
- *
1328
- * expect(result).toEqual({
1329
- * transfer_group: jasmine.objectContaining({
1330
- * identifier: 'myCustomReverse',
1331
- * status: 'closed',
1332
- * metadata: {
1333
- * customJSON: true,
1334
- * extraCustomJSON: true,
1335
- * },
1336
- * transfer_status: 'finished',
1337
- * }),
1338
- * transfers: [
1339
- * jasmine.objectContaining({
1340
- * from_wallet_foreign: 'myWallet2',
1341
- * to_wallet_foreign: 'myWallet1',
1342
- * amount: 8,
1343
- * type: 'transfer',
1344
- * status: 'finished',
1345
- * token_foreign: 'EUR',
1346
- * }),
1347
- * jasmine.objectContaining({
1348
- * from_wallet_foreign: 'myWallet1',
1349
- * to_wallet_foreign: 'EUR',
1350
- * amount: 10,
1351
- * type: 'withdrawal',
1352
- * status: 'finished',
1353
- * token_foreign: 'EUR',
1354
- * }),
1355
- * ],
1356
- * });
1357
- *
1358
- * ```
1359
- *
1360
- * @param {ReverseTransferGroupFnInput} input
1361
- * @param {ReverseTransferGroupFnOptions} [options]
1362
- * @returns {StreamPromise<ReverseTransferGroupFnOutput>}
1363
- *
1364
- */
1365
- reverseTransferGroup(input: ReverseTransferGroupFnInput, options?: ReverseTransferGroupFnOptions): StreamPromise<ReverseTransferGroupFnOutput>;
1366
- /**
1367
- *
1368
- *
1369
- * ```javascript
1370
- *
1371
- * const [[finishedTransfer1], [finishedTransfer2]] = await Promise.all([
1372
- * TEST.knex('transfers').insert({
1373
- * identifier: getTxIdSync(),
1374
- * auto_hash: true,
1375
- * amount: toNumberInput(10.12),
1376
- * status: 'finished',
1377
- * metadata: {
1378
- * example: 'test'
1379
- * },
1380
- * from_wallet_id: WALLETS.withEURFunds0.id,
1381
- * to_wallet_id: WALLETS.validId1,
1382
- * token_id: TOKENS.EUR.id,
1383
- * }).returning('*'),
1384
- * TEST.knex('transfers').insert({
1385
- * identifier: getTxIdSync(),
1386
- * auto_hash: true,
1387
- * amount: toNumberInput(10.12),
1388
- * status: 'finished',
1389
- * metadata: {
1390
- * example: 'test'
1391
- * },
1392
- * from_wallet_id: WALLETS.withEURFunds0.id,
1393
- * to_wallet_id: WALLETS.validId1,
1394
- * token_id: TOKENS.EUR.id,
1395
- * }).returning('*'),
1396
- * ]);
1397
- *
1398
- * const result = await wapiClient.reverseTransfers({
1399
- * metadata: {
1400
- * example: 'test'
1401
- * },
1402
- * });
1403
- *
1404
- * const { transfers } = result;
1405
- * expect(transfers.length).toEqual(2);
1406
- *
1407
- * expect(transfers[0].identifier).not.toEqual(finishedTransfer1.identifier);
1408
- * expect(transfers[0].amount).toEqual(formatNumber(finishedTransfer1.amount));
1409
- * expect(transfers[0].from_wallet_id).toEqual(finishedTransfer1.to_wallet_id);
1410
- * expect(transfers[0].to_wallet_id).toEqual(finishedTransfer1.from_wallet_id);
1411
- *
1412
- * expect(transfers[1].identifier).not.toEqual(finishedTransfer2.identifier);
1413
- * expect(transfers[1].amount).toEqual(formatNumber(finishedTransfer2.amount));
1414
- * expect(transfers[1].from_wallet_id).toEqual(finishedTransfer2.to_wallet_id);
1415
- * expect(transfers[1].to_wallet_id).toEqual(finishedTransfer2.from_wallet_id);
1416
- *
1417
- * ```
1418
- *
1419
- * @param {ReverseTransfersFnInput} [input]
1420
- * @param {ReverseTransfersFnOptions} [options]
1421
- * @returns {StreamPromise<ReverseTransfersFnOutput>}
1422
- *
1423
- */
1424
- reverseTransfers(): ReverseQueryBuilder<ReverseTransfersFnFields, ReverseTransfersFnStringFields, ReverseTransfersFnMetadataFields, ReverseTransfersFnModifications, ReverseTransfersFnOutput>;
1425
- reverseTransfers(input: ReverseTransfersFnInput, options?: ReverseTransfersFnOptions): StreamPromise<ReverseTransfersFnOutput>;
1426
- /**
1427
- *
1428
- * Configure WAPI instance Flags
1429
- *
1430
- * ```javascript
1431
- *
1432
- * const result = await wapiClient.setFlags({
1433
- * production: false,
1434
- * allow_timestamps: true,
1435
- * }, {
1436
- * tracking_id: 'mylog',
1437
- * });
1438
- * expect(result).toEqual({
1439
- * flags: {
1440
- * production: false,
1441
- * allow_timestamps: true,
1442
- * },
1443
- * message: 'flag updated, reconnect to apply',
1444
- * });
1445
- *
1446
- * ```
1447
- *
1448
- * @param {SetFlagsFnInput} input
1449
- * @param {SetFlagsFnOptions} [options]
1450
- * @returns {StreamPromise<SetFlagsFnOutput>}
1451
- *
1452
- */
1453
- setFlags(input: SetFlagsFnInput, options?: SetFlagsFnOptions): StreamPromise<SetFlagsFnOutput>;
1454
- /**
1455
- * Update token object
1456
- *
1457
- * ```javascript
1458
- *
1459
- * const result = await wapiClient.updateToken(
1460
- * {
1461
- * token: TOKENS.EUR.foreign,
1462
- * public: false,
1463
- * metadata: {
1464
- * metadata_field: 2,
1465
- * },
1466
- * status: 'disabled',
1467
- * },
1468
- * {
1469
- * return_when_not_updated: true,
1470
- * tracking_id: 'mylogId',
1471
- * // transaction_id: Transaction.identifier, // created transaction identifier
1472
- * },
1473
- * );
1474
- * expect(result).toEqual({
1475
- * token: jasmine.objectContaining({
1476
- * belongs_to: TOKENS.EUR.belongs_to,
1477
- * divisor: TOKENS.EUR.divisor,
1478
- * id: TOKENS.EUR.id,
1479
- * limit: TOKENS.EUR.limit,
1480
- * metadata: {
1481
- * metadata_field: 2,
1482
- * },
1483
- * type: TOKENS.EUR.type,
1484
- * foreign: TOKENS.EUR.foreign,
1485
- * public: false,
1486
- * status: 'disabled',
1487
- * }),
1488
- * updated: true,
1489
- * });
1490
- *
1491
- * ```
1492
- *
1493
- * @param {UpdateTokenFnInput} input
1494
- * @param {UpdateTokenFnOptions} [options]
1495
- * @returns {StreamPromise<UpdateTokenFnOutput>}
1496
- *
1497
- */
1498
- updateToken(input: UpdateTokenFnInput, options?: UpdateTokenFnOptions): StreamPromise<UpdateTokenFnOutput>;
1499
- /**
1500
- *
1501
- * Update the status of a Transfer (pending to finished or cancelled)
1502
- *
1503
- * ```javascript
1504
- *
1505
- * const result = await wapiClient.updateTransfer({
1506
- * transfer: 'myPendingDeposit',
1507
- * status: 'cancelled',
1508
- * metadata: {
1509
- * meta: 'new',
1510
- * was: true,
1511
- * },
1512
- * }, {
1513
- * return_from_balance: true,
1514
- * return_to_balance: true,
1515
- * return_when_not_updated: true,
1516
- * metadata_action: 'extend',
1517
- * tracking_id: 'mylogId',
1518
- * // transaction_id: Transaction.identifier, // created transaction identifier
1519
- * });
1520
- * expect(result).toEqual({
1521
- * transfer: jasmine.objectContaining({
1522
- * identifier: 'myPendingDeposit',
1523
- * amount: 10.01,
1524
- * type: 'deposit',
1525
- * status: 'cancelled',
1526
- * transfer_group_id: null,
1527
- * reverses_id: null,
1528
- * from_wallet_foreign: 'EURO',
1529
- * to_wallet_foreign: 'myWallet',
1530
- * token_foreign: 'EURO',
1531
- * metadata: {
1532
- * meta: 'new',
1533
- * is: true,
1534
- * was: true,
1535
- * }
1536
- * }),
1537
- * to_balance: jasmine.objectContaining({
1538
- * token_foreign: 'EURO',
1539
- * wallet_foreign: 'myWallet',
1540
- * pending_amount: 0,
1541
- * finished_amount: 0,
1542
- * amount: 0,
1543
- * }),
1544
- * from_balance: jasmine.objectContaining({
1545
- * token_foreign: 'EURO',
1546
- * wallet_foreign: 'EURO',
1547
- * pending_amount: 0,
1548
- * finished_amount: 0,
1549
- * amount: 0,
1550
- * }),
1551
- * updated: true,
1552
- * });
1553
- *
1554
- * ```
1555
- *
1556
- * @param {UpdateTransferFnInput} input
1557
- * @param {UpdateTransferFnOptions} [options]
1558
- * @returns {StreamPromise<UpdateTransferFnOutput>}
1559
- *
1560
- */
1561
- updateTransfer(input: UpdateTransferFnInput, options?: UpdateTransferFnOptions): StreamPromise<UpdateTransferFnOutput>;
1562
- /**
1563
- *
1564
- * Update the status and transfer_status of a TransferGroup
1565
- *
1566
- * ```javascript
1567
- *
1568
- * const result = await wapiClient.updateTransferGroup({
1569
- * transfer_group: 'myCustom',
1570
- * status: 'closed',
1571
- * transfer_status: 'finished',
1572
- * }, {
1573
- * return_transfers: true,
1574
- * return_when_not_updated: true,
1575
- * tracking_id: 'mylogId',
1576
- * // transaction_id: Transaction.identifier, // created transaction identifier
1577
- * });
1578
- * expect(result).toEqual({
1579
- * transfer_group: jasmine.objectContaining({
1580
- * identifier: 'myCustom',
1581
- * status: 'closed',
1582
- * transfer_status: 'finished',
1583
- * }),
1584
- * transfers: [
1585
- * jasmine.objectContaining({
1586
- * identifier: 'transferA',
1587
- * type: 'deposit',
1588
- * status: 'finished',
1589
- * from_wallet_foreign: 'EUR',
1590
- * to_wallet_foreign: 'myWallet1',
1591
- * token_foreign: 'EUR',
1592
- * }),
1593
- * jasmine.objectContaining({
1594
- * identifier: 'transferB',
1595
- * type: 'transfer',
1596
- * status: 'finished',
1597
- * from_wallet_foreign: 'myWallet1',
1598
- * to_wallet_foreign: 'myWallet2',
1599
- * token_foreign: 'EUR',
1600
- * }),
1601
- * ],
1602
- * updated: true,
1603
- * });
1604
- *
1605
- * ```
1606
- *
1607
- * @param {UpdateTransferGroupFnInput} input
1608
- * @param {UpdateTransferGroupFnOptions} [options]
1609
- * @returns {StreamPromise<UpdateTransferGroupFnOutput>}
1610
- *
1611
- */
1612
- updateTransferGroup(input: UpdateTransferGroupFnInput, options?: UpdateTransferGroupFnOptions): StreamPromise<UpdateTransferGroupFnOutput>;
1613
- /**
1614
- *
1615
- *
1616
- * ```javascript
1617
- *
1618
- * const result = await wapiClient.updateTransferGroups()
1619
- * .where({
1620
- * status: 'open',
1621
- * })
1622
- * .whereIn('identifier', ['transferGroup1', 'transferGroup2'])
1623
- * .whereMetadata('old', 'data')
1624
- * .update({
1625
- * transfer_status: 'finished',
1626
- * })
1627
- * .options({
1628
- * return_transfers: true,
1629
- * });
1630
- *
1631
- * ```
1632
- *
1633
- * @param {UpdateTransferGroupsFnInput} [input]
1634
- * @param {UpdateTransferGroupsFnOptions} [options]
1635
- * @returns {StreamPromise<UpdateTransferGroupsFnOutput>}
1636
- *
1637
- */
1638
- updateTransferGroups(): UpdateQueryBuilder<UpdateTransferGroupsFnFields, UpdateTransferGroupsFnStringFields, UpdateTransferGroupsFnMetadataFields, UpdateTransferGroupsFnResultFields, UpdateTransferGroupsFnUpdateFields, UpdateTransferGroupsFnOutput>;
1639
- updateTransferGroups(input: UpdateTransferGroupsFnInput, options?: UpdateTransferGroupsFnOptions): StreamPromise<UpdateTransferGroupsFnOutput>;
1640
- /**
1641
- *
1642
- *
1643
- * ```javascript
1644
- *
1645
- * const result = await wapiClient.updateTransfers({
1646
- * metadata: {
1647
- * example: 'test',
1648
- * },
1649
- * wallet: WALLETS.validId1.foreign,
1650
- * token: 'EUR',
1651
- * update: {
1652
- * status: 'finished',
1653
- * },
1654
- * });
1655
- *
1656
- * expect(result.transfers.length).toEqual(1);
1657
- * expect(result.transfers[0].status).toEqual('finished');
1658
- * expect(result.updated).toEqual(true);
1659
- *
1660
- * ```
1661
- *
1662
- * @param {UpdateTransfersFnInput} [input]
1663
- * @param {UpdateTransfersFnOptions} [options]
1664
- * @returns {StreamPromise<UpdateTransfersFnOutput>}
1665
- *
1666
- */
1667
- updateTransfers(): UpdateQueryBuilder<UpdateTransfersFnFields, UpdateTransfersFnStringFields, UpdateTransfersFnMetadataFields, UpdateTransfersFnResultFields, UpdateTransfersFnUpdateFields, UpdateTransfersFnOutput>;
1668
- updateTransfers(input: UpdateTransfersFnInput, options?: UpdateTransfersFnOptions): StreamPromise<UpdateTransfersFnOutput>;
1669
- /**
1670
- * Update Wallet
1671
- *
1672
- * ```javascript
1673
- *
1674
- * const result = await wapiClient.updateWallet(
1675
- * {
1676
- * wallet: WALLETS.withEURFunds0.foreign,
1677
- * name: 'WT4',
1678
- * status: 'disabled',
1679
- * metadata: {
1680
- * metadata_number: 2,
1681
- * },
1682
- * },
1683
- * {
1684
- * return_when_not_updated: true,
1685
- * tracking_id: 'mylogId',
1686
- * // transaction_id: Transaction.identifier, // created transaction identifier
1687
- * },
1688
- * );
1689
- * expect(result).toEqual({
1690
- * wallet: jasmine.objectContaining({
1691
- * id: WALLETS.withEURFunds0.id,
1692
- * foreign: WALLETS.withEURFunds0.foreign,
1693
- * name: 'WT4',
1694
- * metadata: {metadata_number: 2},
1695
- * type: WALLETS.withEURFunds0.type,
1696
- * status: 'disabled',
1697
- * default_allow_negative: false,
1698
- * default_allow_positive: true,
1699
- * default_dtw_from: '011',
1700
- * default_dtw_to: '110',
1701
- * }),
1702
- * updated: true,
1703
- * });
1704
- *
1705
- * ```
1706
- *
1707
- * @param {UpdateWalletFnInput} input
1708
- * @param {UpdateWalletFnOptions} [options]
1709
- * @returns {StreamPromise<UpdateWalletFnOutput>}
1710
- *
1711
- */
1712
- updateWallet(input: UpdateWalletFnInput, options?: UpdateWalletFnOptions): StreamPromise<UpdateWalletFnOutput>;
1713
- }
1714
- export declare function createClientWithWS(opts: WapiConnectionOptions, config?: ClientConfig): Client;
1
+ import { WapiConnectionOptions, WapiHttpConnectionOptions, WsClient, HttpClient } from './api';
2
+ import { ClientHooks, ISocketId } from './api/base-client';
3
+ import { AggregateQueryBuilder, UpdateQueryBuilder, ReverseQueryBuilder, QueryBuilder } from './lib/query-builder';
4
+ import { StreamPromise } from './lib/stream-promise';
5
+ import { StreamPromiseInput } from './lib/stream-promise-input';
6
+ import { AggregateTransfersFnInput, AggregateTransfersFnOutput, AggregateTransfersFnOptions, AggregateTransfersFnFields, AggregateTransfersFnMetadataFields, AggregateTransfersFnStringFields, AggregateTransfersFnGroupFields, CreateAccessTokenFnInput, CreateAccessTokenFnOutput, CreateAccessTokenFnOptions, CreateContractFnInput, CreateContractFnOutput, CreateContractFnOptions, CreateDepositFnInput, CreateDepositFnOutput, CreateDepositFnOptions, CreateExchangeFnInput, CreateExchangeFnOutput, CreateExchangeFnOptions, CreateTokenFnInput, CreateTokenFnOutput, CreateTokenFnOptions, CreateTransferFnInput, CreateTransferFnOutput, CreateTransferFnOptions, CreateTransferGroupFnInput, CreateTransferGroupFnOutput, CreateTransferGroupFnOptions, CreateTransfersFnInput, CreateTransfersFnOutput, CreateTransfersFnOptions, CreateWalletFnInput, CreateWalletFnOutput, CreateWalletFnOptions, CreateWithdrawalFnInput, CreateWithdrawalFnOutput, CreateWithdrawalFnOptions, FindBalancesFnInput, FindBalancesFnOutput, FindBalancesFnOptions, FindBalancesFnFields, FindBalancesFnMetadataFields, FindBalancesFnStringFields, FindBalancesFnResultFields, FindTokensFnInput, FindTokensFnOutput, FindTokensFnOptions, FindTokensFnFields, FindTokensFnMetadataFields, FindTokensFnStringFields, FindTokensFnResultFields, FindTransferGroupsFnInput, FindTransferGroupsFnOutput, FindTransferGroupsFnOptions, FindTransferGroupsFnFields, FindTransferGroupsFnMetadataFields, FindTransferGroupsFnStringFields, FindTransferGroupsFnResultFields, FindTransfersFnInput, FindTransfersFnOutput, FindTransfersFnOptions, FindTransfersFnFields, FindTransfersFnMetadataFields, FindTransfersFnStringFields, FindTransfersFnResultFields, FindWalletsFnInput, FindWalletsFnOutput, FindWalletsFnOptions, FindWalletsFnFields, FindWalletsFnMetadataFields, FindWalletsFnStringFields, FindWalletsFnResultFields, GetBalanceFnInput, GetBalanceFnOutput, GetBalanceFnOptions, GetBalanceHistoryFnInput, GetBalanceHistoryFnOutput, GetBalanceHistoryFnOptions, GetFlagsFnInput, GetFlagsFnOutput, GetFlagsFnOptions, GetStatisticsFnInput, GetStatisticsFnOutput, GetStatisticsFnOptions, GetTokenFnInput, GetTokenFnOutput, GetTokenFnOptions, GetTransferFnInput, GetTransferFnOutput, GetTransferFnOptions, GetTransferGroupFnInput, GetTransferGroupFnOutput, GetTransferGroupFnOptions, GetWalletFnInput, GetWalletFnOutput, GetWalletFnOptions, ImportDataFnInput, ImportDataFnOutput, ImportDataFnOptions, ImportDataFnStreamChunk, ReverseTransferFnInput, ReverseTransferFnOutput, ReverseTransferFnOptions, ReverseTransferGroupFnInput, ReverseTransferGroupFnOutput, ReverseTransferGroupFnOptions, ReverseTransfersFnInput, ReverseTransfersFnOutput, ReverseTransfersFnOptions, ReverseTransfersFnFields, ReverseTransfersFnMetadataFields, ReverseTransfersFnStringFields, ReverseTransfersFnModifications, SetFlagsFnInput, SetFlagsFnOutput, SetFlagsFnOptions, UpdateTokenFnInput, UpdateTokenFnOutput, UpdateTokenFnOptions, UpdateTransferFnInput, UpdateTransferFnOutput, UpdateTransferFnOptions, UpdateTransferGroupFnInput, UpdateTransferGroupFnOutput, UpdateTransferGroupFnOptions, UpdateTransferGroupsFnInput, UpdateTransferGroupsFnOutput, UpdateTransferGroupsFnOptions, UpdateTransferGroupsFnFields, UpdateTransferGroupsFnMetadataFields, UpdateTransferGroupsFnStringFields, UpdateTransferGroupsFnResultFields, UpdateTransferGroupsFnUpdateFields, UpdateTransfersFnInput, UpdateTransfersFnOutput, UpdateTransfersFnOptions, UpdateTransfersFnFields, UpdateTransfersFnMetadataFields, UpdateTransfersFnStringFields, UpdateTransfersFnResultFields, UpdateTransfersFnUpdateFields, UpdateWalletFnInput, UpdateWalletFnOutput, UpdateWalletFnOptions } from './fns';
7
+ export interface ClientConfig {
8
+ token?: number | string;
9
+ hooks?: ClientHooks;
10
+ }
11
+ export declare class Client {
12
+ /**
13
+ * The BaseClient in use for communication with WAPI Server, manages the actual networking
14
+ */
15
+ api: WsClient | HttpClient;
16
+ /**
17
+ * Promise resolving to ID upon connection opening
18
+ */
19
+ $connect: Promise<ISocketId>;
20
+ private config;
21
+ /**
22
+ * @internal
23
+ */
24
+ constructor(_apiClient: WsClient | HttpClient, initialConf?: ClientConfig);
25
+ /**
26
+ * Close connection to WAPI instance
27
+ *
28
+ * ```javascript
29
+ *
30
+ * await wapiClient.close();
31
+ *
32
+ * ```
33
+ */
34
+ close(): Promise<void>;
35
+ /**
36
+ * Returns WAPI client verion
37
+ *
38
+ * ```javascript
39
+ *
40
+ * wapiClient.version();
41
+ *
42
+ * ```
43
+ */
44
+ version(): string;
45
+ /**
46
+ * Set a hook function
47
+ *
48
+ * ```javascript
49
+ *
50
+ * wapiClient.setHook('disconnect', () => {
51
+ * console.log('disconnected');
52
+ * });
53
+ *
54
+ * ```
55
+ * @param {ClientHooks} hookName
56
+ * @param value
57
+ */
58
+ setHook(hookName: keyof ClientHooks, value: (input?: unknown) => boolean | void): this;
59
+ /**
60
+ * Overwrite client configuration (default token, hooks)
61
+ *
62
+ *
63
+ * ```javascript
64
+ *
65
+ * wapiClient.configure({
66
+ * token: 'EURO',
67
+ * hooks: {
68
+ * disconnect: () => {}
69
+ * },
70
+ * });
71
+ *
72
+ * ```
73
+ * @param {ClientConfig} newConf
74
+ */
75
+ configure(newConf: Partial<ClientConfig>): this;
76
+ /**
77
+ * Get current config key value (token)
78
+ * ```javascript
79
+ *
80
+ * const token = wapiClient.getConfig('token');
81
+ *
82
+ * ```
83
+ */
84
+ getConfig(key: 'token'): number | string | undefined;
85
+ /**
86
+ *
87
+ * Aggregate Transfers using either a simple filter or queryBuilder
88
+ *
89
+ *
90
+ * ```javascript
91
+ *
92
+ * const result = await wapiClient.aggregateTransfers()
93
+ * .where({
94
+ * type: 'deposit',
95
+ * from_wallet: 'EUR',
96
+ * to_wallet: 'house',
97
+ * })
98
+ * .whereMetadata('example', 'test')
99
+ * .sum('to.amount as amount')
100
+ * .count()
101
+ * .groupBy(
102
+ * 'metadata.even as type',
103
+ * 'hour',
104
+ * )
105
+ * .options({
106
+ * tracking_id: 'hello',
107
+ * return_all_intervals: {
108
+ * start_time: '2021-07-31 11:00:00',
109
+ * end_time: '2021-07-31 13:00:00'
110
+ * }
111
+ * });
112
+ *
113
+ * expect(result).toEqual({
114
+ * rows: [
115
+ * {
116
+ * amount: 25,
117
+ * count: 5,
118
+ * type: 'even',
119
+ * hour: '2021-07-31 12',
120
+ * },
121
+ * {
122
+ * amount: 30,
123
+ * count: 5,
124
+ * type: 'odd',
125
+ * hour: '2021-07-31 12',
126
+ * },
127
+ * {
128
+ * amount: null,
129
+ * count: 0,
130
+ * type: null,
131
+ * hour: '2021-07-31 11',
132
+ * },
133
+ * {
134
+ * amount: null,
135
+ * count: 0,
136
+ * type: null,
137
+ * hour: '2021-07-31 13',
138
+ * },
139
+ * ],
140
+ * metadata: {
141
+ * aggregators: [
142
+ * {
143
+ * function: 'sum',
144
+ * field: 'to.amount',
145
+ * alias: 'amount',
146
+ * },
147
+ * {
148
+ * function: 'count',
149
+ * alias: 'count',
150
+ * },
151
+ * ],
152
+ * groups: [
153
+ * {
154
+ * type: 'metadata_field',
155
+ * field: 'even',
156
+ * alias: 'type',
157
+ * },
158
+ * {
159
+ * alias: 'hour',
160
+ * field: 'hour',
161
+ * type: 'period',
162
+ * },
163
+ * ],
164
+ * },
165
+ * });
166
+ *
167
+ * ```
168
+ *
169
+ * @param {AggregateTransfersFnInput} [input]
170
+ * @param {AggregateTransfersFnOptions} [options]
171
+ * @returns {StreamPromise<AggregateTransfersFnOutput>}
172
+ *
173
+ */
174
+ aggregateTransfers(): AggregateQueryBuilder<AggregateTransfersFnFields, AggregateTransfersFnStringFields, AggregateTransfersFnMetadataFields, AggregateTransfersFnGroupFields, AggregateTransfersFnOutput>;
175
+ aggregateTransfers(input: AggregateTransfersFnInput, options?: AggregateTransfersFnOptions): StreamPromise<AggregateTransfersFnOutput>;
176
+ /**
177
+ *
178
+ *
179
+ * ```javascript
180
+ *
181
+ * const response = await wapiClient.createAccessToken({
182
+ * token: {
183
+ * type: 'limited',
184
+ * scopes: ['getBalance'],
185
+ * filters: {
186
+ * wallet_foreign: 'user-1-wallet',
187
+ * token_foreign: 'EUR',
188
+ * },
189
+ * expiresIn: 60,
190
+ * }
191
+ * });
192
+ *
193
+ * ```
194
+ *
195
+ * @param {CreateAccessTokenFnInput} [input]
196
+ * @param {CreateAccessTokenFnOptions} [options]
197
+ * @returns {StreamPromise<CreateAccessTokenFnOutput>}
198
+ *
199
+ */
200
+ createAccessToken(input?: CreateAccessTokenFnInput, options?: CreateAccessTokenFnOptions): StreamPromise<CreateAccessTokenFnOutput>;
201
+ /**
202
+ *
203
+ *
204
+ * ```javascript
205
+ *
206
+ * const result = await wapiClient.createContract({
207
+ * foreign: 'MYContract',
208
+ * metadata: {
209
+ * cool: true,
210
+ * },
211
+ * value_token: 'EUR',
212
+ * value_amount: 100,
213
+ * owner: 'oppo',
214
+ * buyer: {
215
+ * wallet: WALLETS.withEURFunds0.foreign,
216
+ * metadata: {
217
+ * buying: true,
218
+ * },
219
+ * amount: 101,
220
+ * token: 'EUR',
221
+ * },
222
+ * });
223
+ *
224
+ * ```
225
+ *
226
+ * @param {CreateContractFnInput} input
227
+ * @param {CreateContractFnOptions} [options]
228
+ * @returns {StreamPromise<CreateContractFnOutput>}
229
+ *
230
+ */
231
+ createContract(input: CreateContractFnInput, options?: CreateContractFnOptions): StreamPromise<CreateContractFnOutput>;
232
+ /**
233
+ *
234
+ * Create a deposit transaction into a wallet, by issuing new tokens to the system.
235
+ *
236
+ * ```javascript
237
+ *
238
+ * const result = await wapiClient.createDeposit({
239
+ * identifier: 'mycustomId',
240
+ * token: 'ForeignForToken',
241
+ * wallet: 'ForeignForWallet',
242
+ * amount: 10.01,
243
+ * metadata: {
244
+ * customJsonBlob: true,
245
+ * },
246
+ * status: 'finished',
247
+ * // transfer_group: TransferGroup.identifier, // existing transfer group identifier
248
+ * }, {
249
+ * tracking_id: 'mylogId',
250
+ * // transaction_id: Transaction.identifier, // created transaction identifier
251
+ * create_wallet_if_not_exists: true,
252
+ * return_balance: true,
253
+ * });
254
+ *
255
+ * expect(result).toEqual({
256
+ * transfer: jasmine.objectContaining({
257
+ * identifier: 'mycustomId',
258
+ * token_foreign: 'ForeignForToken',
259
+ * to_wallet_foreign: 'ForeignForWallet',
260
+ * amount: 10.01,
261
+ * metadata: {
262
+ * customJsonBlob: true,
263
+ * },
264
+ * status: 'finished',
265
+ * // ... other fields
266
+ * }),
267
+ * to_balance: jasmine.objectContaining({
268
+ * token_foreign: 'ForeignForToken',
269
+ * wallet_foreign: 'ForeignForWallet',
270
+ * pending_amount: 0,
271
+ * finished_amount: 10.01,
272
+ * amount: 10.01,
273
+ * // ... other fields
274
+ * }),
275
+ * });
276
+ *
277
+ * ```
278
+ *
279
+ * @param {CreateDepositFnInput} input
280
+ * @param {CreateDepositFnOptions} [options]
281
+ * @returns {StreamPromise<CreateDepositFnOutput>}
282
+ *
283
+ */
284
+ createDeposit(input: CreateDepositFnInput, options?: CreateDepositFnOptions): StreamPromise<CreateDepositFnOutput>;
285
+ /**
286
+ *
287
+ * Create an exchange transfer group - change one token in certain amount for another token of certain amount
288
+ * The transfers are connected and either fail or succeed both
289
+ *
290
+ * ```javascript
291
+ *
292
+ * const result = await wapiClient.createExchange({
293
+ * identifier: 'exchange',
294
+ * from_identifier: 'exchange1',
295
+ * from_wallet: WALLETS.withEURFunds0.foreign,
296
+ * from_token: 'EUR',
297
+ * from_amount: 10,
298
+ * to_identifier: 'exchange2',
299
+ * to_token: 'USD',
300
+ * to_wallet: WALLETS.withUSDFunds0.foreign,
301
+ * to_amount: 20,
302
+ * status: 'finished',
303
+ * metadata: {
304
+ * exchangeRate: 2,
305
+ * },
306
+ * }, {
307
+ * tracking_id: 'mylogId',
308
+ * // transaction_id: Transaction.identifier, // created transaction identifier
309
+ * });
310
+ * expect(result).toEqual({
311
+ * transfer_group: jasmine.objectContaining({
312
+ * identifier: 'exchange',
313
+ * status: 'closed',
314
+ * transfer_status: 'finished',
315
+ * }),
316
+ * transfers: [
317
+ * jasmine.objectContaining({
318
+ * status: 'finished',
319
+ * amount: 10,
320
+ * from_wallet_id: WALLETS.withEURFunds0.id,
321
+ * to_wallet_id: WALLETS.withUSDFunds0.id,
322
+ * token_id: TOKENS.EUR.id,
323
+ * metadata: {
324
+ * exchangeRate: 2,
325
+ * },
326
+ * identifier: 'exchange1',
327
+ * }),
328
+ * jasmine.objectContaining({
329
+ * status: 'finished',
330
+ * amount: 20,
331
+ * to_wallet_id: WALLETS.withEURFunds0.id,
332
+ * from_wallet_id: WALLETS.withUSDFunds0.id,
333
+ * token_id: TOKENS.USD.id,
334
+ * metadata: {
335
+ * exchangeRate: 2,
336
+ * },
337
+ * identifier: 'exchange2',
338
+ * }),
339
+ * ],
340
+ * });
341
+ *
342
+ * ```
343
+ *
344
+ * @param {CreateExchangeFnInput} input
345
+ * @param {CreateExchangeFnOptions} [options]
346
+ * @returns {StreamPromise<CreateExchangeFnOutput>}
347
+ *
348
+ */
349
+ createExchange(input: CreateExchangeFnInput, options?: CreateExchangeFnOptions): StreamPromise<CreateExchangeFnOutput>;
350
+ /**
351
+ *
352
+ * Create a new Token in the system which can then be transferred between wallets
353
+ *
354
+ * ```javascript
355
+ *
356
+ * const result = await wapiClient.createToken(
357
+ * {
358
+ * foreign: 'EURO',
359
+ * divisor: 10,
360
+ * limit: 10,
361
+ * public: true,
362
+ * metadata: {
363
+ * customMetadata: true,
364
+ * },
365
+ * // belongs_to: 'EURO-wallet'
366
+ * },
367
+ * {
368
+ * tracking_id: 'mylogId',
369
+ * // transaction_id: Transaction.identifier, // created transaction identifier
370
+ * },
371
+ * );
372
+ *
373
+ * expect(result).toEqual({
374
+ * token: jasmine.objectContaining({
375
+ * foreign: 'EURO',
376
+ * public: true,
377
+ * metadata: {
378
+ * customMetadata: true,
379
+ * },
380
+ * }),
381
+ * wallet: jasmine.objectContaining({
382
+ * default_allow_positive: false,
383
+ * default_allow_negative: true,
384
+ * foreign: 'EURO',
385
+ * metadata: null,
386
+ * type: 'token',
387
+ * }),
388
+ * });
389
+ *
390
+ * ```
391
+ *
392
+ * @param {CreateTokenFnInput} input
393
+ * @param {CreateTokenFnOptions} [options]
394
+ * @returns {StreamPromise<CreateTokenFnOutput>}
395
+ *
396
+ */
397
+ createToken(input: CreateTokenFnInput, options?: CreateTokenFnOptions): StreamPromise<CreateTokenFnOutput>;
398
+ /**
399
+ *
400
+ * Create a transfer of Token amount from one wallet to the other.
401
+ *
402
+ * ```javascript
403
+ *
404
+ * const result = await wapiClient.createTransfer({
405
+ * identifier: 'mynewtransferid',
406
+ * token: 'EUR',
407
+ * from_wallet: WALLETS.withEURFunds0.foreign,
408
+ * to_wallet: 'foreignForMbyExistingWallet',
409
+ * amount: 10.01,
410
+ * metadata: {
411
+ * customJSON: true,
412
+ * },
413
+ * type: 'transfer',
414
+ * status: 'pending',
415
+ * // transfer_group: TransferGroup.identifier,
416
+ * }, {
417
+ * create_to_wallet_if_not_exists: true,
418
+ * tracking_id: 'mylogId',
419
+ * // transaction_id: Transaction.identifier, // created transaction identifier
420
+ * });
421
+ *
422
+ * expect(result).toEqual({
423
+ * transfer: jasmine.objectContaining({
424
+ * identifier: 'mynewtransferid',
425
+ * token_foreign: 'EUR',
426
+ * from_wallet_foreign: WALLETS.withEURFunds0.foreign,
427
+ * to_wallet_foreign: 'foreignForMbyExistingWallet',
428
+ * amount: 10.01,
429
+ * metadata: {
430
+ * customJSON: true,
431
+ * },
432
+ * type: 'transfer',
433
+ * status: 'pending',
434
+ * // ...
435
+ * }),
436
+ * });
437
+ *
438
+ * ```
439
+ *
440
+ * @param {CreateTransferFnInput} [input]
441
+ * @param {CreateTransferFnOptions} [options]
442
+ * @returns {StreamPromise<CreateTransferFnOutput>}
443
+ *
444
+ */
445
+ createTransfer(input?: CreateTransferFnInput, options?: CreateTransferFnOptions): StreamPromise<CreateTransferFnOutput>;
446
+ /**
447
+ *
448
+ * Create a TransferGroup entity to group transfers into a logical or status locked group.
449
+ * Can include the transfers in the same call or if non 'closed' TransferGroup, add the transfers later.
450
+ * Can also include child TransferGroups to create a hierarchy
451
+ *
452
+ *
453
+ * ```javascript
454
+ *
455
+ * const result = await wapiClient.createTransferGroup({
456
+ * identifier: 'mytgIdentifier',
457
+ * status: 'closed',
458
+ * metadata: {
459
+ * customJSON: true,
460
+ * },
461
+ * transfer_status: 'finished',
462
+ * // transfer_group: ParentTransferGroup.identifier,
463
+ * children: [
464
+ * {
465
+ * identifier: 'txIdentifier',
466
+ * from_wallet: WALLETS.withEURFunds0.foreign,
467
+ * to_wallet: 'newWalletForeign',
468
+ * token: 'EUR',
469
+ * amount: 10,
470
+ * type: 'transfer',
471
+ * latest_control_hash: WALLETS.withEURFunds0.latest_control_hash,
472
+ * },
473
+ * {
474
+ * identifier: 'childTgTransferId',
475
+ * from_wallet: 'newWalletForeign',
476
+ * to_wallet: WALLETS.withEURFunds0.foreign,
477
+ * token: 'EUR',
478
+ * amount: 9,
479
+ * type: 'transfer',
480
+ * latest_control_hash: null, // not needed because we just transferred money there,
481
+ * },
482
+ * ],
483
+ * }, {
484
+ * validate_final_balance_only: true,
485
+ * create_to_wallet_if_not_exists: true,
486
+ * tracking_id: 'mylogId',
487
+ * // transaction_id: Transaction.identifier, // created transaction identifier
488
+ * });
489
+ *
490
+ * expect(result).toEqual(jasmine.objectContaining({
491
+ * transfer_group: jasmine.objectContaining({
492
+ * identifier: 'mytgIdentifier',
493
+ * status: 'closed',
494
+ * metadata: {
495
+ * customJSON: true,
496
+ * },
497
+ * transfer_status: 'finished',
498
+ * }),
499
+ * transfers: [
500
+ * jasmine.objectContaining({
501
+ * identifier: 'txIdentifier',
502
+ * from_wallet_foreign: WALLETS.withEURFunds0.foreign,
503
+ * to_wallet_foreign: 'newWalletForeign',
504
+ * token_foreign: 'EUR',
505
+ * amount: 10,
506
+ * type: 'transfer',
507
+ * }),
508
+ * jasmine.objectContaining({
509
+ * identifier: 'childTgTransferId',
510
+ * from_wallet_foreign: 'newWalletForeign',
511
+ * to_wallet_foreign: WALLETS.withEURFunds0.foreign,
512
+ * token_foreign: 'EUR',
513
+ * amount: 9,
514
+ * type: 'transfer',
515
+ * }),
516
+ * ],
517
+ * }));
518
+ *
519
+ *
520
+ * ```
521
+ *
522
+ * @param {CreateTransferGroupFnInput} input
523
+ * @param {CreateTransferGroupFnOptions} [options]
524
+ * @returns {StreamPromise<CreateTransferGroupFnOutput>}
525
+ *
526
+ */
527
+ createTransferGroup(input: CreateTransferGroupFnInput, options?: CreateTransferGroupFnOptions): StreamPromise<CreateTransferGroupFnOutput>;
528
+ /**
529
+ *
530
+ * Create multiple transfers with one call. Transfers are created in a transaction so it either succeeds or fails as one.
531
+ * Will respect internal balance transfers to avoid latest_control_hash
532
+ *
533
+ * ```javascript
534
+ *
535
+ * const result = await wapiClient.createTransfers({
536
+ * transfers: [{
537
+ * type: 'deposit',
538
+ * wallet: WALLETS.validForeign2,
539
+ * token: 'EURO',
540
+ * amount: 10.01,
541
+ * }, {
542
+ * from_wallet: WALLETS.validForeign2,
543
+ * to_wallet: 'newWalletForeignMby',
544
+ * token: 'EURO',
545
+ * amount: 10.01,
546
+ * latest_control_hash: null, // not required as we just transferred funds
547
+ * }, {
548
+ * type: 'withdrawal',
549
+ * wallet: 'newWalletForeignMby',
550
+ * token: 'EURO',
551
+ * amount: 10.01,
552
+ * latest_control_hash: null, // not required as we just transferred funds
553
+ * }],
554
+ * }, {
555
+ * create_to_wallet_if_not_exists: true,
556
+ * return_from_balance: true,
557
+ * return_to_balance: true,
558
+ * tracking_id: 'mylogId',
559
+ * // transaction_id: Transaction.identifier, // created transaction identifier
560
+ * });
561
+ *
562
+ * expect(result).toEqual(jasmine.objectContaining({
563
+ * transfers: [
564
+ * jasmine.objectContaining({
565
+ * type: 'deposit',
566
+ * token_foreign: 'EURO',
567
+ * to_wallet_foreign: WALLETS.validForeign2,
568
+ * amount: 10.01,
569
+ * }),
570
+ * jasmine.objectContaining({
571
+ * type: 'transfer',
572
+ * token_foreign: 'EURO',
573
+ * from_wallet_foreign: WALLETS.validForeign2,
574
+ * to_wallet_foreign: 'newWalletForeignMby',
575
+ * amount: 10.01,
576
+ * }),
577
+ * jasmine.objectContaining({
578
+ * type: 'withdrawal',
579
+ * token_foreign: 'EURO',
580
+ * from_wallet_foreign: 'newWalletForeignMby',
581
+ * amount: 10.01,
582
+ * }),
583
+ * ],
584
+ * // We are doing a 0 sum with 3 transactions so everything is back to 0
585
+ * from_balances: [
586
+ * jasmine.objectContaining({
587
+ * token_foreign: 'EURO',
588
+ * wallet_foreign: 'EURO',
589
+ * amount: 0,
590
+ * }),
591
+ * jasmine.objectContaining({
592
+ * token_foreign: 'EURO',
593
+ * wallet_foreign: WALLETS.validForeign2,
594
+ * amount: 0,
595
+ * }),
596
+ * jasmine.objectContaining({
597
+ * token_foreign: 'EURO',
598
+ * wallet_foreign: 'newWalletForeignMby',
599
+ * amount: 0,
600
+ * }),
601
+ * ],
602
+ * to_balances: [
603
+ * jasmine.objectContaining({
604
+ * token_foreign: 'EURO',
605
+ * wallet_foreign: WALLETS.validForeign2,
606
+ * amount: 0,
607
+ * }),
608
+ * jasmine.objectContaining({
609
+ * token_foreign: 'EURO',
610
+ * wallet_foreign: 'newWalletForeignMby',
611
+ * amount: 0,
612
+ * }),
613
+ * jasmine.objectContaining({
614
+ * token_foreign: 'EURO',
615
+ * wallet_foreign: 'EURO',
616
+ * amount: 0,
617
+ * }),
618
+ * ],
619
+ * }));
620
+ *
621
+ *
622
+ * ```
623
+ *
624
+ * @param {CreateTransfersFnInput} input
625
+ * @param {CreateTransfersFnOptions} [options]
626
+ * @returns {StreamPromise<CreateTransfersFnOutput>}
627
+ *
628
+ */
629
+ createTransfers(input: CreateTransfersFnInput, options?: CreateTransfersFnOptions): StreamPromise<CreateTransfersFnOutput>;
630
+ /**
631
+ *
632
+ * Create a Wallet entity which can then transfer amounts of Tokens.
633
+ *
634
+ * ```javascript
635
+ *
636
+ * const result = await wapiClient.createWallet({
637
+ * foreign: 'test-wallet-2',
638
+ * name: 'Irrelevant',
639
+ * metadata: {
640
+ * awesome: true,
641
+ * invalid: false,
642
+ * },
643
+ * }, {
644
+ * tracking_id: 'mylogId',
645
+ * // transaction_id: Transaction.identifier, // created transaction identifier
646
+ * });
647
+ *
648
+ * expect(result).toEqual({
649
+ * wallet: jasmine.objectContaining({
650
+ * foreign: 'test-wallet-2',
651
+ * name: 'Irrelevant',
652
+ * metadata: {
653
+ * awesome: true,
654
+ * invalid: false,
655
+ * },
656
+ * }),
657
+ * });
658
+ *
659
+ *
660
+ * ```
661
+ *
662
+ * @param {CreateWalletFnInput} input
663
+ * @param {CreateWalletFnOptions} [options]
664
+ * @returns {StreamPromise<CreateWalletFnOutput>}
665
+ *
666
+ */
667
+ createWallet(input: CreateWalletFnInput, options?: CreateWalletFnOptions): StreamPromise<CreateWalletFnOutput>;
668
+ /**
669
+ *
670
+ * Create a transfer withdrawing funds from a Wallet.
671
+ * Will default to transferring funds to Token default Wallet.
672
+ *
673
+ * ```javascript
674
+ *
675
+ * const result = await wapiClient.createWithdrawal({
676
+ * identifier: 'mycustomId',
677
+ * token: 'ForeignForToken',
678
+ * wallet: 'ForeignForWallet',
679
+ * amount: 10.01,
680
+ * metadata: {
681
+ * customJsonBlob: true,
682
+ * },
683
+ * status: 'finished',
684
+ * latest_control_hash: null,
685
+ * // transfer_group: TransferGroup.identifier, // existing transfer group identifier
686
+ * }, {
687
+ * tracking_id: 'mylogId',
688
+ * // transaction_id: Transaction.identifier, // created transaction identifier
689
+ * return_balance: true,
690
+ * });
691
+ *
692
+ * expect(result).toEqual({
693
+ * transfer: jasmine.objectContaining({
694
+ * identifier: 'mycustomId',
695
+ * token_foreign: 'ForeignForToken',
696
+ * from_wallet_foreign: 'ForeignForWallet',
697
+ * amount: 10.01,
698
+ * metadata: {
699
+ * customJsonBlob: true,
700
+ * },
701
+ * status: 'finished',
702
+ * // ... other fields
703
+ * }),
704
+ * from_balance: jasmine.objectContaining({
705
+ * token_foreign: 'ForeignForToken',
706
+ * wallet_foreign: 'ForeignForWallet',
707
+ * pending_amount: 0,
708
+ * finished_amount: 89.99,
709
+ * amount: 89.99,
710
+ * // ... other fields
711
+ * }),
712
+ * });
713
+ *
714
+ * ```
715
+ *
716
+ * @param {CreateWithdrawalFnInput} input
717
+ * @param {CreateWithdrawalFnOptions} [options]
718
+ * @returns {StreamPromise<CreateWithdrawalFnOutput>}
719
+ *
720
+ */
721
+ createWithdrawal(input: CreateWithdrawalFnInput, options?: CreateWithdrawalFnOptions): StreamPromise<CreateWithdrawalFnOutput>;
722
+ /**
723
+ *
724
+ * Search for Balances using either a simple filter or queryBuilder
725
+ *
726
+ *
727
+ * ```javascript
728
+ *
729
+ * const result = await wapiClient.findBalances()
730
+ * .where({
731
+ * wallet: WALLETS.validId0,
732
+ * })
733
+ * .orWhere('amount', '>', 100)
734
+ * .orWhere({
735
+ * wallet: WALLETS.validId1,
736
+ * token: 'USD',
737
+ * })
738
+ * .orWhere(builder => {
739
+ * builder.where('updated_at', '<', '2020-01-01')
740
+ * .where('amount', '<', -1000000);
741
+ * })
742
+ * .limit(5)
743
+ * .offset(0)
744
+ * .orderBy('amount', 'desc')
745
+ * .options({
746
+ * tracking_id: 'hello',
747
+ * return_metadata_total: true,
748
+ * });
749
+ *
750
+ * ```
751
+ *
752
+ * @param {FindBalancesFnInput} [input]
753
+ * @param {FindBalancesFnOptions} [options]
754
+ * @returns {StreamPromise<FindBalancesFnOutput>}
755
+ *
756
+ */
757
+ findBalances(): QueryBuilder<FindBalancesFnFields, FindBalancesFnStringFields, FindBalancesFnMetadataFields, FindBalancesFnResultFields, FindBalancesFnOptions, FindBalancesFnOutput>;
758
+ findBalances(input: FindBalancesFnInput, options?: FindBalancesFnOptions): StreamPromise<FindBalancesFnOutput>;
759
+ /**
760
+ *
761
+ * Search for Tokens using either a simple filter or queryBuilder
762
+ *
763
+ *
764
+ * ```javascript
765
+ *
766
+ * const result = await wapiClient.findTokens()
767
+ * .where({
768
+ * metadata: {
769
+ * even: true,
770
+ * example: 'test',
771
+ * },
772
+ * })
773
+ * .orWhere({
774
+ * foreign: 'token-example1',
775
+ * })
776
+ * .limit(5)
777
+ * .offset(0)
778
+ * .orderBy(['foreign', {column: 'id', order: 'desc'}])
779
+ * .options({
780
+ * tracking_id: 'hello',
781
+ * return_metadata_total: true,
782
+ * });
783
+ *
784
+ * ```
785
+ *
786
+ * @param {FindTokensFnInput} [input]
787
+ * @param {FindTokensFnOptions} [options]
788
+ * @returns {StreamPromise<FindTokensFnOutput>}
789
+ *
790
+ */
791
+ findTokens(): QueryBuilder<FindTokensFnFields, FindTokensFnStringFields, FindTokensFnMetadataFields, FindTokensFnResultFields, FindTokensFnOptions, FindTokensFnOutput>;
792
+ findTokens(input: FindTokensFnInput, options?: FindTokensFnOptions): StreamPromise<FindTokensFnOutput>;
793
+ /**
794
+ *
795
+ * Search for TransferGroups using either a simple filter or queryBuilder
796
+ *
797
+ *
798
+ * ```javascript
799
+ *
800
+ * const result = await wapiClient.findTransferGroups()
801
+ * .where({
802
+ * metadata: {
803
+ * even: true,
804
+ * example: 'test',
805
+ * },
806
+ * })
807
+ * .orWhere({
808
+ * identifier: 'reverser-example',
809
+ * })
810
+ * .orWhere(builder => {
811
+ * builder.where({
812
+ * metadata: {
813
+ * kak: true,
814
+ * },
815
+ * })
816
+ * .where('created_at', '>', '2020-01-01');
817
+ * })
818
+ * .limit(5)
819
+ * .offset(0)
820
+ * .orderBy('id', 'desc')
821
+ * .select('id', 'type', 'identifier')
822
+ * .options({
823
+ * tracking_id: 'hello',
824
+ * return_metadata_total: true,
825
+ * });
826
+ *
827
+ * ```
828
+ *
829
+ * @param {FindTransferGroupsFnInput} [input]
830
+ * @param {FindTransferGroupsFnOptions} [options]
831
+ * @returns {StreamPromise<FindTransferGroupsFnOutput>}
832
+ *
833
+ */
834
+ findTransferGroups(): QueryBuilder<FindTransferGroupsFnFields, FindTransferGroupsFnStringFields, FindTransferGroupsFnMetadataFields, FindTransferGroupsFnResultFields, FindTransferGroupsFnOptions, FindTransferGroupsFnOutput>;
835
+ findTransferGroups(input: FindTransferGroupsFnInput, options?: FindTransferGroupsFnOptions): StreamPromise<FindTransferGroupsFnOutput>;
836
+ /**
837
+ *
838
+ * Search for Transfers using either a simple filter or queryBuilder
839
+ *
840
+ *
841
+ * ```javascript
842
+ *
843
+ * const result = await wapiClient.findTransfers()
844
+ * .where({
845
+ * metadata: {
846
+ * example: true,
847
+ * },
848
+ * })
849
+ * .where('id', '>', 1)
850
+ * .where(builder => {
851
+ * builder.where('status', 'finished')
852
+ * .orWhere('type', 'deposit');
853
+ * })
854
+ * .limit(5)
855
+ * .offset(0)
856
+ * .orderBy(['token_id', {column: 'id', order: 'desc'}])
857
+ * .select('id', 'type', 'from_wallet_foreign', 'to_wallet_foreign')
858
+ * .options({
859
+ * tracking_id: 'hello',
860
+ * });
861
+ *
862
+ * ```
863
+ *
864
+ * @param {FindTransfersFnInput} [input]
865
+ * @param {FindTransfersFnOptions} [options]
866
+ * @returns {StreamPromise<FindTransfersFnOutput>}
867
+ *
868
+ */
869
+ findTransfers(): QueryBuilder<FindTransfersFnFields, FindTransfersFnStringFields, FindTransfersFnMetadataFields, FindTransfersFnResultFields, FindTransfersFnOptions, FindTransfersFnOutput>;
870
+ findTransfers(input: FindTransfersFnInput, options?: FindTransfersFnOptions): StreamPromise<FindTransfersFnOutput>;
871
+ /**
872
+ *
873
+ * Search for Wallets using either a simple filter or queryBuilder
874
+ *
875
+ *
876
+ * ```javascript
877
+ *
878
+ * const result = await wapiClient.findWallets()
879
+ * .where({
880
+ * metadata: {
881
+ * general: true,
882
+ * },
883
+ * })
884
+ * .where('id', '>', 1)
885
+ * .where(builder => {
886
+ * builder
887
+ * .whereMetadata('tost', 10)
888
+ * .orWhereMetadata('test', 1);
889
+ * })
890
+ * .limit(5)
891
+ * .offset(0)
892
+ * .orderBy(['status', {column: 'id', order: 'desc'}])
893
+ * .select('id')
894
+ * .options({
895
+ * tracking_id: 'hello',
896
+ * });
897
+ *
898
+ * ```
899
+ *
900
+ * @param {FindWalletsFnInput} [input]
901
+ * @param {FindWalletsFnOptions} [options]
902
+ * @returns {StreamPromise<FindWalletsFnOutput>}
903
+ *
904
+ */
905
+ findWallets(): QueryBuilder<FindWalletsFnFields, FindWalletsFnStringFields, FindWalletsFnMetadataFields, FindWalletsFnResultFields, FindWalletsFnOptions, FindWalletsFnOutput>;
906
+ findWallets(input: FindWalletsFnInput, options?: FindWalletsFnOptions): StreamPromise<FindWalletsFnOutput>;
907
+ /**
908
+ *
909
+ * Get a specific token/wallet balance
910
+ *
911
+ * ```javascript
912
+ *
913
+ * const result = await wapiClient.getBalance({
914
+ * wallet: 'myMbyExistingWallet',
915
+ * token: 'MBYTOKEN',
916
+ * datetime: '2020-01-01',
917
+ * }, {
918
+ * create_wallet_if_not_exists: true,
919
+ * create_token_if_not_exists: true,
920
+ * create_if_not_exists: true,
921
+ * tracking_id: 'mylogId',
922
+ * // transaction_id: Transaction.identifier, // created transaction identifier
923
+ * });
924
+ *
925
+ * expect(result).toEqual({
926
+ * balance: jasmine.objectContaining({
927
+ * wallet_foreign: 'myMbyExistingWallet',
928
+ * token_foreign: 'MBYTOKEN',
929
+ * pending_amount: 0,
930
+ * finished_amount: 0,
931
+ * amount: 0,
932
+ * latest_control_hash: null,
933
+ * available_balance: 0,
934
+ * // ...
935
+ * }),
936
+ * });
937
+ *
938
+ *
939
+ * ```
940
+ *
941
+ * @param {GetBalanceFnInput} input
942
+ * @param {GetBalanceFnOptions} [options]
943
+ * @returns {StreamPromise<GetBalanceFnOutput>}
944
+ *
945
+ */
946
+ getBalance(input: GetBalanceFnInput, options?: GetBalanceFnOptions): StreamPromise<GetBalanceFnOutput>;
947
+ /**
948
+ *
949
+ * Get a list of changes to token/wallet balance
950
+ *
951
+ * ```javascript
952
+ *
953
+ * // setup
954
+ * const deposit = await wapiClient.createDeposit({
955
+ * wallet: 'newWallet',
956
+ * amount: 10,
957
+ * status: 'pending',
958
+ * identifier: 'depositUSD',
959
+ * token: 'USD',
960
+ * }, {
961
+ * create_wallet_if_not_exists: true,
962
+ * });
963
+ * const updatedTransfer = await wapiClient.updateTransfer({
964
+ * transfer: 'depositUSD',
965
+ * status: 'finished',
966
+ * });
967
+ *
968
+ * const result = await wapiClient.getBalanceHistory({
969
+ * wallet: 'newWallet',
970
+ * token: 'USD',
971
+ * }, {
972
+ * create_token_if_not_exists: true,
973
+ * create_wallet_if_not_exists: true,
974
+ * limit: 5,
975
+ * select: [
976
+ * 'transfer_identifier',
977
+ * 'pending_amount',
978
+ * 'finished_amount',
979
+ * 'pending_amount_from',
980
+ * 'pending_amount_to',
981
+ * 'amount',
982
+ * // 'balance_id',
983
+ * // 'transfer_id',
984
+ * // 'transfer_control_hash',
985
+ * // 'transfer_from_wallet_id',
986
+ * // 'transfer_from_wallet_foreign',
987
+ * // 'transfer_to_wallet_id',
988
+ * // 'transfer_to_wallet_foreign',
989
+ * // 'transfer_amount',
990
+ * // 'transfer_type',
991
+ * // 'transfer_status',
992
+ * // 'transfer_force',
993
+ * // 'transfer_created_at',
994
+ * // 'transfer_updated_at',
995
+ * // 'transfer_metadata',
996
+ * // 'transfer_transfer_group_id',
997
+ * // 'transfer_transfer_group_identifier',
998
+ * // 'transfer_reverses_id',
999
+ * // 'transfer_reverses_identifier',
1000
+ * // 'transfer_status_finalized_at',
1001
+ * // 'token_id',
1002
+ * // 'token_foreign',
1003
+ * // 'wallet_id',
1004
+ * // 'wallet_foreign',
1005
+ * // 'latest_control_hash',
1006
+ * // 'updated_at',
1007
+ * ],
1008
+ * offset: 0,
1009
+ * order: 'desc',
1010
+ * return_metadata_total: true,
1011
+ * tracking_id: 'mylogId',
1012
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1013
+ * });
1014
+ * expect(result).toEqual({
1015
+ * balances: [
1016
+ * {
1017
+ * transfer_identifier: 'depositUSD',
1018
+ * pending_amount: 0,
1019
+ * finished_amount: 10,
1020
+ * pending_amount_to: 0,
1021
+ * pending_amount_from: 0,
1022
+ * amount: 10,
1023
+ * },
1024
+ * {
1025
+ * transfer_identifier: 'depositUSD',
1026
+ * pending_amount: 10,
1027
+ * finished_amount: 0,
1028
+ * pending_amount_to: 10,
1029
+ * pending_amount_from: 0,
1030
+ * amount: 10,
1031
+ * },
1032
+ * ],
1033
+ * metadata: {
1034
+ * limit: 5,
1035
+ * offset: 0,
1036
+ * total: 2,
1037
+ * more_rows: false,
1038
+ * },
1039
+ * });
1040
+ *
1041
+ * ```
1042
+ *
1043
+ * @param {GetBalanceHistoryFnInput} input
1044
+ * @param {GetBalanceHistoryFnOptions} [options]
1045
+ * @returns {StreamPromise<GetBalanceHistoryFnOutput>}
1046
+ *
1047
+ */
1048
+ getBalanceHistory(input: GetBalanceHistoryFnInput, options?: GetBalanceHistoryFnOptions): StreamPromise<GetBalanceHistoryFnOutput>;
1049
+ /**
1050
+ *
1051
+ * Retrieve the current state of configurable Flags for your WAPI instance
1052
+ *
1053
+ * ```javascript
1054
+ *
1055
+ * const result = await wapiClient.getFlags();
1056
+ * expect(result.flags).toEqual({
1057
+ * production: true,
1058
+ * allow_timestamps: false,
1059
+ * });
1060
+ *
1061
+ * ```
1062
+ *
1063
+ * @param {GetFlagsFnInput} [input]
1064
+ * @param {GetFlagsFnOptions} [options]
1065
+ * @returns {StreamPromise<GetFlagsFnOutput>}
1066
+ *
1067
+ */
1068
+ getFlags(input?: GetFlagsFnInput, options?: GetFlagsFnOptions): StreamPromise<GetFlagsFnOutput>;
1069
+ /**
1070
+ *
1071
+ * Get aggregated statistics about WAPI entities
1072
+ *
1073
+ * ```javascript
1074
+ *
1075
+ * const result = await wapiClient.getStatistics({
1076
+ * model: 'Transfer',
1077
+ * aggregator: 'count',
1078
+ * groups: [{
1079
+ * type: 'period',
1080
+ * field: {
1081
+ * period: 'month',
1082
+ * timezone: 'Europe/Tallinn',
1083
+ * },
1084
+ * }],
1085
+ * filter: {
1086
+ * end_time: (new Date(`${new Date().getFullYear() + 1}-01-01`)).toISOString(),
1087
+ * start_time: (new Date(`${new Date().getFullYear()}-01-01`)).toISOString(),
1088
+ * },
1089
+ * }, {
1090
+ * tracking_id: 'mylogId',
1091
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1092
+ * });
1093
+ *
1094
+ * expect(result).toEqual({
1095
+ * rows: [
1096
+ * {
1097
+ * aggregate: 3,
1098
+ * period: `${new Date().getFullYear()}-${(new Date().getMonth() + 1 + '').padStart(2, '0')}`,
1099
+ * },
1100
+ * ],
1101
+ * });
1102
+ *
1103
+ * ```
1104
+ *
1105
+ * @param {GetStatisticsFnInput} [input]
1106
+ * @param {GetStatisticsFnOptions} [options]
1107
+ * @returns {StreamPromise<GetStatisticsFnOutput>}
1108
+ *
1109
+ */
1110
+ getStatistics(input?: GetStatisticsFnInput, options?: GetStatisticsFnOptions): StreamPromise<GetStatisticsFnOutput>;
1111
+ /**
1112
+ *
1113
+ * Get information about token
1114
+ *
1115
+ * ```javascript
1116
+ *
1117
+ * const result = await wapiClient.getToken({
1118
+ * foreign: 'EURO',
1119
+ * }, {
1120
+ * create_if_not_exists: true,
1121
+ * // return_only_id: true, // for example purposes we want more than id
1122
+ * ignore_cache: true,
1123
+ * tracking_id: 'mylogId',
1124
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1125
+ * });
1126
+ *
1127
+ * expect(result).toEqual({
1128
+ * token: jasmine.objectContaining({
1129
+ * foreign: 'EURO',
1130
+ * metadata: null,
1131
+ * }),
1132
+ * });
1133
+ *
1134
+ * ```
1135
+ *
1136
+ * @param {GetTokenFnInput} [input]
1137
+ * @param {GetTokenFnOptions} [options]
1138
+ * @returns {StreamPromise<GetTokenFnOutput>}
1139
+ *
1140
+ */
1141
+ getToken(input?: GetTokenFnInput, options?: GetTokenFnOptions): StreamPromise<GetTokenFnOutput>;
1142
+ /**
1143
+ *
1144
+ * Get information about a specific transfer
1145
+ *
1146
+ * ```javascript
1147
+ *
1148
+ * const result = await wapiClient.getTransfer({
1149
+ * transfer: 'get-transfer-test',
1150
+ * }, {
1151
+ * tracking_id: 'mylogId',
1152
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1153
+ * });
1154
+ * expect(result).toEqual({
1155
+ * transfer: jasmine.objectContaining({
1156
+ * identifier: 'get-transfer-test',
1157
+ * // ...
1158
+ * }),
1159
+ * });
1160
+ *
1161
+ * ```
1162
+ *
1163
+ * @param {GetTransferFnInput} input
1164
+ * @param {GetTransferFnOptions} [options]
1165
+ * @returns {StreamPromise<GetTransferFnOutput>}
1166
+ *
1167
+ */
1168
+ getTransfer(input: GetTransferFnInput, options?: GetTransferFnOptions): StreamPromise<GetTransferFnOutput>;
1169
+ /**
1170
+ *
1171
+ * Get TransferGroup information
1172
+ *
1173
+ * ```javascript
1174
+ *
1175
+ * const result = await wapiClient.getTransferGroup({
1176
+ * transfer_group: 'customIdentifier',
1177
+ * }, {
1178
+ * create_if_not_exists: true,
1179
+ * // return_only_id: true, // example requires more than just ID
1180
+ * tracking_id: 'mylogId',
1181
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1182
+ * });
1183
+ * expect(result).toEqual({
1184
+ * transfer_group: jasmine.objectContaining({
1185
+ * identifier: 'customIdentifier',
1186
+ * metadata: null,
1187
+ * status: 'open',
1188
+ * transfer_status: 'pending',
1189
+ * status_finalized_at: null,
1190
+ * transfer_status_finalized_at: null,
1191
+ * reverses_id: null,
1192
+ * }),
1193
+ * });
1194
+ *
1195
+ * ```
1196
+ *
1197
+ * @param {GetTransferGroupFnInput} input
1198
+ * @param {GetTransferGroupFnOptions} [options]
1199
+ * @returns {StreamPromise<GetTransferGroupFnOutput>}
1200
+ *
1201
+ */
1202
+ getTransferGroup(input: GetTransferGroupFnInput, options?: GetTransferGroupFnOptions): StreamPromise<GetTransferGroupFnOutput>;
1203
+ /**
1204
+ *
1205
+ * Get information about wallet
1206
+ *
1207
+ * ```javascript
1208
+ *
1209
+ * const result = await wapiClient.getWallet({
1210
+ * wallet: WALLETS.withEURFunds0.foreign,
1211
+ * }, {
1212
+ * tracking_id: 'mylogId',
1213
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1214
+ * ignore_cache: true,
1215
+ * create_if_not_exists: true,
1216
+ * return_only_id: false,
1217
+ * });
1218
+ * expect(result).toEqual({
1219
+ * wallet: jasmine.objectContaining({
1220
+ * foreign: WALLETS.withEURFunds0.foreign,
1221
+ * }),
1222
+ * });
1223
+ *
1224
+ * ```
1225
+ *
1226
+ * @param {GetWalletFnInput} input
1227
+ * @param {GetWalletFnOptions} [options]
1228
+ * @returns {StreamPromise<GetWalletFnOutput>}
1229
+ *
1230
+ */
1231
+ getWallet(input: GetWalletFnInput, options?: GetWalletFnOptions): StreamPromise<GetWalletFnOutput>;
1232
+ /**
1233
+ *
1234
+ *
1235
+ * ```javascript
1236
+ *
1237
+ * const result = await wapiClient.importData().input(async (stream) => {
1238
+ * const fileStream = createReadStream(join(__dirname, '../lib/short-import.txt'));
1239
+ *
1240
+ * const rl = createInterface({
1241
+ * input: fileStream,
1242
+ * crlfDelay: Infinity
1243
+ * });
1244
+ * for await (const line of rl) {
1245
+ * // Each line in input.txt will be successively available here as `line`.
1246
+ * if (!line) {
1247
+ * continue;
1248
+ * }
1249
+ * const obj = JSON.parse(line);
1250
+ * stream.write(obj);
1251
+ * }
1252
+ * stream.end();
1253
+ * });
1254
+ *
1255
+ * ```
1256
+ *
1257
+ * @param {ImportDataFnInput} [input]
1258
+ * @param {ImportDataFnOptions} [options]
1259
+ * @returns {StreamPromise<ImportDataFnOutput>}
1260
+ *
1261
+ */
1262
+ importData(options?: ImportDataFnOptions): StreamPromiseInput<ImportDataFnOutput, ImportDataFnStreamChunk>;
1263
+ importData(input: ImportDataFnInput, options?: ImportDataFnOptions): StreamPromise<ImportDataFnOutput>;
1264
+ /**
1265
+ *
1266
+ * Reverse a transfer of value between two wallets
1267
+ * will cancel pending transfers and create opposite transfers for finished ones.
1268
+ *
1269
+ * ```javascript
1270
+ *
1271
+ * const result = await wapiClient.reverseTransfer({
1272
+ * transfer: 'MYDEPOSIT',
1273
+ * status: 'finished',
1274
+ * identifier: 'MYREVERSEDEPOSIT',
1275
+ * force: true,
1276
+ * // metadata: {},
1277
+ * metadata: {
1278
+ * extraCustomJSON: true,
1279
+ * },
1280
+ * }, {
1281
+ * reverse_deposit: true,
1282
+ * reverse_withdrawal: true,
1283
+ * return_to_balance: true,
1284
+ * return_from_balance: true,
1285
+ * metadata_action: 'extend',
1286
+ * tracking_id: 'mylogId',
1287
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1288
+ * });
1289
+ * expect(result).toEqual({
1290
+ * transfer: jasmine.objectContaining({
1291
+ * identifier: 'MYREVERSEDEPOSIT',
1292
+ * amount: 10.01,
1293
+ * type: 'withdrawal',
1294
+ * status: 'finished',
1295
+ * force: true,
1296
+ * metadata: {
1297
+ * customJSON: true,
1298
+ * extraCustomJSON: true,
1299
+ * },
1300
+ * transfer_group_id: null,
1301
+ * reverses_id: DEPOSIT.id,
1302
+ * from_wallet_foreign: DEPOSIT.to_wallet_foreign,
1303
+ * to_wallet_foreign: DEPOSIT.from_wallet_foreign,
1304
+ * token_foreign: DEPOSIT.token_foreign,
1305
+ * // ...
1306
+ * }),
1307
+ * to_balance: jasmine.objectContaining({
1308
+ * token_foreign: DEPOSIT.token_foreign,
1309
+ * wallet_foreign: DEPOSIT.from_wallet_foreign,
1310
+ * // ...
1311
+ * }),
1312
+ * from_balance: jasmine.objectContaining({
1313
+ * token_foreign: DEPOSIT.token_foreign,
1314
+ * wallet_foreign: DEPOSIT.to_wallet_foreign,
1315
+ * // ...
1316
+ * }),
1317
+ * });
1318
+ *
1319
+ * ```
1320
+ *
1321
+ * @param {ReverseTransferFnInput} input
1322
+ * @param {ReverseTransferFnOptions} [options]
1323
+ * @returns {StreamPromise<ReverseTransferFnOutput>}
1324
+ *
1325
+ */
1326
+ reverseTransfer(input: ReverseTransferFnInput, options?: ReverseTransferFnOptions): StreamPromise<ReverseTransferFnOutput>;
1327
+ /**
1328
+ *
1329
+ * Similar to reverseTransfer will reverse value transfers, however it will reverse the whole
1330
+ * group with its children by creating a new group with opposite transfers.
1331
+ *
1332
+ * ```javascript
1333
+ *
1334
+ * // Should succeed if flag is set
1335
+ * const result = await wapiClient.reverseTransferGroup({
1336
+ * transfer_group: 'myCustom',
1337
+ * identifier: 'myCustomReverse',
1338
+ * metadata: {
1339
+ * extraCustomJSON: true,
1340
+ * },
1341
+ * transfer_status: 'finished',
1342
+ * }, {
1343
+ * validate_final_balance_only: true,
1344
+ * reverse_deposit: true,
1345
+ * reverse_withdrawal: true,
1346
+ * return_transfers: true,
1347
+ * metadata_action: 'extend',
1348
+ * transfer_metadata_action: 'extend',
1349
+ * tracking_id: 'mylogId',
1350
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1351
+ * });
1352
+ *
1353
+ * expect(result).toEqual({
1354
+ * transfer_group: jasmine.objectContaining({
1355
+ * identifier: 'myCustomReverse',
1356
+ * status: 'closed',
1357
+ * metadata: {
1358
+ * customJSON: true,
1359
+ * extraCustomJSON: true,
1360
+ * },
1361
+ * transfer_status: 'finished',
1362
+ * }),
1363
+ * transfers: [
1364
+ * jasmine.objectContaining({
1365
+ * from_wallet_foreign: 'myWallet2',
1366
+ * to_wallet_foreign: 'myWallet1',
1367
+ * amount: 8,
1368
+ * type: 'transfer',
1369
+ * status: 'finished',
1370
+ * token_foreign: 'EUR',
1371
+ * }),
1372
+ * jasmine.objectContaining({
1373
+ * from_wallet_foreign: 'myWallet1',
1374
+ * to_wallet_foreign: 'EUR',
1375
+ * amount: 10,
1376
+ * type: 'withdrawal',
1377
+ * status: 'finished',
1378
+ * token_foreign: 'EUR',
1379
+ * }),
1380
+ * ],
1381
+ * });
1382
+ *
1383
+ * ```
1384
+ *
1385
+ * @param {ReverseTransferGroupFnInput} input
1386
+ * @param {ReverseTransferGroupFnOptions} [options]
1387
+ * @returns {StreamPromise<ReverseTransferGroupFnOutput>}
1388
+ *
1389
+ */
1390
+ reverseTransferGroup(input: ReverseTransferGroupFnInput, options?: ReverseTransferGroupFnOptions): StreamPromise<ReverseTransferGroupFnOutput>;
1391
+ /**
1392
+ *
1393
+ *
1394
+ * ```javascript
1395
+ *
1396
+ * const [[finishedTransfer1], [finishedTransfer2]] = await Promise.all([
1397
+ * TEST.knex('transfers').insert({
1398
+ * identifier: getTxIdSync(),
1399
+ * auto_hash: true,
1400
+ * amount: toNumberInput(10.12),
1401
+ * status: 'finished',
1402
+ * metadata: {
1403
+ * example: 'test'
1404
+ * },
1405
+ * from_wallet_id: WALLETS.withEURFunds0.id,
1406
+ * to_wallet_id: WALLETS.validId1,
1407
+ * token_id: TOKENS.EUR.id,
1408
+ * }).returning('*'),
1409
+ * TEST.knex('transfers').insert({
1410
+ * identifier: getTxIdSync(),
1411
+ * auto_hash: true,
1412
+ * amount: toNumberInput(10.12),
1413
+ * status: 'finished',
1414
+ * metadata: {
1415
+ * example: 'test'
1416
+ * },
1417
+ * from_wallet_id: WALLETS.withEURFunds0.id,
1418
+ * to_wallet_id: WALLETS.validId1,
1419
+ * token_id: TOKENS.EUR.id,
1420
+ * }).returning('*'),
1421
+ * ]);
1422
+ *
1423
+ * const result = await wapiClient.reverseTransfers({
1424
+ * metadata: {
1425
+ * example: 'test'
1426
+ * },
1427
+ * });
1428
+ *
1429
+ * const { transfers } = result;
1430
+ * expect(transfers.length).toEqual(2);
1431
+ *
1432
+ * expect(transfers[0].identifier).not.toEqual(finishedTransfer1.identifier);
1433
+ * expect(transfers[0].amount).toEqual(formatNumber(finishedTransfer1.amount));
1434
+ * expect(transfers[0].from_wallet_id).toEqual(finishedTransfer1.to_wallet_id);
1435
+ * expect(transfers[0].to_wallet_id).toEqual(finishedTransfer1.from_wallet_id);
1436
+ *
1437
+ * expect(transfers[1].identifier).not.toEqual(finishedTransfer2.identifier);
1438
+ * expect(transfers[1].amount).toEqual(formatNumber(finishedTransfer2.amount));
1439
+ * expect(transfers[1].from_wallet_id).toEqual(finishedTransfer2.to_wallet_id);
1440
+ * expect(transfers[1].to_wallet_id).toEqual(finishedTransfer2.from_wallet_id);
1441
+ *
1442
+ * ```
1443
+ *
1444
+ * @param {ReverseTransfersFnInput} [input]
1445
+ * @param {ReverseTransfersFnOptions} [options]
1446
+ * @returns {StreamPromise<ReverseTransfersFnOutput>}
1447
+ *
1448
+ */
1449
+ reverseTransfers(): ReverseQueryBuilder<ReverseTransfersFnFields, ReverseTransfersFnStringFields, ReverseTransfersFnMetadataFields, ReverseTransfersFnModifications, ReverseTransfersFnOutput>;
1450
+ reverseTransfers(input: ReverseTransfersFnInput, options?: ReverseTransfersFnOptions): StreamPromise<ReverseTransfersFnOutput>;
1451
+ /**
1452
+ *
1453
+ * Configure WAPI instance Flags
1454
+ *
1455
+ * ```javascript
1456
+ *
1457
+ * const result = await wapiClient.setFlags({
1458
+ * production: false,
1459
+ * allow_timestamps: true,
1460
+ * }, {
1461
+ * tracking_id: 'mylog',
1462
+ * });
1463
+ * expect(result).toEqual({
1464
+ * flags: {
1465
+ * production: false,
1466
+ * allow_timestamps: true,
1467
+ * },
1468
+ * message: 'flag updated, reconnect to apply',
1469
+ * });
1470
+ *
1471
+ * ```
1472
+ *
1473
+ * @param {SetFlagsFnInput} input
1474
+ * @param {SetFlagsFnOptions} [options]
1475
+ * @returns {StreamPromise<SetFlagsFnOutput>}
1476
+ *
1477
+ */
1478
+ setFlags(input: SetFlagsFnInput, options?: SetFlagsFnOptions): StreamPromise<SetFlagsFnOutput>;
1479
+ /**
1480
+ * Update token object
1481
+ *
1482
+ * ```javascript
1483
+ *
1484
+ * const result = await wapiClient.updateToken(
1485
+ * {
1486
+ * token: TOKENS.EUR.foreign,
1487
+ * public: false,
1488
+ * metadata: {
1489
+ * metadata_field: 2,
1490
+ * },
1491
+ * status: 'disabled',
1492
+ * },
1493
+ * {
1494
+ * return_when_not_updated: true,
1495
+ * tracking_id: 'mylogId',
1496
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1497
+ * },
1498
+ * );
1499
+ * expect(result).toEqual({
1500
+ * token: jasmine.objectContaining({
1501
+ * belongs_to: TOKENS.EUR.belongs_to,
1502
+ * divisor: TOKENS.EUR.divisor,
1503
+ * id: TOKENS.EUR.id,
1504
+ * limit: TOKENS.EUR.limit,
1505
+ * metadata: {
1506
+ * metadata_field: 2,
1507
+ * },
1508
+ * type: TOKENS.EUR.type,
1509
+ * foreign: TOKENS.EUR.foreign,
1510
+ * public: false,
1511
+ * status: 'disabled',
1512
+ * }),
1513
+ * updated: true,
1514
+ * });
1515
+ *
1516
+ * ```
1517
+ *
1518
+ * @param {UpdateTokenFnInput} input
1519
+ * @param {UpdateTokenFnOptions} [options]
1520
+ * @returns {StreamPromise<UpdateTokenFnOutput>}
1521
+ *
1522
+ */
1523
+ updateToken(input: UpdateTokenFnInput, options?: UpdateTokenFnOptions): StreamPromise<UpdateTokenFnOutput>;
1524
+ /**
1525
+ *
1526
+ * Update the status of a Transfer (pending to finished or cancelled)
1527
+ *
1528
+ * ```javascript
1529
+ *
1530
+ * const result = await wapiClient.updateTransfer({
1531
+ * transfer: 'myPendingDeposit',
1532
+ * status: 'cancelled',
1533
+ * metadata: {
1534
+ * meta: 'new',
1535
+ * was: true,
1536
+ * },
1537
+ * }, {
1538
+ * return_from_balance: true,
1539
+ * return_to_balance: true,
1540
+ * return_when_not_updated: true,
1541
+ * metadata_action: 'extend',
1542
+ * tracking_id: 'mylogId',
1543
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1544
+ * });
1545
+ * expect(result).toEqual({
1546
+ * transfer: jasmine.objectContaining({
1547
+ * identifier: 'myPendingDeposit',
1548
+ * amount: 10.01,
1549
+ * type: 'deposit',
1550
+ * status: 'cancelled',
1551
+ * transfer_group_id: null,
1552
+ * reverses_id: null,
1553
+ * from_wallet_foreign: 'EURO',
1554
+ * to_wallet_foreign: 'myWallet',
1555
+ * token_foreign: 'EURO',
1556
+ * metadata: {
1557
+ * meta: 'new',
1558
+ * is: true,
1559
+ * was: true,
1560
+ * }
1561
+ * }),
1562
+ * to_balance: jasmine.objectContaining({
1563
+ * token_foreign: 'EURO',
1564
+ * wallet_foreign: 'myWallet',
1565
+ * pending_amount: 0,
1566
+ * finished_amount: 0,
1567
+ * amount: 0,
1568
+ * }),
1569
+ * from_balance: jasmine.objectContaining({
1570
+ * token_foreign: 'EURO',
1571
+ * wallet_foreign: 'EURO',
1572
+ * pending_amount: 0,
1573
+ * finished_amount: 0,
1574
+ * amount: 0,
1575
+ * }),
1576
+ * updated: true,
1577
+ * });
1578
+ *
1579
+ * ```
1580
+ *
1581
+ * @param {UpdateTransferFnInput} input
1582
+ * @param {UpdateTransferFnOptions} [options]
1583
+ * @returns {StreamPromise<UpdateTransferFnOutput>}
1584
+ *
1585
+ */
1586
+ updateTransfer(input: UpdateTransferFnInput, options?: UpdateTransferFnOptions): StreamPromise<UpdateTransferFnOutput>;
1587
+ /**
1588
+ *
1589
+ * Update the status and transfer_status of a TransferGroup
1590
+ *
1591
+ * ```javascript
1592
+ *
1593
+ * const result = await wapiClient.updateTransferGroup({
1594
+ * transfer_group: 'myCustom',
1595
+ * status: 'closed',
1596
+ * transfer_status: 'finished',
1597
+ * }, {
1598
+ * return_transfers: true,
1599
+ * return_when_not_updated: true,
1600
+ * tracking_id: 'mylogId',
1601
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1602
+ * });
1603
+ * expect(result).toEqual({
1604
+ * transfer_group: jasmine.objectContaining({
1605
+ * identifier: 'myCustom',
1606
+ * status: 'closed',
1607
+ * transfer_status: 'finished',
1608
+ * }),
1609
+ * transfers: [
1610
+ * jasmine.objectContaining({
1611
+ * identifier: 'transferA',
1612
+ * type: 'deposit',
1613
+ * status: 'finished',
1614
+ * from_wallet_foreign: 'EUR',
1615
+ * to_wallet_foreign: 'myWallet1',
1616
+ * token_foreign: 'EUR',
1617
+ * }),
1618
+ * jasmine.objectContaining({
1619
+ * identifier: 'transferB',
1620
+ * type: 'transfer',
1621
+ * status: 'finished',
1622
+ * from_wallet_foreign: 'myWallet1',
1623
+ * to_wallet_foreign: 'myWallet2',
1624
+ * token_foreign: 'EUR',
1625
+ * }),
1626
+ * ],
1627
+ * updated: true,
1628
+ * });
1629
+ *
1630
+ * ```
1631
+ *
1632
+ * @param {UpdateTransferGroupFnInput} input
1633
+ * @param {UpdateTransferGroupFnOptions} [options]
1634
+ * @returns {StreamPromise<UpdateTransferGroupFnOutput>}
1635
+ *
1636
+ */
1637
+ updateTransferGroup(input: UpdateTransferGroupFnInput, options?: UpdateTransferGroupFnOptions): StreamPromise<UpdateTransferGroupFnOutput>;
1638
+ /**
1639
+ *
1640
+ *
1641
+ * ```javascript
1642
+ *
1643
+ * const result = await wapiClient.updateTransferGroups()
1644
+ * .where({
1645
+ * status: 'open',
1646
+ * })
1647
+ * .whereIn('identifier', ['transferGroup1', 'transferGroup2'])
1648
+ * .whereMetadata('old', 'data')
1649
+ * .update({
1650
+ * transfer_status: 'finished',
1651
+ * })
1652
+ * .options({
1653
+ * return_transfers: true,
1654
+ * });
1655
+ *
1656
+ * ```
1657
+ *
1658
+ * @param {UpdateTransferGroupsFnInput} [input]
1659
+ * @param {UpdateTransferGroupsFnOptions} [options]
1660
+ * @returns {StreamPromise<UpdateTransferGroupsFnOutput>}
1661
+ *
1662
+ */
1663
+ updateTransferGroups(): UpdateQueryBuilder<UpdateTransferGroupsFnFields, UpdateTransferGroupsFnStringFields, UpdateTransferGroupsFnMetadataFields, UpdateTransferGroupsFnResultFields, UpdateTransferGroupsFnUpdateFields, UpdateTransferGroupsFnOutput>;
1664
+ updateTransferGroups(input: UpdateTransferGroupsFnInput, options?: UpdateTransferGroupsFnOptions): StreamPromise<UpdateTransferGroupsFnOutput>;
1665
+ /**
1666
+ *
1667
+ *
1668
+ * ```javascript
1669
+ *
1670
+ * const result = await wapiClient.updateTransfers({
1671
+ * metadata: {
1672
+ * example: 'test',
1673
+ * },
1674
+ * wallet: WALLETS.validId1.foreign,
1675
+ * token: 'EUR',
1676
+ * update: {
1677
+ * status: 'finished',
1678
+ * },
1679
+ * });
1680
+ *
1681
+ * expect(result.transfers.length).toEqual(1);
1682
+ * expect(result.transfers[0].status).toEqual('finished');
1683
+ * expect(result.updated).toEqual(true);
1684
+ *
1685
+ * ```
1686
+ *
1687
+ * @param {UpdateTransfersFnInput} [input]
1688
+ * @param {UpdateTransfersFnOptions} [options]
1689
+ * @returns {StreamPromise<UpdateTransfersFnOutput>}
1690
+ *
1691
+ */
1692
+ updateTransfers(): UpdateQueryBuilder<UpdateTransfersFnFields, UpdateTransfersFnStringFields, UpdateTransfersFnMetadataFields, UpdateTransfersFnResultFields, UpdateTransfersFnUpdateFields, UpdateTransfersFnOutput>;
1693
+ updateTransfers(input: UpdateTransfersFnInput, options?: UpdateTransfersFnOptions): StreamPromise<UpdateTransfersFnOutput>;
1694
+ /**
1695
+ * Update Wallet
1696
+ *
1697
+ * ```javascript
1698
+ *
1699
+ * const result = await wapiClient.updateWallet(
1700
+ * {
1701
+ * wallet: WALLETS.withEURFunds0.foreign,
1702
+ * name: 'WT4',
1703
+ * status: 'disabled',
1704
+ * metadata: {
1705
+ * metadata_number: 2,
1706
+ * },
1707
+ * },
1708
+ * {
1709
+ * return_when_not_updated: true,
1710
+ * tracking_id: 'mylogId',
1711
+ * // transaction_id: Transaction.identifier, // created transaction identifier
1712
+ * },
1713
+ * );
1714
+ * expect(result).toEqual({
1715
+ * wallet: jasmine.objectContaining({
1716
+ * id: WALLETS.withEURFunds0.id,
1717
+ * foreign: WALLETS.withEURFunds0.foreign,
1718
+ * name: 'WT4',
1719
+ * metadata: {metadata_number: 2},
1720
+ * type: WALLETS.withEURFunds0.type,
1721
+ * status: 'disabled',
1722
+ * default_allow_negative: false,
1723
+ * default_allow_positive: true,
1724
+ * default_dtw_from: '011',
1725
+ * default_dtw_to: '110',
1726
+ * }),
1727
+ * updated: true,
1728
+ * });
1729
+ *
1730
+ * ```
1731
+ *
1732
+ * @param {UpdateWalletFnInput} input
1733
+ * @param {UpdateWalletFnOptions} [options]
1734
+ * @returns {StreamPromise<UpdateWalletFnOutput>}
1735
+ *
1736
+ */
1737
+ updateWallet(input: UpdateWalletFnInput, options?: UpdateWalletFnOptions): StreamPromise<UpdateWalletFnOutput>;
1738
+ }
1739
+ export declare function createClientWithWS(opts: WapiConnectionOptions, config?: ClientConfig): Client;
1740
+ export declare function createClientWithHttp(opts: WapiHttpConnectionOptions, config?: ClientConfig): Client;