@waves/node-api-js 1.3.10-beta.2 → 1.3.10-beta.3
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/README.md +2 -2
- package/cjs/api-node/activation/index.d.ts +21 -21
- package/cjs/api-node/activation/index.js +19 -19
- package/cjs/api-node/addresses/index.d.ts +81 -81
- package/cjs/api-node/addresses/index.js +173 -173
- package/cjs/api-node/alias/index.d.ts +6 -6
- package/cjs/api-node/alias/index.js +21 -21
- package/cjs/api-node/assets/index.d.ts +79 -79
- package/cjs/api-node/assets/index.js +171 -171
- package/cjs/api-node/blocks/index.d.ts +143 -143
- package/cjs/api-node/blocks/index.js +209 -209
- package/cjs/api-node/debug/index.d.ts +189 -189
- package/cjs/api-node/debug/index.js +244 -244
- package/cjs/api-node/eth/index.d.ts +3 -3
- package/cjs/api-node/eth/index.js +14 -14
- package/cjs/api-node/leasing/index.d.ts +22 -22
- package/cjs/api-node/leasing/index.js +41 -41
- package/cjs/api-node/node/index.d.ts +11 -11
- package/cjs/api-node/node/index.js +19 -19
- package/cjs/api-node/peers/index.d.ts +46 -46
- package/cjs/api-node/peers/index.js +59 -59
- package/cjs/api-node/rewards/index.d.ts +21 -21
- package/cjs/api-node/rewards/index.js +20 -20
- package/cjs/api-node/transactions/index.d.ts +73 -73
- package/cjs/api-node/transactions/index.js +192 -192
- package/cjs/api-node/utils/index.d.ts +110 -110
- package/cjs/api-node/utils/index.js +210 -210
- package/cjs/api-node/wallet/index.d.ts +5 -5
- package/cjs/api-node/wallet/index.js +6 -6
- package/cjs/constants.d.ts +40 -40
- package/cjs/constants.js +42 -42
- package/cjs/create.d.ts +1238 -1238
- package/cjs/create.js +115 -115
- package/cjs/index.d.ts +9 -9
- package/cjs/index.js +17 -17
- package/cjs/interface.d.ts +44 -44
- package/cjs/interface.js +9 -9
- package/cjs/tools/adresses/availableSponsoredBalances.d.ts +7 -7
- package/cjs/tools/adresses/availableSponsoredBalances.js +29 -29
- package/cjs/tools/adresses/ethAddress2waves.d.ts +1 -1
- package/cjs/tools/adresses/ethAddress2waves.js +46 -46
- package/cjs/tools/adresses/getAssetIdListByTx.d.ts +2 -2
- package/cjs/tools/adresses/getAssetIdListByTx.js +47 -47
- package/cjs/tools/adresses/getAssetsByTransaction.d.ts +3 -3
- package/cjs/tools/adresses/getAssetsByTransaction.js +13 -13
- package/cjs/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
- package/cjs/tools/adresses/getTransactionsWithAssets.js +12 -12
- package/cjs/tools/adresses/watch.d.ts +24 -24
- package/cjs/tools/adresses/watch.js +167 -167
- package/cjs/tools/adresses/wavesAddress2eth.d.ts +1 -1
- package/cjs/tools/adresses/wavesAddress2eth.js +9 -9
- package/cjs/tools/assets/wavesAsset2eth.d.ts +1 -1
- package/cjs/tools/assets/wavesAsset2eth.js +9 -9
- package/cjs/tools/blocks/detectInterval.d.ts +1 -1
- package/cjs/tools/blocks/detectInterval.js +11 -11
- package/cjs/tools/blocks/getNetworkByte.d.ts +1 -1
- package/cjs/tools/blocks/getNetworkByte.js +53 -53
- package/cjs/tools/blocks/getNetworkCode.d.ts +1 -1
- package/cjs/tools/blocks/getNetworkCode.js +10 -10
- package/cjs/tools/blocks/waitHeight.d.ts +3 -3
- package/cjs/tools/blocks/waitHeight.js +64 -64
- package/cjs/tools/parse.d.ts +1 -1
- package/cjs/tools/parse.js +7 -7
- package/cjs/tools/query.d.ts +4 -4
- package/cjs/tools/query.js +40 -40
- package/cjs/tools/request.d.ts +64 -64
- package/cjs/tools/request.js +41 -41
- package/cjs/tools/resolve.d.ts +1 -1
- package/cjs/tools/resolve.js +6 -6
- package/cjs/tools/stringify.d.ts +1 -1
- package/cjs/tools/stringify.js +20 -20
- package/cjs/tools/transactions/broadcast.d.ts +14 -14
- package/cjs/tools/transactions/broadcast.js +59 -59
- package/cjs/tools/transactions/ethTxId2waves.d.ts +1 -1
- package/cjs/tools/transactions/ethTxId2waves.js +10 -10
- package/cjs/tools/transactions/wait.d.ts +10 -10
- package/cjs/tools/transactions/wait.js +41 -41
- package/cjs/tools/utils.d.ts +32 -32
- package/cjs/tools/utils.js +117 -117
- package/dist/node-api.js +2300 -2300
- package/es/api-node/activation/index.d.ts +21 -21
- package/es/api-node/activation/index.js +12 -12
- package/es/api-node/addresses/index.d.ts +81 -81
- package/es/api-node/addresses/index.js +110 -110
- package/es/api-node/alias/index.d.ts +6 -6
- package/es/api-node/alias/index.js +13 -13
- package/es/api-node/assets/index.d.ts +79 -79
- package/es/api-node/assets/index.js +102 -102
- package/es/api-node/blocks/index.d.ts +143 -143
- package/es/api-node/blocks/index.js +178 -178
- package/es/api-node/debug/index.d.ts +189 -189
- package/es/api-node/debug/index.js +200 -200
- package/es/api-node/eth/index.d.ts +3 -3
- package/es/api-node/eth/index.js +7 -7
- package/es/api-node/leasing/index.d.ts +22 -22
- package/es/api-node/leasing/index.js +21 -21
- package/es/api-node/node/index.d.ts +11 -11
- package/es/api-node/node/index.js +9 -9
- package/es/api-node/peers/index.d.ts +46 -46
- package/es/api-node/peers/index.js +45 -45
- package/es/api-node/rewards/index.d.ts +21 -21
- package/es/api-node/rewards/index.js +12 -12
- package/es/api-node/transactions/index.d.ts +73 -73
- package/es/api-node/transactions/index.js +136 -136
- package/es/api-node/utils/index.d.ts +110 -110
- package/es/api-node/utils/index.js +192 -192
- package/es/api-node/wallet/index.d.ts +5 -5
- package/es/api-node/wallet/index.js +6 -6
- package/es/constants.d.ts +40 -40
- package/es/constants.js +39 -39
- package/es/create.d.ts +1238 -1238
- package/es/create.js +89 -89
- package/es/index.d.ts +9 -9
- package/es/index.js +8 -8
- package/es/interface.d.ts +44 -44
- package/es/interface.js +2 -2
- package/es/tools/adresses/availableSponsoredBalances.d.ts +7 -7
- package/es/tools/adresses/availableSponsoredBalances.js +26 -26
- package/es/tools/adresses/ethAddress2waves.d.ts +1 -1
- package/es/tools/adresses/ethAddress2waves.js +30 -30
- package/es/tools/adresses/getAssetIdListByTx.d.ts +2 -2
- package/es/tools/adresses/getAssetIdListByTx.js +23 -23
- package/es/tools/adresses/getAssetsByTransaction.d.ts +3 -3
- package/es/tools/adresses/getAssetsByTransaction.js +7 -7
- package/es/tools/adresses/getTransactionsWithAssets.d.ts +6 -6
- package/es/tools/adresses/getTransactionsWithAssets.js +6 -6
- package/es/tools/adresses/watch.d.ts +24 -24
- package/es/tools/adresses/watch.js +133 -133
- package/es/tools/adresses/wavesAddress2eth.d.ts +1 -1
- package/es/tools/adresses/wavesAddress2eth.js +6 -6
- package/es/tools/assets/wavesAsset2eth.d.ts +1 -1
- package/es/tools/assets/wavesAsset2eth.js +6 -6
- package/es/tools/blocks/detectInterval.d.ts +1 -1
- package/es/tools/blocks/detectInterval.js +8 -8
- package/es/tools/blocks/getNetworkByte.d.ts +1 -1
- package/es/tools/blocks/getNetworkByte.js +50 -50
- package/es/tools/blocks/getNetworkCode.d.ts +1 -1
- package/es/tools/blocks/getNetworkCode.js +4 -4
- package/es/tools/blocks/waitHeight.d.ts +3 -3
- package/es/tools/blocks/waitHeight.js +35 -35
- package/es/tools/parse.d.ts +1 -1
- package/es/tools/parse.js +4 -4
- package/es/tools/query.d.ts +4 -4
- package/es/tools/query.js +11 -11
- package/es/tools/request.d.ts +64 -64
- package/es/tools/request.js +21 -21
- package/es/tools/resolve.d.ts +1 -1
- package/es/tools/resolve.js +3 -3
- package/es/tools/stringify.d.ts +1 -1
- package/es/tools/stringify.js +17 -17
- package/es/tools/transactions/broadcast.d.ts +14 -14
- package/es/tools/transactions/broadcast.js +42 -42
- package/es/tools/transactions/ethTxId2waves.d.ts +1 -1
- package/es/tools/transactions/ethTxId2waves.js +7 -7
- package/es/tools/transactions/wait.d.ts +10 -10
- package/es/tools/transactions/wait.js +38 -38
- package/es/tools/utils.d.ts +32 -32
- package/es/tools/utils.js +72 -72
- package/package.json +66 -66
- package/cjs/api-node/consensus/index.d.ts +0 -39
- package/cjs/api-node/consensus/index.js +0 -37
- package/cjs/api-node/consensus/index.js.map +0 -1
- package/es/api-node/consensus/index.d.ts +0 -39
- package/es/api-node/consensus/index.js +0 -27
- package/es/api-node/consensus/index.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchByAddress = exports.fetchByAlias = void 0;
|
|
7
|
-
var request_1 = __importDefault(require("../../tools/request"));
|
|
8
|
-
function fetchByAlias(base, alias) {
|
|
9
|
-
return request_1.default({
|
|
10
|
-
base: base,
|
|
11
|
-
url: "/alias/by-alias/" + alias
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.fetchByAlias = fetchByAlias;
|
|
15
|
-
function fetchByAddress(base, address) {
|
|
16
|
-
return request_1.default({
|
|
17
|
-
base: base,
|
|
18
|
-
url: "/alias/by-address/" + address
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
exports.fetchByAddress = fetchByAddress;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchByAddress = exports.fetchByAlias = void 0;
|
|
7
|
+
var request_1 = __importDefault(require("../../tools/request"));
|
|
8
|
+
function fetchByAlias(base, alias) {
|
|
9
|
+
return request_1.default({
|
|
10
|
+
base: base,
|
|
11
|
+
url: "/alias/by-alias/" + alias
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.fetchByAlias = fetchByAlias;
|
|
15
|
+
function fetchByAddress(base, address) {
|
|
16
|
+
return request_1.default({
|
|
17
|
+
base: base,
|
|
18
|
+
url: "/alias/by-address/" + address
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.fetchByAddress = fetchByAddress;
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { TLong } from '../../interface';
|
|
2
|
-
import { AssetDecimals, IssueTransaction, SignedTransaction, WithApiMixin } from '@waves/ts-types';
|
|
3
|
-
/**
|
|
4
|
-
* GET /assets/details/{assetId}
|
|
5
|
-
* Information about an asset
|
|
6
|
-
*/
|
|
7
|
-
export declare function fetchDetails(base: string, assetId: string, options?: RequestInit): Promise<TAssetDetails>;
|
|
8
|
-
export declare function fetchDetails(base: string, assetId: Array<string>, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
9
|
-
/**
|
|
10
|
-
* POST /assets/details
|
|
11
|
-
* Provides detailed information about the given assets
|
|
12
|
-
*/
|
|
13
|
-
export declare function fetchAssetsDetails(base: string, assetIds: Array<string>, options?: RequestInit): Promise<Array<TAssetDetails | TErrorResponse>>;
|
|
14
|
-
export declare function fetchAssetDistribution(base: string, assetId: string, height: number, limit: number, options?: RequestInit): Promise<IAssetDistribution>;
|
|
15
|
-
/**
|
|
16
|
-
* TODO
|
|
17
|
-
* GET /assets/{assetId}/distribution
|
|
18
|
-
* Asset balance distribution
|
|
19
|
-
*/
|
|
20
|
-
export declare function fetchAssetsAddressLimit(base: string, address: string, limit: number, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
21
|
-
/**
|
|
22
|
-
* TODO
|
|
23
|
-
* GET assets/nft/${address}/limit/${limit}
|
|
24
|
-
* Asset balance distribution
|
|
25
|
-
*/
|
|
26
|
-
interface IFetchAssetsNftParams {
|
|
27
|
-
address: string;
|
|
28
|
-
limit: number;
|
|
29
|
-
after?: string;
|
|
30
|
-
}
|
|
31
|
-
export declare function fetchAssetsNft(base: string, { address, limit, after }: IFetchAssetsNftParams, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
32
|
-
export declare function fetchAssetsBalance(base: string, address: string, options?: RequestInit): Promise<TAssetsBalance>;
|
|
33
|
-
export declare function fetchBalanceAddressAssetId(base: string, address: string, assetId: string, options?: RequestInit): Promise<IBalanceAddressAssetId>;
|
|
34
|
-
export declare function convertEthAssetId(base: string, assetId: string): Promise<string>;
|
|
35
|
-
export interface IAssetDistribution {
|
|
36
|
-
hasNext: boolean;
|
|
37
|
-
lastItem: string | null;
|
|
38
|
-
items: Record<string, number>;
|
|
39
|
-
}
|
|
40
|
-
export interface IBalanceAddressAssetId<LONG = TLong> {
|
|
41
|
-
address: string;
|
|
42
|
-
assetId: string;
|
|
43
|
-
balance: LONG;
|
|
44
|
-
}
|
|
45
|
-
export declare type TAssetsBalance = {
|
|
46
|
-
'address': string;
|
|
47
|
-
'balances': Array<TAssetBalance>;
|
|
48
|
-
};
|
|
49
|
-
export declare type TAssetBalance<LONG = TLong> = {
|
|
50
|
-
'assetId': string;
|
|
51
|
-
'balance': LONG;
|
|
52
|
-
'reissuable': true;
|
|
53
|
-
'minSponsoredAssetFee': LONG | null;
|
|
54
|
-
'sponsorBalance': LONG | null;
|
|
55
|
-
'quantity': LONG;
|
|
56
|
-
'issueTransaction': SignedTransaction<IssueTransaction & WithApiMixin> & {
|
|
57
|
-
feeAssetId: null;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export declare type TAssetDetails<LONG = TLong> = {
|
|
61
|
-
assetId: string;
|
|
62
|
-
issueHeight: number;
|
|
63
|
-
issueTimestamp: number;
|
|
64
|
-
issuer: string;
|
|
65
|
-
issuerPublicKey: string;
|
|
66
|
-
name: string;
|
|
67
|
-
description: string;
|
|
68
|
-
decimals: AssetDecimals;
|
|
69
|
-
reissuable: boolean;
|
|
70
|
-
quantity: LONG;
|
|
71
|
-
scripted: boolean;
|
|
72
|
-
minSponsoredAssetFee: LONG | null;
|
|
73
|
-
originTransactionId: string;
|
|
74
|
-
};
|
|
75
|
-
export declare type TErrorResponse = {
|
|
76
|
-
error: number;
|
|
77
|
-
message: string;
|
|
78
|
-
};
|
|
79
|
-
export {};
|
|
1
|
+
import { TLong } from '../../interface';
|
|
2
|
+
import { AssetDecimals, IssueTransaction, SignedTransaction, WithApiMixin } from '@waves/ts-types';
|
|
3
|
+
/**
|
|
4
|
+
* GET /assets/details/{assetId}
|
|
5
|
+
* Information about an asset
|
|
6
|
+
*/
|
|
7
|
+
export declare function fetchDetails(base: string, assetId: string, options?: RequestInit): Promise<TAssetDetails>;
|
|
8
|
+
export declare function fetchDetails(base: string, assetId: Array<string>, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
9
|
+
/**
|
|
10
|
+
* POST /assets/details
|
|
11
|
+
* Provides detailed information about the given assets
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchAssetsDetails(base: string, assetIds: Array<string>, options?: RequestInit): Promise<Array<TAssetDetails | TErrorResponse>>;
|
|
14
|
+
export declare function fetchAssetDistribution(base: string, assetId: string, height: number, limit: number, options?: RequestInit): Promise<IAssetDistribution>;
|
|
15
|
+
/**
|
|
16
|
+
* TODO
|
|
17
|
+
* GET /assets/{assetId}/distribution
|
|
18
|
+
* Asset balance distribution
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchAssetsAddressLimit(base: string, address: string, limit: number, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
21
|
+
/**
|
|
22
|
+
* TODO
|
|
23
|
+
* GET assets/nft/${address}/limit/${limit}
|
|
24
|
+
* Asset balance distribution
|
|
25
|
+
*/
|
|
26
|
+
interface IFetchAssetsNftParams {
|
|
27
|
+
address: string;
|
|
28
|
+
limit: number;
|
|
29
|
+
after?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function fetchAssetsNft(base: string, { address, limit, after }: IFetchAssetsNftParams, options?: RequestInit): Promise<Array<TAssetDetails>>;
|
|
32
|
+
export declare function fetchAssetsBalance(base: string, address: string, options?: RequestInit): Promise<TAssetsBalance>;
|
|
33
|
+
export declare function fetchBalanceAddressAssetId(base: string, address: string, assetId: string, options?: RequestInit): Promise<IBalanceAddressAssetId>;
|
|
34
|
+
export declare function convertEthAssetId(base: string, assetId: string): Promise<string>;
|
|
35
|
+
export interface IAssetDistribution {
|
|
36
|
+
hasNext: boolean;
|
|
37
|
+
lastItem: string | null;
|
|
38
|
+
items: Record<string, number>;
|
|
39
|
+
}
|
|
40
|
+
export interface IBalanceAddressAssetId<LONG = TLong> {
|
|
41
|
+
address: string;
|
|
42
|
+
assetId: string;
|
|
43
|
+
balance: LONG;
|
|
44
|
+
}
|
|
45
|
+
export declare type TAssetsBalance = {
|
|
46
|
+
'address': string;
|
|
47
|
+
'balances': Array<TAssetBalance>;
|
|
48
|
+
};
|
|
49
|
+
export declare type TAssetBalance<LONG = TLong> = {
|
|
50
|
+
'assetId': string;
|
|
51
|
+
'balance': LONG;
|
|
52
|
+
'reissuable': true;
|
|
53
|
+
'minSponsoredAssetFee': LONG | null;
|
|
54
|
+
'sponsorBalance': LONG | null;
|
|
55
|
+
'quantity': LONG;
|
|
56
|
+
'issueTransaction': SignedTransaction<IssueTransaction & WithApiMixin> & {
|
|
57
|
+
feeAssetId: null;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare type TAssetDetails<LONG = TLong> = {
|
|
61
|
+
assetId: string;
|
|
62
|
+
issueHeight: number;
|
|
63
|
+
issueTimestamp: number;
|
|
64
|
+
issuer: string;
|
|
65
|
+
issuerPublicKey: string;
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
decimals: AssetDecimals;
|
|
69
|
+
reissuable: boolean;
|
|
70
|
+
quantity: LONG;
|
|
71
|
+
scripted: boolean;
|
|
72
|
+
minSponsoredAssetFee: LONG | null;
|
|
73
|
+
originTransactionId: string;
|
|
74
|
+
};
|
|
75
|
+
export declare type TErrorResponse = {
|
|
76
|
+
error: number;
|
|
77
|
+
message: string;
|
|
78
|
+
};
|
|
79
|
+
export {};
|
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.convertEthAssetId = exports.fetchBalanceAddressAssetId = exports.fetchAssetsBalance = exports.fetchAssetsNft = exports.fetchAssetsAddressLimit = exports.fetchAssetDistribution = exports.fetchAssetsDetails = exports.fetchDetails = void 0;
|
|
54
|
-
var ts_types_1 = require("@waves/ts-types");
|
|
55
|
-
var request_1 = __importDefault(require("../../tools/request"));
|
|
56
|
-
var utils_1 = require("../../tools/utils");
|
|
57
|
-
var query_1 = __importDefault(require("../../tools/query"));
|
|
58
|
-
function fetchDetails(base, assetId, options) {
|
|
59
|
-
if (options === void 0) { options = Object.create(null); }
|
|
60
|
-
var isOnce = !Array.isArray(assetId);
|
|
61
|
-
return Promise.all(utils_1.toArray(assetId).map(function (id) { return request_1.default({
|
|
62
|
-
base: base,
|
|
63
|
-
url: "/assets/details/" + id,
|
|
64
|
-
options: options
|
|
65
|
-
}); }))
|
|
66
|
-
.then(function (list) { return isOnce ? list[0] : list; });
|
|
67
|
-
}
|
|
68
|
-
exports.fetchDetails = fetchDetails;
|
|
69
|
-
/**
|
|
70
|
-
* POST /assets/details
|
|
71
|
-
* Provides detailed information about the given assets
|
|
72
|
-
*/
|
|
73
|
-
function fetchAssetsDetails(base, assetIds, options) {
|
|
74
|
-
if (options === void 0) { options = Object.create(null); }
|
|
75
|
-
var body = JSON.stringify({ ids: assetIds });
|
|
76
|
-
var _options = __assign(__assign({}, options), { body: body, headers: {
|
|
77
|
-
'content-type': 'application/json'
|
|
78
|
-
}, method: 'POST' });
|
|
79
|
-
return request_1.default({ base: base, url: "/assets/details", options: _options });
|
|
80
|
-
}
|
|
81
|
-
exports.fetchAssetsDetails = fetchAssetsDetails;
|
|
82
|
-
function fetchAssetDistribution(base, assetId, height, limit, options) {
|
|
83
|
-
if (options === void 0) { options = Object.create(null); }
|
|
84
|
-
return request_1.default({ base: base, url: "/assets/" + assetId + "/distribution/" + height + "/limit/" + limit, options: options });
|
|
85
|
-
}
|
|
86
|
-
exports.fetchAssetDistribution = fetchAssetDistribution;
|
|
87
|
-
/**
|
|
88
|
-
* TODO
|
|
89
|
-
* GET /assets/{assetId}/distribution
|
|
90
|
-
* Asset balance distribution
|
|
91
|
-
*/
|
|
92
|
-
function fetchAssetsAddressLimit(base, address, limit, options) {
|
|
93
|
-
if (options === void 0) { options = Object.create(null); }
|
|
94
|
-
return request_1.default({ base: base, url: "assets/nft/" + address + "/limit/" + limit, options: options });
|
|
95
|
-
}
|
|
96
|
-
exports.fetchAssetsAddressLimit = fetchAssetsAddressLimit;
|
|
97
|
-
function fetchAssetsNft(base, _a, options) {
|
|
98
|
-
var address = _a.address, limit = _a.limit, after = _a.after;
|
|
99
|
-
if (options === void 0) { options = Object.create(null); }
|
|
100
|
-
var url = new URL("assets/nft/" + address + "/limit/" + limit, base);
|
|
101
|
-
if (after) {
|
|
102
|
-
url.searchParams.append('after', after);
|
|
103
|
-
}
|
|
104
|
-
return request_1.default({ base: base, url: "" + url.pathname + url.search, options: options });
|
|
105
|
-
}
|
|
106
|
-
exports.fetchAssetsNft = fetchAssetsNft;
|
|
107
|
-
function fetchAssetsBalance(base, address, options) {
|
|
108
|
-
if (options === void 0) { options = Object.create(null); }
|
|
109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var balancesResponse, assetsWithoutIssueTransaction, detailsIds, assetsDetailsResponse;
|
|
111
|
-
return __generator(this, function (_a) {
|
|
112
|
-
switch (_a.label) {
|
|
113
|
-
case 0: return [4 /*yield*/, request_1.default({ base: base, url: "/assets/balance/" + address, options: options })];
|
|
114
|
-
case 1:
|
|
115
|
-
balancesResponse = _a.sent();
|
|
116
|
-
assetsWithoutIssueTransaction = balancesResponse.balances.reduce(function (acc, balance, index) {
|
|
117
|
-
if (!balance.issueTransaction) {
|
|
118
|
-
acc[balance.assetId] = index;
|
|
119
|
-
}
|
|
120
|
-
return acc;
|
|
121
|
-
}, {});
|
|
122
|
-
detailsIds = Object.keys(assetsWithoutIssueTransaction);
|
|
123
|
-
if (!detailsIds.length) return [3 /*break*/, 3];
|
|
124
|
-
return [4 /*yield*/, fetchAssetsDetails(base, detailsIds, options)];
|
|
125
|
-
case 2:
|
|
126
|
-
assetsDetailsResponse = _a.sent();
|
|
127
|
-
assetsDetailsResponse.forEach(function (assetDetails) {
|
|
128
|
-
if ('error' in assetDetails) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
var assetIndex = assetsWithoutIssueTransaction[assetDetails.assetId];
|
|
132
|
-
var assetBalance = balancesResponse.balances[assetIndex];
|
|
133
|
-
if (!assetBalance) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
assetBalance.issueTransaction = {
|
|
137
|
-
id: assetDetails.originTransactionId,
|
|
138
|
-
name: assetDetails.name,
|
|
139
|
-
decimals: assetDetails.decimals,
|
|
140
|
-
description: assetDetails.description,
|
|
141
|
-
quantity: assetDetails.quantity,
|
|
142
|
-
reissuable: assetDetails.reissuable,
|
|
143
|
-
sender: assetDetails.issuer,
|
|
144
|
-
senderPublicKey: assetDetails.issuerPublicKey,
|
|
145
|
-
timestamp: assetDetails.issueTimestamp,
|
|
146
|
-
height: assetDetails.issueHeight,
|
|
147
|
-
script: assetDetails.scripted ? '-' : null,
|
|
148
|
-
proofs: [],
|
|
149
|
-
fee: Math.pow(10, 8),
|
|
150
|
-
feeAssetId: null,
|
|
151
|
-
version: 3,
|
|
152
|
-
type: ts_types_1.TRANSACTION_TYPE.ISSUE,
|
|
153
|
-
chainId: 0
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
_a.label = 3;
|
|
157
|
-
case 3: return [2 /*return*/, balancesResponse];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
exports.fetchAssetsBalance = fetchAssetsBalance;
|
|
163
|
-
function fetchBalanceAddressAssetId(base, address, assetId, options) {
|
|
164
|
-
if (options === void 0) { options = Object.create(null); }
|
|
165
|
-
return request_1.default({ base: base, url: "/assets/balance/" + address + "/" + assetId, options: options });
|
|
166
|
-
}
|
|
167
|
-
exports.fetchBalanceAddressAssetId = fetchBalanceAddressAssetId;
|
|
168
|
-
function convertEthAssetId(base, assetId) {
|
|
169
|
-
return request_1.default({ base: base, url: "/eth/assets" + query_1.default({ id: assetId }) }).then(function (assets) { return assets[0].assetId; });
|
|
170
|
-
}
|
|
171
|
-
exports.convertEthAssetId = convertEthAssetId;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.convertEthAssetId = exports.fetchBalanceAddressAssetId = exports.fetchAssetsBalance = exports.fetchAssetsNft = exports.fetchAssetsAddressLimit = exports.fetchAssetDistribution = exports.fetchAssetsDetails = exports.fetchDetails = void 0;
|
|
54
|
+
var ts_types_1 = require("@waves/ts-types");
|
|
55
|
+
var request_1 = __importDefault(require("../../tools/request"));
|
|
56
|
+
var utils_1 = require("../../tools/utils");
|
|
57
|
+
var query_1 = __importDefault(require("../../tools/query"));
|
|
58
|
+
function fetchDetails(base, assetId, options) {
|
|
59
|
+
if (options === void 0) { options = Object.create(null); }
|
|
60
|
+
var isOnce = !Array.isArray(assetId);
|
|
61
|
+
return Promise.all(utils_1.toArray(assetId).map(function (id) { return request_1.default({
|
|
62
|
+
base: base,
|
|
63
|
+
url: "/assets/details/" + id,
|
|
64
|
+
options: options
|
|
65
|
+
}); }))
|
|
66
|
+
.then(function (list) { return isOnce ? list[0] : list; });
|
|
67
|
+
}
|
|
68
|
+
exports.fetchDetails = fetchDetails;
|
|
69
|
+
/**
|
|
70
|
+
* POST /assets/details
|
|
71
|
+
* Provides detailed information about the given assets
|
|
72
|
+
*/
|
|
73
|
+
function fetchAssetsDetails(base, assetIds, options) {
|
|
74
|
+
if (options === void 0) { options = Object.create(null); }
|
|
75
|
+
var body = JSON.stringify({ ids: assetIds });
|
|
76
|
+
var _options = __assign(__assign({}, options), { body: body, headers: {
|
|
77
|
+
'content-type': 'application/json'
|
|
78
|
+
}, method: 'POST' });
|
|
79
|
+
return request_1.default({ base: base, url: "/assets/details", options: _options });
|
|
80
|
+
}
|
|
81
|
+
exports.fetchAssetsDetails = fetchAssetsDetails;
|
|
82
|
+
function fetchAssetDistribution(base, assetId, height, limit, options) {
|
|
83
|
+
if (options === void 0) { options = Object.create(null); }
|
|
84
|
+
return request_1.default({ base: base, url: "/assets/" + assetId + "/distribution/" + height + "/limit/" + limit, options: options });
|
|
85
|
+
}
|
|
86
|
+
exports.fetchAssetDistribution = fetchAssetDistribution;
|
|
87
|
+
/**
|
|
88
|
+
* TODO
|
|
89
|
+
* GET /assets/{assetId}/distribution
|
|
90
|
+
* Asset balance distribution
|
|
91
|
+
*/
|
|
92
|
+
function fetchAssetsAddressLimit(base, address, limit, options) {
|
|
93
|
+
if (options === void 0) { options = Object.create(null); }
|
|
94
|
+
return request_1.default({ base: base, url: "assets/nft/" + address + "/limit/" + limit, options: options });
|
|
95
|
+
}
|
|
96
|
+
exports.fetchAssetsAddressLimit = fetchAssetsAddressLimit;
|
|
97
|
+
function fetchAssetsNft(base, _a, options) {
|
|
98
|
+
var address = _a.address, limit = _a.limit, after = _a.after;
|
|
99
|
+
if (options === void 0) { options = Object.create(null); }
|
|
100
|
+
var url = new URL("assets/nft/" + address + "/limit/" + limit, base);
|
|
101
|
+
if (after) {
|
|
102
|
+
url.searchParams.append('after', after);
|
|
103
|
+
}
|
|
104
|
+
return request_1.default({ base: base, url: "" + url.pathname + url.search, options: options });
|
|
105
|
+
}
|
|
106
|
+
exports.fetchAssetsNft = fetchAssetsNft;
|
|
107
|
+
function fetchAssetsBalance(base, address, options) {
|
|
108
|
+
if (options === void 0) { options = Object.create(null); }
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
var balancesResponse, assetsWithoutIssueTransaction, detailsIds, assetsDetailsResponse;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, request_1.default({ base: base, url: "/assets/balance/" + address, options: options })];
|
|
114
|
+
case 1:
|
|
115
|
+
balancesResponse = _a.sent();
|
|
116
|
+
assetsWithoutIssueTransaction = balancesResponse.balances.reduce(function (acc, balance, index) {
|
|
117
|
+
if (!balance.issueTransaction) {
|
|
118
|
+
acc[balance.assetId] = index;
|
|
119
|
+
}
|
|
120
|
+
return acc;
|
|
121
|
+
}, {});
|
|
122
|
+
detailsIds = Object.keys(assetsWithoutIssueTransaction);
|
|
123
|
+
if (!detailsIds.length) return [3 /*break*/, 3];
|
|
124
|
+
return [4 /*yield*/, fetchAssetsDetails(base, detailsIds, options)];
|
|
125
|
+
case 2:
|
|
126
|
+
assetsDetailsResponse = _a.sent();
|
|
127
|
+
assetsDetailsResponse.forEach(function (assetDetails) {
|
|
128
|
+
if ('error' in assetDetails) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
var assetIndex = assetsWithoutIssueTransaction[assetDetails.assetId];
|
|
132
|
+
var assetBalance = balancesResponse.balances[assetIndex];
|
|
133
|
+
if (!assetBalance) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
assetBalance.issueTransaction = {
|
|
137
|
+
id: assetDetails.originTransactionId,
|
|
138
|
+
name: assetDetails.name,
|
|
139
|
+
decimals: assetDetails.decimals,
|
|
140
|
+
description: assetDetails.description,
|
|
141
|
+
quantity: assetDetails.quantity,
|
|
142
|
+
reissuable: assetDetails.reissuable,
|
|
143
|
+
sender: assetDetails.issuer,
|
|
144
|
+
senderPublicKey: assetDetails.issuerPublicKey,
|
|
145
|
+
timestamp: assetDetails.issueTimestamp,
|
|
146
|
+
height: assetDetails.issueHeight,
|
|
147
|
+
script: assetDetails.scripted ? '-' : null,
|
|
148
|
+
proofs: [],
|
|
149
|
+
fee: Math.pow(10, 8),
|
|
150
|
+
feeAssetId: null,
|
|
151
|
+
version: 3,
|
|
152
|
+
type: ts_types_1.TRANSACTION_TYPE.ISSUE,
|
|
153
|
+
chainId: 0
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
_a.label = 3;
|
|
157
|
+
case 3: return [2 /*return*/, balancesResponse];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
exports.fetchAssetsBalance = fetchAssetsBalance;
|
|
163
|
+
function fetchBalanceAddressAssetId(base, address, assetId, options) {
|
|
164
|
+
if (options === void 0) { options = Object.create(null); }
|
|
165
|
+
return request_1.default({ base: base, url: "/assets/balance/" + address + "/" + assetId, options: options });
|
|
166
|
+
}
|
|
167
|
+
exports.fetchBalanceAddressAssetId = fetchBalanceAddressAssetId;
|
|
168
|
+
function convertEthAssetId(base, assetId) {
|
|
169
|
+
return request_1.default({ base: base, url: "/eth/assets" + query_1.default({ id: assetId }) }).then(function (assets) { return assets[0].assetId; });
|
|
170
|
+
}
|
|
171
|
+
exports.convertEthAssetId = convertEthAssetId;
|
|
172
172
|
//# sourceMappingURL=index.js.map
|