@cityofzion/bs-neo3 1.12.1 → 1.13.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/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<any>;
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");
@@ -98,7 +98,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
98
98
  if (eventName !== 'Transfer' || (properties.length !== 3 && properties.length !== 4))
99
99
  return;
100
100
  const promise = () => __awaiter(this, void 0, void 0, function* () {
101
- var _b;
101
+ var _b, _c;
102
102
  const isAsset = properties.length === 3;
103
103
  const from = properties[0].value;
104
104
  const to = properties[1].value;
@@ -108,7 +108,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
108
108
  const token = yield this.getTokenInfo(contractHash);
109
109
  const [, , { value: amount }] = properties;
110
110
  return {
111
- amount: (0, blockchain_service_1.formatNumber)(amount, token.decimals),
111
+ amount: amount ? neon_js_1.u.BigInteger.fromNumber(amount).toDecimal((_b = token.decimals) !== null && _b !== void 0 ? _b : 0) : '0',
112
112
  from: convertedFrom,
113
113
  to: convertedTo,
114
114
  contractHash,
@@ -119,7 +119,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
119
119
  return {
120
120
  from: convertedFrom,
121
121
  to: convertedTo,
122
- tokenId: (_b = properties[3].value) !== null && _b !== void 0 ? _b : '',
122
+ tokenId: (_c = properties[3].value) !== null && _c !== void 0 ? _c : '',
123
123
  contractHash,
124
124
  type: 'nft',
125
125
  };
@@ -151,19 +151,21 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
151
151
  };
152
152
  });
153
153
  }
154
- getFullTransactionsByAddress(params) {
155
- var _a;
154
+ getFullTransactionsByAddress(_a) {
155
+ var _b, _c;
156
+ var { nextCursor } = _a, params = __rest(_a, ["nextCursor"]);
156
157
  return __awaiter(this, void 0, void 0, function* () {
157
- __classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
158
+ __classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateGetFullTransactionsByAddressParams).call(this, params);
158
159
  const data = [];
159
- const _b = yield NeoRest.getFullTransactionsByAddress({
160
+ const response = yield NeoRest.getFullTransactionsByAddress({
160
161
  address: params.address,
161
162
  timestampFrom: params.dateFrom,
162
163
  timestampTo: params.dateTo,
163
164
  network: this._network.id,
164
- cursor: params.nextCursor,
165
- }), { nextCursor } = _b, response = __rest(_b, ["nextCursor"]);
166
- const items = (_a = response.data) !== null && _a !== void 0 ? _a : [];
165
+ cursor: nextCursor,
166
+ pageLimit: (_b = params.pageSize) !== null && _b !== void 0 ? _b : 50,
167
+ });
168
+ const items = (_c = response.data) !== null && _c !== void 0 ? _c : [];
167
169
  const addressTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getAddressTemplateUrl();
168
170
  const txTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getTxTemplateUrl();
169
171
  const nftTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getNftTemplateUrl();
@@ -182,7 +184,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
182
184
  events: [],
183
185
  };
184
186
  const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
185
- var _c, _d, _e, _f;
187
+ var _d, _e, _f, _g;
186
188
  let nftEvent;
187
189
  let assetEvent;
188
190
  let from = event.from;
@@ -195,7 +197,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
195
197
  from = 'Mint';
196
198
  if (!to)
197
199
  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 : '';
200
+ 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 : '';
199
201
  const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenId;
200
202
  if (isNft) {
201
203
  const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ contractHash: hash, tokenId }));
@@ -220,7 +222,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
220
222
  }
221
223
  else {
222
224
  const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(hash));
223
- const amount = (0, blockchain_service_1.formatNumber)(event.amount, (_f = token === null || token === void 0 ? void 0 : token.decimals) !== null && _f !== void 0 ? _f : event.tokenDecimals);
225
+ const amount = (0, blockchain_service_1.formatNumber)(event.amount, (_g = token === null || token === void 0 ? void 0 : token.decimals) !== null && _g !== void 0 ? _g : event.tokenDecimals);
224
226
  assetEvent = {
225
227
  eventType: 'token',
226
228
  amount,
@@ -241,7 +243,18 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
241
243
  data.push(newItem);
242
244
  }));
243
245
  yield Promise.allSettled(itemPromises);
244
- return { nextCursor, data };
246
+ return { nextCursor: response.nextCursor, data };
247
+ });
248
+ }
249
+ exportFullTransactionsByAddress(params) {
250
+ return __awaiter(this, void 0, void 0, function* () {
251
+ __classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
252
+ return yield NeoRest.exportFullTransactionsByAddress({
253
+ address: params.address,
254
+ timestampFrom: params.dateFrom,
255
+ timestampTo: params.dateTo,
256
+ network: this._network.id,
257
+ });
245
258
  });
246
259
  }
247
260
  getContract(contractHash) {
@@ -333,4 +346,9 @@ _DoraBDSNeo3_supportedNep11Standards = new WeakMap(), _DoraBDSNeo3_nftDataServic
333
346
  blockchain_service_1.BSFullTransactionsByAddressHelper.validateFullTransactionsByAddressParams(params);
334
347
  if (!neon_js_1.wallet.isAddress(params.address))
335
348
  throw new Error('Invalid address param');
349
+ }, _DoraBDSNeo3_validateGetFullTransactionsByAddressParams = function _DoraBDSNeo3_validateGetFullTransactionsByAddressParams(_a) {
350
+ var { pageSize } = _a, params = __rest(_a, ["pageSize"]);
351
+ if (typeof pageSize === 'number' && (isNaN(pageSize) || pageSize < 1 || pageSize > 500))
352
+ throw new Error('Page size should be between 1 and 500');
353
+ __classPrivateFieldGet(this, _DoraBDSNeo3_instances, "m", _DoraBDSNeo3_validateFullTransactionsByAddressParams).call(this, params);
336
354
  };
@@ -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.12.1",
3
+ "version": "1.13.0",
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.4.0",
15
+ "@cityofzion/dora-ts": "0.5.0",
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.17.1",
24
+ "@cityofzion/blockchain-service": "1.18.0",
25
25
  "@cityofzion/bs-asteroid-sdk": "0.9.1"
26
26
  },
27
27
  "devDependencies": {