wapi-client 0.8.13 → 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.
- package/dist/api/base-client.browser.cjs +9 -14
- package/dist/api/base-client.browser.js +10 -17
- package/dist/api/base-client.cjs +9 -14
- package/dist/api/base-client.js +10 -17
- package/dist/api/jsonrpc/jsonrpc.enums.d.ts +5 -4
- package/dist/api/ws-client.browser.cjs +3 -11
- package/dist/api/ws-client.browser.js +4 -16
- package/dist/api/ws-client.cjs +4 -12
- package/dist/api/ws-client.js +5 -17
- package/dist/client.browser.cjs +2 -5
- package/dist/client.browser.js +3 -6
- package/dist/client.cjs +3 -6
- package/dist/client.js +4 -7
- package/dist/fns/create-deposit/create-deposit.browser.cjs +1 -4
- package/dist/fns/create-deposit/create-deposit.browser.js +2 -5
- package/dist/fns/create-deposit/create-deposit.cjs +1 -4
- package/dist/fns/create-deposit/create-deposit.js +2 -5
- package/dist/fns/create-withdrawal/create-withdrawal.browser.cjs +1 -4
- package/dist/fns/create-withdrawal/create-withdrawal.browser.js +2 -5
- package/dist/fns/create-withdrawal/create-withdrawal.cjs +1 -4
- package/dist/fns/create-withdrawal/create-withdrawal.js +2 -5
- package/dist/fns/find-transfers/find-transfers.browser.cjs +8 -20
- package/dist/fns/find-transfers/find-transfers.browser.js +9 -21
- package/dist/fns/find-transfers/find-transfers.cjs +8 -20
- package/dist/fns/find-transfers/find-transfers.js +9 -21
- package/dist/fns/get-balance/get-balance.browser.cjs +2 -8
- package/dist/fns/get-balance/get-balance.browser.js +3 -9
- package/dist/fns/get-balance/get-balance.cjs +2 -8
- package/dist/fns/get-balance/get-balance.js +3 -9
- package/dist/fns/get-balance-history/get-balance-history.browser.cjs +1 -4
- package/dist/fns/get-balance-history/get-balance-history.browser.js +2 -5
- package/dist/fns/get-balance-history/get-balance-history.cjs +1 -4
- package/dist/fns/get-balance-history/get-balance-history.js +2 -5
- package/dist/fns/get-token/get-token.browser.cjs +1 -4
- package/dist/fns/get-token/get-token.browser.js +2 -5
- package/dist/fns/get-token/get-token.cjs +1 -4
- package/dist/fns/get-token/get-token.js +2 -5
- package/dist/fns/import-data/import-data.cjs +2 -5
- package/dist/fns/import-data/import-data.js +3 -6
- package/dist/fns/import-data/import-data.node.browser.cjs +2 -5
- package/dist/fns/import-data/import-data.node.browser.js +3 -6
- package/dist/fns/import-data/import-data.node.cjs +2 -5
- package/dist/fns/import-data/import-data.node.js +3 -6
- package/dist/fns/set-flags/set-flags.browser.cjs +3 -3
- package/dist/fns/set-flags/set-flags.browser.js +3 -3
- package/dist/fns/set-flags/set-flags.cjs +3 -3
- package/dist/fns/set-flags/set-flags.js +3 -3
- package/dist/index.browser.cjs +13 -1
- package/dist/index.browser.js +25 -1
- package/dist/index.cjs +25 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -1
- package/dist/lib/errors.browser.cjs +642 -214
- package/dist/lib/errors.browser.js +645 -214
- package/dist/lib/errors.cjs +652 -218
- package/dist/lib/errors.d.ts +1411 -342
- package/dist/lib/errors.js +645 -214
- package/dist/lib/query-builder.browser.cjs +2 -2
- package/dist/lib/query-builder.browser.js +2 -2
- package/dist/lib/query-builder.cjs +2 -2
- package/dist/lib/query-builder.js +2 -2
- package/dist/lib/stream-promise.browser.cjs +3 -4
- package/dist/lib/stream-promise.browser.js +4 -5
- package/dist/lib/stream-promise.cjs +3 -4
- package/dist/lib/stream-promise.js +4 -5
- package/dist/lib/utils.browser.cjs +9 -13
- package/dist/lib/utils.browser.js +9 -13
- package/dist/lib/utils.cjs +9 -13
- package/dist/lib/utils.js +9 -13
- package/dist/lib/validator.browser.cjs +6 -4
- package/dist/lib/validator.browser.js +6 -4
- package/dist/lib/validator.cjs +6 -4
- package/dist/lib/validator.js +6 -4
- package/dist/types/index.d.ts +2374 -1304
- package/dist/wapi-client-web.iife.js +6 -6
- package/dist/wapi-client.iife.js +6 -6
- package/package.json +1 -1
|
@@ -67,10 +67,7 @@ function createWithdrawal(options, input, fnOptions) {
|
|
|
67
67
|
}
|
|
68
68
|
const token = inputCopy.token || client.getConfig("token");
|
|
69
69
|
if (token === void 0) {
|
|
70
|
-
throw new import_errors.InputError({
|
|
71
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
72
|
-
data: input
|
|
73
|
-
});
|
|
70
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input });
|
|
74
71
|
}
|
|
75
72
|
const withdrawal = __spreadProps(__spreadValues({}, inputCopy), {
|
|
76
73
|
identifier: inputCopy.identifier,
|
|
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
|
21
21
|
// src/fns/create-withdrawal/create-withdrawal.ts
|
|
22
|
-
import {
|
|
22
|
+
import { InputError } from "../../lib/errors";
|
|
23
23
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
24
24
|
import {
|
|
25
25
|
checkCopyObject,
|
|
@@ -53,10 +53,7 @@ function createWithdrawal(options, input, fnOptions) {
|
|
|
53
53
|
}
|
|
54
54
|
const token = inputCopy.token || client.getConfig("token");
|
|
55
55
|
if (token === void 0) {
|
|
56
|
-
throw new InputError({
|
|
57
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
58
|
-
data: input
|
|
59
|
-
});
|
|
56
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input });
|
|
60
57
|
}
|
|
61
58
|
const withdrawal = __spreadProps(__spreadValues({}, inputCopy), {
|
|
62
59
|
identifier: inputCopy.identifier,
|
|
@@ -93,19 +93,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
93
93
|
delete inputCopy.options.order_by;
|
|
94
94
|
if (inputCopy.options.return_running_balance) {
|
|
95
95
|
if (inputCopy.options.return_running_balance_for_wallet) {
|
|
96
|
-
throw new import_errors.InputError({
|
|
97
|
-
|
|
98
|
-
data: {
|
|
99
|
-
options: inputCopy.options
|
|
100
|
-
}
|
|
96
|
+
throw new import_errors.InputError("CONFLICTING_OPTIONS_FOR_BALANCE", {
|
|
97
|
+
options: inputCopy.options
|
|
101
98
|
});
|
|
102
99
|
}
|
|
103
100
|
if (!filter.wallet) {
|
|
104
|
-
throw new import_errors.InputError({
|
|
105
|
-
|
|
106
|
-
data: {
|
|
107
|
-
input: inputCopy
|
|
108
|
-
}
|
|
101
|
+
throw new import_errors.InputError("RUNNING_BALANCE_WITHOUT_WALLET", {
|
|
102
|
+
input: inputCopy
|
|
109
103
|
});
|
|
110
104
|
}
|
|
111
105
|
inputCopy.options.return_running_balance_for_wallet = inputCopy.wallet;
|
|
@@ -114,19 +108,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
114
108
|
delete inputCopy.options.return_running_balance_for_wallet;
|
|
115
109
|
if (inputCopy.options.return_signed_amount) {
|
|
116
110
|
if (inputCopy.options.return_signed_amount_for_wallet) {
|
|
117
|
-
throw new import_errors.InputError({
|
|
118
|
-
|
|
119
|
-
data: {
|
|
120
|
-
options: inputCopy.options
|
|
121
|
-
}
|
|
111
|
+
throw new import_errors.InputError("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT", {
|
|
112
|
+
options: inputCopy.options
|
|
122
113
|
});
|
|
123
114
|
}
|
|
124
115
|
if (!filter.wallet) {
|
|
125
|
-
throw new import_errors.InputError({
|
|
126
|
-
|
|
127
|
-
data: {
|
|
128
|
-
input: inputCopy
|
|
129
|
-
}
|
|
116
|
+
throw new import_errors.InputError("SIGNED_AMOUNT_WITHOUT_WALLET", {
|
|
117
|
+
input: inputCopy
|
|
130
118
|
});
|
|
131
119
|
}
|
|
132
120
|
inputCopy.options.return_signed_amount_for_wallet = inputCopy.wallet;
|
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
|
|
18
18
|
// src/fns/find-transfers/find-transfers.ts
|
|
19
19
|
import { QueryBuilder } from "../../lib/query-builder.browser.js";
|
|
20
|
-
import {
|
|
20
|
+
import { InputError } from "../../lib/errors.browser.js";
|
|
21
21
|
import {
|
|
22
22
|
getForeign,
|
|
23
23
|
getIdentifierFilter,
|
|
@@ -77,19 +77,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
77
77
|
delete inputCopy.options.order_by;
|
|
78
78
|
if (inputCopy.options.return_running_balance) {
|
|
79
79
|
if (inputCopy.options.return_running_balance_for_wallet) {
|
|
80
|
-
throw new InputError({
|
|
81
|
-
|
|
82
|
-
data: {
|
|
83
|
-
options: inputCopy.options
|
|
84
|
-
}
|
|
80
|
+
throw new InputError("CONFLICTING_OPTIONS_FOR_BALANCE", {
|
|
81
|
+
options: inputCopy.options
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
84
|
if (!filter.wallet) {
|
|
88
|
-
throw new InputError({
|
|
89
|
-
|
|
90
|
-
data: {
|
|
91
|
-
input: inputCopy
|
|
92
|
-
}
|
|
85
|
+
throw new InputError("RUNNING_BALANCE_WITHOUT_WALLET", {
|
|
86
|
+
input: inputCopy
|
|
93
87
|
});
|
|
94
88
|
}
|
|
95
89
|
inputCopy.options.return_running_balance_for_wallet = inputCopy.wallet;
|
|
@@ -98,19 +92,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
98
92
|
delete inputCopy.options.return_running_balance_for_wallet;
|
|
99
93
|
if (inputCopy.options.return_signed_amount) {
|
|
100
94
|
if (inputCopy.options.return_signed_amount_for_wallet) {
|
|
101
|
-
throw new InputError({
|
|
102
|
-
|
|
103
|
-
data: {
|
|
104
|
-
options: inputCopy.options
|
|
105
|
-
}
|
|
95
|
+
throw new InputError("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT", {
|
|
96
|
+
options: inputCopy.options
|
|
106
97
|
});
|
|
107
98
|
}
|
|
108
99
|
if (!filter.wallet) {
|
|
109
|
-
throw new InputError({
|
|
110
|
-
|
|
111
|
-
data: {
|
|
112
|
-
input: inputCopy
|
|
113
|
-
}
|
|
100
|
+
throw new InputError("SIGNED_AMOUNT_WITHOUT_WALLET", {
|
|
101
|
+
input: inputCopy
|
|
114
102
|
});
|
|
115
103
|
}
|
|
116
104
|
inputCopy.options.return_signed_amount_for_wallet = inputCopy.wallet;
|
|
@@ -93,19 +93,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
93
93
|
delete inputCopy.options.order_by;
|
|
94
94
|
if (inputCopy.options.return_running_balance) {
|
|
95
95
|
if (inputCopy.options.return_running_balance_for_wallet) {
|
|
96
|
-
throw new import_errors.InputError({
|
|
97
|
-
|
|
98
|
-
data: {
|
|
99
|
-
options: inputCopy.options
|
|
100
|
-
}
|
|
96
|
+
throw new import_errors.InputError("CONFLICTING_OPTIONS_FOR_BALANCE", {
|
|
97
|
+
options: inputCopy.options
|
|
101
98
|
});
|
|
102
99
|
}
|
|
103
100
|
if (!filter.wallet) {
|
|
104
|
-
throw new import_errors.InputError({
|
|
105
|
-
|
|
106
|
-
data: {
|
|
107
|
-
input: inputCopy
|
|
108
|
-
}
|
|
101
|
+
throw new import_errors.InputError("RUNNING_BALANCE_WITHOUT_WALLET", {
|
|
102
|
+
input: inputCopy
|
|
109
103
|
});
|
|
110
104
|
}
|
|
111
105
|
inputCopy.options.return_running_balance_for_wallet = inputCopy.wallet;
|
|
@@ -114,19 +108,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
114
108
|
delete inputCopy.options.return_running_balance_for_wallet;
|
|
115
109
|
if (inputCopy.options.return_signed_amount) {
|
|
116
110
|
if (inputCopy.options.return_signed_amount_for_wallet) {
|
|
117
|
-
throw new import_errors.InputError({
|
|
118
|
-
|
|
119
|
-
data: {
|
|
120
|
-
options: inputCopy.options
|
|
121
|
-
}
|
|
111
|
+
throw new import_errors.InputError("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT", {
|
|
112
|
+
options: inputCopy.options
|
|
122
113
|
});
|
|
123
114
|
}
|
|
124
115
|
if (!filter.wallet) {
|
|
125
|
-
throw new import_errors.InputError({
|
|
126
|
-
|
|
127
|
-
data: {
|
|
128
|
-
input: inputCopy
|
|
129
|
-
}
|
|
116
|
+
throw new import_errors.InputError("SIGNED_AMOUNT_WITHOUT_WALLET", {
|
|
117
|
+
input: inputCopy
|
|
130
118
|
});
|
|
131
119
|
}
|
|
132
120
|
inputCopy.options.return_signed_amount_for_wallet = inputCopy.wallet;
|
|
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
|
|
18
18
|
// src/fns/find-transfers/find-transfers.ts
|
|
19
19
|
import { QueryBuilder } from "../../lib/query-builder";
|
|
20
|
-
import {
|
|
20
|
+
import { InputError } from "../../lib/errors";
|
|
21
21
|
import {
|
|
22
22
|
getForeign,
|
|
23
23
|
getIdentifierFilter,
|
|
@@ -77,19 +77,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
77
77
|
delete inputCopy.options.order_by;
|
|
78
78
|
if (inputCopy.options.return_running_balance) {
|
|
79
79
|
if (inputCopy.options.return_running_balance_for_wallet) {
|
|
80
|
-
throw new InputError({
|
|
81
|
-
|
|
82
|
-
data: {
|
|
83
|
-
options: inputCopy.options
|
|
84
|
-
}
|
|
80
|
+
throw new InputError("CONFLICTING_OPTIONS_FOR_BALANCE", {
|
|
81
|
+
options: inputCopy.options
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
84
|
if (!filter.wallet) {
|
|
88
|
-
throw new InputError({
|
|
89
|
-
|
|
90
|
-
data: {
|
|
91
|
-
input: inputCopy
|
|
92
|
-
}
|
|
85
|
+
throw new InputError("RUNNING_BALANCE_WITHOUT_WALLET", {
|
|
86
|
+
input: inputCopy
|
|
93
87
|
});
|
|
94
88
|
}
|
|
95
89
|
inputCopy.options.return_running_balance_for_wallet = inputCopy.wallet;
|
|
@@ -98,19 +92,13 @@ function findTransfers(options, input, fnOptions) {
|
|
|
98
92
|
delete inputCopy.options.return_running_balance_for_wallet;
|
|
99
93
|
if (inputCopy.options.return_signed_amount) {
|
|
100
94
|
if (inputCopy.options.return_signed_amount_for_wallet) {
|
|
101
|
-
throw new InputError({
|
|
102
|
-
|
|
103
|
-
data: {
|
|
104
|
-
options: inputCopy.options
|
|
105
|
-
}
|
|
95
|
+
throw new InputError("CONFLICTING_OPTIONS_FOR_SIGNED_AMOUNT", {
|
|
96
|
+
options: inputCopy.options
|
|
106
97
|
});
|
|
107
98
|
}
|
|
108
99
|
if (!filter.wallet) {
|
|
109
|
-
throw new InputError({
|
|
110
|
-
|
|
111
|
-
data: {
|
|
112
|
-
input: inputCopy
|
|
113
|
-
}
|
|
100
|
+
throw new InputError("SIGNED_AMOUNT_WITHOUT_WALLET", {
|
|
101
|
+
input: inputCopy
|
|
114
102
|
});
|
|
115
103
|
}
|
|
116
104
|
inputCopy.options.return_signed_amount_for_wallet = inputCopy.wallet;
|
|
@@ -43,17 +43,11 @@ function getBalance(options, input, fnOptions) {
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
if (inputCopy.datetime && (0, import_utils.isFutureDate)(inputCopy.datetime)) {
|
|
46
|
-
throw new import_errors.InputError({
|
|
47
|
-
message: import_errors.ERROR_MESSAGES.BAL_FUTURE_DATETIME,
|
|
48
|
-
data: inputCopy
|
|
49
|
-
});
|
|
46
|
+
throw new import_errors.InputError("BAL_FUTURE_DATETIME", { input: inputCopy });
|
|
50
47
|
}
|
|
51
48
|
const token = inputCopy.token || client.getConfig("token");
|
|
52
49
|
if (token === void 0) {
|
|
53
|
-
throw new import_errors.InputError({
|
|
54
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
55
|
-
data: input
|
|
56
|
-
});
|
|
50
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input: inputCopy });
|
|
57
51
|
}
|
|
58
52
|
return client.api.getBalance({
|
|
59
53
|
balance: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-balance/get-balance.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors.browser.js";
|
|
3
3
|
import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
4
4
|
import {
|
|
5
5
|
checkCopyObject,
|
|
@@ -24,17 +24,11 @@ function getBalance(options, input, fnOptions) {
|
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
|
26
26
|
if (inputCopy.datetime && isFutureDate(inputCopy.datetime)) {
|
|
27
|
-
throw new InputError({
|
|
28
|
-
message: ERROR_MESSAGES.BAL_FUTURE_DATETIME,
|
|
29
|
-
data: inputCopy
|
|
30
|
-
});
|
|
27
|
+
throw new InputError("BAL_FUTURE_DATETIME", { input: inputCopy });
|
|
31
28
|
}
|
|
32
29
|
const token = inputCopy.token || client.getConfig("token");
|
|
33
30
|
if (token === void 0) {
|
|
34
|
-
throw new InputError({
|
|
35
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
36
|
-
data: input
|
|
37
|
-
});
|
|
31
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input: inputCopy });
|
|
38
32
|
}
|
|
39
33
|
return client.api.getBalance({
|
|
40
34
|
balance: {
|
|
@@ -43,17 +43,11 @@ function getBalance(options, input, fnOptions) {
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
if (inputCopy.datetime && (0, import_utils.isFutureDate)(inputCopy.datetime)) {
|
|
46
|
-
throw new import_errors.InputError({
|
|
47
|
-
message: import_errors.ERROR_MESSAGES.BAL_FUTURE_DATETIME,
|
|
48
|
-
data: inputCopy
|
|
49
|
-
});
|
|
46
|
+
throw new import_errors.InputError("BAL_FUTURE_DATETIME", { input: inputCopy });
|
|
50
47
|
}
|
|
51
48
|
const token = inputCopy.token || client.getConfig("token");
|
|
52
49
|
if (token === void 0) {
|
|
53
|
-
throw new import_errors.InputError({
|
|
54
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
55
|
-
data: input
|
|
56
|
-
});
|
|
50
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input: inputCopy });
|
|
57
51
|
}
|
|
58
52
|
return client.api.getBalance({
|
|
59
53
|
balance: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-balance/get-balance.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors";
|
|
3
3
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
4
4
|
import {
|
|
5
5
|
checkCopyObject,
|
|
@@ -24,17 +24,11 @@ function getBalance(options, input, fnOptions) {
|
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
|
26
26
|
if (inputCopy.datetime && isFutureDate(inputCopy.datetime)) {
|
|
27
|
-
throw new InputError({
|
|
28
|
-
message: ERROR_MESSAGES.BAL_FUTURE_DATETIME,
|
|
29
|
-
data: inputCopy
|
|
30
|
-
});
|
|
27
|
+
throw new InputError("BAL_FUTURE_DATETIME", { input: inputCopy });
|
|
31
28
|
}
|
|
32
29
|
const token = inputCopy.token || client.getConfig("token");
|
|
33
30
|
if (token === void 0) {
|
|
34
|
-
throw new InputError({
|
|
35
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
36
|
-
data: input
|
|
37
|
-
});
|
|
31
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input: inputCopy });
|
|
38
32
|
}
|
|
39
33
|
return client.api.getBalance({
|
|
40
34
|
balance: {
|
|
@@ -39,10 +39,7 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
39
39
|
}
|
|
40
40
|
const token = inputCopy.token || client.getConfig("token");
|
|
41
41
|
if (token === void 0) {
|
|
42
|
-
throw new import_errors.InputError({
|
|
43
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
44
|
-
data: input
|
|
45
|
-
});
|
|
42
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input });
|
|
46
43
|
}
|
|
47
44
|
return client.api.getBalanceHistory({
|
|
48
45
|
balance: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-balance-history/get-balance-history.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors.browser.js";
|
|
3
3
|
import { getForeign, validateClientFnInput } from "../../lib/utils.browser.js";
|
|
4
4
|
import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
5
5
|
var validate = getValidator(SchemaNames.GetBalanceHistoryFnInput);
|
|
@@ -15,10 +15,7 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
15
15
|
}
|
|
16
16
|
const token = inputCopy.token || client.getConfig("token");
|
|
17
17
|
if (token === void 0) {
|
|
18
|
-
throw new InputError({
|
|
19
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
20
|
-
data: input
|
|
21
|
-
});
|
|
18
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input });
|
|
22
19
|
}
|
|
23
20
|
return client.api.getBalanceHistory({
|
|
24
21
|
balance: {
|
|
@@ -39,10 +39,7 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
39
39
|
}
|
|
40
40
|
const token = inputCopy.token || client.getConfig("token");
|
|
41
41
|
if (token === void 0) {
|
|
42
|
-
throw new import_errors.InputError({
|
|
43
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
44
|
-
data: input
|
|
45
|
-
});
|
|
42
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input });
|
|
46
43
|
}
|
|
47
44
|
return client.api.getBalanceHistory({
|
|
48
45
|
balance: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-balance-history/get-balance-history.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors";
|
|
3
3
|
import { getForeign, validateClientFnInput } from "../../lib/utils";
|
|
4
4
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
5
5
|
var validate = getValidator(SchemaNames.GetBalanceHistoryFnInput);
|
|
@@ -15,10 +15,7 @@ function getBalanceHistory(options, input, fnOptions) {
|
|
|
15
15
|
}
|
|
16
16
|
const token = inputCopy.token || client.getConfig("token");
|
|
17
17
|
if (token === void 0) {
|
|
18
|
-
throw new InputError({
|
|
19
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
20
|
-
data: input
|
|
21
|
-
});
|
|
18
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input });
|
|
22
19
|
}
|
|
23
20
|
return client.api.getBalanceHistory({
|
|
24
21
|
balance: {
|
|
@@ -44,10 +44,7 @@ function getToken(options, input = {}, fnOptions) {
|
|
|
44
44
|
}
|
|
45
45
|
const token = inputCopy.foreign || client.getConfig("token");
|
|
46
46
|
if (token === void 0) {
|
|
47
|
-
throw new import_errors.InputError({
|
|
48
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
49
|
-
data: input
|
|
50
|
-
});
|
|
47
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input });
|
|
51
48
|
}
|
|
52
49
|
return client.api.getToken({
|
|
53
50
|
token: (0, import_utils.getForeign)(token),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-token/get-token.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors.browser.js";
|
|
3
3
|
import {
|
|
4
4
|
checkCopyObject,
|
|
5
5
|
getForeign,
|
|
@@ -24,10 +24,7 @@ function getToken(options, input = {}, fnOptions) {
|
|
|
24
24
|
}
|
|
25
25
|
const token = inputCopy.foreign || client.getConfig("token");
|
|
26
26
|
if (token === void 0) {
|
|
27
|
-
throw new InputError({
|
|
28
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
29
|
-
data: input
|
|
30
|
-
});
|
|
27
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input });
|
|
31
28
|
}
|
|
32
29
|
return client.api.getToken({
|
|
33
30
|
token: getForeign(token),
|
|
@@ -44,10 +44,7 @@ function getToken(options, input = {}, fnOptions) {
|
|
|
44
44
|
}
|
|
45
45
|
const token = inputCopy.foreign || client.getConfig("token");
|
|
46
46
|
if (token === void 0) {
|
|
47
|
-
throw new import_errors.InputError({
|
|
48
|
-
message: import_errors.ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
49
|
-
data: input
|
|
50
|
-
});
|
|
47
|
+
throw new import_errors.InputError("INPUT_NEEDS_TOKEN", { input });
|
|
51
48
|
}
|
|
52
49
|
return client.api.getToken({
|
|
53
50
|
token: (0, import_utils.getForeign)(token),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/fns/get-token/get-token.ts
|
|
2
|
-
import {
|
|
2
|
+
import { InputError } from "../../lib/errors";
|
|
3
3
|
import {
|
|
4
4
|
checkCopyObject,
|
|
5
5
|
getForeign,
|
|
@@ -24,10 +24,7 @@ function getToken(options, input = {}, fnOptions) {
|
|
|
24
24
|
}
|
|
25
25
|
const token = inputCopy.foreign || client.getConfig("token");
|
|
26
26
|
if (token === void 0) {
|
|
27
|
-
throw new InputError({
|
|
28
|
-
message: ERROR_MESSAGES.INPUT_NEEDS_TOKEN,
|
|
29
|
-
data: input
|
|
30
|
-
});
|
|
27
|
+
throw new InputError("INPUT_NEEDS_TOKEN", { input });
|
|
31
28
|
}
|
|
32
29
|
return client.api.getToken({
|
|
33
30
|
token: getForeign(token),
|
|
@@ -104,11 +104,8 @@ function getTransform() {
|
|
|
104
104
|
if (!(0, import_import_data.isImportDataFnStreamChunk)(data)) {
|
|
105
105
|
const { error } = chunkValidator(data);
|
|
106
106
|
throw new import_errors.ValidationError({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
data,
|
|
110
|
-
error
|
|
111
|
-
}
|
|
107
|
+
data,
|
|
108
|
+
error
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
buffer.push(transformToTxChunk(data));
|
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/fns/import-data/import-data.ts
|
|
42
|
-
import {
|
|
42
|
+
import { ValidationError } from "../../lib/errors";
|
|
43
43
|
import { TransformStream } from "../../lib/isomorphic/node/streams";
|
|
44
44
|
import { getForeign, validateClientFnInput } from "../../lib/utils";
|
|
45
45
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
@@ -85,11 +85,8 @@ function getTransform() {
|
|
|
85
85
|
if (!isImportDataFnStreamChunk(data)) {
|
|
86
86
|
const { error } = chunkValidator(data);
|
|
87
87
|
throw new ValidationError({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
data,
|
|
91
|
-
error
|
|
92
|
-
}
|
|
88
|
+
data,
|
|
89
|
+
error
|
|
93
90
|
});
|
|
94
91
|
}
|
|
95
92
|
buffer.push(transformToTxChunk(data));
|
|
@@ -104,11 +104,8 @@ function getTransform() {
|
|
|
104
104
|
if (!(0, import_import_data.isImportDataFnStreamChunk)(data)) {
|
|
105
105
|
const { error } = chunkValidator(data);
|
|
106
106
|
throw new import_errors.ValidationError({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
data,
|
|
110
|
-
error
|
|
111
|
-
}
|
|
107
|
+
data,
|
|
108
|
+
error
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
buffer.push(transformToTxChunk(data));
|
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/fns/import-data/import-data.node.ts
|
|
42
|
-
import {
|
|
42
|
+
import { ValidationError } from "../../lib/errors.browser.js";
|
|
43
43
|
import { TransformStream } from "../../lib/isomorphic/node/streams.browser.js";
|
|
44
44
|
import { getForeign, validateClientFnInput } from "../../lib/utils.browser.js";
|
|
45
45
|
import { getValidator, SchemaNames } from "../../lib/validator.browser.js";
|
|
@@ -85,11 +85,8 @@ function getTransform() {
|
|
|
85
85
|
if (!isImportDataFnStreamChunk(data)) {
|
|
86
86
|
const { error } = chunkValidator(data);
|
|
87
87
|
throw new ValidationError({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
data,
|
|
91
|
-
error
|
|
92
|
-
}
|
|
88
|
+
data,
|
|
89
|
+
error
|
|
93
90
|
});
|
|
94
91
|
}
|
|
95
92
|
buffer.push(transformToTxChunk(data));
|
|
@@ -104,11 +104,8 @@ function getTransform() {
|
|
|
104
104
|
if (!(0, import_import_data.isImportDataFnStreamChunk)(data)) {
|
|
105
105
|
const { error } = chunkValidator(data);
|
|
106
106
|
throw new import_errors.ValidationError({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
data,
|
|
110
|
-
error
|
|
111
|
-
}
|
|
107
|
+
data,
|
|
108
|
+
error
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
buffer.push(transformToTxChunk(data));
|
|
@@ -39,7 +39,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
// src/fns/import-data/import-data.node.ts
|
|
42
|
-
import {
|
|
42
|
+
import { ValidationError } from "../../lib/errors";
|
|
43
43
|
import { TransformStream } from "../../lib/isomorphic/node/streams";
|
|
44
44
|
import { getForeign, validateClientFnInput } from "../../lib/utils";
|
|
45
45
|
import { getValidator, SchemaNames } from "../../lib/validator";
|
|
@@ -85,11 +85,8 @@ function getTransform() {
|
|
|
85
85
|
if (!isImportDataFnStreamChunk(data)) {
|
|
86
86
|
const { error } = chunkValidator(data);
|
|
87
87
|
throw new ValidationError({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
data,
|
|
91
|
-
error
|
|
92
|
-
}
|
|
88
|
+
data,
|
|
89
|
+
error
|
|
93
90
|
});
|
|
94
91
|
}
|
|
95
92
|
buffer.push(transformToTxChunk(data));
|
|
@@ -46,9 +46,9 @@ function setFlags(options, input, fnOptions) {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
if (Object.keys(flags).length < 1) {
|
|
49
|
-
throw new import_errors.InputError({
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
throw new import_errors.InputError("REQUIRED_INPUT_MISSING", {
|
|
50
|
+
requiredOneOf: flagKeys,
|
|
51
|
+
input
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return client.api.setFlags({
|
|
@@ -22,9 +22,9 @@ function setFlags(options, input, fnOptions) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
if (Object.keys(flags).length < 1) {
|
|
25
|
-
throw new InputError({
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
throw new InputError("REQUIRED_INPUT_MISSING", {
|
|
26
|
+
requiredOneOf: flagKeys,
|
|
27
|
+
input
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
return client.api.setFlags({
|
|
@@ -46,9 +46,9 @@ function setFlags(options, input, fnOptions) {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
if (Object.keys(flags).length < 1) {
|
|
49
|
-
throw new import_errors.InputError({
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
throw new import_errors.InputError("REQUIRED_INPUT_MISSING", {
|
|
50
|
+
requiredOneOf: flagKeys,
|
|
51
|
+
input
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
return client.api.setFlags({
|
|
@@ -22,9 +22,9 @@ function setFlags(options, input, fnOptions) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
if (Object.keys(flags).length < 1) {
|
|
25
|
-
throw new InputError({
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
throw new InputError("REQUIRED_INPUT_MISSING", {
|
|
26
|
+
requiredOneOf: flagKeys,
|
|
27
|
+
input
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
return client.api.setFlags({
|