@cityofzion/bs-neo3 1.13.0 → 1.13.2

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.
@@ -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
- // TODO: created issue to fix it (https://app.clickup.com/t/86a86n3yw), type from @cityofzion/dora-ts is wrong, it's necessary to do this force casting now
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, _c;
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 [, , { value: amount }] = properties;
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: (_c = properties[3].value) !== null && _c !== void 0 ? _c : '',
121
+ tokenId: properties[3].value,
123
122
  contractHash,
124
123
  type: 'nft',
125
124
  };
@@ -170,7 +169,8 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
170
169
  const txTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getTxTemplateUrl();
171
170
  const nftTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getNftTemplateUrl();
172
171
  const contractTemplateUrl = __classPrivateFieldGet(this, _DoraBDSNeo3_explorerService, "f").getContractTemplateUrl();
173
- const itemPromises = items.map((item) => __awaiter(this, void 0, void 0, function* () {
172
+ const itemPromises = items.map((_d) => __awaiter(this, void 0, void 0, function* () {
173
+ var { networkFeeAmount, systemFeeAmount } = _d, item = __rest(_d, ["networkFeeAmount", "systemFeeAmount"]);
174
174
  const txId = item.transactionID;
175
175
  const newItem = {
176
176
  txId,
@@ -179,32 +179,32 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
179
179
  date: item.date,
180
180
  invocationCount: item.invocationCount,
181
181
  notificationCount: item.notificationCount,
182
- networkFeeAmount: (0, blockchain_service_1.formatNumber)(item.networkFeeAmount, this._feeToken.decimals),
183
- systemFeeAmount: (0, blockchain_service_1.formatNumber)(item.systemFeeAmount, this._feeToken.decimals),
182
+ networkFeeAmount: networkFeeAmount
183
+ ? blockchain_service_1.BSNumberHelper.formatNumber(networkFeeAmount, { decimals: this._feeToken.decimals })
184
+ : undefined,
185
+ systemFeeAmount: systemFeeAmount
186
+ ? blockchain_service_1.BSNumberHelper.formatNumber(systemFeeAmount, { decimals: this._feeToken.decimals })
187
+ : undefined,
184
188
  events: [],
185
189
  };
186
190
  const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
187
- var _d, _e, _f, _g;
191
+ var _e, _f, _g, _h, _j, _k;
188
192
  let nftEvent;
189
193
  let assetEvent;
190
- let from = event.from;
191
- let to = event.to;
192
194
  const { methodName, tokenID: tokenId, contractHash: hash } = event;
195
+ const from = (_e = event.from) !== null && _e !== void 0 ? _e : undefined;
196
+ const to = (_f = event.to) !== null && _f !== void 0 ? _f : undefined;
193
197
  const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
194
198
  const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
195
199
  const hashUrl = hash ? contractTemplateUrl === null || contractTemplateUrl === void 0 ? void 0 : contractTemplateUrl.replace('{hash}', hash) : undefined;
196
- if (!from)
197
- from = 'Mint';
198
- if (!to)
199
- to = 'Burn';
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 : '';
200
+ const standard = (_j = (_h = (_g = event.supportedStandards) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.toLowerCase()) !== null && _j !== void 0 ? _j : '';
201
201
  const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenId;
202
202
  if (isNft) {
203
203
  const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ contractHash: hash, tokenId }));
204
204
  const nftUrl = hash ? nftTemplateUrl === null || nftTemplateUrl === void 0 ? void 0 : nftTemplateUrl.replace('{hash}', hash).replace('{tokenId}', tokenId) : undefined;
205
205
  nftEvent = {
206
206
  eventType: 'nft',
207
- amount: '0',
207
+ amount: undefined,
208
208
  methodName,
209
209
  from,
210
210
  fromUrl,
@@ -222,10 +222,12 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
222
222
  }
223
223
  else {
224
224
  const [token] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => this.getTokenInfo(hash));
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);
225
+ const { amount } = event;
226
226
  assetEvent = {
227
227
  eventType: 'token',
228
- amount,
228
+ amount: amount
229
+ ? blockchain_service_1.BSNumberHelper.formatNumber(amount, { decimals: (_k = token === null || token === void 0 ? void 0 : token.decimals) !== null && _k !== void 0 ? _k : event.tokenDecimals })
230
+ : undefined,
229
231
  methodName,
230
232
  from,
231
233
  fromUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-neo3",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
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.5.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.18.0",
24
+ "@cityofzion/blockchain-service": "1.18.2",
25
25
  "@cityofzion/bs-asteroid-sdk": "0.9.1"
26
26
  },
27
27
  "devDependencies": {