@trezor/blockchain-link-utils
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -0,1 +1,8 @@ | ||
# 1.0.12 | ||
- fix(blockchain-link-utils): support `multisigAuthority` in solana txs (dfd96d23b) | ||
- fix(blockchain-link-utils): use `some` instead of `find` in solana tx type predcicates (1d58f980d) | ||
- fix(blockchain-link-utils): parse solana transfers originating from exchanges (58b125fb2) | ||
- fix(blockchain-link): correct import in solana using @trezor/ prefix (3a4895d6b) | ||
# 1.0.11 | ||
@@ -2,0 +9,0 @@ |
import BigNumber from 'bignumber.js'; | ||
import { TokenTransfer, Transaction } from 'packages/blockchain-link-types/lib'; | ||
import { TokenTransfer, Transaction } from '@trezor/blockchain-link-types/lib'; | ||
import type { AccountInfo, ParsedAccountData, ParsedTransactionWithMeta, SolanaValidParsedTxWithMeta, SolanaTokenAccountInfo, TokenDetailByMint, PublicKey } from '@trezor/blockchain-link-types/lib/solana'; | ||
@@ -4,0 +4,0 @@ import type { TokenInfo } from '@trezor/blockchain-link-types/lib'; |
@@ -149,6 +149,6 @@ "use strict"; | ||
const getTokenTransferTxType = (transfers) => { | ||
if (transfers.every(({ type }) => type === 'recv')) { | ||
if (transfers.some(({ type }) => type === 'recv')) { | ||
return 'recv'; | ||
} | ||
if (transfers.every(({ type }) => type === 'sent')) { | ||
if (transfers.some(({ type }) => type === 'sent')) { | ||
return 'sent'; | ||
@@ -166,6 +166,6 @@ } | ||
const [senders, receivers] = (0, utils_1.arrayPartition)(effects, ({ amount }) => amount.isNegative()); | ||
if (senders.find(({ address }) => address === accountAddress)) { | ||
if (senders.some(({ address }) => address === accountAddress)) { | ||
return 'sent'; | ||
} | ||
if (receivers.find(({ address }) => address === accountAddress)) { | ||
if (receivers.some(({ address }) => address === accountAddress)) { | ||
return 'recv'; | ||
@@ -185,5 +185,6 @@ } | ||
const isInstructionCreatingTokenAccount = (instruction) => instruction.program === 'spl-associated-token-account' && | ||
instruction.parsed.type === 'create'; | ||
(instruction.parsed.type === 'create' || instruction.parsed.type === 'createIdempotent'); | ||
const isTransfer = parsedInstructions.every(instruction => instruction.parsed.type === 'transfer' || | ||
instruction.parsed.type === 'transferChecked' || | ||
(instruction.program === 'system' && instruction.parsed.type === 'advanceNonce') || | ||
isInstructionCreatingTokenAccount(instruction)); | ||
@@ -253,4 +254,5 @@ if (isTransfer) { | ||
typeof parsed.info === 'object' && | ||
'authority' in parsed.info && | ||
typeof parsed.info.authority === 'string' && | ||
(('authority' in parsed.info && typeof parsed.info.authority === 'string') || | ||
('multisigAuthority' in parsed.info && | ||
typeof parsed.info.multisigAuthority === 'string')) && | ||
'source' in parsed.info && | ||
@@ -273,3 +275,3 @@ typeof parsed.info.source === 'string' && | ||
const isAccountDestination = accountAddresses.includes(parsed.info.destination); | ||
const isAccountSource = accountAddresses.includes(parsed.info.authority || parsed.info.source); | ||
const isAccountSource = accountAddresses.includes(parsed.info.multisigAuthority || parsed.info.authority || parsed.info.source); | ||
if (isAccountDestination && isAccountSource) { | ||
@@ -276,0 +278,0 @@ return 'self'; |
{ | ||
"name": "@trezor/blockchain-link-utils", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"license": "See LICENSE.md in repo root", | ||
@@ -22,7 +22,7 @@ "sideEffects": false, | ||
"@solana/web3.js": "^1.87.6", | ||
"@trezor/utils": "9.0.17", | ||
"@trezor/utils": "9.0.18", | ||
"bignumber.js": "^9.1.1" | ||
}, | ||
"devDependencies": { | ||
"@trezor/blockchain-link-types": "1.0.10", | ||
"@trezor/blockchain-link-types": "1.0.11", | ||
"@trezor/type-utils": "1.0.2", | ||
@@ -29,0 +29,0 @@ "jest": "29.5.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54675
1118
+ Added@trezor/utils@9.0.18(transitive)
- Removed@trezor/utils@9.0.17(transitive)
Updated@trezor/utils@9.0.18