wapi-client 0.4.0 → 0.5.0

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