@xchainjs/xchain-thorchain 0.28.5 → 0.28.6

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/lib/index.esm.js CHANGED
@@ -10448,13 +10448,14 @@ class Client extends BaseXChainClient {
10448
10448
  * @returns {Tx} The transaction details of the given transaction id.
10449
10449
  */
10450
10450
  getTransactionData(txId, address) {
10451
- var _a, _b, _c, _d, _e, _f;
10451
+ var _a, _b, _c, _d, _e, _f, _g;
10452
10452
  return __awaiter(this, void 0, void 0, function* () {
10453
10453
  const txResult = yield this.fetchTransaction(txId);
10454
10454
  if (txResult && txResult.logs) {
10455
10455
  // extract values from the response
10456
10456
  const transferEvent = (_a = txResult.logs[0].events) === null || _a === void 0 ? void 0 : _a.find((event) => event.type === 'transfer');
10457
10457
  const messageEvent = (_b = txResult.logs[0].events) === null || _b === void 0 ? void 0 : _b.find((event) => event.type === 'message');
10458
+ const coinReceivedEvent = (_c = txResult.logs[0].events) === null || _c === void 0 ? void 0 : _c.find((event) => event.type === 'coin_received');
10458
10459
  if (!transferEvent || !messageEvent) {
10459
10460
  throw new Error('Invalid transaction data');
10460
10461
  }
@@ -10477,14 +10478,14 @@ class Client extends BaseXChainClient {
10477
10478
  .split(/(?<=\d)(?=\D)/)
10478
10479
  .filter(Boolean)[1]
10479
10480
  .replace(/[a-z]/g, (letter) => letter.toUpperCase());
10480
- const fromAddress = ((_c = transferEvent.attributes.find((attr) => attr.key === 'sender')) === null || _c === void 0 ? void 0 : _c.value)
10481
- ? (_d = transferEvent.attributes.find((attr) => attr.key === 'sender')) === null || _d === void 0 ? void 0 : _d.value
10481
+ const fromAddress = ((_d = transferEvent.attributes.find((attr) => attr.key === 'sender')) === null || _d === void 0 ? void 0 : _d.value)
10482
+ ? (_e = transferEvent.attributes.find((attr) => attr.key === 'sender')) === null || _e === void 0 ? void 0 : _e.value
10482
10483
  : address;
10483
- const memo = ((_e = txResult.tx) === null || _e === void 0 ? void 0 : _e.body) ? txResult.tx.body.memo.split(':') : '';
10484
+ const memo = ((_f = txResult.tx) === null || _f === void 0 ? void 0 : _f.body) ? txResult.tx.body.memo.split(':') : '';
10484
10485
  const toAddress = memo[2] ? memo[2] : '';
10485
- const toAsset = memo[1] ? assetFromStringEx(memo[1]) : AssetRuneNative;
10486
+ const toAsset = memo[1] && !coinReceivedEvent ? assetFromStringEx(memo[1]) : AssetRuneNative;
10486
10487
  const date = new Date(txResult.timestamp);
10487
- const typeString = (_f = messageEvent.attributes.find((attr) => attr.key === 'action')) === null || _f === void 0 ? void 0 : _f.value;
10488
+ const typeString = (_g = messageEvent.attributes.find((attr) => attr.key === 'action')) === null || _g === void 0 ? void 0 : _g.value;
10488
10489
  const hash = txResult.txhash;
10489
10490
  if (assetString && hash && fromAddress && typeString) {
10490
10491
  const fromAsset = assetString === 'RUNE' ? AssetRuneNative : assetFromStringEx(assetString);