@trezor/blockchain-link-utils
Advanced tools
Comparing version 1.2.6 to 1.2.7-beta.1
@@ -1,3 +0,3 @@ | ||
import type { Utxo, Transaction, TokenTransfer, TokenInfo, AccountAddresses, AccountInfo, InternalTransfer } from '@trezor/blockchain-link-types'; | ||
import type { ServerInfo, AccountInfo as BlockbookAccountInfo, AccountUtxo as BlockbookAccountUtxo, Transaction as BlockbookTransaction } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
import type { AccountAddresses, AccountInfo, InternalTransfer, TokenInfo, TokenTransfer, Transaction, Utxo } from '@trezor/blockchain-link-types'; | ||
import type { AccountInfo as BlockbookAccountInfo, AccountUtxo as BlockbookAccountUtxo, Transaction as BlockbookTransaction, ServerInfo } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
import { Addresses } from './utils'; | ||
@@ -7,2 +7,3 @@ export declare const transformServerInfo: (payload: ServerInfo) => { | ||
shortcut: string; | ||
network: string; | ||
testnet: boolean; | ||
@@ -9,0 +10,0 @@ version: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformAccountUtxo = exports.transformAccountInfo = exports.transformAddresses = exports.transformTokenInfo = exports.transformTransaction = exports.isTxFailed = exports.filterEthereumInternalTransfers = exports.isEthereumStakingInternalTransfer = exports.filterTokenTransfers = exports.transformServerInfo = void 0; | ||
const wallet_sdk_1 = require("@everstake/wallet-sdk"); | ||
const bigNumber_1 = require("@trezor/utils/lib/bigNumber"); | ||
const utils_1 = require("./utils"); | ||
const transformServerInfo = (payload) => { | ||
var _a; | ||
var _a, _b; | ||
return ({ | ||
name: payload.name, | ||
shortcut: payload.shortcut, | ||
network: (_a = payload.network) !== null && _a !== void 0 ? _a : payload.shortcut, | ||
testnet: payload.testnet, | ||
@@ -16,3 +18,3 @@ version: payload.version, | ||
blockHash: payload.bestHash, | ||
consensusBranchId: ((_a = payload.backend) === null || _a === void 0 ? void 0 : _a.consensus) | ||
consensusBranchId: ((_b = payload.backend) === null || _b === void 0 ? void 0 : _b.consensus) | ||
? parseInt(payload.backend.consensus.chaintip, 16) | ||
@@ -63,15 +65,6 @@ : undefined, | ||
exports.filterTokenTransfers = filterTokenTransfers; | ||
const ethereumStakingAddresses = { | ||
poolInstance: [ | ||
'0xD523794C879D9eC028960a231F866758e405bE34', | ||
'0xAFA848357154a6a624686b348303EF9a13F63264', | ||
], | ||
withdrawTreasury: [ | ||
'0x19449f0f696703Aa3b1485DfA2d855F33659397a', | ||
'0x66cb3AeD024740164EBcF04e292dB09b5B63A2e1', | ||
], | ||
}; | ||
const isEthereumStakingInternalTransfer = (from, to) => { | ||
const { poolInstance, withdrawTreasury } = ethereumStakingAddresses; | ||
return poolInstance.includes(from) && withdrawTreasury.includes(to); | ||
const poolInstances = Object.values(wallet_sdk_1.ETH_NETWORK_ADDRESSES).map(network => network.addressContractPool); | ||
const withdrawTreasuries = Object.values(wallet_sdk_1.ETH_NETWORK_ADDRESSES).map(network => network.addressContractWithdrawTreasury); | ||
return poolInstances.includes(from) && withdrawTreasuries.includes(to); | ||
}; | ||
@@ -78,0 +71,0 @@ exports.isEthereumStakingInternalTransfer = isEthereumStakingInternalTransfer; |
@@ -1,4 +0,4 @@ | ||
import type { BlockfrostUtxos, BlockfrostTransaction, BlockfrostAccountInfo, ParseAssetResult, AssetBalance } from '@trezor/blockchain-link-types/lib/blockfrost'; | ||
import type { VinVout } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
import type { Utxo, Transaction, AccountInfo, AccountAddresses, TokenInfo, TokenTransfer, TransferType } from '@trezor/blockchain-link-types/lib/common'; | ||
import type { AssetBalance, BlockfrostAccountInfo, BlockfrostTransaction, BlockfrostUtxos, ParseAssetResult } from '@trezor/blockchain-link-types/lib/blockfrost'; | ||
import type { AccountAddresses, AccountInfo, TokenInfo, TokenTransfer, Transaction, TransferType, Utxo } from '@trezor/blockchain-link-types/lib/common'; | ||
export declare const transformUtxos: (utxos: BlockfrostUtxos[]) => Utxo[]; | ||
@@ -5,0 +5,0 @@ export declare const parseAsset: (hex: string) => ParseAssetResult; |
@@ -79,5 +79,3 @@ "use strict"; | ||
} | ||
const info = tokens.map(token => { | ||
return Object.assign({ type: 'BLOCKFROST', balance: token.quantity }, (0, exports.transformToken)(token)); | ||
}); | ||
const info = tokens.map(token => (Object.assign({ type: 'BLOCKFROST', balance: token.quantity }, (0, exports.transformToken)(token)))); | ||
return info.length > 0 ? info : undefined; | ||
@@ -84,0 +82,0 @@ }; |
import type { Transaction } from '@trezor/blockchain-link-types'; | ||
type RippleTransactionMetadata = { | ||
AffectedNodes: any[]; | ||
DeliveredAmount?: any[]; | ||
TransactionIndex: number; | ||
TransactionResult: string; | ||
delivered_amount?: string; | ||
}; | ||
export declare const transformServerInfo: (payload: any) => { | ||
name: string; | ||
shortcut: string; | ||
network: string; | ||
testnet: boolean; | ||
@@ -11,3 +19,4 @@ version: any; | ||
}; | ||
export declare const transformTransaction: (tx: any, descriptor?: string) => Transaction; | ||
export declare const transformTransaction: (tx: any, meta: RippleTransactionMetadata | null, descriptor?: string) => Transaction; | ||
export {}; | ||
//# sourceMappingURL=ripple.d.ts.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
shortcut: 'xrp', | ||
network: 'xrp', | ||
testnet: false, | ||
@@ -16,12 +17,21 @@ version: payload.buildVersion, | ||
const BLOCKTIME_OFFSET = 946684800; | ||
const transformTransaction = (tx, descriptor) => { | ||
const transformTransaction = (tx, meta, descriptor) => { | ||
var _a; | ||
const blockTime = typeof tx.date === 'number' && tx.date > 0 ? tx.date + BLOCKTIME_OFFSET : tx.date; | ||
const type = tx.TransactionType !== 'Payment' || !descriptor | ||
? 'unknown' | ||
: (tx.Account === descriptor && 'sent') || 'recv'; | ||
let txType; | ||
if (meta != null && !((_a = meta.TransactionResult) === null || _a === void 0 ? void 0 : _a.startsWith('tes'))) { | ||
txType = 'failed'; | ||
} | ||
else if (tx.TransactionType !== 'Payment' || !descriptor) { | ||
txType = 'unknown'; | ||
} | ||
else { | ||
txType = tx.Account === descriptor ? 'sent' : 'recv'; | ||
} | ||
const addresses = [tx.Destination]; | ||
const amount = tx.Amount; | ||
const fee = tx.Fee; | ||
const destinationTag = tx.DestinationTag; | ||
return { | ||
type, | ||
type: txType, | ||
txid: tx.hash, | ||
@@ -33,3 +43,3 @@ amount, | ||
blockHash: tx.hash, | ||
targets: type === 'unknown' | ||
targets: txType === 'unknown' | ||
? [] | ||
@@ -54,2 +64,5 @@ : [ | ||
}, | ||
rippleSpecific: { | ||
destinationTag, | ||
}, | ||
}; | ||
@@ -56,0 +69,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
import { BigNumber } from '@trezor/utils/lib/bigNumber'; | ||
import { TokenTransfer, Transaction } from '@trezor/blockchain-link-types/lib'; | ||
import type { TokenInfo } from '@trezor/blockchain-link-types/lib'; | ||
import type { AccountInfo, Address, ParsedAccountData, ParsedTransactionWithMeta, SolanaTokenAccountInfo, SolanaValidParsedTxWithMeta, TokenDetailByMint } from '@trezor/blockchain-link-types/lib/solana'; | ||
import type { TokenInfo } from '@trezor/blockchain-link-types/lib'; | ||
import { BigNumber } from '@trezor/utils/lib/bigNumber'; | ||
export type ApiTokenAccount = { | ||
@@ -10,5 +10,22 @@ account: AccountInfo<ParsedAccountData>; | ||
export declare const TOKEN_PROGRAM_PUBLIC_KEY = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; | ||
export declare const TOKEN_2022_PROGRAM_PUBLIC_KEY = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; | ||
export declare const ASSOCIATED_TOKEN_PROGRAM_PUBLIC_KEY = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; | ||
export declare const SYSTEM_PROGRAM_PUBLIC_KEY = "11111111111111111111111111111111"; | ||
export declare const WSOL_MINT = "So11111111111111111111111111111111111111112"; | ||
export declare const STAKE_PROGRAM_PUBLIC_KEY = "Stake11111111111111111111111111111111111111"; | ||
export declare const COMPUTE_BUDGET_PROGRAM_ID = "ComputeBudget111111111111111111111111111111"; | ||
export declare const SERUM_ASSET_OWNER_PROGRAM_ID = "4MNPdKu9wFMvEeZBMt3Eipfs5ovVWTJb31pEXDJAAxX5"; | ||
export declare const SERUM_ASSET_OWNER_PHANTOM_DEPLOYMENT_PROGRAM_ID = "DeJBGdMFa1uynnnKiwrVioatTuHmNLpyFKnmB5kaFdzQ"; | ||
declare const tokenProgramNames: readonly ["spl-token", "spl-token-2022"]; | ||
export type TokenProgramName = (typeof tokenProgramNames)[number]; | ||
export declare const tokenProgramsInfo: { | ||
readonly 'spl-token': { | ||
readonly publicKey: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; | ||
readonly tokenStandard: "SPL"; | ||
}; | ||
readonly 'spl-token-2022': { | ||
readonly publicKey: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; | ||
readonly tokenStandard: "SPL-2022"; | ||
}; | ||
}; | ||
export declare const getTokenMetadata: () => Promise<TokenDetailByMint>; | ||
@@ -19,2 +36,3 @@ export declare const getTokenNameAndSymbol: (mint: string, tokenDetailByMint: TokenDetailByMint) => { | ||
}; | ||
export declare const tokenStandardToTokenProgramName: (standard: string) => TokenProgramName; | ||
export declare const transformTokenInfo: (tokenAccounts: readonly ApiTokenAccount[], tokenDetailByMint: TokenDetailByMint) => TokenInfo[]; | ||
@@ -21,0 +39,0 @@ export declare const extractAccountBalanceDiff: (transaction: ParsedTransactionWithMeta, address: string, isTokenDiff?: boolean) => { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformTransaction = exports.getTokens = exports.getAmount = exports.getDetails = exports.getTxType = exports.getTargets = exports.extractAccountBalanceDiff = exports.transformTokenInfo = exports.getTokenNameAndSymbol = exports.getTokenMetadata = exports.WSOL_MINT = exports.SYSTEM_PROGRAM_PUBLIC_KEY = exports.ASSOCIATED_TOKEN_PROGRAM_PUBLIC_KEY = exports.TOKEN_PROGRAM_PUBLIC_KEY = void 0; | ||
exports.transformTransaction = exports.getTokens = exports.getAmount = exports.getDetails = exports.getTxType = exports.getTargets = exports.extractAccountBalanceDiff = exports.transformTokenInfo = exports.tokenStandardToTokenProgramName = exports.getTokenNameAndSymbol = exports.getTokenMetadata = exports.tokenProgramsInfo = exports.SERUM_ASSET_OWNER_PHANTOM_DEPLOYMENT_PROGRAM_ID = exports.SERUM_ASSET_OWNER_PROGRAM_ID = exports.COMPUTE_BUDGET_PROGRAM_ID = exports.STAKE_PROGRAM_PUBLIC_KEY = exports.WSOL_MINT = exports.SYSTEM_PROGRAM_PUBLIC_KEY = exports.ASSOCIATED_TOKEN_PROGRAM_PUBLIC_KEY = exports.TOKEN_2022_PROGRAM_PUBLIC_KEY = exports.TOKEN_PROGRAM_PUBLIC_KEY = void 0; | ||
exports.getNativeEffects = getNativeEffects; | ||
const tslib_1 = require("tslib"); | ||
const ts_belt_1 = require("@mobily/ts-belt"); | ||
const env_utils_1 = require("@trezor/env-utils"); | ||
const utils_1 = require("@trezor/utils"); | ||
const bigNumber_1 = require("@trezor/utils/lib/bigNumber"); | ||
const utils_1 = require("@trezor/utils"); | ||
const env_utils_1 = require("@trezor/env-utils"); | ||
const utils_2 = require("./utils"); | ||
exports.TOKEN_PROGRAM_PUBLIC_KEY = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'; | ||
exports.TOKEN_2022_PROGRAM_PUBLIC_KEY = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'; | ||
exports.ASSOCIATED_TOKEN_PROGRAM_PUBLIC_KEY = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'; | ||
exports.SYSTEM_PROGRAM_PUBLIC_KEY = '11111111111111111111111111111111'; | ||
exports.WSOL_MINT = 'So11111111111111111111111111111111111111112'; | ||
exports.STAKE_PROGRAM_PUBLIC_KEY = 'Stake11111111111111111111111111111111111111'; | ||
exports.COMPUTE_BUDGET_PROGRAM_ID = 'ComputeBudget111111111111111111111111111111'; | ||
exports.SERUM_ASSET_OWNER_PROGRAM_ID = '4MNPdKu9wFMvEeZBMt3Eipfs5ovVWTJb31pEXDJAAxX5'; | ||
exports.SERUM_ASSET_OWNER_PHANTOM_DEPLOYMENT_PROGRAM_ID = 'DeJBGdMFa1uynnnKiwrVioatTuHmNLpyFKnmB5kaFdzQ'; | ||
const tokenProgramNames = ['spl-token', 'spl-token-2022']; | ||
exports.tokenProgramsInfo = { | ||
'spl-token': { | ||
publicKey: exports.TOKEN_PROGRAM_PUBLIC_KEY, | ||
tokenStandard: 'SPL', | ||
}, | ||
'spl-token-2022': { | ||
publicKey: exports.TOKEN_2022_PROGRAM_PUBLIC_KEY, | ||
tokenStandard: 'SPL-2022', | ||
}, | ||
}; | ||
const getTokenMetadata = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { | ||
@@ -36,5 +52,13 @@ const env = (0, env_utils_1.isCodesignBuild)() ? 'stable' : 'develop'; | ||
exports.getTokenNameAndSymbol = getTokenNameAndSymbol; | ||
const isTokenProgramName = (programName) => tokenProgramNames.some(name => name === programName); | ||
const tokenStandardToTokenProgramName = (standard) => { | ||
const tokenProgram = Object.entries(exports.tokenProgramsInfo).find(([_, programInfo]) => programInfo.tokenStandard === standard); | ||
if (!tokenProgram) | ||
throw new Error(`Cannot convert token standard ${standard} to Solana token program name`); | ||
return tokenProgram[0]; | ||
}; | ||
exports.tokenStandardToTokenProgramName = tokenStandardToTokenProgramName; | ||
const isSplTokenAccount = (tokenAccount) => { | ||
const { parsed } = tokenAccount.account.data; | ||
return (tokenAccount.account.data.program === 'spl-token' && | ||
return (isTokenProgramName(tokenAccount.account.data.program) && | ||
'info' in parsed && | ||
@@ -54,4 +78,4 @@ !!parsed.info && | ||
const tokens = ts_belt_1.F.toMutable((0, ts_belt_1.pipe)(tokenAccounts, ts_belt_1.A.filter(isSplTokenAccount), ts_belt_1.A.map(tokenAccount => { | ||
const { info } = tokenAccount.account.data.parsed; | ||
return Object.assign(Object.assign({ type: 'SPL', contract: info.mint, balance: info.tokenAmount.amount, decimals: info.tokenAmount.decimals }, (0, exports.getTokenNameAndSymbol)(info.mint, tokenDetailByMint)), { address: tokenAccount.pubkey }); | ||
const { parsed: { info }, program, } = tokenAccount.account.data; | ||
return Object.assign(Object.assign({ type: exports.tokenProgramsInfo[program].tokenStandard, contract: info.mint, balance: info.tokenAmount.amount, decimals: info.tokenAmount.decimals }, (0, exports.getTokenNameAndSymbol)(info.mint, tokenDetailByMint)), { address: tokenAccount.pubkey }); | ||
}), ts_belt_1.A.reduce({}, (acc, token) => { | ||
@@ -194,2 +218,14 @@ if (acc[token.contract] != null) { | ||
} | ||
const isUnknownProgramInstruction = (instruction) => ![ | ||
exports.SYSTEM_PROGRAM_PUBLIC_KEY, | ||
...Object.values(exports.tokenProgramsInfo).map(info => info.publicKey), | ||
exports.ASSOCIATED_TOKEN_PROGRAM_PUBLIC_KEY, | ||
exports.STAKE_PROGRAM_PUBLIC_KEY, | ||
exports.COMPUTE_BUDGET_PROGRAM_ID, | ||
exports.SERUM_ASSET_OWNER_PROGRAM_ID, | ||
exports.SERUM_ASSET_OWNER_PHANTOM_DEPLOYMENT_PROGRAM_ID, | ||
].includes(instruction.programId); | ||
if (transaction.transaction.message.instructions.some(isUnknownProgramInstruction)) { | ||
return 'contract'; | ||
} | ||
const parsedInstructions = transaction.transaction.message.instructions.filter((instruction) => 'parsed' in instruction); | ||
@@ -268,3 +304,3 @@ if (parsedInstructions.length === 0) { | ||
typeof ix.program === 'string' && | ||
ix.program === 'spl-token' && | ||
isTokenProgramName(ix.program) && | ||
'type' in parsed && | ||
@@ -290,2 +326,3 @@ typeof parsed.type === 'string' && | ||
const getTokens = (tx, accountAddress, tokenDetailByMint, tokenAccountsInfos) => { | ||
var _a, _b, _c; | ||
const getUiType = ({ parsed }) => { | ||
@@ -312,7 +349,12 @@ const accountAddresses = [ | ||
}; | ||
const effects = tx.transaction.message.instructions | ||
.filter(isTokenTransferInstruction) | ||
const instructions = [ | ||
...tx.transaction.message.instructions, | ||
...((_c = (_b = (_a = tx.meta) === null || _a === void 0 ? void 0 : _a.innerInstructions) === null || _b === void 0 ? void 0 : _b.flatMap(innerIx => innerIx.instructions)) !== null && _c !== void 0 ? _c : []), | ||
]; | ||
const effects = instructions | ||
.filter((instruction) => isTokenTransferInstruction(instruction) && | ||
tokenAccountsInfos.some(tokenAccountInfo => matchTokenAccountInfo(instruction, tokenAccountInfo.address))) | ||
.map((ix) => { | ||
var _a, _b; | ||
const { parsed } = ix; | ||
const { parsed, program } = ix; | ||
const instructionTokenInfo = tokenAccountsInfos.find(tokenAccountInfo => matchTokenAccountInfo(ix, tokenAccountInfo.address)); | ||
@@ -327,3 +369,3 @@ const mint = parsed.info.mint || (instructionTokenInfo === null || instructionTokenInfo === void 0 ? void 0 : instructionTokenInfo.mint) || 'Unknown token contract'; | ||
: parsed.info.destination; | ||
return Object.assign(Object.assign({ type: getUiType(ix), standard: 'SPL', from, | ||
return Object.assign(Object.assign({ type: getUiType(ix), standard: exports.tokenProgramsInfo[program].tokenStandard, from, | ||
to, contract: mint, decimals }, (0, exports.getTokenNameAndSymbol)(mint, tokenDetailByMint)), { amount }); | ||
@@ -335,2 +377,60 @@ }) | ||
exports.getTokens = getTokens; | ||
function getTransactionStakeType(tx) { | ||
const { instructions } = tx.transaction.message; | ||
if (!instructions) { | ||
throw new Error('Invalid transaction data'); | ||
} | ||
for (const instruction of instructions) { | ||
if (instruction.programId === exports.STAKE_PROGRAM_PUBLIC_KEY && 'parsed' in instruction) { | ||
const { type } = instruction.parsed || {}; | ||
if (type === 'delegate') | ||
return 'stake'; | ||
if (type === 'deactivate') | ||
return 'unstake'; | ||
if (type === 'withdraw') | ||
return 'claim'; | ||
} | ||
} | ||
return undefined; | ||
} | ||
const getUnstakeAmount = (tx) => { | ||
const { transaction, meta } = tx; | ||
const { instructions, accountKeys } = transaction.message; | ||
if (!instructions || !meta) { | ||
throw new Error('Invalid transaction data'); | ||
} | ||
const stakeAccountIndexes = instructions | ||
.filter((instruction) => { | ||
var _a; | ||
return instruction.programId === exports.STAKE_PROGRAM_PUBLIC_KEY && | ||
'parsed' in instruction && | ||
((_a = instruction.parsed) === null || _a === void 0 ? void 0 : _a.type) === 'deactivate'; | ||
}) | ||
.map(instruction => { | ||
var _a, _b; | ||
if (typeof ((_a = instruction.parsed) === null || _a === void 0 ? void 0 : _a.info) === 'object' && | ||
'stakeAccount' in instruction.parsed.info) { | ||
const stakeAccount = (_b = instruction.parsed.info) === null || _b === void 0 ? void 0 : _b.stakeAccount; | ||
return accountKeys.findIndex(key => key.pubkey === stakeAccount); | ||
} | ||
return -1; | ||
}) | ||
.filter(index => index >= 0); | ||
const totalPostBalance = stakeAccountIndexes.reduce((sum, stakeAccountIndex) => { var _a; return sum.plus(new bigNumber_1.BigNumber(((_a = meta.postBalances[stakeAccountIndex]) === null || _a === void 0 ? void 0 : _a.toString(10)) || 0)); }, new bigNumber_1.BigNumber(0)); | ||
return totalPostBalance.toString(); | ||
}; | ||
const determineTransactionType = (type, stakeType) => { | ||
if (type !== 'unknown' || !stakeType) { | ||
return type; | ||
} | ||
switch (stakeType) { | ||
case 'claim': | ||
return 'recv'; | ||
case 'stake': | ||
case 'unstake': | ||
return 'sent'; | ||
default: | ||
return 'unknown'; | ||
} | ||
}; | ||
const transformTransaction = (tx, accountAddress, tokenAccountsInfos, tokenDetailByMint = {}) => { | ||
@@ -340,7 +440,11 @@ const nativeEffects = getNativeEffects(tx); | ||
const type = (0, exports.getTxType)(tx, nativeEffects, accountAddress, tokens); | ||
const targets = (0, exports.getTargets)(nativeEffects, type, accountAddress); | ||
const amount = (0, exports.getAmount)(nativeEffects.find(({ address }) => address === accountAddress), type); | ||
const stakeType = getTransactionStakeType(tx); | ||
const txType = determineTransactionType(type, stakeType); | ||
const targets = (0, exports.getTargets)(nativeEffects, txType, accountAddress); | ||
const amount = stakeType === 'unstake' | ||
? getUnstakeAmount(tx) | ||
: (0, exports.getAmount)(nativeEffects.find(({ address }) => address === accountAddress), type); | ||
const details = (0, exports.getDetails)(tx, nativeEffects, accountAddress, type); | ||
return { | ||
type, | ||
type: txType, | ||
txid: tx.transaction.signatures[0].toString(), | ||
@@ -357,2 +461,3 @@ blockTime: tx.blockTime == null ? undefined : Number(tx.blockTime), | ||
status: 'confirmed', | ||
stakeType, | ||
}, | ||
@@ -359,0 +464,0 @@ }; |
@@ -0,4 +1,4 @@ | ||
import type { VinVout } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
import type { EnhancedVinVout, Transaction } from '@trezor/blockchain-link-types/lib/common'; | ||
import { BigNumberValue } from '@trezor/utils/lib/bigNumber'; | ||
import type { Transaction, EnhancedVinVout } from '@trezor/blockchain-link-types/lib/common'; | ||
import type { VinVout } from '@trezor/blockchain-link-types/lib/blockbook'; | ||
export type Addresses = ({ | ||
@@ -5,0 +5,0 @@ address: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatTokenSymbol = exports.sortTxsFromLatest = exports.transformTarget = exports.sumVinVout = exports.enhanceVinVout = exports.filterTargets = exports.isAccountOwned = void 0; | ||
const utils_1 = require("@trezor/utils"); | ||
const bigNumber_1 = require("@trezor/utils/lib/bigNumber"); | ||
const utils_1 = require("@trezor/utils"); | ||
const isAccountOwned = (addresses) => (vinVout) => Array.isArray(vinVout === null || vinVout === void 0 ? void 0 : vinVout.addresses) && vinVout.addresses.some(a => addresses.includes(a)); | ||
@@ -7,0 +7,0 @@ exports.isAccountOwned = isAccountOwned; |
{ | ||
"name": "@trezor/blockchain-link-utils", | ||
"version": "1.2.6", | ||
"version": "1.2.7-beta.1", | ||
"license": "See LICENSE.md in repo root", | ||
@@ -23,8 +23,9 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@everstake/wallet-sdk": "^1.0.7", | ||
"@mobily/ts-belt": "^3.13.1", | ||
"@trezor/env-utils": "1.2.1", | ||
"@trezor/utils": "9.2.6" | ||
"@trezor/env-utils": "1.2.2-beta.1", | ||
"@trezor/utils": "9.2.7-beta.1" | ||
}, | ||
"devDependencies": { | ||
"@trezor/blockchain-link-types": "1.2.5", | ||
"@trezor/blockchain-link-types": "1.2.6-beta.1", | ||
"@trezor/eslint": "1.0.0", | ||
@@ -31,0 +32,0 @@ "@trezor/type-utils": "1.1.4", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
66984
1306
5
2
+ Added@everstake/wallet-sdk@^1.0.7
+ Added@adraffy/ens-normalize@1.11.0(transitive)
+ Added@babel/runtime@7.26.9(transitive)
+ Added@ethereumjs/rlp@4.0.15.0.2(transitive)
+ Added@ethersproject/abi@5.8.0(transitive)
+ Added@ethersproject/abstract-provider@5.8.0(transitive)
+ Added@ethersproject/abstract-signer@5.8.0(transitive)
+ Added@ethersproject/address@5.8.0(transitive)
+ Added@ethersproject/base64@5.8.0(transitive)
+ Added@ethersproject/basex@5.8.0(transitive)
+ Added@ethersproject/bignumber@5.8.0(transitive)
+ Added@ethersproject/bytes@5.8.0(transitive)
+ Added@ethersproject/constants@5.8.0(transitive)
+ Added@ethersproject/contracts@5.8.0(transitive)
+ Added@ethersproject/hash@5.8.0(transitive)
+ Added@ethersproject/hdnode@5.8.0(transitive)
+ Added@ethersproject/json-wallets@5.8.0(transitive)
+ Added@ethersproject/keccak256@5.8.0(transitive)
+ Added@ethersproject/logger@5.8.0(transitive)
+ Added@ethersproject/networks@5.8.0(transitive)
+ Added@ethersproject/pbkdf2@5.8.0(transitive)
+ Added@ethersproject/properties@5.8.0(transitive)
+ Added@ethersproject/providers@5.8.0(transitive)
+ Added@ethersproject/random@5.8.0(transitive)
+ Added@ethersproject/rlp@5.8.0(transitive)
+ Added@ethersproject/sha2@5.8.0(transitive)
+ Added@ethersproject/signing-key@5.8.0(transitive)
+ Added@ethersproject/solidity@5.8.0(transitive)
+ Added@ethersproject/strings@5.8.0(transitive)
+ Added@ethersproject/transactions@5.8.0(transitive)
+ Added@ethersproject/units@5.8.0(transitive)
+ Added@ethersproject/wallet@5.8.0(transitive)
+ Added@ethersproject/web@5.8.0(transitive)
+ Added@ethersproject/wordlists@5.8.0(transitive)
+ Added@everstake/wallet-sdk@1.0.13(transitive)
+ Added@noble/curves@1.4.21.8.1(transitive)
+ Added@noble/hashes@1.4.01.7.1(transitive)
+ Added@scure/base@1.1.9(transitive)
+ Added@scure/bip32@1.4.0(transitive)
+ Added@scure/bip39@1.3.0(transitive)
+ Added@solana/buffer-layout@4.0.1(transitive)
+ Added@solana/web3.js@1.95.8(transitive)
+ Added@swc/helpers@0.5.15(transitive)
+ Added@trezor/env-utils@1.2.2-beta.1(transitive)
+ Added@trezor/utils@9.2.7-beta.1(transitive)
+ Added@types/connect@3.4.38(transitive)
+ Added@types/node@12.20.55(transitive)
+ Added@types/uuid@8.3.4(transitive)
+ Added@types/ws@7.4.78.5.148.5.3(transitive)
+ AddedJSONStream@1.3.5(transitive)
+ Addedabitype@0.7.1(transitive)
+ Addedaes-js@3.0.0(transitive)
+ Addedagentkeepalive@4.6.0(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedbase-x@3.0.10(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbech32@1.1.4(transitive)
+ Addedbigint-buffer@1.1.5(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbn.js@4.12.15.2.1(transitive)
+ Addedborsh@0.7.0(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbs58@4.0.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedbufferutil@4.0.9(transitive)
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.2(transitive)
+ Addedcall-bound@1.0.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcrc-32@1.2.2(transitive)
+ Addedcross-fetch@4.1.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddelay@5.0.0(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedelliptic@6.6.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addedes6-promisify@5.0.0(transitive)
+ Addedethereum-cryptography@2.2.1(transitive)
+ Addedethereum-multicall@2.26.0(transitive)
+ Addedethers@5.8.0(transitive)
+ Addedeventemitter3@5.0.1(transitive)
+ Addedeyes@0.1.8(transitive)
+ Addedfast-stable-stringify@1.0.0(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedfor-each@0.3.5(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.3.0(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedhumanize-ms@1.2.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arguments@1.2.0(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-generator-function@1.1.0(transitive)
+ Addedis-regex@1.2.1(transitive)
+ Addedis-typed-array@1.1.15(transitive)
+ Addedisomorphic-ws@4.0.15.0.0(transitive)
+ Addedjayson@4.1.3(transitive)
+ Addedjs-sha3@0.8.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsonparse@1.3.1(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedms@2.1.3(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addednode-gyp-build@4.8.4(transitive)
+ Addedpossible-typed-array-names@1.1.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedrpc-websockets@9.1.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafe-regex-test@1.1.0(transitive)
+ Addedscrypt-js@3.0.1(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedsuperstruct@2.0.2(transitive)
+ Addedtext-encoding-utf-8@1.0.2(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedtypescript@5.8.2(transitive)
+ Addedutf-8-validate@5.0.10(transitive)
+ Addedutil@0.12.5(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedweb3@4.16.0(transitive)
+ Addedweb3-core@4.7.1(transitive)
+ Addedweb3-errors@1.3.1(transitive)
+ Addedweb3-eth@4.11.1(transitive)
+ Addedweb3-eth-abi@4.4.1(transitive)
+ Addedweb3-eth-accounts@4.3.1(transitive)
+ Addedweb3-eth-contract@4.7.2(transitive)
+ Addedweb3-eth-ens@4.4.0(transitive)
+ Addedweb3-eth-iban@4.0.7(transitive)
+ Addedweb3-eth-personal@4.1.0(transitive)
+ Addedweb3-net@4.1.0(transitive)
+ Addedweb3-providers-http@4.2.0(transitive)
+ Addedweb3-providers-ipc@4.0.7(transitive)
+ Addedweb3-providers-ws@4.0.8(transitive)
+ Addedweb3-rpc-methods@1.3.0(transitive)
+ Addedweb3-rpc-providers@1.0.0-rc.4(transitive)
+ Addedweb3-types@1.10.0(transitive)
+ Addedweb3-utils@4.3.3(transitive)
+ Addedweb3-validator@2.0.6(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwhich-typed-array@1.1.18(transitive)
+ Addedws@7.5.108.18.0(transitive)
+ Addedzod@3.24.2(transitive)
- Removed@trezor/env-utils@1.2.1(transitive)
- Removed@trezor/utils@9.2.6(transitive)
Updated@trezor/utils@9.2.7-beta.1