wapi-client 0.9.2 → 0.9.5
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/ws-client.cjs +1 -1
- package/dist/api/ws-client.js +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +1 -1
- package/dist/fns/aggregate-transfers/aggregate-transfers.d.ts +1 -1
- package/dist/fns/find-tokens/find-tokens.enums.d.ts +2 -3
- package/dist/fns/find-tokens/find-tokens.schema.input.json +1 -16
- package/dist/fns/find-transfer-groups/find-transfer-groups.enums.d.ts +2 -8
- package/dist/fns/find-transfer-groups/find-transfer-groups.schema.input.json +3 -34
- package/dist/fns/find-wallets/find-wallets.enums.d.ts +1 -1
- package/dist/fns/reverse-transfers/reverse-transfers.d.ts +1 -1
- package/dist/fns/update-transfer-groups/update-transfer-groups.d.ts +1 -1
- package/dist/fns/update-transfers/update-transfers.d.ts +1 -1
- package/dist/lib/errors.browser.cjs +25 -0
- package/dist/lib/errors.browser.js +25 -0
- package/dist/lib/errors.cjs +25 -0
- package/dist/lib/errors.d.ts +180 -95
- package/dist/lib/errors.js +25 -0
- package/dist/lib/query-builder.d.ts +6 -8
- package/dist/txs/create-distribution/create-distribution.enums.d.ts +1 -1
- package/dist/txs/find-balance-many/find-balance-many.enums.d.ts +1 -1
- package/dist/txs/find-token-many/find-token-many.enums.d.ts +4 -3
- package/dist/txs/find-token-many/find-token-many.schema.input.json +6 -0
- package/dist/txs/find-token-many/find-token-many.schema.output.json +8 -1
- package/dist/txs/find-transfer-group-many/find-transfer-group-many.enums.d.ts +10 -4
- package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.input.json +4 -3
- package/dist/txs/find-transfer-group-many/find-transfer-group-many.schema.output.json +23 -1
- package/dist/txs/find-transfer-many/find-transfer-many.enums.d.ts +1 -1
- package/dist/txs/get-balance-history/get-balance-history.enums.d.ts +5 -1
- package/dist/txs/get-balance-history/get-balance-history.schema.output.json +7 -1
- package/dist/txs/get-token/get-token.enums.d.ts +43 -1
- package/dist/txs/get-token/get-token.schema.input.json +5 -1
- package/dist/txs/get-token/get-token.schema.output.json +63 -2
- package/dist/txs/get-token-many/get-token-many.enums.d.ts +6 -2
- package/dist/txs/get-token-many/get-token-many.schema.input.json +5 -0
- package/dist/txs/get-token-many/get-token-many.schema.output.json +3 -0
- package/dist/txs/update-transfer-group/update-transfer-group.enums.d.ts +1 -1
- package/dist/types/index.d.ts +271 -138
- package/dist/wapi-client-web.iife.js +1 -1
- package/dist/wapi-client.iife.js +1 -1
- package/package.json +2 -3
package/dist/lib/errors.js
CHANGED
|
@@ -382,6 +382,11 @@ var ERROR_GROUPS = {
|
|
|
382
382
|
message: "TR_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",
|
|
383
383
|
description: `Withdrawals are expected connection points with outside systems, thus extra validation is required. Reversing a Transfer.type = 'withdrawal' requires reverse_withdrawal option to be true.`
|
|
384
384
|
},
|
|
385
|
+
TR_UNIQUE_IDENTIFIER: {
|
|
386
|
+
code: -19115,
|
|
387
|
+
message: "TR_UNIQUE_IDENTIFIER",
|
|
388
|
+
description: `The identifier for Transfer object must be unique`
|
|
389
|
+
},
|
|
385
390
|
TRG_SINGLE_PENDING_TR_CANT_RV: {
|
|
386
391
|
code: -19200,
|
|
387
392
|
message: "TRG_SINGLE_PENDING_TR_CANT_RV",
|
|
@@ -401,6 +406,26 @@ var ERROR_GROUPS = {
|
|
|
401
406
|
code: -19203,
|
|
402
407
|
message: "TRG_WITHDRAWAL_CANT_RV_WITHOUT_FLAG",
|
|
403
408
|
description: `TransferGroup includes Transfer.type = 'withdrawal', thus for extra validation the reverse_withdrawal option must be set true`
|
|
409
|
+
},
|
|
410
|
+
TRG_UNIQUE_IDENTIFIER: {
|
|
411
|
+
code: -19204,
|
|
412
|
+
message: "TRG_UNIQUE_IDENTIFIER",
|
|
413
|
+
description: `The identifier for TransferGroup object must be unique`
|
|
414
|
+
},
|
|
415
|
+
TOKEN_UNIQUE_FOREIGN: {
|
|
416
|
+
code: -19300,
|
|
417
|
+
message: "TOKEN_UNIQUE_FOREIGN",
|
|
418
|
+
description: `The foreign for Token object must be unique`
|
|
419
|
+
},
|
|
420
|
+
WALLET_UNIQUE_FOREIGN: {
|
|
421
|
+
code: -19400,
|
|
422
|
+
message: "WALLET_UNIQUE_FOREIGN",
|
|
423
|
+
description: `The foreign for Wallet object must be unique`
|
|
424
|
+
},
|
|
425
|
+
UNIQUE_CONSTRAINT: {
|
|
426
|
+
code: -19500,
|
|
427
|
+
message: "UNIQUE_CONSTRAINT",
|
|
428
|
+
description: `Insert violates unique constraint`
|
|
404
429
|
}
|
|
405
430
|
}
|
|
406
431
|
},
|
|
@@ -110,7 +110,7 @@ export type QueryBuilderOrderingInputObject = {
|
|
|
110
110
|
nulls?: 'first' | 'last';
|
|
111
111
|
};
|
|
112
112
|
export type QueryBuilderOrderingInput = string | QueryBuilderOrderingInputObject;
|
|
113
|
-
export declare class QueryBuilderInterface<TableFields extends string, StringFields extends string, MetadataFields extends string, Result> extends QueryBuilderInner<TableFields, StringFields, MetadataFields, Result> {
|
|
113
|
+
export declare class QueryBuilderInterface<TableFields extends string, StringFields extends string, MetadataFields extends string, Options, Result> extends QueryBuilderInner<TableFields, StringFields, MetadataFields, Result> {
|
|
114
114
|
private execFn;
|
|
115
115
|
protected optionsObject: {
|
|
116
116
|
[k: string]: unknown;
|
|
@@ -125,9 +125,7 @@ export declare class QueryBuilderInterface<TableFields extends string, StringFie
|
|
|
125
125
|
});
|
|
126
126
|
private start;
|
|
127
127
|
toJSON(): BuiltQuery;
|
|
128
|
-
options(optionsInput:
|
|
129
|
-
[key: string]: unknown;
|
|
130
|
-
}): this;
|
|
128
|
+
options(optionsInput: Options): this;
|
|
131
129
|
then<TResult1 = Result, TResult2 = never>(onfulfilled?: (value: Result) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: Error) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
132
130
|
catch<TResult2 = never>(onerror: (reason: Error) => TResult2 | PromiseLike<TResult2>): Promise<Result | TResult2>;
|
|
133
131
|
stream(): ReadStream;
|
|
@@ -162,7 +160,7 @@ export declare class QueryBuilderInterface<TableFields extends string, StringFie
|
|
|
162
160
|
*
|
|
163
161
|
* ```
|
|
164
162
|
*/
|
|
165
|
-
export declare class QueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ResultFields extends string, Options extends BaseOptions, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Result> {
|
|
163
|
+
export declare class QueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ResultFields extends string, Options extends BaseOptions, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Options, Result> {
|
|
166
164
|
constructor({ start, modifiers, optionsModifiers, }: {
|
|
167
165
|
start: (query: BuiltQuery) => StreamPromise<Result>;
|
|
168
166
|
modifiers?: (field: TableFields | StringFields | MetadataFields, value: Primitive | {
|
|
@@ -205,7 +203,7 @@ export declare class QueryBuilder<TableFields extends string, StringFields exten
|
|
|
205
203
|
*
|
|
206
204
|
* ```
|
|
207
205
|
*/
|
|
208
|
-
export declare class AggregateQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, GroupFields extends string, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Result> {
|
|
206
|
+
export declare class AggregateQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, GroupFields extends string, Options, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Options, Result> {
|
|
209
207
|
private aggregatorObject;
|
|
210
208
|
private timezoneString;
|
|
211
209
|
constructor({ start, modifiers, optionsModifiers, }: {
|
|
@@ -225,7 +223,7 @@ export declare class AggregateQueryBuilder<TableFields extends string, StringFie
|
|
|
225
223
|
max(input?: string): this;
|
|
226
224
|
sum(input?: string): this;
|
|
227
225
|
}
|
|
228
|
-
export declare class UpdateQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ResultFields extends string, UpdateFields, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Result> {
|
|
226
|
+
export declare class UpdateQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ResultFields extends string, UpdateFields, Options, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Options, Result> {
|
|
229
227
|
private updateObject;
|
|
230
228
|
constructor({ start, modifiers, optionsModifiers, }: {
|
|
231
229
|
start?: (query: BuiltUpdateQuery) => StreamPromise<Result>;
|
|
@@ -237,7 +235,7 @@ export declare class UpdateQueryBuilder<TableFields extends string, StringFields
|
|
|
237
235
|
toJSON(): BuiltUpdateQuery;
|
|
238
236
|
update(updateData: UpdateFields): this;
|
|
239
237
|
}
|
|
240
|
-
export declare class ReverseQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ReverseModifications, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Result> {
|
|
238
|
+
export declare class ReverseQueryBuilder<TableFields extends string, StringFields extends string, MetadataFields extends string, ReverseModifications, Options, Result> extends QueryBuilderInterface<TableFields, StringFields, MetadataFields, Options, Result> {
|
|
241
239
|
private reverseModifications;
|
|
242
240
|
constructor({ start, modifiers, optionsModifiers, }: {
|
|
243
241
|
start?: (query: BuiltReverseQuery) => StreamPromise<Result>;
|
|
@@ -2,8 +2,8 @@ import { ITxGeneralOptions, ITxDistributorLeftoverRule } from '../tx-consts.enum
|
|
|
2
2
|
import { UniqueWalletFilter } from '../get-wallet/get-wallet.enums';
|
|
3
3
|
import { UniqueTokenFilter } from '../get-token/get-token.enums';
|
|
4
4
|
import { UniqueTransferGroupFilter } from '../get-transfer-group/get-transfer-group.enums';
|
|
5
|
-
import { TransferTable } from '../../db/transfer/transfer.enums';
|
|
6
5
|
import { TransferGroupTable } from '../../db/transfer-group/transfer-group.enums';
|
|
6
|
+
import { TransferTable } from '../../db/transfer/transfer.enums';
|
|
7
7
|
/**
|
|
8
8
|
* Optional flags for input
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ITxLimitingOptions, ITxGeneralOptions, ITxSelectOptions, ITxDeselectOptions, ITxMetadataOptions, ITxOrderingInput, ITxFindMetadata } from '../tx-consts.enums';
|
|
2
|
-
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
3
2
|
import { TransferLogTableFields } from '../../db/transfer-log/transfer-log.enums';
|
|
3
|
+
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
4
4
|
import { UniqueWalletFilter } from '../get-wallet/get-wallet.enums';
|
|
5
5
|
import { UniqueTokenFilter } from '../get-token/get-token.enums';
|
|
6
6
|
import { UniqueTransferFilter } from '../get-transfer/get-transfer.enums';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ITxLimitingOptions, ITxGeneralOptions, ITxSelectOptions, ITxDeselectOptions, ITxMetadataOptions, ITxOrderingInput, ITxFindMetadata } from '../tx-consts.enums';
|
|
2
|
-
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataPrimitive, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
3
2
|
import { TokenTableFields } from '../../db/token/token.enums';
|
|
3
|
+
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataPrimitive, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
4
4
|
import { UniqueWalletFilter } from '../get-wallet/get-wallet.enums';
|
|
5
|
-
import { Token } from '../get-token/get-token.enums';
|
|
5
|
+
import { Token, TokenWithBalance } from '../get-token/get-token.enums';
|
|
6
6
|
/**
|
|
7
7
|
* Optional flags for input
|
|
8
8
|
*/
|
|
9
9
|
export interface FindTokenManyAdditionalOptions {
|
|
10
|
+
include_balance?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Optional flags for input ordering
|
|
@@ -77,6 +78,6 @@ export interface FindTokenManyTxOutput {
|
|
|
77
78
|
/**
|
|
78
79
|
* Found tokens
|
|
79
80
|
*/
|
|
80
|
-
tokens: Token[];
|
|
81
|
+
tokens: Token[] | TokenWithBalance[];
|
|
81
82
|
metadata: ITxFindMetadata;
|
|
82
83
|
}
|
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
"description": "Optional flags for input",
|
|
43
43
|
"type": "object",
|
|
44
44
|
"default": {},
|
|
45
|
+
"properties": {
|
|
46
|
+
"include_balance": {
|
|
47
|
+
"description": "Return the total system balance of token",
|
|
48
|
+
"type": "boolean"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
45
51
|
"$typescript": "{\"additionalProperties\":false}"
|
|
46
52
|
},
|
|
47
53
|
"find_token_many_ordering_options": {
|
|
@@ -9,7 +9,14 @@
|
|
|
9
9
|
"description": "Found tokens",
|
|
10
10
|
"type": "array",
|
|
11
11
|
"items": {
|
|
12
|
-
"
|
|
12
|
+
"anyOf": [
|
|
13
|
+
{
|
|
14
|
+
"$ref": "/txs/get-token/get-token.schema.output.json#/definitions/token"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"$ref": "/txs/get-token/get-token.schema.output.json#/definitions/token_with_balance"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
13
20
|
}
|
|
14
21
|
},
|
|
15
22
|
"metadata": {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ITxLimitingOptions, ITxGeneralOptions, ITxSelectOptions, ITxDeselectOptions, ITxMetadataOptions, ITxOrderingInput, ITxFindMetadata } from '../tx-consts.enums';
|
|
2
|
-
import {
|
|
2
|
+
import { TransferGroupTableFields } from '../../db/transfer-group/transfer-group.enums';
|
|
3
3
|
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveIdentifier, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataPrimitive, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
4
4
|
import { UniqueTransferGroupFilter, TransferGroup } from '../get-transfer-group/get-transfer-group.enums';
|
|
5
|
-
import { TransferGroupTableFields } from '../../db/transfer-group/transfer-group.enums';
|
|
6
5
|
export interface FindTransferGroupManyAdditionalOptions {
|
|
7
6
|
/**
|
|
8
7
|
* Return running balance for each transfer_group for wallet in question
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
return_transfers_count?: boolean;
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* Optional flags for input ordering
|
|
@@ -82,10 +81,17 @@ export interface FindTransferGroupManyTxInput {
|
|
|
82
81
|
*
|
|
83
82
|
* @category Output
|
|
84
83
|
*/
|
|
84
|
+
export interface TransferGroupTransfersCount {
|
|
85
|
+
/**
|
|
86
|
+
* Number of transfers in the transfer_group
|
|
87
|
+
*/
|
|
88
|
+
transfers_count?: number;
|
|
89
|
+
}
|
|
90
|
+
export type TransferGroupWithTransfersCount = TransferGroup & TransferGroupTransfersCount;
|
|
85
91
|
export interface FindTransferGroupManyTxOutput {
|
|
86
92
|
/**
|
|
87
93
|
* Found transfers
|
|
88
94
|
*/
|
|
89
|
-
transfer_groups:
|
|
95
|
+
transfer_groups: TransferGroupWithTransfersCount[];
|
|
90
96
|
metadata: ITxFindMetadata;
|
|
91
97
|
}
|
|
@@ -42,9 +42,10 @@
|
|
|
42
42
|
"$typescript": "{\"additionalProperties\":false}",
|
|
43
43
|
"type": "object",
|
|
44
44
|
"properties": {
|
|
45
|
-
"
|
|
46
|
-
"description": "Return
|
|
47
|
-
"
|
|
45
|
+
"return_transfers_count": {
|
|
46
|
+
"description": "Return number of transfers in the transfer_group",
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"default": false
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
},
|
|
@@ -9,13 +9,35 @@
|
|
|
9
9
|
"description": "Found transfers",
|
|
10
10
|
"type": "array",
|
|
11
11
|
"items": {
|
|
12
|
-
"$ref": "
|
|
12
|
+
"$ref": "#/definitions/transfer_group_with_transfers_count"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"metadata": {
|
|
16
16
|
"$ref": "/txs/tx-consts.schema.json#/definitions/i_tx_find_metadata"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
"definitions": {
|
|
20
|
+
"transfer_group_transfers_count": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"transfers_count": {
|
|
24
|
+
"description": "Number of transfers in the group",
|
|
25
|
+
"type": "number"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"$typescript": "{\"additionalProperties\": false}"
|
|
29
|
+
},
|
|
30
|
+
"transfer_group_with_transfers_count": {
|
|
31
|
+
"allOf": [
|
|
32
|
+
{
|
|
33
|
+
"$ref": "/txs/get-transfer-group/get-transfer-group.schema.output.json#/definitions/transfer_group"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"$ref": "#/definitions/transfer_group_transfers_count"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
19
41
|
"required": ["transfer_groups", "metadata"],
|
|
20
42
|
"additionalProperties": false
|
|
21
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ITxLimitingOptions, ITxGeneralOptions, ITxSelectOptions, ITxDeselectOptions, ITxMetadataOptions, ITxOrderingInput, ITxFindMetadata } from '../tx-consts.enums';
|
|
2
2
|
import { UniqueWalletFilter } from '../get-wallet/get-wallet.enums';
|
|
3
|
-
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWherePrimitiveIdentifier, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataPrimitive, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
4
3
|
import { TransferTableAccessibleFields } from '../../db/transfer/transfer.enums';
|
|
4
|
+
import { DbFilterMetadata, DbFilterFunctionWhereInner, DbFilterFunctionWherePrimitive, DbFilterFunctionWherePrimitiveForeign, DbFilterFunctionWherePrimitiveIdentifier, DbFilterFunctionWhereObject, DbFilterFunctionWhereIns, DbFilterFunctionWhereNulls, DbFilterFunctionWhereMetadataIns, DbFilterFunctionWhereMetadataPrimitive, DbFilterFunctionWhereMetadataNulls } from '../../db/consts.enums';
|
|
5
5
|
import { UniqueTokenFilter } from '../get-token/get-token.enums';
|
|
6
6
|
import { UniqueTransferGroupFilter } from '../get-transfer-group/get-transfer-group.enums';
|
|
7
7
|
import { Transfer } from '../get-transfer/get-transfer.enums';
|
|
@@ -86,6 +86,10 @@ export interface BalanceHistory {
|
|
|
86
86
|
* Current finished and pending balance sum
|
|
87
87
|
*/
|
|
88
88
|
amount?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The status of the change to balance
|
|
91
|
+
*/
|
|
92
|
+
status?: 'pending' | 'finished';
|
|
89
93
|
/**
|
|
90
94
|
* Latest control_hash associated with wallet token combination
|
|
91
95
|
*/
|
|
@@ -173,7 +177,7 @@ export interface BalanceHistory {
|
|
|
173
177
|
*/
|
|
174
178
|
transfer_status_finalized_at?: string | null;
|
|
175
179
|
}
|
|
176
|
-
export type BalanceHistoryFields = 'transfer_id' | 'transfer_identifier' | 'transfer_control_hash' | 'transfer_from_wallet_id' | 'transfer_from_wallet_foreign' | 'transfer_to_wallet_id' | 'transfer_to_wallet_foreign' | 'transfer_amount' | 'transfer_type' | 'transfer_status' | 'transfer_force' | 'transfer_created_at' | 'transfer_updated_at' | 'transfer_metadata' | 'transfer_transfer_group_id' | 'transfer_transfer_group_identifier' | 'transfer_reverses_id' | 'transfer_reverses_identifier' | 'transfer_status_finalized_at' | 'balance_id' | 'token_id' | 'token_foreign' | 'wallet_id' | 'wallet_foreign' | 'pending_amount' | 'pending_amount_to' | 'pending_amount_from' | 'finished_amount' | 'amount' | 'latest_control_hash' | 'updated_at' | 'status';
|
|
180
|
+
export type BalanceHistoryFields = 'transfer_id' | 'transfer_identifier' | 'transfer_control_hash' | 'transfer_from_wallet_id' | 'transfer_from_wallet_foreign' | 'transfer_to_wallet_id' | 'transfer_to_wallet_foreign' | 'transfer_amount' | 'transfer_type' | 'transfer_status' | 'transfer_force' | 'transfer_created_at' | 'transfer_updated_at' | 'transfer_metadata' | 'transfer_transfer_group_id' | 'transfer_transfer_group_identifier' | 'transfer_reverses_id' | 'transfer_reverses_identifier' | 'transfer_status_finalized_at' | 'balance_id' | 'token_id' | 'token_foreign' | 'wallet_id' | 'wallet_foreign' | 'pending_amount' | 'pending_amount_to' | 'pending_amount_from' | 'finished_amount' | 'amount' | 'latest_control_hash' | 'updated_at' | 'status' | 'available_balance';
|
|
177
181
|
/**
|
|
178
182
|
* Output of getBalanceHistory
|
|
179
183
|
*
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
"description": "Current finished and pending balance sum",
|
|
65
65
|
"type": "number"
|
|
66
66
|
},
|
|
67
|
+
"status": {
|
|
68
|
+
"description": "The status of the change to balance",
|
|
69
|
+
"type": ["string"],
|
|
70
|
+
"enum": ["pending", "finished"]
|
|
71
|
+
},
|
|
67
72
|
"latest_control_hash": {
|
|
68
73
|
"description": "Latest control_hash associated with wallet token combination",
|
|
69
74
|
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/latest_control_hash"
|
|
@@ -170,7 +175,8 @@
|
|
|
170
175
|
"amount",
|
|
171
176
|
"latest_control_hash",
|
|
172
177
|
"updated_at",
|
|
173
|
-
"status"
|
|
178
|
+
"status",
|
|
179
|
+
"available_balance"
|
|
174
180
|
]
|
|
175
181
|
}
|
|
176
182
|
},
|
|
@@ -12,6 +12,10 @@ export interface GetTokenAdditionalOptions {
|
|
|
12
12
|
* If true then the returning object is only guaranteed to have id
|
|
13
13
|
*/
|
|
14
14
|
return_only_id?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Return the total system balance of token
|
|
17
|
+
*/
|
|
18
|
+
include_balance?: boolean;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* ID based filter for token
|
|
@@ -101,6 +105,44 @@ export interface Token {
|
|
|
101
105
|
*/
|
|
102
106
|
belongs_to_foreign?: string | null;
|
|
103
107
|
}
|
|
108
|
+
export interface TokenWithBalance extends Token {
|
|
109
|
+
/**
|
|
110
|
+
* Latest transfer affecting the balance
|
|
111
|
+
*/
|
|
112
|
+
balance_transfer_id: number | null;
|
|
113
|
+
/**
|
|
114
|
+
* Current pending balance
|
|
115
|
+
*/
|
|
116
|
+
balance_pending_amount: number | null;
|
|
117
|
+
/**
|
|
118
|
+
* Sum of incoming pending transfers
|
|
119
|
+
*/
|
|
120
|
+
balance_pending_amount_to: number | null;
|
|
121
|
+
/**
|
|
122
|
+
* Sum of outgoing pending transfers
|
|
123
|
+
*/
|
|
124
|
+
balance_pending_amount_from: number | null;
|
|
125
|
+
/**
|
|
126
|
+
* Current finished balance
|
|
127
|
+
*/
|
|
128
|
+
balance_finished_amount: number | null;
|
|
129
|
+
/**
|
|
130
|
+
* Current finished and pending balance sum
|
|
131
|
+
*/
|
|
132
|
+
balance_amount: number | null;
|
|
133
|
+
/**
|
|
134
|
+
* Available balance that is sum of pending_amount_from and finished_amount
|
|
135
|
+
*/
|
|
136
|
+
balance_available_balance: number | null;
|
|
137
|
+
/**
|
|
138
|
+
* Latest control_hash associated with wallet token combination
|
|
139
|
+
*/
|
|
140
|
+
balance_latest_control_hash: number | null;
|
|
141
|
+
/**
|
|
142
|
+
* Last modification date of balance
|
|
143
|
+
*/
|
|
144
|
+
balance_updated_at: number | null;
|
|
145
|
+
}
|
|
104
146
|
/**
|
|
105
147
|
* Output of getToken
|
|
106
148
|
*
|
|
@@ -110,5 +152,5 @@ export interface GetTokenTxOutput {
|
|
|
110
152
|
/**
|
|
111
153
|
* requested token
|
|
112
154
|
*/
|
|
113
|
-
token?: Token;
|
|
155
|
+
token?: Token | TokenWithBalance;
|
|
114
156
|
}
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"type": "object",
|
|
27
27
|
"properties": {
|
|
28
28
|
"ignore_cache": {
|
|
29
|
-
"description": "If true then result is returned from cache layer if possible",
|
|
30
29
|
"type": "boolean",
|
|
31
30
|
"default": false
|
|
32
31
|
},
|
|
@@ -39,6 +38,11 @@
|
|
|
39
38
|
"type": "boolean",
|
|
40
39
|
"description": "If true then the returning object is only guaranteed to have id",
|
|
41
40
|
"default": false
|
|
41
|
+
},
|
|
42
|
+
"include_balance": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Return the total system balance of token",
|
|
45
|
+
"default": false
|
|
42
46
|
}
|
|
43
47
|
},
|
|
44
48
|
"default": {},
|
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
"properties": {
|
|
8
8
|
"token": {
|
|
9
9
|
"description": "requested token",
|
|
10
|
-
"
|
|
10
|
+
"anyOf": [
|
|
11
|
+
{
|
|
12
|
+
"$ref": "#/definitions/token"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"$ref": "#/definitions/token_with_balance"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
11
18
|
}
|
|
12
19
|
},
|
|
13
20
|
"definitions": {
|
|
@@ -49,7 +56,61 @@
|
|
|
49
56
|
}
|
|
50
57
|
},
|
|
51
58
|
"required": ["id"],
|
|
52
|
-
"additionalProperties": false
|
|
59
|
+
"$typescript": "{\"additionalProperties\": false}"
|
|
60
|
+
},
|
|
61
|
+
"token_with_balance": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"allOf": [
|
|
64
|
+
{
|
|
65
|
+
"$ref": "#/definitions/token"
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
{
|
|
69
|
+
"$ref": "#/definitions/token_balance"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"token_balance": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"properties": {
|
|
76
|
+
"balance_transfer_id": {
|
|
77
|
+
"description": "Latest transfer id",
|
|
78
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/transfer_id"
|
|
79
|
+
},
|
|
80
|
+
"balance_pending_amount": {
|
|
81
|
+
"description": "Current pending balance",
|
|
82
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/pending_amount"
|
|
83
|
+
},
|
|
84
|
+
"balance_pending_amount_to": {
|
|
85
|
+
"description": "Sum of incoming pending transfers",
|
|
86
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/pending_amount_to"
|
|
87
|
+
},
|
|
88
|
+
"balance_pending_amount_from": {
|
|
89
|
+
"description": "Sum of outgoing pending transfers",
|
|
90
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/pending_amount_from"
|
|
91
|
+
},
|
|
92
|
+
"balance_finished_amount": {
|
|
93
|
+
"description": "Current finished balance",
|
|
94
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/finished_amount"
|
|
95
|
+
},
|
|
96
|
+
"balance_amount": {
|
|
97
|
+
"description": "Current finished and pending balance sum",
|
|
98
|
+
"type": "number"
|
|
99
|
+
},
|
|
100
|
+
"balance_available_balance": {
|
|
101
|
+
"description": "Available balance that is sum of pending_amount_from and finished_amount",
|
|
102
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/available_balance"
|
|
103
|
+
},
|
|
104
|
+
"balance_latest_control_hash": {
|
|
105
|
+
"description": "Latest control_hash associated with wallet token combination",
|
|
106
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/latest_control_hash"
|
|
107
|
+
},
|
|
108
|
+
"balance_updated_at": {
|
|
109
|
+
"description": "Last modification date of balance",
|
|
110
|
+
"$ref": "/db/transfer-log/transfer-log.schema.json#/properties/created_at"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"$typescript": "{\"additionalProperties\": false}"
|
|
53
114
|
}
|
|
54
115
|
},
|
|
55
116
|
"additionalProperties": false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UniqueTokenFilter } from '../get-token/get-token.enums';
|
|
1
|
+
import { TokenWithBalance, UniqueTokenFilter } from '../get-token/get-token.enums';
|
|
2
2
|
import { ITxGeneralOptions } from '../tx-consts.enums';
|
|
3
3
|
import { TokenTable, TokenTableOptional } from '../../db/token/token.enums';
|
|
4
4
|
/**
|
|
@@ -14,6 +14,10 @@ export interface GetTokenManyAdditionalOptions {
|
|
|
14
14
|
* If true then the returning object is only guaranteed to have id
|
|
15
15
|
*/
|
|
16
16
|
return_only_id?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Return the total system balance of token
|
|
19
|
+
*/
|
|
20
|
+
include_balance?: boolean;
|
|
17
21
|
}
|
|
18
22
|
export type GetTokenManyTxOptions = ITxGeneralOptions & GetTokenManyAdditionalOptions;
|
|
19
23
|
/**
|
|
@@ -25,7 +29,7 @@ export interface GetTokenManyTxInput {
|
|
|
25
29
|
tokens: UniqueTokenFilter[];
|
|
26
30
|
options?: GetTokenManyTxOptions;
|
|
27
31
|
}
|
|
28
|
-
export type TokenResult = TokenTable | TokenTableOptional | null;
|
|
32
|
+
export type TokenResult = TokenTable | TokenTableOptional | TokenWithBalance | null;
|
|
29
33
|
/**
|
|
30
34
|
* Output of getTokenMany
|
|
31
35
|
*
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"type": "boolean",
|
|
42
42
|
"description": "If true then the returning object is only guaranteed to have id",
|
|
43
43
|
"default": false
|
|
44
|
+
},
|
|
45
|
+
"include_balance": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"description": "Return the total system balance of token",
|
|
48
|
+
"default": false
|
|
44
49
|
}
|
|
45
50
|
},
|
|
46
51
|
"default": {},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UniqueTransferGroupFilter } from '../get-transfer-group/get-transfer-group.enums';
|
|
2
2
|
import { ITxGeneralOptionsWithoutTx, ITxMetadataAction } from '../tx-consts.enums';
|
|
3
|
-
import { TransferGroupTable } from '../../db/transfer-group/transfer-group.enums';
|
|
4
3
|
import { TransferGroupStatus, TransferStatus } from '../../db/consts.enums';
|
|
4
|
+
import { TransferGroupTable } from '../../db/transfer-group/transfer-group.enums';
|
|
5
5
|
import { Transfer } from '../get-transfer/get-transfer.enums';
|
|
6
6
|
/**
|
|
7
7
|
* Optional flags for input
|