@cityofzion/bs-neo-legacy 1.11.1 → 1.12.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, ExplorerService, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, ExplorerService, ExportTransactionsByAddressParams, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeoLegacyNetworkId } from '../../constants/BSNeoLegacyConstants';
|
|
3
3
|
export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
#private;
|
|
@@ -6,7 +6,8 @@ export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaim
|
|
|
6
6
|
constructor(network: Network<BSNeoLegacyNetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], explorerService: ExplorerService);
|
|
7
7
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
8
8
|
getTransactionsByAddress({ address, nextPageParams, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
9
|
-
getFullTransactionsByAddress(params: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
|
|
9
|
+
getFullTransactionsByAddress({ nextCursor, ...params }: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
|
|
10
|
+
exportFullTransactionsByAddress(params: ExportTransactionsByAddressParams): Promise<string>;
|
|
10
11
|
getContract(contractHash: string): Promise<ContractResponse>;
|
|
11
12
|
getTokenInfo(tokenHash: string): Promise<Token>;
|
|
12
13
|
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
@@ -30,7 +30,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
30
30
|
}
|
|
31
31
|
return t;
|
|
32
32
|
};
|
|
33
|
-
var _DoraBDSNeoLegacy_instances, _DoraBDSNeoLegacy_supportedNep5Standards, _DoraBDSNeoLegacy_network, _DoraBDSNeoLegacy_claimToken, _DoraBDSNeoLegacy_feeToken, _DoraBDSNeoLegacy_tokens, _DoraBDSNeoLegacy_tokenCache, _DoraBDSNeoLegacy_explorerService, _DoraBDSNeoLegacy_validateFullTransactionsByAddressParams;
|
|
33
|
+
var _DoraBDSNeoLegacy_instances, _DoraBDSNeoLegacy_supportedNep5Standards, _DoraBDSNeoLegacy_network, _DoraBDSNeoLegacy_claimToken, _DoraBDSNeoLegacy_feeToken, _DoraBDSNeoLegacy_tokens, _DoraBDSNeoLegacy_tokenCache, _DoraBDSNeoLegacy_explorerService, _DoraBDSNeoLegacy_validateFullTransactionsByAddressParams, _DoraBDSNeoLegacy_validateGetFullTransactionsByAddressParams;
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.DoraBDSNeoLegacy = void 0;
|
|
36
36
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
@@ -122,19 +122,21 @@ class DoraBDSNeoLegacy {
|
|
|
122
122
|
};
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
getFullTransactionsByAddress(
|
|
126
|
-
var
|
|
125
|
+
getFullTransactionsByAddress(_a) {
|
|
126
|
+
var _b, _c;
|
|
127
|
+
var { nextCursor } = _a, params = __rest(_a, ["nextCursor"]);
|
|
127
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
__classPrivateFieldGet(this, _DoraBDSNeoLegacy_instances, "m",
|
|
129
|
+
__classPrivateFieldGet(this, _DoraBDSNeoLegacy_instances, "m", _DoraBDSNeoLegacy_validateGetFullTransactionsByAddressParams).call(this, params);
|
|
129
130
|
const data = [];
|
|
130
|
-
const
|
|
131
|
+
const response = yield dora_ts_1.api.NeoLegacyREST.getFullTransactionsByAddress({
|
|
131
132
|
address: params.address,
|
|
132
133
|
timestampFrom: params.dateFrom,
|
|
133
134
|
timestampTo: params.dateTo,
|
|
134
135
|
network: 'mainnet',
|
|
135
|
-
cursor:
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
cursor: nextCursor,
|
|
137
|
+
pageLimit: (_b = params.pageSize) !== null && _b !== void 0 ? _b : 30,
|
|
138
|
+
});
|
|
139
|
+
const items = (_c = response.data) !== null && _c !== void 0 ? _c : [];
|
|
138
140
|
const addressTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeoLegacy_explorerService, "f").getAddressTemplateUrl();
|
|
139
141
|
const txTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeoLegacy_explorerService, "f").getTxTemplateUrl();
|
|
140
142
|
const contractTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeoLegacy_explorerService, "f").getContractTemplateUrl();
|
|
@@ -152,17 +154,17 @@ class DoraBDSNeoLegacy {
|
|
|
152
154
|
events: [],
|
|
153
155
|
};
|
|
154
156
|
const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
var
|
|
157
|
+
var _d, _e, _f, _g;
|
|
156
158
|
const { contractHash: hash, amount, from, to } = event;
|
|
157
159
|
const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(hash));
|
|
158
|
-
const standard = (
|
|
160
|
+
const standard = (_f = (_e = (_d = event.supportedStandards) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.toLowerCase()) !== null && _f !== void 0 ? _f : '';
|
|
159
161
|
const isNep5 = __classPrivateFieldGet(this, _DoraBDSNeoLegacy_supportedNep5Standards, "f").includes(standard);
|
|
160
162
|
const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
|
|
161
163
|
const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
|
|
162
164
|
const hashUrl = hash ? contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', hash) : undefined;
|
|
163
165
|
const assetEvent = {
|
|
164
166
|
eventType: 'token',
|
|
165
|
-
amount: (0, blockchain_service_1.formatNumber)(amount, (
|
|
167
|
+
amount: (0, blockchain_service_1.formatNumber)(amount, (_g = token === null || token === void 0 ? void 0 : token.decimals) !== null && _g !== void 0 ? _g : event.tokenDecimals),
|
|
166
168
|
methodName: event.methodName,
|
|
167
169
|
from: from || 'Mint',
|
|
168
170
|
fromUrl,
|
|
@@ -179,7 +181,18 @@ class DoraBDSNeoLegacy {
|
|
|
179
181
|
data.push(newItem);
|
|
180
182
|
}));
|
|
181
183
|
yield Promise.allSettled(itemPromises);
|
|
182
|
-
return { nextCursor, data };
|
|
184
|
+
return { nextCursor: response.nextCursor, data };
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
exportFullTransactionsByAddress(params) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
__classPrivateFieldGet(this, _DoraBDSNeoLegacy_instances, "m", _DoraBDSNeoLegacy_validateFullTransactionsByAddressParams).call(this, params);
|
|
190
|
+
return yield dora_ts_1.api.NeoLegacyREST.exportFullTransactionsByAddress({
|
|
191
|
+
address: params.address,
|
|
192
|
+
timestampFrom: params.dateFrom,
|
|
193
|
+
timestampTo: params.dateTo,
|
|
194
|
+
network: 'mainnet',
|
|
195
|
+
});
|
|
183
196
|
});
|
|
184
197
|
}
|
|
185
198
|
getContract(contractHash) {
|
|
@@ -287,4 +300,9 @@ _DoraBDSNeoLegacy_supportedNep5Standards = new WeakMap(), _DoraBDSNeoLegacy_netw
|
|
|
287
300
|
blockchain_service_1.BSFullTransactionsByAddressHelper.validateFullTransactionsByAddressParams(params);
|
|
288
301
|
if (!neon_js_1.wallet.isAddress(params.address))
|
|
289
302
|
throw new Error('Invalid address param');
|
|
303
|
+
}, _DoraBDSNeoLegacy_validateGetFullTransactionsByAddressParams = function _DoraBDSNeoLegacy_validateGetFullTransactionsByAddressParams(_a) {
|
|
304
|
+
var { pageSize } = _a, params = __rest(_a, ["pageSize"]);
|
|
305
|
+
if (typeof pageSize === 'number' && (isNaN(pageSize) || pageSize < 1 || pageSize > 30))
|
|
306
|
+
throw new Error('Page size should be between 1 and 30');
|
|
307
|
+
__classPrivateFieldGet(this, _DoraBDSNeoLegacy_instances, "m", _DoraBDSNeoLegacy_validateFullTransactionsByAddressParams).call(this, params);
|
|
290
308
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"/dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@cityofzion/dora-ts": "0.
|
|
12
|
+
"@cityofzion/dora-ts": "0.5.0",
|
|
13
13
|
"@cityofzion/neon-js": "4.8.3",
|
|
14
14
|
"@ledgerhq/hw-transport": "~6.30.5",
|
|
15
15
|
"axios": "1.8.2",
|
|
16
16
|
"date-fns": "~4.1.0",
|
|
17
|
-
"@cityofzion/
|
|
18
|
-
"@cityofzion/
|
|
17
|
+
"@cityofzion/blockchain-service": "1.18.0",
|
|
18
|
+
"@cityofzion/bs-asteroid-sdk": "0.9.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/jest": "29.5.3",
|