@debridge-finance/solana-utils 6.1.0 → 6.1.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.
@@ -13050,12 +13050,10 @@ function getTokenInfo(connection_1, tokenAddress_1) {
13050
13050
  return null;
13051
13051
  }
13052
13052
  // parse token account
13053
- // mint_authority - coption(pubkey) = 4 or 36
13053
+ // mint_authority - coption(pubkey) = 36
13054
13054
  // supply - u64 = 8
13055
13055
  // decimals - u8
13056
- let decimalsOffset = 12;
13057
- if (tokenAccount.data[0] === 1)
13058
- decimalsOffset += 32;
13056
+ const decimalsOffset = 44;
13059
13057
  const decimals = tokenAccount.data[decimalsOffset];
13060
13058
  const { name, symbol, uri } = decodeMetaplexMetadataPartial(pdaAccount.data);
13061
13059
  return {
@@ -13492,20 +13490,22 @@ function getTransactionDiff(connection, tx, txAccounts) {
13492
13490
  const preBalances = parseMultipleAccounts(accountsInfo);
13493
13491
  const postBalances = parseMultipleAccounts(simulatesInfo);
13494
13492
  const balancesDiff = accountsPubKeys.reduce((map, pubKey, i) => {
13495
- var _a;
13493
+ var _a, _b, _c;
13496
13494
  if ((_a = accountsInfo[i]) === null || _a === void 0 ? void 0 : _a.executable) {
13497
13495
  return map;
13498
13496
  }
13499
13497
  const preBalance = preBalances[i];
13500
13498
  const postBalance = postBalances[i];
13499
+ const nativeBefore = (_b = preBalance === null || preBalance === void 0 ? void 0 : preBalance.balance) !== null && _b !== void 0 ? _b : 0;
13500
+ const nativeAfter = (_c = postBalance === null || postBalance === void 0 ? void 0 : postBalance.balance) !== null && _c !== void 0 ? _c : 0;
13501
13501
  const diff = {
13502
13502
  pubKey: pubKey,
13503
- preBalance: preBalance.balance,
13504
- postBalance: postBalance.balance,
13505
- diff: postBalance.balance - preBalance.balance,
13503
+ preBalance: nativeBefore,
13504
+ postBalance: nativeAfter,
13505
+ diff: nativeAfter - nativeBefore,
13506
13506
  };
13507
- if (preBalance.spl || postBalance.spl) {
13508
- const splDiff = getSplDiff(preBalance.spl, postBalance.spl);
13507
+ if ((preBalance === null || preBalance === void 0 ? void 0 : preBalance.spl) || (postBalance === null || postBalance === void 0 ? void 0 : postBalance.spl)) {
13508
+ const splDiff = getSplDiff(preBalance === null || preBalance === void 0 ? void 0 : preBalance.spl, postBalance === null || postBalance === void 0 ? void 0 : postBalance.spl);
13509
13509
  if (splDiff.diff) {
13510
13510
  diff.spl = splDiff;
13511
13511
  }