@cityofzion/bs-neo3 1.13.0 → 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.
@@ -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
  };
@@ -184,20 +183,16 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
184
183
  events: [],
185
184
  };
186
185
  const eventPromises = item.events.map((event) => __awaiter(this, void 0, void 0, function* () {
187
- var _d, _e, _f, _g;
186
+ var _d, _e, _f, _g, _h, _j;
188
187
  let nftEvent;
189
188
  let assetEvent;
190
- let from = event.from;
191
- let to = event.to;
192
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;
193
192
  const fromUrl = from ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', from) : undefined;
194
193
  const toUrl = to ? addressTemplateUrl === null || addressTemplateUrl === void 0 ? void 0 : addressTemplateUrl.replace('{address}', to) : undefined;
195
194
  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 : '';
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 : '';
201
196
  const isNft = __classPrivateFieldGet(this, _DoraBDSNeo3_supportedNep11Standards, "f").includes(standard) && !!tokenId;
202
197
  if (isNft) {
203
198
  const [nft] = yield blockchain_service_1.BSPromisesHelper.tryCatch(() => __classPrivateFieldGet(this, _DoraBDSNeo3_nftDataService, "f").getNft({ contractHash: hash, tokenId }));
@@ -222,7 +217,7 @@ class DoraBDSNeo3 extends RpcBDSNeo3_1.RpcBDSNeo3 {
222
217
  }
223
218
  else {
224
219
  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);
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);
226
221
  assetEvent = {
227
222
  eventType: 'token',
228
223
  amount,
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.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.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.1",
25
25
  "@cityofzion/bs-asteroid-sdk": "0.9.1"
26
26
  },
27
27
  "devDependencies": {