wapi-client 0.10.0 → 0.10.4

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.
@@ -90,28 +90,30 @@ var BaseClient = class {
90
90
  this.$connect = $connect;
91
91
  }
92
92
  _setConnected(value) {
93
- this.isConnected = value;
94
- if (this.isConnected && this._error !== false) {
93
+ this.$connect = void 0;
94
+ if (value && this._error !== false) {
95
95
  this._error = false;
96
96
  }
97
- if (this.isConnected && this.hooks.connected) {
97
+ if (!this.isConnected && value && this.hooks.connected) {
98
98
  this.hooks.connected(this.socId);
99
99
  }
100
- if (!this.isConnected && this.hooks.disconnected) {
100
+ if (this.isConnected && !value && this.hooks.disconnected) {
101
101
  this.hooks.disconnected();
102
102
  }
103
+ this.isConnected = value;
103
104
  }
104
105
  _setErrored(err) {
105
106
  this._error = err;
106
- if (this.isConnected) {
107
- this._setConnected(false);
108
- }
107
+ this._setConnected(false);
108
+ }
109
+ _clearError() {
110
+ this._error = void 0;
109
111
  }
110
112
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
111
113
  _send(input) {
112
114
  throw new Error("This method must be implemented by child class");
113
115
  }
114
- _reconnect() {
116
+ _reconnect(nrOfAttempts) {
115
117
  throw new Error("This method must be implemented by child class");
116
118
  }
117
119
  close() {
@@ -222,11 +224,14 @@ var BaseClient = class {
222
224
  }
223
225
  return new import_stream_promise.StreamPromise((stream) => __async(this, null, function* () {
224
226
  if (this._error) {
225
- this._reconnect();
227
+ this._reconnect(5);
226
228
  }
227
229
  if (!this.isConnected) {
228
230
  yield this.$connect;
229
231
  }
232
+ if (this._error) {
233
+ throw this._error;
234
+ }
230
235
  this._requests.set(jsonRpcMessage.id, {
231
236
  stream,
232
237
  start: Date.now()
@@ -288,11 +293,14 @@ var BaseClient = class {
288
293
  }
289
294
  return new import_stream_promise_input.StreamPromiseInput((stream) => __async(this, null, function* () {
290
295
  if (this._error) {
291
- this._reconnect();
296
+ this._reconnect(5);
292
297
  }
293
298
  if (!this.isConnected) {
294
299
  yield this.$connect;
295
300
  }
301
+ if (this._error) {
302
+ throw this._error;
303
+ }
296
304
  let timeout = setTimeout(() => {
297
305
  stream.push({
298
306
  error: new import_errors.StreamError("INPUT_STREAM_TIMEOUT", { streamId })
@@ -77,28 +77,30 @@ var BaseClient = class {
77
77
  this.$connect = $connect;
78
78
  }
79
79
  _setConnected(value) {
80
- this.isConnected = value;
81
- if (this.isConnected && this._error !== false) {
80
+ this.$connect = void 0;
81
+ if (value && this._error !== false) {
82
82
  this._error = false;
83
83
  }
84
- if (this.isConnected && this.hooks.connected) {
84
+ if (!this.isConnected && value && this.hooks.connected) {
85
85
  this.hooks.connected(this.socId);
86
86
  }
87
- if (!this.isConnected && this.hooks.disconnected) {
87
+ if (this.isConnected && !value && this.hooks.disconnected) {
88
88
  this.hooks.disconnected();
89
89
  }
90
+ this.isConnected = value;
90
91
  }
91
92
  _setErrored(err) {
92
93
  this._error = err;
93
- if (this.isConnected) {
94
- this._setConnected(false);
95
- }
94
+ this._setConnected(false);
95
+ }
96
+ _clearError() {
97
+ this._error = void 0;
96
98
  }
97
99
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
100
  _send(input) {
99
101
  throw new Error("This method must be implemented by child class");
100
102
  }
101
- _reconnect() {
103
+ _reconnect(nrOfAttempts) {
102
104
  throw new Error("This method must be implemented by child class");
103
105
  }
104
106
  close() {
@@ -209,11 +211,14 @@ var BaseClient = class {
209
211
  }
210
212
  return new StreamPromise((stream) => __async(this, null, function* () {
211
213
  if (this._error) {
212
- this._reconnect();
214
+ this._reconnect(5);
213
215
  }
214
216
  if (!this.isConnected) {
215
217
  yield this.$connect;
216
218
  }
219
+ if (this._error) {
220
+ throw this._error;
221
+ }
217
222
  this._requests.set(jsonRpcMessage.id, {
218
223
  stream,
219
224
  start: Date.now()
@@ -275,11 +280,14 @@ var BaseClient = class {
275
280
  }
276
281
  return new StreamPromiseInput((stream) => __async(this, null, function* () {
277
282
  if (this._error) {
278
- this._reconnect();
283
+ this._reconnect(5);
279
284
  }
280
285
  if (!this.isConnected) {
281
286
  yield this.$connect;
282
287
  }
288
+ if (this._error) {
289
+ throw this._error;
290
+ }
283
291
  let timeout = setTimeout(() => {
284
292
  stream.push({
285
293
  error: new StreamError("INPUT_STREAM_TIMEOUT", { streamId })
@@ -90,28 +90,30 @@ var BaseClient = class {
90
90
  this.$connect = $connect;
91
91
  }
92
92
  _setConnected(value) {
93
- this.isConnected = value;
94
- if (this.isConnected && this._error !== false) {
93
+ this.$connect = void 0;
94
+ if (value && this._error !== false) {
95
95
  this._error = false;
96
96
  }
97
- if (this.isConnected && this.hooks.connected) {
97
+ if (!this.isConnected && value && this.hooks.connected) {
98
98
  this.hooks.connected(this.socId);
99
99
  }
100
- if (!this.isConnected && this.hooks.disconnected) {
100
+ if (this.isConnected && !value && this.hooks.disconnected) {
101
101
  this.hooks.disconnected();
102
102
  }
103
+ this.isConnected = value;
103
104
  }
104
105
  _setErrored(err) {
105
106
  this._error = err;
106
- if (this.isConnected) {
107
- this._setConnected(false);
108
- }
107
+ this._setConnected(false);
108
+ }
109
+ _clearError() {
110
+ this._error = void 0;
109
111
  }
110
112
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
111
113
  _send(input) {
112
114
  throw new Error("This method must be implemented by child class");
113
115
  }
114
- _reconnect() {
116
+ _reconnect(nrOfAttempts) {
115
117
  throw new Error("This method must be implemented by child class");
116
118
  }
117
119
  close() {
@@ -222,11 +224,14 @@ var BaseClient = class {
222
224
  }
223
225
  return new import_stream_promise.StreamPromise((stream) => __async(this, null, function* () {
224
226
  if (this._error) {
225
- this._reconnect();
227
+ this._reconnect(5);
226
228
  }
227
229
  if (!this.isConnected) {
228
230
  yield this.$connect;
229
231
  }
232
+ if (this._error) {
233
+ throw this._error;
234
+ }
230
235
  this._requests.set(jsonRpcMessage.id, {
231
236
  stream,
232
237
  start: Date.now()
@@ -288,11 +293,14 @@ var BaseClient = class {
288
293
  }
289
294
  return new import_stream_promise_input.StreamPromiseInput((stream) => __async(this, null, function* () {
290
295
  if (this._error) {
291
- this._reconnect();
296
+ this._reconnect(5);
292
297
  }
293
298
  if (!this.isConnected) {
294
299
  yield this.$connect;
295
300
  }
301
+ if (this._error) {
302
+ throw this._error;
303
+ }
296
304
  let timeout = setTimeout(() => {
297
305
  stream.push({
298
306
  error: new import_errors.StreamError("INPUT_STREAM_TIMEOUT", { streamId })
@@ -60,6 +60,7 @@ export interface ClientHooks {
60
60
  connected?: (socId: undefined | string) => void;
61
61
  disconnected?: () => void;
62
62
  reconnect?: () => void | boolean;
63
+ reconnectError?: (err: Error) => void;
63
64
  preflight?: (msg: JSONRPCRequest) => void | boolean;
64
65
  message?: (msg: JSONRPCResponse) => void;
65
66
  }
@@ -80,8 +81,9 @@ export declare class BaseClient {
80
81
  constructor(connection: WebSocket | HttpConnectionClient, connectionType: WapiClientType, $connect?: Promise<ISocketId>);
81
82
  protected _setConnected(value: boolean): void;
82
83
  protected _setErrored(err: Error): void;
84
+ protected _clearError(): void;
83
85
  protected _send(input: JSONRPCRequest | JSONRPCResponse): void;
84
- protected _reconnect(): void;
86
+ protected _reconnect(nrOfAttempts?: number | undefined): void;
85
87
  close(): Promise<void>;
86
88
  protected _connectionLost(): void;
87
89
  protected _handleMessage(incoming: JSONRPCResponse | JSONRPCRequest): void;
@@ -77,28 +77,30 @@ var BaseClient = class {
77
77
  this.$connect = $connect;
78
78
  }
79
79
  _setConnected(value) {
80
- this.isConnected = value;
81
- if (this.isConnected && this._error !== false) {
80
+ this.$connect = void 0;
81
+ if (value && this._error !== false) {
82
82
  this._error = false;
83
83
  }
84
- if (this.isConnected && this.hooks.connected) {
84
+ if (!this.isConnected && value && this.hooks.connected) {
85
85
  this.hooks.connected(this.socId);
86
86
  }
87
- if (!this.isConnected && this.hooks.disconnected) {
87
+ if (this.isConnected && !value && this.hooks.disconnected) {
88
88
  this.hooks.disconnected();
89
89
  }
90
+ this.isConnected = value;
90
91
  }
91
92
  _setErrored(err) {
92
93
  this._error = err;
93
- if (this.isConnected) {
94
- this._setConnected(false);
95
- }
94
+ this._setConnected(false);
95
+ }
96
+ _clearError() {
97
+ this._error = void 0;
96
98
  }
97
99
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
100
  _send(input) {
99
101
  throw new Error("This method must be implemented by child class");
100
102
  }
101
- _reconnect() {
103
+ _reconnect(nrOfAttempts) {
102
104
  throw new Error("This method must be implemented by child class");
103
105
  }
104
106
  close() {
@@ -209,11 +211,14 @@ var BaseClient = class {
209
211
  }
210
212
  return new StreamPromise((stream) => __async(this, null, function* () {
211
213
  if (this._error) {
212
- this._reconnect();
214
+ this._reconnect(5);
213
215
  }
214
216
  if (!this.isConnected) {
215
217
  yield this.$connect;
216
218
  }
219
+ if (this._error) {
220
+ throw this._error;
221
+ }
217
222
  this._requests.set(jsonRpcMessage.id, {
218
223
  stream,
219
224
  start: Date.now()
@@ -275,11 +280,14 @@ var BaseClient = class {
275
280
  }
276
281
  return new StreamPromiseInput((stream) => __async(this, null, function* () {
277
282
  if (this._error) {
278
- this._reconnect();
283
+ this._reconnect(5);
279
284
  }
280
285
  if (!this.isConnected) {
281
286
  yield this.$connect;
282
287
  }
288
+ if (this._error) {
289
+ throw this._error;
290
+ }
283
291
  let timeout = setTimeout(() => {
284
292
  stream.push({
285
293
  error: new StreamError("INPUT_STREAM_TIMEOUT", { streamId })
@@ -180,18 +180,24 @@ var WsClient = class extends import_base_client.BaseClient {
180
180
  };
181
181
  this._heartbeat();
182
182
  }
183
- _reconnect() {
183
+ _reconnect(nrOfAttempts) {
184
184
  (0, import_debug.debugLog)("reconnect(),tryToReconnect:", this._tryToReconnect);
185
185
  if (!this._tryToReconnect) {
186
186
  return;
187
187
  }
188
- if (this.hooks.reconnect && !this.hooks.reconnect()) {
188
+ if (this.hooks.reconnect && this.hooks.reconnect() === false) {
189
189
  (0, import_debug.debugLog)("reconnect hook returned false");
190
190
  return;
191
191
  }
192
- const nrOfAttempts = window.WAPI_RECONNECT_ATTEMPTS && parseInt(window.WAPI_RECONNECT_ATTEMPTS) || 10;
192
+ if (this.$connect) {
193
+ (0, import_debug.debugLog)("already connecting");
194
+ return;
195
+ }
196
+ super._clearError();
197
+ nrOfAttempts != null ? nrOfAttempts : nrOfAttempts = window.WAPI_RECONNECT_ATTEMPTS && parseInt(window.WAPI_RECONNECT_ATTEMPTS) || 10;
193
198
  const maxWaitTime = window.WAPI_MAX_RECONNECT_WAIT && parseInt(window.WAPI_MAX_RECONNECT_WAIT) || 1e4;
194
199
  this.$connect = (() => __async(this, null, function* () {
200
+ var _a2, _b;
195
201
  let _id;
196
202
  for (let i = 0; i < nrOfAttempts + 1; i++) {
197
203
  try {
@@ -203,11 +209,12 @@ var WsClient = class extends import_base_client.BaseClient {
203
209
  this._ready();
204
210
  break;
205
211
  } catch (err) {
206
- if (err.code === import_errors.ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code) {
207
- throw err;
208
- }
209
- if (i > nrOfAttempts - 1) {
210
- throw err;
212
+ const isAuthError = err.code === import_errors.ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code;
213
+ const outOfAttempts = i > nrOfAttempts - 1;
214
+ if (isAuthError || outOfAttempts) {
215
+ this._setErrored(err);
216
+ (_b = (_a2 = this.hooks).reconnectError) == null ? void 0 : _b.call(_a2, err);
217
+ break;
211
218
  }
212
219
  yield (0, import_utils.wait)(Math.min(Math.pow(1.5, i) * 1e3, maxWaitTime));
213
220
  }
@@ -158,18 +158,24 @@ var WsClient = class extends BaseClient {
158
158
  };
159
159
  this._heartbeat();
160
160
  }
161
- _reconnect() {
161
+ _reconnect(nrOfAttempts) {
162
162
  debugLog("reconnect(),tryToReconnect:", this._tryToReconnect);
163
163
  if (!this._tryToReconnect) {
164
164
  return;
165
165
  }
166
- if (this.hooks.reconnect && !this.hooks.reconnect()) {
166
+ if (this.hooks.reconnect && this.hooks.reconnect() === false) {
167
167
  debugLog("reconnect hook returned false");
168
168
  return;
169
169
  }
170
- const nrOfAttempts = window.WAPI_RECONNECT_ATTEMPTS && parseInt(window.WAPI_RECONNECT_ATTEMPTS) || 10;
170
+ if (this.$connect) {
171
+ debugLog("already connecting");
172
+ return;
173
+ }
174
+ super._clearError();
175
+ nrOfAttempts != null ? nrOfAttempts : nrOfAttempts = window.WAPI_RECONNECT_ATTEMPTS && parseInt(window.WAPI_RECONNECT_ATTEMPTS) || 10;
171
176
  const maxWaitTime = window.WAPI_MAX_RECONNECT_WAIT && parseInt(window.WAPI_MAX_RECONNECT_WAIT) || 1e4;
172
177
  this.$connect = (() => __async(this, null, function* () {
178
+ var _a2, _b;
173
179
  let _id;
174
180
  for (let i = 0; i < nrOfAttempts + 1; i++) {
175
181
  try {
@@ -181,11 +187,12 @@ var WsClient = class extends BaseClient {
181
187
  this._ready();
182
188
  break;
183
189
  } catch (err) {
184
- if (err.code === ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code) {
185
- throw err;
186
- }
187
- if (i > nrOfAttempts - 1) {
188
- throw err;
190
+ const isAuthError = err.code === ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code;
191
+ const outOfAttempts = i > nrOfAttempts - 1;
192
+ if (isAuthError || outOfAttempts) {
193
+ this._setErrored(err);
194
+ (_b = (_a2 = this.hooks).reconnectError) == null ? void 0 : _b.call(_a2, err);
195
+ break;
189
196
  }
190
197
  yield wait(Math.min(Math.pow(1.5, i) * 1e3, maxWaitTime));
191
198
  }
@@ -61,7 +61,7 @@ var import_base_client = require('./base-client.cjs');
61
61
  var import_connection = require('./connection/connection.enums.cjs');
62
62
  var import__ = require('../index.cjs');
63
63
  var _a;
64
- var CLIENT_VERSION = (_a = '0.10.0') != null ? _a : "";
64
+ var CLIENT_VERSION = (_a = '0.10.4') != null ? _a : "";
65
65
  function createWsClient(opts) {
66
66
  const initialConnection = createConnection(opts);
67
67
  return new WsClient(initialConnection, opts);
@@ -186,18 +186,24 @@ var WsClient = class extends import_base_client.BaseClient {
186
186
  };
187
187
  this._heartbeat();
188
188
  }
189
- _reconnect() {
189
+ _reconnect(nrOfAttempts) {
190
190
  (0, import_debug.debugLog)("reconnect(),tryToReconnect:", this._tryToReconnect);
191
191
  if (!this._tryToReconnect) {
192
192
  return;
193
193
  }
194
- if (this.hooks.reconnect && !this.hooks.reconnect()) {
194
+ if (this.hooks.reconnect && this.hooks.reconnect() === false) {
195
195
  (0, import_debug.debugLog)("reconnect hook returned false");
196
196
  return;
197
197
  }
198
- const nrOfAttempts = process.env.WAPI_RECONNECT_ATTEMPTS && parseInt(process.env.WAPI_RECONNECT_ATTEMPTS) || 10;
198
+ if (this.$connect) {
199
+ (0, import_debug.debugLog)("already connecting");
200
+ return;
201
+ }
202
+ super._clearError();
203
+ nrOfAttempts != null ? nrOfAttempts : nrOfAttempts = process.env.WAPI_RECONNECT_ATTEMPTS && parseInt(process.env.WAPI_RECONNECT_ATTEMPTS) || 10;
199
204
  const maxWaitTime = process.env.WAPI_MAX_RECONNECT_WAIT && parseInt(process.env.WAPI_MAX_RECONNECT_WAIT) || 1e4;
200
205
  this.$connect = (() => __async(this, null, function* () {
206
+ var _a2, _b;
201
207
  let _id;
202
208
  for (let i = 0; i < nrOfAttempts + 1; i++) {
203
209
  try {
@@ -209,11 +215,12 @@ var WsClient = class extends import_base_client.BaseClient {
209
215
  this._ready();
210
216
  break;
211
217
  } catch (err) {
212
- if (err.code === import_errors.ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code) {
213
- throw err;
214
- }
215
- if (i > nrOfAttempts - 1) {
216
- throw err;
218
+ const isAuthError = err.code === import_errors.ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code;
219
+ const outOfAttempts = i > nrOfAttempts - 1;
220
+ if (isAuthError || outOfAttempts) {
221
+ this._setErrored(err);
222
+ (_b = (_a2 = this.hooks).reconnectError) == null ? void 0 : _b.call(_a2, err);
223
+ break;
217
224
  }
218
225
  yield (0, import_utils.wait)(Math.min(Math.pow(1.5, i) * 1e3, maxWaitTime));
219
226
  }
@@ -20,7 +20,7 @@ export declare class WsClient extends BaseClient {
20
20
  constructor(initial: ConnectionWPromise, config: WapiConnectionOptions);
21
21
  protected _setErrored(err: Error | AuthenticationError): void;
22
22
  private _ready;
23
- protected _reconnect(): void;
23
+ protected _reconnect(nrOfAttempts?: number | undefined): void;
24
24
  private _heartbeat;
25
25
  protected _send(input: JSONRPCRequest | JSONRPCResponse): void;
26
26
  close(): Promise<void>;
@@ -31,7 +31,7 @@ import {
31
31
  } from "./connection/connection.enums";
32
32
  import { WapiClientType } from "../index";
33
33
  var _a;
34
- var CLIENT_VERSION = (_a = '0.10.0') != null ? _a : "";
34
+ var CLIENT_VERSION = (_a = '0.10.4') != null ? _a : "";
35
35
  function createWsClient(opts) {
36
36
  const initialConnection = createConnection(opts);
37
37
  return new WsClient(initialConnection, opts);
@@ -156,18 +156,24 @@ var WsClient = class extends BaseClient {
156
156
  };
157
157
  this._heartbeat();
158
158
  }
159
- _reconnect() {
159
+ _reconnect(nrOfAttempts) {
160
160
  debugLog("reconnect(),tryToReconnect:", this._tryToReconnect);
161
161
  if (!this._tryToReconnect) {
162
162
  return;
163
163
  }
164
- if (this.hooks.reconnect && !this.hooks.reconnect()) {
164
+ if (this.hooks.reconnect && this.hooks.reconnect() === false) {
165
165
  debugLog("reconnect hook returned false");
166
166
  return;
167
167
  }
168
- const nrOfAttempts = process.env.WAPI_RECONNECT_ATTEMPTS && parseInt(process.env.WAPI_RECONNECT_ATTEMPTS) || 10;
168
+ if (this.$connect) {
169
+ debugLog("already connecting");
170
+ return;
171
+ }
172
+ super._clearError();
173
+ nrOfAttempts != null ? nrOfAttempts : nrOfAttempts = process.env.WAPI_RECONNECT_ATTEMPTS && parseInt(process.env.WAPI_RECONNECT_ATTEMPTS) || 10;
169
174
  const maxWaitTime = process.env.WAPI_MAX_RECONNECT_WAIT && parseInt(process.env.WAPI_MAX_RECONNECT_WAIT) || 1e4;
170
175
  this.$connect = (() => __async(this, null, function* () {
176
+ var _a2, _b;
171
177
  let _id;
172
178
  for (let i = 0; i < nrOfAttempts + 1; i++) {
173
179
  try {
@@ -179,11 +185,12 @@ var WsClient = class extends BaseClient {
179
185
  this._ready();
180
186
  break;
181
187
  } catch (err) {
182
- if (err.code === ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code) {
183
- throw err;
184
- }
185
- if (i > nrOfAttempts - 1) {
186
- throw err;
188
+ const isAuthError = err.code === ERROR_GROUPS.AUTH.ERRORS.AUTHENTICATION_ERROR.code;
189
+ const outOfAttempts = i > nrOfAttempts - 1;
190
+ if (isAuthError || outOfAttempts) {
191
+ this._setErrored(err);
192
+ (_b = (_a2 = this.hooks).reconnectError) == null ? void 0 : _b.call(_a2, err);
193
+ break;
187
194
  }
188
195
  yield wait(Math.min(Math.pow(1.5, i) * 1e3, maxWaitTime));
189
196
  }
@@ -778,6 +778,49 @@ var Client = class {
778
778
  /**
779
779
  *
780
780
  *
781
+ * ```javascript
782
+ *
783
+ * // setup
784
+ * await wapiClient.createDeposit(
785
+ * {
786
+ * wallet: 'newWallet',
787
+ * amount: 10,
788
+ * status: 'pending',
789
+ * identifier: 'depositUSD',
790
+ * token: 'USD',
791
+ * },
792
+ * {
793
+ * create_wallet_if_not_exists: true,
794
+ * },
795
+ * );
796
+ * await wapiClient.updateTransfer({
797
+ * transfer: 'depositUSD',
798
+ * status: 'finished',
799
+ * });
800
+ *
801
+ * const result = await wapiClient.exportBalanceHistory(
802
+ * {
803
+ * wallet: 'newWallet',
804
+ * token: 'USD',
805
+ * },
806
+ * {
807
+ * limit: 0,
808
+ * select: [
809
+ * 'transfer_identifier',
810
+ * 'pending_amount',
811
+ * 'finished_amount',
812
+ * 'pending_amount_from',
813
+ * 'pending_amount_to',
814
+ * 'amount',
815
+ * ],
816
+ * offset: 0,
817
+ * order: 'desc',
818
+ * tracking_id: 'mylogId',
819
+ * // transaction_id: Transaction.identifier, // created transaction identifier
820
+ * },
821
+ * );
822
+ *
823
+ * ```
781
824
  *
782
825
  * @param {ExportBalanceHistoryFnInput} input
783
826
  * @param {ExportBalanceHistoryFnOptions} [options]
@@ -762,6 +762,49 @@ var Client = class {
762
762
  /**
763
763
  *
764
764
  *
765
+ * ```javascript
766
+ *
767
+ * // setup
768
+ * await wapiClient.createDeposit(
769
+ * {
770
+ * wallet: 'newWallet',
771
+ * amount: 10,
772
+ * status: 'pending',
773
+ * identifier: 'depositUSD',
774
+ * token: 'USD',
775
+ * },
776
+ * {
777
+ * create_wallet_if_not_exists: true,
778
+ * },
779
+ * );
780
+ * await wapiClient.updateTransfer({
781
+ * transfer: 'depositUSD',
782
+ * status: 'finished',
783
+ * });
784
+ *
785
+ * const result = await wapiClient.exportBalanceHistory(
786
+ * {
787
+ * wallet: 'newWallet',
788
+ * token: 'USD',
789
+ * },
790
+ * {
791
+ * limit: 0,
792
+ * select: [
793
+ * 'transfer_identifier',
794
+ * 'pending_amount',
795
+ * 'finished_amount',
796
+ * 'pending_amount_from',
797
+ * 'pending_amount_to',
798
+ * 'amount',
799
+ * ],
800
+ * offset: 0,
801
+ * order: 'desc',
802
+ * tracking_id: 'mylogId',
803
+ * // transaction_id: Transaction.identifier, // created transaction identifier
804
+ * },
805
+ * );
806
+ *
807
+ * ```
765
808
  *
766
809
  * @param {ExportBalanceHistoryFnInput} input
767
810
  * @param {ExportBalanceHistoryFnOptions} [options]
package/dist/client.cjs CHANGED
@@ -66,7 +66,7 @@ var import_errors = require('./lib/errors.cjs');
66
66
  var import_fns = require('./fns/index.cjs');
67
67
  var import_import_data = require('./fns/import-data/import-data.guards.cjs');
68
68
  var _a;
69
- var CLIENT_VERSION = (_a = '0.10.0') != null ? _a : "";
69
+ var CLIENT_VERSION = (_a = '0.10.4') != null ? _a : "";
70
70
  var Client = class {
71
71
  /**
72
72
  * @internal
@@ -778,6 +778,49 @@ var Client = class {
778
778
  /**
779
779
  *
780
780
  *
781
+ * ```javascript
782
+ *
783
+ * // setup
784
+ * await wapiClient.createDeposit(
785
+ * {
786
+ * wallet: 'newWallet',
787
+ * amount: 10,
788
+ * status: 'pending',
789
+ * identifier: 'depositUSD',
790
+ * token: 'USD',
791
+ * },
792
+ * {
793
+ * create_wallet_if_not_exists: true,
794
+ * },
795
+ * );
796
+ * await wapiClient.updateTransfer({
797
+ * transfer: 'depositUSD',
798
+ * status: 'finished',
799
+ * });
800
+ *
801
+ * const result = await wapiClient.exportBalanceHistory(
802
+ * {
803
+ * wallet: 'newWallet',
804
+ * token: 'USD',
805
+ * },
806
+ * {
807
+ * limit: 0,
808
+ * select: [
809
+ * 'transfer_identifier',
810
+ * 'pending_amount',
811
+ * 'finished_amount',
812
+ * 'pending_amount_from',
813
+ * 'pending_amount_to',
814
+ * 'amount',
815
+ * ],
816
+ * offset: 0,
817
+ * order: 'desc',
818
+ * tracking_id: 'mylogId',
819
+ * // transaction_id: Transaction.identifier, // created transaction identifier
820
+ * },
821
+ * );
822
+ *
823
+ * ```
781
824
  *
782
825
  * @param {ExportBalanceHistoryFnInput} input
783
826
  * @param {ExportBalanceHistoryFnOptions} [options]