From 610bbf2d8df1120686928fb618df6bc1de0cfe6c Mon Sep 17 00:00:00 2001 From: Peter Sanderson Date: Tue, 14 Jan 2025 12:40:55 +0100 Subject: [PATCH] fix: make types strict to prevent accidental deletion via unused types, the optionality is a trap, they are required --- .github/workflows/test-blockchain-link.yml | 10 +- .../blockchain-link-types/src/blockfrost.ts | 8 +- packages/blockchain-link-types/src/common.ts | 6 +- .../methods/getAccountBalanceHistory.ts | 7 +- .../electrum/methods/getAccountInfo.ts | 5 + .../coinjoin/src/backend/getAccountInfo.ts | 9 +- .../src/types/api/__tests__/bitcoin.ts | 11 +- .../moveLabelsForRbfAccounts.fixture.ts | 240 ++++++++++++++++++ .../coinmarketCommonActions/accounts.ts | 3 + .../coinmarketCommonActions/store.ts | 3 + .../hooks/wallet/__fixtures__/useRbfForm.ts | 3 + .../hooks/wallet/__fixtures__/useSendForm.ts | 54 +++- .../__fixtures__/transactionConstants.ts | 24 ++ .../src/__fixtures__/cardanoUtils.ts | 4 + 14 files changed, 363 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-blockchain-link.yml b/.github/workflows/test-blockchain-link.yml index 7e16a71e17e..ede8dfba7af 100644 --- a/.github/workflows/test-blockchain-link.yml +++ b/.github/workflows/test-blockchain-link.yml @@ -6,14 +6,14 @@ on: - cron: "0 0 * * *" pull_request: paths: - - "packages/blockchain-link" - - "packages/blockchain-link-utils" - - "packages/blockchain-link-types" + - "packages/blockchain-link/**" + - "packages/blockchain-link-utils/**" + - "packages/blockchain-link-types/**" - "packages/e2e-utils/src/fixtures/blockbook.ts" - "packages/e2e-utils/src/mocks/backendServer.ts" # dependencies of packages/blockchain-link - - "packages/utxo-lib" - - "packages/utils" + - "packages/utxo-lib/**" + - "packages/utils/**" - "docker/docker-blockchain-link-test.sh" - ".github/workflows/blockchain-link-test.yml" - "yarn.lock" diff --git a/packages/blockchain-link-types/src/blockfrost.ts b/packages/blockchain-link-types/src/blockfrost.ts index 4ee80dcd594..1562e2145ce 100644 --- a/packages/blockchain-link-types/src/blockfrost.ts +++ b/packages/blockchain-link-types/src/blockfrost.ts @@ -133,9 +133,9 @@ export interface Address { address: string; path: string; transfers: number; - balance?: string; - sent?: string; - received?: string; + balance: string; + sent: string; + received: string; } export interface AccountAddresses { @@ -223,6 +223,7 @@ export type AccountUtxo = { export interface UtxosData extends AddressUtxoContent { blockInformation: BlockContent; } + export interface AssetBalance { unit: string; // policy id + encoded name quantity: string; @@ -297,4 +298,5 @@ declare function FSend( params: AccountBalanceHistoryParams, ): Promise; declare function FSend(method: 'ESTIMATE_FEE', params: EstimateFeeParams): Promise; + export type Send = typeof FSend; diff --git a/packages/blockchain-link-types/src/common.ts b/packages/blockchain-link-types/src/common.ts index 843b6a1d61f..49cc8979b48 100644 --- a/packages/blockchain-link-types/src/common.ts +++ b/packages/blockchain-link-types/src/common.ts @@ -167,9 +167,9 @@ export interface Address { path: string; transfers: number; // decimal: number, - balance?: string; - sent?: string; - received?: string; + balance: string; + sent: string; + received: string; } export interface AccountAddresses { diff --git a/packages/blockchain-link/src/workers/electrum/methods/getAccountBalanceHistory.ts b/packages/blockchain-link/src/workers/electrum/methods/getAccountBalanceHistory.ts index b6d51ec3dbc..053801f54b6 100644 --- a/packages/blockchain-link/src/workers/electrum/methods/getAccountBalanceHistory.ts +++ b/packages/blockchain-link/src/workers/electrum/methods/getAccountBalanceHistory.ts @@ -4,15 +4,18 @@ import { sumVinVout } from '@trezor/blockchain-link-utils'; import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook'; import type { GetAccountBalanceHistory as Req } from '@trezor/blockchain-link-types/src/messages'; import type { GetAccountBalanceHistory as Res } from '@trezor/blockchain-link-types/src/responses'; -import type { AccountAddresses, Transaction } from '@trezor/blockchain-link-types/src/common'; +import { AccountAddresses, Address, Transaction } from '@trezor/blockchain-link-types/src/common'; import type { HistoryTx } from '@trezor/blockchain-link-types/src/electrum'; import { Api, tryGetScripthash, getTransactions, discoverAddress, AddressHistory } from '../utils'; -const transformAddress = (addr: AddressHistory) => ({ +const transformAddress = (addr: AddressHistory): Address => ({ address: addr.address, path: addr.path, transfers: addr.history.length, + balance: '0', + sent: '0', + received: '0', }); const aggregateTransactions = (txs: (Transaction & { blockTime: number })[], groupBy = 3600) => { diff --git a/packages/blockchain-link/src/workers/electrum/methods/getAccountInfo.ts b/packages/blockchain-link/src/workers/electrum/methods/getAccountInfo.ts index fd62f7f813f..6608b68e5a3 100644 --- a/packages/blockchain-link/src/workers/electrum/methods/getAccountInfo.ts +++ b/packages/blockchain-link/src/workers/electrum/methods/getAccountInfo.ts @@ -116,6 +116,8 @@ const getAccountInfo: Api = async (client, payload) => { path, transfers: history.length, balance: confirmed.toString(), // TODO or confirmed + unconfirmed? + sent: '0', + received: '0', }); const addresses = { @@ -134,6 +136,9 @@ const getAccountInfo: Api = async (client, payload) => { address, path, transfers, + balance: '0', + sent: '0', + received: '0', ...(['tokenBalances', 'txids', 'txs'].includes(details) && transfers ? { balance, diff --git a/packages/coinjoin/src/backend/getAccountInfo.ts b/packages/coinjoin/src/backend/getAccountInfo.ts index bd862eb5fe3..c682f5ffe6e 100644 --- a/packages/coinjoin/src/backend/getAccountInfo.ts +++ b/packages/coinjoin/src/backend/getAccountInfo.ts @@ -9,6 +9,7 @@ import type { ScanAccountCheckpoint, PrederivedAddress, AccountCache, + Address, } from '../types/backend'; import { getAccountUtxo } from './getAccountUtxo'; import { CoinjoinAddressController } from './CoinjoinAddressController'; @@ -39,7 +40,7 @@ const sumBalance = (current: number, tx: Transaction) => current + getDelta(tx); const enhanceAddress = (transactions: Transaction[]) => - ({ address, path }: PrederivedAddress) => { + ({ address, path }: PrederivedAddress): Address => { const txs = transactions.filter(tx => doesTxContainAddress(address)(tx.details)); const sent = sumAddressValues(txs, address, tx => tx.details.vin); const received = sumAddressValues(txs, address, tx => tx.details.vout); @@ -48,9 +49,9 @@ const enhanceAddress = address, path, transfers: txs.length, - balance: txs.length ? (received - sent).toString() : undefined, - sent: txs.length ? sent.toString() : undefined, - received: txs.length ? received.toString() : undefined, + balance: txs.length ? (received - sent).toString() : '0', + sent: txs.length ? sent.toString() : '0', + received: txs.length ? received.toString() : '0', }; }; diff --git a/packages/connect/src/types/api/__tests__/bitcoin.ts b/packages/connect/src/types/api/__tests__/bitcoin.ts index 279abc3d425..12650cbf976 100644 --- a/packages/connect/src/types/api/__tests__/bitcoin.ts +++ b/packages/connect/src/types/api/__tests__/bitcoin.ts @@ -380,7 +380,16 @@ export const signTransaction = async (api: TrezorConnect) => { addresses: { used: [], unused: [], - change: [{ path: 'm/44', address: 'a', transfers: 0 }], + change: [ + { + path: 'm/44', + address: 'a', + transfers: 0, + sent: '0', + balance: '0', + received: '0', + }, + ], }, }, coin: 'btc', diff --git a/packages/suite/src/actions/wallet/__fixtures__/moveLabelsForRbf/moveLabelsForRbfAccounts.fixture.ts b/packages/suite/src/actions/wallet/__fixtures__/moveLabelsForRbf/moveLabelsForRbfAccounts.fixture.ts index 4b0eb69f7ad..cf32b1fbd94 100644 --- a/packages/suite/src/actions/wallet/__fixtures__/moveLabelsForRbf/moveLabelsForRbfAccounts.fixture.ts +++ b/packages/suite/src/actions/wallet/__fixtures__/moveLabelsForRbf/moveLabelsForRbfAccounts.fixture.ts @@ -33,101 +33,161 @@ export const accountSpendingCoins: Account = { address: 'bcrt1qze76uzqteg6un6jfcryrxhwvfvjj58tsdeh9xy', path: "m/84'/1'/0'/1/1", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qr5p6f5sk09sms57ket074vywfymuthlg7y8tn0', path: "m/84'/1'/0'/1/2", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qwn0s88t9r39g72m78mcaxj72sy3ct4m4dulavf', path: "m/84'/1'/0'/1/3", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qguznsd2hyl69gjx2axd6f5qu9k274qj9v5syhd', path: "m/84'/1'/0'/1/4", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q8zx9dlztqz9apm7y5gtx8a0tlz57fhncycvun5', path: "m/84'/1'/0'/1/5", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qger2dlc2mykcavfxs0ad8eupr058njwp2e8n6m', path: "m/84'/1'/0'/1/6", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qjm4p4nykvsczt26llswppmfe7xraane9nfruqv', path: "m/84'/1'/0'/1/7", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qm3sx7jlgj7yd3y2ad0jm587k98pcc2x5wfq5jf', path: "m/84'/1'/0'/1/8", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcvgld0z38vnx9fnpsgwuc583838ldv8sf38pwz', path: "m/84'/1'/0'/1/9", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1quja53ex7clst8yhkwenhy8p67aa36kedqszlun', path: "m/84'/1'/0'/1/10", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qlxvp7fwy0azketw0afgw0snxssyphmtthe4g8g', path: "m/84'/1'/0'/1/11", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1ql02lgacsfm543teeymtw2p7xz9unxe6572mxeh', path: "m/84'/1'/0'/1/12", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qnuafw94yvu6td7tcfqea823y342ttrc9d32qnx', path: "m/84'/1'/0'/1/13", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q92khcru77q7hrctf7ter2kltpgtrz23nhnkcaz', path: "m/84'/1'/0'/1/14", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qu8ts4a80ylfq7hgy9aqt0rk65gekmt5p029ymm', path: "m/84'/1'/0'/1/15", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qc0zg0xrs0grvrmr0hrq7u0rdthadsrk406w0dk', path: "m/84'/1'/0'/1/16", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1quvm4wfs9pjrqvr4rmy60k8uevg009jhtx9zzxr', path: "m/84'/1'/0'/1/17", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qetngs772lxz97x94v9ycfjtwelmu7aqmuu5vkl', path: "m/84'/1'/0'/1/18", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qaydzjvcf0qnfxs9aw8zmazt88f6j0wjtgqqn22', path: "m/84'/1'/0'/1/19", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qlecqdxptwt65c52uqzmdqk9njyt4rmygf2vsvd', path: "m/84'/1'/0'/1/20", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], used: [ @@ -153,101 +213,161 @@ export const accountSpendingCoins: Account = { address: 'bcrt1q9l0rk0gkgn73d0gc57qn3t3cwvucaj3h98jwg4', path: "m/84'/1'/0'/0/2", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qtxe2hdle9he8hc2xds7yl2m8zutjksv0gmszw2', path: "m/84'/1'/0'/0/3", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qglrv8xrtf68udd5pxj2pxyq5s7lynq204v2da8', path: "m/84'/1'/0'/0/4", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qds6ygc07t7d8prjs60qnx0nv4gexx9hex07wwl', path: "m/84'/1'/0'/0/5", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q86udlgffezp9kgjvqlfah7a6c8dpepameugfw5', path: "m/84'/1'/0'/0/6", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q503m8pxyvf7ypurcvwv2kp0ajyjumsjq5ad7xq', path: "m/84'/1'/0'/0/7", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qg805w4uhsz3sy9stasdx2rkwp4haf446ew055v', path: "m/84'/1'/0'/0/8", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qy2f6mkfa3aaecqz2s2xr0utf6edza7qzh7gnnn', path: "m/84'/1'/0'/0/9", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q4tm6cgxd3m7uqgzmwxfclruqz894qdv5w05kss', path: "m/84'/1'/0'/0/10", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qguvdun4cjty8js34wswdn4nv2ne7jamajjwgkj', path: "m/84'/1'/0'/0/11", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qp6py2d8acmqcvdfeht3escetv5aunru5d4vlk0', path: "m/84'/1'/0'/0/12", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q88fkyl4zxrcejt4s75ynkunpps3n9kchzvnaw8', path: "m/84'/1'/0'/0/13", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qjfvfjqsp3khtgdkqw87up39skp6zvp062q7y93', path: "m/84'/1'/0'/0/14", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qf49m5zxk9957z8yzyfed6glrcvz3r7y4demdex', path: "m/84'/1'/0'/0/15", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qfmej7qk4f66vx8a5aq5t5nlvp0hxuwe0fg9rrp', path: "m/84'/1'/0'/0/16", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qlfxf67wwud59ru0d4e7qa36zh0daxcfr6ec53g', path: "m/84'/1'/0'/0/17", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcmmen68dyt59pkh7dv2xxf07tme7qxzn0upszf', path: "m/84'/1'/0'/0/18", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qpcgw9fuec7wjjnq8rl0cwfwa7mqvrheud24890', path: "m/84'/1'/0'/0/19", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qxukydnhdldsjf0c8rguxmja9kxsydjzwj486hk', path: "m/84'/1'/0'/0/20", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qq7tkmktggcwp46jefmnh7ytade562ka8qte4un', path: "m/84'/1'/0'/0/21", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, @@ -307,101 +427,161 @@ export const accountReceivingCoins: Account = { address: 'bcrt1q5k7s87q26syf6muqthlprn06sxhklq693u69lu', path: "m/84'/1'/1'/1/1", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qaugvv7tvw6h434feqs4ep62qxv7e0xdm9txmft', path: "m/84'/1'/1'/1/2", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qrm08dns67sj0ycvsqm0rnqzp7ff2crdgurmjzd', path: "m/84'/1'/1'/1/3", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qnrk8ewh48ynxrqlvtmaepgxax3623rx043zate', path: "m/84'/1'/1'/1/4", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qz4xx7glecua7fy0xvdvwx3vhh4zpa7pyfw7dhy', path: "m/84'/1'/1'/1/5", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qr2fm62qd8r9thyvkn44drxr0877jgy88xukyam', path: "m/84'/1'/1'/1/6", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qhzhpctls7v8l2cvxnhz743m3lkpptq4twq6wu9', path: "m/84'/1'/1'/1/7", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcg80e2vyv52vl8fx5842y2raxx4lp4f5wg85dm', path: "m/84'/1'/1'/1/8", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qtayc24uac0hm95eyvmz4rcalnhj46hasutljcy', path: "m/84'/1'/1'/1/9", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qrspwywt63gp07uwn7f5n0522v4jxnhglpskzjl', path: "m/84'/1'/1'/1/10", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qjkgrmaffye33epk5p4cy67ynnhj4njml0j4lmu', path: "m/84'/1'/1'/1/11", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qq7n68efyh97v7fvdkq8eh7thnlaag4z7kpme7g', path: "m/84'/1'/1'/1/12", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qc0qc6wjds0mlw29zu5rn7ngkqu5p6rnkp2zdeu', path: "m/84'/1'/1'/1/13", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q8pdptz6j4z7ky5e264sjcf9c4g6ushvlc75m7l', path: "m/84'/1'/1'/1/14", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qp4fqac7tqmtsxuef7sgud90xljyza2ffaqm5a2', path: "m/84'/1'/1'/1/15", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q5a4vteamypse527xxm9995h6vempc8jps5ttq6', path: "m/84'/1'/1'/1/16", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qx2t5x8ce6wvdc5t9ax04rf2ruudd84f6lmaysq', path: "m/84'/1'/1'/1/17", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qrcdafxz8wtjlxcryzddulrqe2mtgjz38t8s9ha', path: "m/84'/1'/1'/1/18", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qvw8wmaz2qvfkcuz9fm7dyy4yzuy6evle7z8uaj', path: "m/84'/1'/1'/1/19", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qnt0rdkhrzd5550ca57ja0zjxr9uq57ydpm3tzw', path: "m/84'/1'/1'/1/20", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], used: [ @@ -435,101 +615,161 @@ export const accountReceivingCoins: Account = { address: 'bcrt1qs3krye0f3hhknsf9wudy82zkmp5j35rs9wjg33', path: "m/84'/1'/1'/0/3", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qpdq7f5vv90ydwjjzc0r5z5c6yp7qhrj4r8egfy', path: "m/84'/1'/1'/0/4", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qlksrfcwqlzlphpdsglh2cj00efayz2nh846v6x', path: "m/84'/1'/1'/0/5", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1ql47490ve5j98wltlar03a25v4lupjgqhrg4dp8', path: "m/84'/1'/1'/0/6", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1q87dfkaegfr3aqqda2t5kr3a04pah67gckx5stl', path: "m/84'/1'/1'/0/7", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qtusttyvgpaaneh2c78fqejm48g9j95sux0a9rz', path: "m/84'/1'/1'/0/8", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qanwed8uyhlm33hya47ps6kv9sl6kuh45hdt6m6', path: "m/84'/1'/1'/0/9", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcmrfzuenh02ntrv28t0acm4mwc23u0lan9mzdt', path: "m/84'/1'/1'/0/10", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qajh9yx9hwppjskfndmpcs5vdu02an0pfgvhu5m', path: "m/84'/1'/1'/0/11", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qswtgqxygvj8kqfagqrj45lnjutuzec4qz2js27', path: "m/84'/1'/1'/0/12", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qg0n0mwxg5frrrzqaclgzur6qkc4q8my64wu09g', path: "m/84'/1'/1'/0/13", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcm66dfrtjnpg7vte7pwnt45jvct4jmckjth8yk', path: "m/84'/1'/1'/0/14", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qvgntsus4syjj9zehr7240l90ese76kwfg5rkt3', path: "m/84'/1'/1'/0/15", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qvcxpmklkjjn7f4rpuqf92tvtk4mlllgke4hurp', path: "m/84'/1'/1'/0/16", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qa464t8hqjk86f2z0xt2v064jut4w8zstdvmpfp', path: "m/84'/1'/1'/0/17", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qaxhydk5qcaj3ctqy0uktc85e534lzqqvz97v3n', path: "m/84'/1'/1'/0/18", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qcwcue88vje7k6cz0xcdm6wkrkxv06ask6gqeah', path: "m/84'/1'/1'/0/19", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qlvfg066zcyvp0l5mn9sf8p62j9lsyzm8ur4s05', path: "m/84'/1'/1'/0/20", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qn9czsla64h9dq3mtqmwwhznwsvq3892hj7gkg0', path: "m/84'/1'/1'/0/21", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bcrt1qtg5atnpz4mh3e9px2a8jlqu0j66jql26vf0lr2', path: "m/84'/1'/1'/0/22", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, diff --git a/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/accounts.ts b/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/accounts.ts index b39af76c15d..6d06c16c540 100644 --- a/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/accounts.ts +++ b/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/accounts.ts @@ -23,6 +23,9 @@ export const BTC_ACCOUNT: Account = { address: 'bc1q5y487p64hfsjc5gdfeezv29zwcddz5kahve0kp', path: "m/84'/0'/0'/0/0", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, diff --git a/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/store.ts b/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/store.ts index e7e9c1c3036..56889d2f239 100644 --- a/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/store.ts +++ b/packages/suite/src/actions/wallet/coinmarket/__fixtures__/coinmarketCommonActions/store.ts @@ -26,6 +26,9 @@ export const ACCOUNT: Account = { address: 'bc1q5y487p64hfsjc5gdfeezv29zwcddz5kahve0kp', path: "m/84'/0'/0'/0/0", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, diff --git a/packages/suite/src/hooks/wallet/__fixtures__/useRbfForm.ts b/packages/suite/src/hooks/wallet/__fixtures__/useRbfForm.ts index c39c9006352..ea65de2fe43 100644 --- a/packages/suite/src/hooks/wallet/__fixtures__/useRbfForm.ts +++ b/packages/suite/src/hooks/wallet/__fixtures__/useRbfForm.ts @@ -146,6 +146,9 @@ const PREPARE_TX = (params: Partial = {}): HackedTxTy path: "m/44'/0'/0'/1/0", address: '1DyHzbQUoQEsLxJn6M7fMD8Xdt1XvNiwNE', transfers: 1, + balance: '0', + sent: '0', + received: '0', }, feeRate: '3.79', baseFee: 175, diff --git a/packages/suite/src/hooks/wallet/__fixtures__/useSendForm.ts b/packages/suite/src/hooks/wallet/__fixtures__/useSendForm.ts index d4bd9f0b76a..fec2ca13379 100644 --- a/packages/suite/src/hooks/wallet/__fixtures__/useSendForm.ts +++ b/packages/suite/src/hooks/wallet/__fixtures__/useSendForm.ts @@ -59,16 +59,58 @@ export const BTC_ACCOUNT = { key: 'xpub-btc-1stTestnetAddress@device_id:0', addresses: { change: [ - { path: "m/44'/0'/0'/1/0", address: '1-change', transfers: 0 }, - { path: "m/44'/0'/0'/1/1", address: '2-change', transfers: 0 }, + { + path: "m/44'/0'/0'/1/0", + address: '1-change', + transfers: 0, + balance: '0', + sent: '0', + received: '0', + }, + { + path: "m/44'/0'/0'/1/1", + address: '2-change', + transfers: 0, + balance: '0', + sent: '0', + received: '0', + }, ], used: [ - { path: "m/44'/0'/0'/0/0", address: '1-used', transfers: 1 }, - { path: "m/44'/0'/0'/0/1", address: '2-used', transfers: 1 }, + { + path: "m/44'/0'/0'/0/0", + address: '1-used', + transfers: 1, + balance: '0', + sent: '0', + received: '0', + }, + { + path: "m/44'/0'/0'/0/1", + address: '2-used', + transfers: 1, + balance: '0', + sent: '0', + received: '0', + }, ], unused: [ - { path: "m/44'/0'/0'/0/2", address: '1-unused', transfers: 0 }, - { path: "m/44'/0'/0'/0/3", address: '2-unused', transfers: 0 }, + { + path: "m/44'/0'/0'/0/2", + address: '1-unused', + transfers: 0, + balance: '0', + sent: '0', + received: '0', + }, + { + path: "m/44'/0'/0'/0/3", + address: '2-unused', + transfers: 0, + balance: '0', + sent: '0', + received: '0', + }, ], }, balance: '100000000000', diff --git a/packages/suite/src/reducers/wallet/__fixtures__/transactionConstants.ts b/packages/suite/src/reducers/wallet/__fixtures__/transactionConstants.ts index 3dcf9903919..1c31c9f1e9a 100644 --- a/packages/suite/src/reducers/wallet/__fixtures__/transactionConstants.ts +++ b/packages/suite/src/reducers/wallet/__fixtures__/transactionConstants.ts @@ -22,11 +22,17 @@ export const accounts: CommonAccount[] = [ address: 'bc1qktmhrsmsenepnnfst8x6j27l0uqv7ggrg8x38q', path: "m/84'/0'/0'/1/0", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bc1q0tl5v4u3ct2xgf8cmzgsgx2t76vxpzy5y7afuj', path: "m/84'/0'/0'/1/1", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], used: [ @@ -52,11 +58,17 @@ export const accounts: CommonAccount[] = [ address: 'bc1qfcjv620stvtzjeelg26ncgww8ks49zy8lracjz', path: "m/84'/0'/0'/0/5", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bc1quqgq44wq0zjh6d920zs42nsy4n4ev5vt8nxke4', path: "m/84'/0'/0'/0/6", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, @@ -103,11 +115,17 @@ export const accounts: CommonAccount[] = [ address: 'bc1pgxdrjnuj9nktxhknwpc5ynu7d0ly68mjqmx39l9xtcpu7zpqmk7qnyecgs', path: "m/86'/0'/0'/1/16", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bc1p47uug6jgnfakskkwdddg0qlv6ev9dexxu9qaadnlauhhnqlx2rus5s8usa', path: "m/86'/0'/0'/1/17", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], used: [ @@ -125,11 +143,17 @@ export const accounts: CommonAccount[] = [ address: 'bc1plca7n9vs7d906nwlqyvk0d0jxnxss6x7w3x2y879quuvj8xn3p3s7vrrl2', path: "m/86'/0'/0'/0/1", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, { address: 'bc1pks4em3l8vg4zyk5xpcmgygh7elkhu03z3fqj48a2a2lv948cn4hsyltl3h', path: "m/86'/0'/0'/0/2", transfers: 0, + balance: '0', + sent: '0', + received: '0', }, ], }, diff --git a/suite-common/wallet-utils/src/__fixtures__/cardanoUtils.ts b/suite-common/wallet-utils/src/__fixtures__/cardanoUtils.ts index 3ae4a3c515a..e511c2e54ff 100644 --- a/suite-common/wallet-utils/src/__fixtures__/cardanoUtils.ts +++ b/suite-common/wallet-utils/src/__fixtures__/cardanoUtils.ts @@ -24,6 +24,7 @@ export const getChangeAddressParameters = [ 'addr1qq0w6pmkt9khgfud806ycw50zm7gvzkhlf0gpperulsrelhm2tfs2k368ger3n3pngluz0lympuh65rzarw5vux862dskal4js', path: "m/1852'/1815'/0'/0/0", transfers: 6, + balance: '0', received: '1003000000', sent: '1003000000', }, @@ -34,6 +35,7 @@ export const getChangeAddressParameters = [ 'addr1qq2zpf6lqjs0lm0y624qv3a4j3w9x9ynaf5hkx8yqwgxl30m2tfs2k368ger3n3pngluz0lympuh65rzarw5vux862ds83yr28', path: "m/1852'/1815'/0'/0/6", transfers: 0, + balance: '0', received: '0', sent: '0', }, @@ -44,6 +46,7 @@ export const getChangeAddressParameters = [ 'addr1qq43pzxxgfdvffrw5jnrej9840nuylaykv7uzcy56t02xv8m2tfs2k368ger3n3pngluz0lympuh65rzarw5vux862dszv2e9w', path: "m/1852'/1815'/0'/1/0", transfers: 30, + balance: '0', received: '10', sent: '10', }, @@ -52,6 +55,7 @@ export const getChangeAddressParameters = [ 'addr1qpqz745252wmrd2gmttze7njgguzgrp2dk3e8756u7xdwxlm2tfs2k368ger3n3pngluz0lympuh65rzarw5vux862dscg0wdp', path: "m/1852'/1815'/0'/1/1", transfers: 0, + balance: '0', received: '0', sent: '0', },