wapi-client 0.8.12 → 0.9.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 (79) hide show
  1. package/dist/api/base-client.browser.cjs +12 -15
  2. package/dist/api/base-client.browser.js +13 -18
  3. package/dist/api/base-client.cjs +12 -15
  4. package/dist/api/base-client.js +13 -18
  5. package/dist/api/jsonrpc/jsonrpc.enums.d.ts +5 -4
  6. package/dist/api/ws-client.browser.cjs +3 -11
  7. package/dist/api/ws-client.browser.js +4 -16
  8. package/dist/api/ws-client.cjs +4 -12
  9. package/dist/api/ws-client.js +5 -17
  10. package/dist/client.browser.cjs +2 -5
  11. package/dist/client.browser.js +3 -6
  12. package/dist/client.cjs +3 -6
  13. package/dist/client.js +4 -7
  14. package/dist/fns/create-deposit/create-deposit.browser.cjs +1 -4
  15. package/dist/fns/create-deposit/create-deposit.browser.js +2 -5
  16. package/dist/fns/create-deposit/create-deposit.cjs +1 -4
  17. package/dist/fns/create-deposit/create-deposit.js +2 -5
  18. package/dist/fns/create-withdrawal/create-withdrawal.browser.cjs +1 -4
  19. package/dist/fns/create-withdrawal/create-withdrawal.browser.js +2 -5
  20. package/dist/fns/create-withdrawal/create-withdrawal.cjs +1 -4
  21. package/dist/fns/create-withdrawal/create-withdrawal.js +2 -5
  22. package/dist/fns/find-transfers/find-transfers.browser.cjs +8 -20
  23. package/dist/fns/find-transfers/find-transfers.browser.js +9 -21
  24. package/dist/fns/find-transfers/find-transfers.cjs +8 -20
  25. package/dist/fns/find-transfers/find-transfers.js +9 -21
  26. package/dist/fns/get-balance/get-balance.browser.cjs +2 -8
  27. package/dist/fns/get-balance/get-balance.browser.js +3 -9
  28. package/dist/fns/get-balance/get-balance.cjs +2 -8
  29. package/dist/fns/get-balance/get-balance.js +3 -9
  30. package/dist/fns/get-balance-history/get-balance-history.browser.cjs +1 -4
  31. package/dist/fns/get-balance-history/get-balance-history.browser.js +2 -5
  32. package/dist/fns/get-balance-history/get-balance-history.cjs +1 -4
  33. package/dist/fns/get-balance-history/get-balance-history.js +2 -5
  34. package/dist/fns/get-token/get-token.browser.cjs +1 -4
  35. package/dist/fns/get-token/get-token.browser.js +2 -5
  36. package/dist/fns/get-token/get-token.cjs +1 -4
  37. package/dist/fns/get-token/get-token.js +2 -5
  38. package/dist/fns/import-data/import-data.cjs +2 -5
  39. package/dist/fns/import-data/import-data.js +3 -6
  40. package/dist/fns/import-data/import-data.node.browser.cjs +2 -5
  41. package/dist/fns/import-data/import-data.node.browser.js +3 -6
  42. package/dist/fns/import-data/import-data.node.cjs +2 -5
  43. package/dist/fns/import-data/import-data.node.js +3 -6
  44. package/dist/fns/set-flags/set-flags.browser.cjs +3 -3
  45. package/dist/fns/set-flags/set-flags.browser.js +3 -3
  46. package/dist/fns/set-flags/set-flags.cjs +3 -3
  47. package/dist/fns/set-flags/set-flags.js +3 -3
  48. package/dist/index.browser.cjs +13 -1
  49. package/dist/index.browser.js +25 -1
  50. package/dist/index.cjs +25 -1
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +25 -1
  53. package/dist/lib/errors.browser.cjs +642 -214
  54. package/dist/lib/errors.browser.js +645 -214
  55. package/dist/lib/errors.cjs +652 -218
  56. package/dist/lib/errors.d.ts +1411 -342
  57. package/dist/lib/errors.js +645 -214
  58. package/dist/lib/isomorphic/web/streams.browser.cjs +3 -0
  59. package/dist/lib/isomorphic/web/streams.browser.js +3 -0
  60. package/dist/lib/query-builder.browser.cjs +2 -2
  61. package/dist/lib/query-builder.browser.js +2 -2
  62. package/dist/lib/query-builder.cjs +2 -2
  63. package/dist/lib/query-builder.js +2 -2
  64. package/dist/lib/stream-promise.browser.cjs +3 -4
  65. package/dist/lib/stream-promise.browser.js +4 -5
  66. package/dist/lib/stream-promise.cjs +3 -4
  67. package/dist/lib/stream-promise.js +4 -5
  68. package/dist/lib/utils.browser.cjs +9 -13
  69. package/dist/lib/utils.browser.js +9 -13
  70. package/dist/lib/utils.cjs +9 -13
  71. package/dist/lib/utils.js +9 -13
  72. package/dist/lib/validator.browser.cjs +6 -4
  73. package/dist/lib/validator.browser.js +6 -4
  74. package/dist/lib/validator.cjs +6 -4
  75. package/dist/lib/validator.js +6 -4
  76. package/dist/types/index.d.ts +2374 -1304
  77. package/dist/wapi-client-web.iife.js +6 -6
  78. package/dist/wapi-client.iife.js +6 -6
  79. package/package.json +1 -1
