@cityofzion/bs-neo3 1.12.2 → 1.13.1
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/BSNeo3.d.ts
CHANGED
|
@@ -37,5 +37,5 @@ export declare class BSNeo3<BSName extends string = string> implements Blockchai
|
|
|
37
37
|
calculateTransferFee(param: TransferParam<BSName>): Promise<string>;
|
|
38
38
|
transfer(param: TransferParam<BSName>): Promise<string[]>;
|
|
39
39
|
claim(account: Account<BSName>): Promise<string>;
|
|
40
|
-
resolveNameServiceDomain(domainName: string): Promise<
|
|
40
|
+
resolveNameServiceDomain(domainName: string): Promise<string>;
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceResponse, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, NftDataService, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse, ExplorerService } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BalanceResponse, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, NftDataService, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse, ExplorerService, ExportTransactionsByAddressParams } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
3
|
import { RpcBDSNeo3 } from './RpcBDSNeo3';
|
|
4
4
|
export declare class DoraBDSNeo3 extends RpcBDSNeo3 {
|
|
@@ -6,7 +6,8 @@ export declare class DoraBDSNeo3 extends RpcBDSNeo3 {
|
|
|
6
6
|
constructor(network: Network<BSNeo3NetworkId>, feeToken: Token, claimToken: Token, tokens: Token[], nftDataService: NftDataService, 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 _DoraBDSNeo3_instances, _DoraBDSNeo3_supportedNep11Standards, _DoraBDSNeo3_nftDataService, _DoraBDSNeo3_explorerService, _DoraBDSNeo3_validateFullTransactionsByAddressParams;
|
|
33
|
+
var _DoraBDSNeo3_instances, _DoraBDSNeo3_supportedNep11Standards, _DoraBDSNeo3_nftDataService, _DoraBDSNeo3_explorerService, _DoraBDSNeo3_validateFullTransactionsByAddressParams, _DoraBDSNeo3_validateGetFullTransactionsByAddressParams;
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.DoraBDSNeo3 = void 0;
|
|
36
36
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
@@ -93,12 +93,11 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
93
93
|
const transferPromises = [];
|
|
94
94
|
item.notifications.forEach(({ contract: contractHash, state, event_name: eventName }) => {
|
|
95
95
|
var _a;
|
|
96
|
-
|
|
97
|
-
const properties = (_a = (Array.isArray(state) ? state : state === null || state === void 0 ? void 0 : state.value)) !== null && _a !== void 0 ? _a : [];
|
|
96
|
+
const properties = Array.isArray(state) ? state : (_a = state === null || state === void 0 ? void 0 : state.value) !== null && _a !== void 0 ? _a : [];
|
|
98
97
|
if (eventName !== 'Transfer' || (properties.length !== 3 && properties.length !== 4))
|
|
99
98
|
return;
|
|
100
99
|
const promise = () => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
var _b
|
|
100
|
+
var _b;
|
|
102
101
|
const isAsset = properties.length === 3;
|
|
103
102
|
const from = properties[0].value;
|
|
104
103
|
const to = properties[1].value;
|
|
@@ -106,7 +105,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
106
105
|
const convertedTo = to ? this.convertByteStringToAddress(to) : 'Burn';
|
|
107
106
|
if (isAsset) {
|
|
108
107
|
const token = yield this.getTokenInfo(contractHash);
|
|
109
|
-
const
|
|
108
|
+
const amount = properties[2].value;
|
|
110
109
|
return {
|
|
111
110
|
amount: amount ? neon_js_1.u.BigInteger.fromNumber(amount).toDecimal((_b = token.decimals) !== null && _b !== void 0 ? _b : 0) : '0',
|
|
112
111
|
from: convertedFrom,
|
|
@@ -119,7 +118,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
119
118
|
return {
|
|
120
119
|
from: convertedFrom,
|
|
121
120
|
to: convertedTo,
|
|
122
|
-
tokenId:
|
|
121
|
+
tokenId: properties[3].value,
|
|
123
122
|
contractHash,
|
|
124
123
|
type: 'nft',
|
|
125
124
|
};
|
|
@@ -151,19 +150,21 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
151
150
|
};
|
|
152
151
|
});
|
|
153
152
|
}
|
|
154
|
-
getFullTransactionsByAddress(
|
|
155
|
-
var
|
|
153
|
+
getFullTransactionsByAddress(_a) {
|
|
154
|
+
var _b, _c;
|
|
155
|
+
var { nextCursor } = _a, params = __rest(_a, ["nextCursor"]);
|
|
156
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
__classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m",
|
|
157
|
+
__classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateGetFullTransactionsByAddressParams).call(this, params);
|
|
158
158
|
const data = [];
|
|
159
|
-
const
|
|
159
|
+
const response = yield NeoRest.getFullTransactionsByAddress({
|
|
160
160
|
address: params.address,
|
|
161
161
|
timestampFrom: params.dateFrom,
|
|
162
162
|
timestampTo: params.dateTo,
|
|
163
163
|
network: this._network.id,
|
|
164
|
-
cursor:
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
cursor: nextCursor,
|
|
165
|
+
pageLimit: (_b = params.pageSize) !== null && _b !== void 0 ? _b : 50,
|
|
166
|
+
});
|
|
167
|
+
const items = (_c = response.data) !== null && _c !== void 0 ? _c : [];
|
|
167
168
|
const addressTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getAddressTemplateUrl();
|
|
168
169
|
const txTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getTxTemplateUrl();
|
|
169
170
|
const nftTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getNftTemplateUrl();
|
|
@@ -182,20 +183,16 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
182
183
|
events: [],
|
|
183
184
|
};
|
|
184
185
|
const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
var
|
|
186
|
+
var _d, _e, _f, _g, _h, _j;
|
|
186
187
|
let nftEvent;
|
|
187
188
|
let assetEvent;
|
|
188
|
-
let from = event.from;
|
|
189
|
-
let to = event.to;
|
|
190
189
|
const { methodName, tokenID: tokenId, contractHash: hash } = event;
|
|
190
|
+
const from = (_d = event.from) !== null && _d !== void 0 ? _d : undefined;
|
|
191
|
+
const to = (_e = event.to) !== null && _e !== void 0 ? _e : undefined;
|
|
191
192
|
const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
|
|
192
193
|
const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
|
|
193
194
|
const hashUrl = hash ? contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', hash) : undefined;
|
|
194
|
-
|
|
195
|
-
from = 'Mint';
|
|
196
|
-
if (!to)
|
|
197
|
-
to = 'Burn';
|
|
198
|
-
const standard = (_e = (_d = (_c = event.supportedStandards) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) !== null && _e !== void 0 ? _e : '';
|
|
195
|
+
const standard = (_h = (_g = (_f = event.supportedStandards) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.toLowerCase()) !== null && _h !== void 0 ? _h : '';
|
|
199
196
|
const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenId;
|
|
200
197
|
if (isNft) {
|
|
201
198
|
const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ contractHash: hash, tokenId }));
|
|
@@ -220,7 +217,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
220
217
|
}
|
|
221
218
|
else {
|
|
222
219
|
const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(hash));
|
|
223
|
-
const amount = (0, blockchain_service_1.formatNumber)(event.amount, (
|
|
220
|
+
const amount = (0, blockchain_service_1.formatNumber)(event.amount, (_j = token === null || token === void 0 ? void 0 : token.decimals) !== null && _j !== void 0 ? _j : event.tokenDecimals);
|
|
224
221
|
assetEvent = {
|
|
225
222
|
eventType: 'token',
|
|
226
223
|
amount,
|
|
@@ -241,7 +238,18 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
|
|
|
241
238
|
data.push(newItem);
|
|
242
239
|
}));
|
|
243
240
|
yield Promise.allSettled(itemPromises);
|
|
244
|
-
return { nextCursor, data };
|
|
241
|
+
return { nextCursor: response.nextCursor, data };
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
exportFullTransactionsByAddress(params) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
__classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
|
|
247
|
+
return yield NeoRest.exportFullTransactionsByAddress({
|
|
248
|
+
address: params.address,
|
|
249
|
+
timestampFrom: params.dateFrom,
|
|
250
|
+
timestampTo: params.dateTo,
|
|
251
|
+
network: this._network.id,
|
|
252
|
+
});
|
|
245
253
|
});
|
|
246
254
|
}
|
|
247
255
|
getContract(contractHash) {
|
|
@@ -333,4 +341,9 @@ _DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataServic
|
|
|
333
341
|
blockchain_service_1.BSFullTransactionsByAddressHelper.validateFullTransactionsByAddressParams(params);
|
|
334
342
|
if (!neon_js_1.wallet.isAddress(params.address))
|
|
335
343
|
throw new Error('Invalid address param');
|
|
344
|
+
}, _DoraBDSNeo3_validateGetFullTransactionsByAddressParams = function _DoraBDSNeo3_validateGetFullTransactionsByAddressParams(_a) {
|
|
345
|
+
var { pageSize } = _a, params = __rest(_a, ["pageSize"]);
|
|
346
|
+
if (typeof pageSize === 'number' && (isNaN(pageSize) || pageSize < 1 || pageSize > 500))
|
|
347
|
+
throw new Error('Page size should be between 1 and 500');
|
|
348
|
+
__classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
|
|
336
349
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BalanceResponse, BDSClaimable, BlockchainDataService, ContractResponse, ExportTransactionsByAddressParams, FullTransactionsByAddressParams, FullTransactionsByAddressResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
3
|
export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
readonly _tokenCache: Map<string, Token>;
|
|
@@ -11,6 +11,7 @@ export declare class RpcBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
|
11
11
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
12
12
|
getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
13
13
|
getFullTransactionsByAddress(_params: FullTransactionsByAddressParams): Promise<FullTransactionsByAddressResponse>;
|
|
14
|
+
exportFullTransactionsByAddress(_params: ExportTransactionsByAddressParams): Promise<string>;
|
|
14
15
|
getContract(contractHash: string): Promise<ContractResponse>;
|
|
15
16
|
getTokenInfo(tokenHash: string): Promise<Token>;
|
|
16
17
|
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
@@ -55,6 +55,11 @@ class RpcBDSNeo3 {
|
|
|
55
55
|
throw new Error('Method not supported.');
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
exportFullTransactionsByAddress(_params) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
throw new Error('Method not implemented.');
|
|
61
|
+
});
|
|
62
|
+
}
|
|
58
63
|
getContract(contractHash) {
|
|
59
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
65
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@cityofzion/neon-js": "5.5.1",
|
|
14
14
|
"@cityofzion/neon-core": "5.5.1",
|
|
15
|
-
"@cityofzion/dora-ts": "0.
|
|
15
|
+
"@cityofzion/dora-ts": "0.5.1",
|
|
16
16
|
"axios": "1.8.2",
|
|
17
17
|
"query-string": "7.1.3",
|
|
18
18
|
"@ledgerhq/hw-transport": "~6.30.5",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"isomorphic-ws": "^5.0.0",
|
|
22
22
|
"lodash.clonedeep": "^4.5.0",
|
|
23
23
|
"date-fns": "~4.1.0",
|
|
24
|
-
"@cityofzion/blockchain-service": "1.
|
|
24
|
+
"@cityofzion/blockchain-service": "1.18.1",
|
|
25
25
|
"@cityofzion/bs-asteroid-sdk": "0.9.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|