@@ -95,6 +95,9 @@ var ReadStream = class {
95
95
  this.end();
96
96
  return this;
97
97
  }
98
+ get destroyed() {
99
+ return this._finished;
100
+ }
98
101
  };
99
102
  var ReadWriteStream = class {
100
103
  constructor() {
@@ -71,6 +71,9 @@ var ReadStream = class {
71
71
  this.end();
72
72
  return this;
73
73
  }
74
+ get destroyed() {
75
+ return this._finished;
76
+ }
74
77
  };
75
78
  var ReadWriteStream = class {
76
79
  constructor() {
@@ -362,8 +362,8 @@ function aggregatorInputToAggregator(fn, input) {
362
362
  };
363
363
  }
364
364
  if (!input.includes(" as ")) {
365
- throw new import_errors.InputError({
366
- message: "Invalid Aggregator"
365
+ throw new import_errors.InputError("UNCLEAR_AGGREGATOR", {
366
+ input
367
367
  });
368
368
  }
369
369
  const [field, alias] = input.split(" as ");
@@ -340,8 +340,8 @@ function aggregatorInputToAggregator(fn, input) {
340
340
  };
341
341
  }
342
342
  if (!input.includes(" as ")) {
343
- throw new InputError({
344
- message: "Invalid Aggregator"
343
+ throw new InputError("UNCLEAR_AGGREGATOR", {
344
+ input
345
345
  });
346
346
  }
347
347
  const [field, alias] = input.split(" as ");
@@ -362,8 +362,8 @@ function aggregatorInputToAggregator(fn, input) {
362
362
  };
363
363
  }
364
364
  if (!input.includes(" as ")) {
365
- throw new import_errors.InputError({
366
- message: "Invalid Aggregator"
365
+ throw new import_errors.InputError("UNCLEAR_AGGREGATOR", {
366
+ input
367
367
  });
368
368
  }
369
369
  const [field, alias] = input.split(" as ");
@@ -340,8 +340,8 @@ function aggregatorInputToAggregator(fn, input) {
340
340
  };
341
341
  }
342
342
  if (!input.includes(" as ")) {
343
- throw new InputError({
344
- message: "Invalid Aggregator"
343
+ throw new InputError("UNCLEAR_AGGREGATOR", {
344
+ input
345
345
  });
346
346
  }
347
347
  const [field, alias] = input.split(" as ");
@@ -179,10 +179,9 @@ var StreamPromise = class {
179
179
  result[key] = value;
180
180
  } else {
181
181
  this.streamObject.destroy(
182
- new import_errors.StreamError({
183
- message: "Received multiple chunks for non-array property " + key,
184
- code: import_errors.ERROR_TYPES.StreamError,
185
- data: value
182
+ new import_errors.StreamError("INVALID_RESPONSE_STREAM_CHUNK", {
183
+ property: key,
184
+ value
186
185
  })
187
186
  );
188
187
  err = true;
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
21
  // src/lib/stream-promise.ts
22
- import { ERROR_TYPES, getError, StreamError } from "./errors.browser.js";
22
+ import { getError, StreamError } from "./errors.browser.js";
23
23
  import { JSONRPC } from "../api/jsonrpc/jsonrpc.enums.browser.js";
24
24
  import { ReadStream } from "./isomorphic/web/streams.browser.js";
25
25
  import { debugLog } from "./debug.browser.js";
@@ -159,10 +159,9 @@ var StreamPromise = class {
159
159
  result[key] = value;
160
160
  } else {
161
161
  this.streamObject.destroy(
162
- new StreamError({
163
- message: "Received multiple chunks for non-array property " + key,
164
- code: ERROR_TYPES.StreamError,
165
- data: value
162
+ new StreamError("INVALID_RESPONSE_STREAM_CHUNK", {
163
+ property: key,
164
+ value
166
165
  })
167
166
  );
168
167
  err = true;
@@ -179,10 +179,9 @@ var StreamPromise = class {
179
179
  result[key] = value;
180
180
  } else {
181
181
  this.streamObject.destroy(
182
- new import_errors.StreamError({
183
- message: "Received multiple chunks for non-array property " + key,
184
- code: import_errors.ERROR_TYPES.StreamError,
185
- data: value
182
+ new import_errors.StreamError("INVALID_RESPONSE_STREAM_CHUNK", {
183
+ property: key,
184
+ value
186
185
  })
187
186
  );
188
187
  err = true;
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
21
  // src/lib/stream-promise.ts
22
- import { ERROR_TYPES, getError, StreamError } from "./errors";
22
+ import { getError, StreamError } from "./errors";
23
23
  import { JSONRPC } from "../api/jsonrpc/jsonrpc.enums";
24
24
  import { ReadStream } from "./isomorphic/node/streams";
25
25
  import { debugLog } from "./debug";
@@ -159,10 +159,9 @@ var StreamPromise = class {
159
159
  result[key] = value;
160
160
  } else {
161
161
  this.streamObject.destroy(
162
- new StreamError({
163
- message: "Received multiple chunks for non-array property " + key,
164
- code: ERROR_TYPES.StreamError,
165
- data: value
162
+ new StreamError("INVALID_RESPONSE_STREAM_CHUNK", {
163
+ property: key,
164
+ value
166
165
  })
167
166
  );
168
167
  err = true;
@@ -39,7 +39,6 @@ __export(utils_exports, {
39
39
  wait: () => wait
40
40
  });
41
41
  module.exports = __toCommonJS(utils_exports);
42
- var import__ = require('../index.cjs');
43
42
  var import_errors = require('./errors.cjs');
44
43
 
45
44
  // node_modules/uuid/dist/esm-browser/rng.js
@@ -137,10 +136,7 @@ function getTxIdSync(object) {
137
136
  }
138
137
  const key = internalMap.getKey(object);
139
138
  if (internalMap.get(key)) {
140
- throw new import_errors.InputError({
141
- message: import__.ErrorMessage.INPUT_NEEDS_IDENTIFIER,
142
- data: object
143
- });
139
+ throw new import_errors.InputError("INPUT_NEEDS_IDENTIFIER", { object });
144
140
  }
145
141
  const value = v4_default();
146
142
  internalMap.set(key, value);
@@ -158,18 +154,18 @@ function copyObject(input) {
158
154
  function checkCopyObject(input, property, value) {
159
155
  if (property in input) {
160
156
  if (input[property] === void 0) {
161
- throw new import_errors.ValidationError({
162
- message: `undefined provided for ${property}`,
163
- data: input
164
- });
157
+ throw new import_errors.ValidationError(
158
+ { input },
159
+ `undefined provided for ${property}`
160
+ );
165
161
  }
166
162
  return input;
167
163
  }
168
164
  if (!value) {
169
- throw new import_errors.ValidationError({
170
- message: `${property} is required if no default set`,
171
- data: input
172
- });
165
+ throw new import_errors.ValidationError(
166
+ { input },
167
+ `${property} is required if no default set`
168
+ );
173
169
  }
174
170
  const copy = copyObject(input);
175
171
  copy[property] = value;
@@ -1,5 +1,4 @@
1
1
  // src/lib/utils.ts
2
- import { ErrorMessage } from "../index.browser.js";
3
2
  import { InputError, ValidationError } from "./errors.browser.js";
4
3
 
5
4
  // node_modules/uuid/dist/esm-browser/rng.js
@@ -97,10 +96,7 @@ function getTxIdSync(object) {
97
96
  }
98
97
  const key = internalMap.getKey(object);
99
98
  if (internalMap.get(key)) {
100
- throw new InputError({
101
- message: ErrorMessage.INPUT_NEEDS_IDENTIFIER,
102
- data: object
103
- });
99
+ throw new InputError("INPUT_NEEDS_IDENTIFIER", { object });
104
100
  }
105
101
  const value = v4_default();
106
102
  internalMap.set(key, value);
@@ -118,18 +114,18 @@ function copyObject(input) {
118
114
  function checkCopyObject(input, property, value) {
119
115
  if (property in input) {
120
116
  if (input[property] === void 0) {
121
- throw new ValidationError({
122
- message: `undefined provided for ${property}`,
123
- data: input
124
- });
117
+ throw new ValidationError(
118
+ { input },
119
+ `undefined provided for ${property}`
120
+ );
125
121
  }
126
122
  return input;
127
123
  }
128
124
  if (!value) {
129
- throw new ValidationError({
130
- message: `${property} is required if no default set`,
131
- data: input
132
- });
125
+ throw new ValidationError(
126
+ { input },
127
+ `${property} is required if no default set`
128
+ );
133
129
  }
134
130
  const copy = copyObject(input);
135
131
  copy[property] = value;
@@ -571,7 +571,6 @@ __export(utils_exports, {
571
571
  wait: () => wait
572
572
  });
573
573
  module.exports = __toCommonJS(utils_exports);
574
- var import__ = require('../index.cjs');
575
574
  var import_errors = require('./errors.cjs');
576
575
  var import_uuid = __toESM(require_dist(), 1);
577
576
  var import_get_random_hex = require('./isomorphic/node/get-random-hex.cjs');
@@ -620,10 +619,7 @@ function getTxIdSync(object) {
620
619
  }
621
620
  const key = internalMap.getKey(object);
622
621
  if (internalMap.get(key)) {
623
- throw new import_errors.InputError({
624
- message: import__.ErrorMessage.INPUT_NEEDS_IDENTIFIER,
625
- data: object
626
- });
622
+ throw new import_errors.InputError("INPUT_NEEDS_IDENTIFIER", { object });
627
623
  }
628
624
  const value = (0, import_uuid.v4)();
629
625
  internalMap.set(key, value);
@@ -641,18 +637,18 @@ function copyObject(input) {
641
637
  function checkCopyObject(input, property, value) {
642
638
  if (property in input) {
643
639
  if (input[property] === void 0) {
644
- throw new import_errors.ValidationError({
645
- message: `undefined provided for ${property}`,
646
- data: input
647
- });
640
+ throw new import_errors.ValidationError(
641
+ { input },
642
+ `undefined provided for ${property}`
643
+ );
648
644
  }
649
645
  return input;
650
646
  }
651
647
  if (!value) {
652
- throw new import_errors.ValidationError({
653
- message: `${property} is required if no default set`,
654
- data: input
655
- });
648
+ throw new import_errors.ValidationError(
649
+ { input },
650
+ `${property} is required if no default set`
651
+ );
656
652
  }
657
653
  const copy = copyObject(input);
658
654
  copy[property] = value;
package/dist/lib/utils.js CHANGED
@@ -551,7 +551,6 @@ var require_dist = __commonJS({
551
551
 
552
552
  // src/lib/utils.ts
553
553
  var import_uuid = __toESM(require_dist(), 1);
554
- import { ErrorMessage } from "../index";
555
554
  import { InputError, ValidationError } from "./errors";
556
555
  import { getRandomHex } from "./isomorphic/node/get-random-hex";
557
556
  var internalMap = {
@@ -599,10 +598,7 @@ function getTxIdSync(object) {
599
598
  }
600
599
  const key = internalMap.getKey(object);
601
600
  if (internalMap.get(key)) {
602
- throw new InputError({
603
- message: ErrorMessage.INPUT_NEEDS_IDENTIFIER,
604
- data: object
605
- });
601
+ throw new InputError("INPUT_NEEDS_IDENTIFIER", { object });
606
602
  }
607
603
  const value = (0, import_uuid.v4)();
608
604
  internalMap.set(key, value);
@@ -620,18 +616,18 @@ function copyObject(input) {
620
616
  function checkCopyObject(input, property, value) {
621
617
  if (property in input) {
622
618
  if (input[property] === void 0) {
623
- throw new ValidationError({
624
- message: `undefined provided for ${property}`,
625
- data: input
626
- });
619
+ throw new ValidationError(
620
+ { input },
621
+ `undefined provided for ${property}`
622
+ );
627
623
  }
628
624
  return input;
629
625
  }
630
626
  if (!value) {
631
- throw new ValidationError({
632
- message: `${property} is required if no default set`,
633
- data: input
634
- });
627
+ throw new ValidationError(
628
+ { input },
629
+ `${property} is required if no default set`
630
+ );
635
631
  }
636
632
  const copy = copyObject(input);
637
633
  copy[property] = value;
@@ -7036,10 +7036,12 @@ function getValidationError(errors, errorsText) {
7036
7036
  if (errorsText === void 0) {
7037
7037
  return;
7038
7038
  }
7039
- return new import_errors.ValidationError({
7040
- message: errorsText,
7041
- data: errors
7042
- });
7039
+ return new import_errors.ValidationError(
7040
+ {
7041
+ errors
7042
+ },
7043
+ errorsText
7044
+ );
7043
7045
  }
7044
7046
  function wrapValidator(validate) {
7045
7047
  return function(input) {
@@ -7023,10 +7023,12 @@ function getValidationError(errors, errorsText) {
7023
7023
  if (errorsText === void 0) {
7024
7024
  return;
7025
7025
  }
7026
- return new ValidationError({
7027
- message: errorsText,
7028
- data: errors
7029
- });
7026
+ return new ValidationError(
7027
+ {
7028
+ errors
7029
+ },
7030
+ errorsText
7031
+ );
7030
7032
  }
7031
7033
  function wrapValidator(validate) {
7032
7034
  return function(input) {
@@ -264,10 +264,12 @@ function getValidationError(errors, errorsText) {
264
264
  if (errorsText === void 0) {
265
265
  return;
266
266
  }
267
- return new import_errors.ValidationError({
268
- message: errorsText,
269
- data: errors
270
- });
267
+ return new import_errors.ValidationError(
268
+ {
269
+ errors
270
+ },
271
+ errorsText
272
+ );
271
273
  }
272
274
  function wrapValidator(validate) {
273
275
  return function(input) {
@@ -231,10 +231,12 @@ function getValidationError(errors, errorsText) {
231
231
  if (errorsText === void 0) {
232
232
  return;
233
233
  }
234
- return new ValidationError({
235
- message: errorsText,
236
- data: errors
237
- });
234
+ return new ValidationError(
235
+ {
236
+ errors
237
+ },
238
+ errorsText
239
+ );
238
240
  }
239
241
  function wrapValidator(validate) {
240
242
  return function(input) {