mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-23 10:12:20 +01:00
chore(packages): autofix for sort-imports eslint rule
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { encodeDataToQueryString, getRandomId, getUrl, reportEvent } from './utils';
|
||||
import type {
|
||||
InitOptions,
|
||||
Event as AnalyticsEvent,
|
||||
App,
|
||||
ReportConfig,
|
||||
AnalyticsOptions,
|
||||
App,
|
||||
InitOptions,
|
||||
ReportConfig,
|
||||
} from './types';
|
||||
import { encodeDataToQueryString, getRandomId, getUrl, reportEvent } from './utils';
|
||||
|
||||
export class Analytics<T extends AnalyticsEvent> {
|
||||
private enabled?: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-console */
|
||||
import { fixtures } from './fixtures/encodeDataToQueryString';
|
||||
import { Analytics } from '../analytics';
|
||||
import { encodeDataToQueryString, getRandomId } from '../utils';
|
||||
import { fixtures } from './fixtures/encodeDataToQueryString';
|
||||
|
||||
jest.mock('@trezor/utils', () => ({
|
||||
__esModule: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Environment } from '@trezor/env-utils';
|
||||
import { getWeakRandomId } from '@trezor/utils';
|
||||
|
||||
import type { App, Event as AnalyticsEvent } from './types';
|
||||
import type { Event as AnalyticsEvent, App } from './types';
|
||||
|
||||
export const getTrackingRandomId = () => getWeakRandomId(10);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import express from 'express';
|
||||
import cors, { CorsOptions } from 'cors';
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import type { RequiredKey } from '@trezor/type-utils';
|
||||
|
||||
import type {
|
||||
AddressAlias,
|
||||
Token as BlockbookToken,
|
||||
TokenTransfer as BlockbookTokenTransfer,
|
||||
Tx as BlockbookTx,
|
||||
Utxo as BlockbookUtxo,
|
||||
ContractInfo,
|
||||
MempoolTxidFilterEntries,
|
||||
StakingPool,
|
||||
Vin,
|
||||
Vout,
|
||||
WsBlockFilterReq,
|
||||
WsBlockFiltersBatchReq,
|
||||
WsBlockHashRes,
|
||||
WsInfoRes,
|
||||
} from './blockbook-api';
|
||||
import type { AccountBalanceHistory, FiatRatesBySymbol, TokenStandard } from './common';
|
||||
import type {
|
||||
AccountBalanceHistoryParams,
|
||||
AccountInfoParams,
|
||||
EstimateFeeParams,
|
||||
GetCurrentFiatRatesParams,
|
||||
GetFiatRatesForTimestampsParams,
|
||||
GetFiatRatesTickersListParams,
|
||||
EstimateFeeParams,
|
||||
RpcCallParams,
|
||||
AccountInfoParams,
|
||||
} from './params';
|
||||
import type { AccountBalanceHistory, FiatRatesBySymbol, TokenStandard } from './common';
|
||||
import type {
|
||||
Tx as BlockbookTx,
|
||||
Vin,
|
||||
Vout,
|
||||
Utxo as BlockbookUtxo,
|
||||
WsInfoRes,
|
||||
WsBlockHashRes,
|
||||
WsBlockFilterReq,
|
||||
WsBlockFiltersBatchReq,
|
||||
MempoolTxidFilterEntries,
|
||||
Token as BlockbookToken,
|
||||
TokenTransfer as BlockbookTokenTransfer,
|
||||
AddressAlias,
|
||||
ContractInfo,
|
||||
StakingPool,
|
||||
} from './blockbook-api';
|
||||
|
||||
type OptionalKey<M, K extends keyof M> = Omit<M, K> & Partial<Pick<M, K>>;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AccountInfoParams, EstimateFeeParams, AccountBalanceHistoryParams } from './params';
|
||||
import type { AccountBalanceHistory } from './common';
|
||||
import type { AccountBalanceHistoryParams, AccountInfoParams, EstimateFeeParams } from './params';
|
||||
|
||||
type TxContentUtxo = {
|
||||
/** Transaction hash */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BlockEvent, NotificationEvent, FiatRatesEvent, MempoolEvent } from './responses';
|
||||
import type { BlockEvent, FiatRatesEvent, MempoolEvent, NotificationEvent } from './responses';
|
||||
|
||||
export interface Events {
|
||||
connected: undefined;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { BlockchainSettings, ChannelMessage, SubscriptionAccountInfo } from './common';
|
||||
import * as MESSAGES from './constants/messages';
|
||||
import type { SubscriptionAccountInfo, BlockchainSettings, ChannelMessage } from './common';
|
||||
import type {
|
||||
AccountBalanceHistoryParams,
|
||||
AccountInfoParams,
|
||||
EstimateFeeParams,
|
||||
GetCurrentFiatRatesParams,
|
||||
GetFiatRatesForTimestampsParams,
|
||||
GetFiatRatesTickersListParams,
|
||||
EstimateFeeParams,
|
||||
RpcCallParams,
|
||||
AccountInfoParams,
|
||||
} from './params';
|
||||
|
||||
// messages sent from blockchain.js to worker
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { Block, MempoolTransactionNotification } from './blockbook';
|
||||
import type {
|
||||
AccountBalanceHistory,
|
||||
AccountInfo,
|
||||
ChannelMessage,
|
||||
FiatRatesBySymbol,
|
||||
ServerInfo,
|
||||
Transaction,
|
||||
Utxo,
|
||||
} from './common';
|
||||
import { HANDSHAKE } from './constants/messages';
|
||||
import * as RESPONSES from './constants/responses';
|
||||
import type {
|
||||
ServerInfo,
|
||||
AccountInfo,
|
||||
Utxo,
|
||||
FiatRatesBySymbol,
|
||||
Transaction,
|
||||
AccountBalanceHistory,
|
||||
ChannelMessage,
|
||||
} from './common';
|
||||
import type { MempoolTransactionNotification, Block } from './blockbook';
|
||||
|
||||
// messages sent from worker to blockchain.js
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { SolDelegation } from '@everstake/wallet-sdk';
|
||||
import type {
|
||||
AccountInfoBase,
|
||||
AccountInfoWithBase58EncodedData,
|
||||
@@ -7,7 +8,6 @@ import type {
|
||||
GetTransactionApi,
|
||||
Signature,
|
||||
} from '@solana/web3.js';
|
||||
import type { SolDelegation } from '@everstake/wallet-sdk';
|
||||
|
||||
import type {
|
||||
GetObjectWithKey,
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import { ETH_NETWORK_ADDRESSES } from '@everstake/wallet-sdk';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import type {
|
||||
Utxo,
|
||||
Transaction,
|
||||
TokenTransfer,
|
||||
TokenInfo,
|
||||
Address,
|
||||
AccountAddresses,
|
||||
AccountInfo,
|
||||
Address,
|
||||
InternalTransfer,
|
||||
TokenInfo,
|
||||
TokenTransfer,
|
||||
Transaction,
|
||||
Utxo,
|
||||
} from '@trezor/blockchain-link-types';
|
||||
import type {
|
||||
ServerInfo,
|
||||
AccountInfo as BlockbookAccountInfo,
|
||||
AccountUtxo as BlockbookAccountUtxo,
|
||||
Transaction as BlockbookTransaction,
|
||||
ServerInfo,
|
||||
VinVout,
|
||||
} from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { Addresses, filterTargets, enhanceVinVout, sumVinVout, transformTarget } from './utils';
|
||||
import { Addresses, enhanceVinVout, filterTargets, sumVinVout, transformTarget } from './utils';
|
||||
|
||||
export const transformServerInfo = (payload: ServerInfo) => ({
|
||||
name: payload.name,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
import type {
|
||||
BlockfrostUtxos,
|
||||
BlockfrostTransaction,
|
||||
BlockfrostAccountInfo,
|
||||
ParseAssetResult,
|
||||
AssetBalance,
|
||||
} from '@trezor/blockchain-link-types/src/blockfrost';
|
||||
import type { VinVout } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type {
|
||||
Utxo,
|
||||
Transaction,
|
||||
AccountInfo,
|
||||
AssetBalance,
|
||||
BlockfrostAccountInfo,
|
||||
BlockfrostTransaction,
|
||||
BlockfrostUtxos,
|
||||
ParseAssetResult,
|
||||
} from '@trezor/blockchain-link-types/src/blockfrost';
|
||||
import type {
|
||||
AccountAddresses,
|
||||
AccountInfo,
|
||||
TokenInfo,
|
||||
TokenTransfer,
|
||||
Transaction,
|
||||
TransferType,
|
||||
Utxo,
|
||||
} from '@trezor/blockchain-link-types/src/common';
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import {
|
||||
enhanceVinVout,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { A, D, F, pipe } from '@mobily/ts-belt';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Target, TokenTransfer, Transaction } from '@trezor/blockchain-link-types/src';
|
||||
import { arrayPartition } from '@trezor/utils';
|
||||
import type { StakeType, TokenInfo, TokenStandard } from '@trezor/blockchain-link-types/src';
|
||||
import type {
|
||||
AccountInfo,
|
||||
Address,
|
||||
@@ -14,8 +13,9 @@ import type {
|
||||
SolanaValidParsedTxWithMeta,
|
||||
TokenDetailByMint,
|
||||
} from '@trezor/blockchain-link-types/src/solana';
|
||||
import type { TokenInfo, TokenStandard, StakeType } from '@trezor/blockchain-link-types/src';
|
||||
import { isCodesignBuild } from '@trezor/env-utils';
|
||||
import { arrayPartition } from '@trezor/utils';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { formatTokenSymbol } from './utils';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
parseAsset,
|
||||
transformUtxos,
|
||||
transformTokenInfo,
|
||||
transformInputOutput,
|
||||
transformTransaction,
|
||||
transformAccountInfo,
|
||||
transformInputOutput,
|
||||
transformTokenInfo,
|
||||
transformTransaction,
|
||||
transformUtxos,
|
||||
} from '../blockfrost';
|
||||
import fixtures from './fixtures/blockfrost';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DeepPartial } from '@trezor/type-utils';
|
||||
import type { AccountAddresses, Transaction } from '@trezor/blockchain-link-types';
|
||||
import type { Transaction as BlockbookTransaction } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { DeepPartial } from '@trezor/type-utils';
|
||||
|
||||
const token = {
|
||||
amount: '',
|
||||
|
||||
@@ -5,17 +5,17 @@ import {
|
||||
} from '@trezor/blockchain-link-types/src/solana';
|
||||
|
||||
import {
|
||||
ApiTokenAccount,
|
||||
extractAccountBalanceDiff,
|
||||
getAmount,
|
||||
getDetails,
|
||||
getTargets,
|
||||
getTokens,
|
||||
getNativeEffects,
|
||||
getTxType,
|
||||
transformTransaction,
|
||||
getTargets,
|
||||
getTokenNameAndSymbol,
|
||||
getTokens,
|
||||
getTxType,
|
||||
transformTokenInfo,
|
||||
ApiTokenAccount,
|
||||
transformTransaction,
|
||||
} from '../solana';
|
||||
import { fixtures } from './fixtures/solana';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
import { isNotUndefined, topologicalSort } from '@trezor/utils';
|
||||
import type { Transaction, EnhancedVinVout } from '@trezor/blockchain-link-types/src/common';
|
||||
import type { VinVout } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { EnhancedVinVout, Transaction } from '@trezor/blockchain-link-types/src/common';
|
||||
import { isNotUndefined, topologicalSort } from '@trezor/utils';
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export type Addresses = ({ address: string } | string)[] | string;
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { BlockchainSettings } from '@trezor/blockchain-link-types';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type { Events } from '@trezor/blockchain-link-types/src/events';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import type * as ResponseTypes from '@trezor/blockchain-link-types/src/responses';
|
||||
import {
|
||||
Throttler,
|
||||
TypedEmitter,
|
||||
createDeferred,
|
||||
createDeferredManager,
|
||||
createLazy,
|
||||
TypedEmitter,
|
||||
Throttler,
|
||||
} from '@trezor/utils';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import type { BlockchainSettings } from '@trezor/blockchain-link-types';
|
||||
import type * as ResponseTypes from '@trezor/blockchain-link-types/src/responses';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { Events } from '@trezor/blockchain-link-types/src/events';
|
||||
|
||||
const workerWrapper = (factory: BlockchainSettings['worker']): Worker | Promise<Worker> => {
|
||||
if (typeof factory === 'function') return factory();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import BlockbookWorker from '../workers/blockbook/index';
|
||||
import RippleWorker from '../workers/ripple/index';
|
||||
import BlockfrostWorker from '../workers/blockfrost/index';
|
||||
import CONFIG from './config';
|
||||
import BlockchainLink from '../index';
|
||||
import { getInputValue, fillValues, onClear } from './utils';
|
||||
import { fillValues, getInputValue, onClear } from './utils';
|
||||
import BlockbookWorker from '../workers/blockbook/index';
|
||||
import BlockfrostWorker from '../workers/blockfrost/index';
|
||||
import RippleWorker from '../workers/ripple/index';
|
||||
import SolanaWorker from '../workers/solana';
|
||||
|
||||
const instances: BlockchainLink[] = [];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import WebSocket from 'ws';
|
||||
|
||||
import { createDeferred, createDeferredManager, TypedEmitter } from '@trezor/utils';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { TimerId } from '@trezor/type-utils';
|
||||
import { TypedEmitter, createDeferred, createDeferredManager } from '@trezor/utils';
|
||||
|
||||
interface Subscription<T> {
|
||||
id: string;
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
import { SocksProxyAgent } from 'socks-proxy-agent';
|
||||
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type { BlockchainSettings, Response } from '@trezor/blockchain-link-types';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import type { Response, BlockchainSettings } from '@trezor/blockchain-link-types';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type { Message } from '@trezor/blockchain-link-types/src/messages';
|
||||
|
||||
import { prioritizeEndpoints } from './utils';
|
||||
import { WorkerState } from './state';
|
||||
import { prioritizeEndpoints } from './utils';
|
||||
|
||||
// self is not declared in TS Webworker lib typings
|
||||
declare const self: { postMessage: (...args: any[]) => any };
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import * as utils from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import type { Response, SubscriptionAccountInfo } from '@trezor/blockchain-link-types';
|
||||
import type {
|
||||
AddressNotification,
|
||||
@@ -8,7 +5,10 @@ import type {
|
||||
FiatRatesNotification,
|
||||
MempoolTransactionNotification,
|
||||
} from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import * as utils from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
|
||||
import { BlockbookAPI } from './websocket';
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import WebSocket from 'ws';
|
||||
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type {
|
||||
BlockNotification,
|
||||
MempoolTransactionNotification,
|
||||
AddressNotification,
|
||||
Send,
|
||||
BlockNotification,
|
||||
FiatRatesNotification,
|
||||
FilterRequestParams,
|
||||
MempoolTransactionNotification,
|
||||
Send,
|
||||
} from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type {
|
||||
GetCurrentFiatRates,
|
||||
GetFiatRatesForTimestamps,
|
||||
GetFiatRatesTickersList,
|
||||
GetCurrentFiatRates,
|
||||
} from '@trezor/blockchain-link-types/src/messages';
|
||||
import type {
|
||||
AccountBalanceHistoryParams,
|
||||
AccountInfoParams,
|
||||
EstimateFeeParams,
|
||||
AccountBalanceHistoryParams,
|
||||
RpcCallParams,
|
||||
} from '@trezor/blockchain-link-types/src/params';
|
||||
import { getSuiteVersion } from '@trezor/env-utils';
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import {
|
||||
transformUtxos,
|
||||
transformAccountInfo,
|
||||
transformTransaction,
|
||||
} from '@trezor/blockchain-link-utils/src/blockfrost';
|
||||
import type { SubscriptionAccountInfo } from '@trezor/blockchain-link-types/src/common';
|
||||
import type { Response } from '@trezor/blockchain-link-types';
|
||||
import type {
|
||||
BlockfrostTransaction,
|
||||
BlockContent,
|
||||
BlockfrostTransaction,
|
||||
} from '@trezor/blockchain-link-types/src/blockfrost';
|
||||
import type { SubscriptionAccountInfo } from '@trezor/blockchain-link-types/src/common';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import {
|
||||
transformAccountInfo,
|
||||
transformTransaction,
|
||||
transformUtxos,
|
||||
} from '@trezor/blockchain-link-utils/src/blockfrost';
|
||||
|
||||
import { BlockfrostAPI } from './websocket';
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import WebSocket from 'ws';
|
||||
|
||||
import type {
|
||||
Send,
|
||||
BlockContent,
|
||||
BlockfrostTransaction,
|
||||
Send,
|
||||
} from '@trezor/blockchain-link-types/src/blockfrost';
|
||||
import type {
|
||||
AccountBalanceHistoryParams,
|
||||
AccountInfoParams,
|
||||
EstimateFeeParams,
|
||||
AccountBalanceHistoryParams,
|
||||
} from '@trezor/blockchain-link-types/src/params';
|
||||
import { getSuiteVersion } from '@trezor/env-utils';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Network, networks } from '@trezor/utxo-lib';
|
||||
import { ElectrumAPI, BlockHeader, Version } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import { BlockHeader, ElectrumAPI, Version } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import { IntervalId } from '@trezor/type-utils';
|
||||
import { Network, networks } from '@trezor/utxo-lib';
|
||||
|
||||
import { JsonRpcClientOptions } from './json-rpc';
|
||||
import { BatchingJsonRpcClient } from './batching';
|
||||
import { JsonRpcClientOptions } from './json-rpc';
|
||||
import type { ISocket } from '../sockets/interface';
|
||||
|
||||
const KEEP_ALIVE_INTERVAL = 120 * 1000; // 2 minutes
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import type { Response } from '@trezor/blockchain-link-types';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { Message } from '@trezor/blockchain-link-types/src/messages';
|
||||
import { Without } from '@trezor/type-utils';
|
||||
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
import * as M from './methods';
|
||||
import * as L from './listeners';
|
||||
import { createSocket } from './sockets';
|
||||
import { CachingElectrumClient } from './client/caching';
|
||||
import type { ElectrumClient } from './client/electrum';
|
||||
import * as L from './listeners';
|
||||
import * as M from './methods';
|
||||
import { createSocket } from './sockets';
|
||||
|
||||
type BlockListener = ReturnType<typeof L.blockListener>;
|
||||
type TxListener = ReturnType<typeof L.txListener>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { throwError } from '@trezor/utils';
|
||||
import { RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import type { BlockHeader, ElectrumAPI } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import { throwError } from '@trezor/utils';
|
||||
|
||||
import { blockheaderToBlockhash } from '../utils';
|
||||
import type { BaseWorker } from '../../baseWorker';
|
||||
import { blockheaderToBlockhash } from '../utils';
|
||||
|
||||
export const blockListener = (worker: BaseWorker<ElectrumAPI>) => {
|
||||
const { state } = worker;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { throwError } from '@trezor/utils';
|
||||
import { RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import type {
|
||||
ElectrumAPI,
|
||||
HistoryTx,
|
||||
StatusChange,
|
||||
} from '@trezor/blockchain-link-types/src/electrum';
|
||||
import type { Subscribe, Unsubscribe } from '@trezor/blockchain-link-types/src/messages';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import { throwError } from '@trezor/utils';
|
||||
|
||||
import type { BaseWorker } from '../../baseWorker';
|
||||
import { createAddressManager, getTransactions } from '../utils';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
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 { AccountAddresses, Address, Transaction } from '@trezor/blockchain-link-types/src/common';
|
||||
import type { HistoryTx } from '@trezor/blockchain-link-types/src/electrum';
|
||||
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 { sumVinVout } from '@trezor/blockchain-link-utils';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
|
||||
import { Api, tryGetScripthash, getTransactions, discoverAddress, AddressHistory } from '../utils';
|
||||
import { AddressHistory, Api, discoverAddress, getTransactions, tryGetScripthash } from '../utils';
|
||||
|
||||
const transformAddress = (addr: AddressHistory): Address => ({
|
||||
address: addr.address,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
import { sortTxsFromLatest } from '@trezor/blockchain-link-utils';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import type { Address, Transaction } from '@trezor/blockchain-link-types';
|
||||
import type { VinVout } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { ElectrumAPI } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import type { GetAccountInfo as Req } from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { GetAccountInfo as Res } from '@trezor/blockchain-link-types/src/responses';
|
||||
import type { VinVout } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { Address, Transaction } from '@trezor/blockchain-link-types';
|
||||
import { sortTxsFromLatest } from '@trezor/blockchain-link-utils';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
|
||||
import { Api, tryGetScripthash, discoverAddress, AddressHistory, getTransactions } from '../utils';
|
||||
import { AddressHistory, Api, discoverAddress, getTransactions, tryGetScripthash } from '../utils';
|
||||
|
||||
// const PAGE_DEFAULT = 0;
|
||||
const PAGE_SIZE_DEFAULT = 25;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { throwError } from '@trezor/utils';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
import type { Utxo } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import type { GetAccountUtxo as Req } from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { GetAccountUtxo as Res } from '@trezor/blockchain-link-types/src/responses';
|
||||
import type { Utxo } from '@trezor/blockchain-link-types/src/electrum';
|
||||
import { throwError } from '@trezor/utils';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
|
||||
import { Api, tryGetScripthash, discoverAddress } from '../utils';
|
||||
import { Api, discoverAddress, tryGetScripthash } from '../utils';
|
||||
|
||||
const transformUtxo =
|
||||
(currentHeight: number, addressInfo: { address?: string; path?: string } = {}) =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { throwError } from '@trezor/utils';
|
||||
import type { GetInfo as Req } from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { GetInfo as Res } from '@trezor/blockchain-link-types/src/responses';
|
||||
import { throwError } from '@trezor/utils';
|
||||
|
||||
import { Api, blockheaderToBlockhash } from '../utils';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import type { GetTransaction as Req } from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { GetTransaction as Res } from '@trezor/blockchain-link-types/src/responses';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
|
||||
import { Api, getTransactions } from '../utils';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Socket as TCPSocket } from 'net';
|
||||
import type { TLSSocket } from 'tls';
|
||||
import type { SocksProxyAgent } from 'socks-proxy-agent';
|
||||
import type { TLSSocket } from 'tls';
|
||||
|
||||
import type { ISocket, SocketListener } from './interface';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { parseElectrumUrl } from '@trezor/utils';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { parseElectrumUrl } from '@trezor/utils';
|
||||
|
||||
import type { SocketBase, SocketOptions } from './base';
|
||||
import { TcpSocket } from './tcp';
|
||||
import { TlsSocket } from './tls';
|
||||
import { TorSocket } from './tor';
|
||||
import type { SocketBase, SocketOptions } from './base';
|
||||
|
||||
export const createSocket = (url: string, options?: SocketOptions): SocketBase => {
|
||||
const parsed = parseElectrumUrl(url);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isNotUndefined, arrayDistinct, objectPartition } from '@trezor/utils';
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
import type { AccountAddresses, SubscriptionAccountInfo } from '@trezor/blockchain-link-types/src';
|
||||
import { arrayDistinct, isNotUndefined, objectPartition } from '@trezor/utils';
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import { addressToScripthash } from './transform';
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { arrayToDictionary, arrayDistinct } from '@trezor/utils';
|
||||
import type { Transaction as BlockbookTransaction } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type {
|
||||
ElectrumAPI,
|
||||
TransactionVerbose,
|
||||
TxIn,
|
||||
TxCoinbase,
|
||||
TxOut,
|
||||
HistoryTx,
|
||||
TransactionVerbose,
|
||||
TxCoinbase,
|
||||
TxIn,
|
||||
TxOut,
|
||||
} from '@trezor/blockchain-link-types/src/electrum';
|
||||
import { arrayDistinct, arrayToDictionary } from '@trezor/utils';
|
||||
|
||||
import { btcToSat } from './transform';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { address as a, crypto as c, Network } from '@trezor/utxo-lib';
|
||||
import { Network, address as a, crypto as c } from '@trezor/utxo-lib';
|
||||
|
||||
export const btcToSat = (btc: number) => Math.round(100000000 * btc).toString();
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { RippleAPI, APIOptions } from 'ripple-lib';
|
||||
import { APIOptions, RippleAPI } from 'ripple-lib';
|
||||
import { RippleError } from 'ripple-lib/dist/npm/common/errors';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type { AccountInfo, Response, SubscriptionAccountInfo } from '@trezor/blockchain-link-types';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import * as utils from '@trezor/blockchain-link-utils/src/ripple';
|
||||
import type { Response, SubscriptionAccountInfo, AccountInfo } from '@trezor/blockchain-link-types';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import * as utils from '@trezor/blockchain-link-utils/src/ripple';
|
||||
import { TimerId } from '@trezor/type-utils';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
|
||||
|
||||
@@ -2,19 +2,19 @@ import {
|
||||
Address,
|
||||
Base64EncodedWireTransaction,
|
||||
CompiledTransactionMessage,
|
||||
decompileTransactionMessage,
|
||||
getBase64Decoder,
|
||||
getCompiledTransactionMessageEncoder,
|
||||
GetFeeForMessageApi,
|
||||
GetRecentPrioritizationFeesApi,
|
||||
getTransactionEncoder,
|
||||
isWritableRole,
|
||||
pipe,
|
||||
Rpc,
|
||||
SignaturesMap,
|
||||
SimulateTransactionApi,
|
||||
TransactionMessageBytes,
|
||||
TransactionMessageBytesBase64,
|
||||
decompileTransactionMessage,
|
||||
getBase64Decoder,
|
||||
getCompiledTransactionMessageEncoder,
|
||||
getTransactionEncoder,
|
||||
isWritableRole,
|
||||
pipe,
|
||||
} from '@solana/web3.js';
|
||||
|
||||
import { COMPUTE_BUDGET_PROGRAM_ID } from '@trezor/blockchain-link-utils/src/solana';
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
import { getTokenSize as _getTokenSize } from '@solana-program/token';
|
||||
import { getTokenSize as _getToken2022Size } from '@solana-program/token-2022';
|
||||
import {
|
||||
AccountInfoBase,
|
||||
ClusterUrl,
|
||||
RpcMainnet,
|
||||
RpcSubscriptionsMainnet,
|
||||
SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,
|
||||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED,
|
||||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT,
|
||||
SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,
|
||||
Signature,
|
||||
Slot,
|
||||
SolanaRpcApiMainnet,
|
||||
SolanaRpcResponse,
|
||||
SolanaRpcSubscriptionsApi,
|
||||
TransactionWithBlockhashLifetime,
|
||||
address,
|
||||
assertTransactionIsFullySigned,
|
||||
ClusterUrl,
|
||||
createDefaultRpcTransport,
|
||||
createSolanaRpcFromTransport,
|
||||
createSolanaRpcSubscriptions,
|
||||
@@ -17,50 +28,39 @@ import {
|
||||
isSolanaError,
|
||||
mainnet,
|
||||
pipe,
|
||||
RpcMainnet,
|
||||
RpcSubscriptionsMainnet,
|
||||
sendAndConfirmTransactionFactory,
|
||||
Signature,
|
||||
Slot,
|
||||
SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,
|
||||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT,
|
||||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED,
|
||||
SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,
|
||||
SolanaRpcApiMainnet,
|
||||
SolanaRpcSubscriptionsApi,
|
||||
TransactionWithBlockhashLifetime,
|
||||
AccountInfoBase,
|
||||
SolanaRpcResponse,
|
||||
} from '@solana/web3.js';
|
||||
import { getTokenSize as _getTokenSize } from '@solana-program/token';
|
||||
import { getTokenSize as _getToken2022Size } from '@solana-program/token-2022';
|
||||
|
||||
import type {
|
||||
Response,
|
||||
AccountInfo,
|
||||
Transaction,
|
||||
Response,
|
||||
SubscriptionAccountInfo,
|
||||
TokenInfo,
|
||||
Transaction,
|
||||
} from '@trezor/blockchain-link-types';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import type {
|
||||
SolanaValidParsedTxWithMeta,
|
||||
ParsedTransactionWithMeta,
|
||||
SolanaTokenAccountInfo,
|
||||
SolanaValidParsedTxWithMeta,
|
||||
TokenDetailByMint,
|
||||
} from '@trezor/blockchain-link-types/src/solana';
|
||||
import type * as MessageTypes from '@trezor/blockchain-link-types/src/messages';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { solanaUtils } from '@trezor/blockchain-link-utils';
|
||||
import { BigNumber, createDeferred, createLazy } from '@trezor/utils';
|
||||
import {
|
||||
transformTokenInfo,
|
||||
tokenProgramsInfo,
|
||||
type TokenProgramName,
|
||||
tokenProgramsInfo,
|
||||
transformTokenInfo,
|
||||
} from '@trezor/blockchain-link-utils/src/solana';
|
||||
import { getSuiteVersion } from '@trezor/env-utils';
|
||||
import { IntervalId } from '@trezor/type-utils';
|
||||
import { BigNumber, createDeferred, createLazy } from '@trezor/utils';
|
||||
|
||||
import { getBaseFee, getPriorityFee } from './fee';
|
||||
import { BaseWorker, ContextType, CONTEXT } from '../baseWorker';
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
import { getSolanaStakingData } from '../utils';
|
||||
|
||||
export type SolanaAPI = Readonly<{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import type { SubscriptionAccountInfo } from '@trezor/blockchain-link-types';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { Cache } from '@trezor/utils';
|
||||
|
||||
export class WorkerState {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Solana, SolNetwork } from '@everstake/wallet-sdk';
|
||||
import { SolNetwork, Solana } from '@everstake/wallet-sdk';
|
||||
|
||||
import { parseHostname } from '@trezor/utils';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { BackendWebsocketServerMock } from '@trezor/e2e-utils';
|
||||
|
||||
import BlockchainLink from '../../src';
|
||||
import {
|
||||
// blockbookWorkerFactory,
|
||||
blockbookModuleFactory,
|
||||
} from './worker';
|
||||
import BlockchainLink from '../../src';
|
||||
|
||||
const backends = [
|
||||
// TODO: nodejs tests are failing, fix it.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { BackendWebsocketServerMock } from '@trezor/e2e-utils';
|
||||
|
||||
import BlockchainLink from '../../src';
|
||||
import {
|
||||
// blockfrostWorkerFactory,
|
||||
blockfrostModuleFactory,
|
||||
} from './worker';
|
||||
import BlockchainLink from '../../src';
|
||||
|
||||
const backends = [
|
||||
// TODO: nodejs tests are failing, fix it.
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { BackendWebsocketServerMock } from '@trezor/e2e-utils';
|
||||
|
||||
import BlockchainLink from '../../src';
|
||||
import {
|
||||
// rippleWorkerFactory,
|
||||
rippleModuleFactory,
|
||||
// blockbookWorkerFactory,
|
||||
blockbookModuleFactory,
|
||||
// blockfrostWorkerFactory,
|
||||
blockfrostModuleFactory,
|
||||
// rippleWorkerFactory,
|
||||
rippleModuleFactory,
|
||||
} from './worker';
|
||||
import BlockchainLink from '../../src';
|
||||
|
||||
// Testing each build using same scenarios (connection + events)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GET_ACCOUNT_INFO, HANDSHAKE } from '@trezor/blockchain-link-types/src/constants/messages';
|
||||
import type { Message } from '@trezor/blockchain-link-types/src/messages';
|
||||
import type { Response } from '@trezor/blockchain-link-types/src/responses';
|
||||
import { GET_ACCOUNT_INFO, HANDSHAKE } from '@trezor/blockchain-link-types/src/constants/messages';
|
||||
|
||||
import ElectrumWorker from '../../src/workers/electrum';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { BackendWebsocketServerMock } from '@trezor/e2e-utils';
|
||||
|
||||
import BlockchainLink from '../../src';
|
||||
import {
|
||||
// rippleWorkerFactory,
|
||||
rippleModuleFactory,
|
||||
} from './worker';
|
||||
import BlockchainLink from '../../src';
|
||||
|
||||
const backends = [
|
||||
// TODO: nodejs tests are failing, fix it.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import TinyWorker from 'tiny-worker';
|
||||
|
||||
const BlockbookWorkerModule = require('../../../build/module/blockbook-worker');
|
||||
const RippleWorkerModule = require('../../../build/module/ripple-worker');
|
||||
const BlockfrostWorkerModule = require('../../../build/module/blockfrost-worker');
|
||||
const RippleWorkerModule = require('../../../build/module/ripple-worker');
|
||||
|
||||
export const rippleWorkerFactory = () => {
|
||||
if (typeof Worker === 'undefined') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DeepPartial } from '@trezor/type-utils';
|
||||
import type { AccountInfo, AccountInfoParams } from '@trezor/blockchain-link-types';
|
||||
import type { AccountInfo as BlockbookAccountInfo } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { DeepPartial } from '@trezor/type-utils';
|
||||
|
||||
const fixtures: {
|
||||
description: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import blockbook from './getAccountInfo-blockbook';
|
||||
import ripple from './getAccountInfo-ripple';
|
||||
import blockfrost from './getAccountInfo-blockfrost';
|
||||
import ripple from './getAccountInfo-ripple';
|
||||
|
||||
export default {
|
||||
blockbook,
|
||||
|
||||
@@ -3,8 +3,8 @@ import { BackendWebsocketServerMock } from '@trezor/e2e-utils';
|
||||
import workers from './worker';
|
||||
import BlockchainLink from '../../src';
|
||||
import fixturesBlockbook from './fixtures/notifications-blockbook';
|
||||
import fixturesRipple from './fixtures/notifications-ripple';
|
||||
import fixturesBlockfrost from './fixtures/notifications-blockfrost';
|
||||
import fixturesRipple from './fixtures/notifications-ripple';
|
||||
|
||||
const fixtures = {
|
||||
blockbook: fixturesBlockbook,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { WorkerState } from '../../src/workers/state';
|
||||
import fixtures from './fixtures/state';
|
||||
import { WorkerState } from '../../src/workers/state';
|
||||
|
||||
const state = new WorkerState();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { prioritizeEndpoints } from '../../src/workers/utils';
|
||||
import * as fixtures from './fixtures/utils';
|
||||
import { prioritizeEndpoints } from '../../src/workers/utils';
|
||||
|
||||
describe('prioritizeEndpoints', () => {
|
||||
it('prioritizeEndpoints', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Blockbook from '../../../src/workers/blockbook';
|
||||
import Ripple from '../../../src/workers/ripple';
|
||||
import Blockfrost from '../../../src/workers/blockfrost';
|
||||
import Ripple from '../../../src/workers/ripple';
|
||||
|
||||
export default [
|
||||
{ name: 'blockbook', worker: Blockbook },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const webpack = require('webpack');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const { SRC, BUILD, PORT } = require('./constants');
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import type { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import { deriveAddresses } from './backendUtils';
|
||||
import { getAddressScript } from './filters';
|
||||
import type { AccountAddress, ScanAccountCheckpoint, AccountCache } from '../types/backend';
|
||||
import { DISCOVERY_LOOKOUT, DISCOVERY_LOOKOUT_EXTENDED } from '../constants';
|
||||
import type { AccountAddress, AccountCache, ScanAccountCheckpoint } from '../types/backend';
|
||||
|
||||
export type AddressController = Pick<CoinjoinAddressController, 'receive' | 'change' | 'analyze'>;
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ import { CoinjoinBackendClient } from './CoinjoinBackendClient';
|
||||
import { CoinjoinFilterController } from './CoinjoinFilterController';
|
||||
import { CoinjoinMempoolController } from './CoinjoinMempoolController';
|
||||
import { DISCOVERY_LOOKOUT, DISCOVERY_LOOKOUT_EXTENDED } from '../constants';
|
||||
import { scanAccount } from './scanAccount';
|
||||
import { getAccountInfo } from './getAccountInfo';
|
||||
import { createPendingTransaction } from './createPendingTx';
|
||||
import { deriveAddresses, isTaprootAddress } from './backendUtils';
|
||||
import { getCoinjoinNetwork } from '../utils/settingsUtils';
|
||||
import type { CoinjoinBackendSettings, LogEvent, Logger, LogLevel } from '../types';
|
||||
import { createPendingTransaction } from './createPendingTx';
|
||||
import { getAccountInfo } from './getAccountInfo';
|
||||
import { scanAccount } from './scanAccount';
|
||||
import type { CoinjoinBackendSettings, LogEvent, LogLevel, Logger } from '../types';
|
||||
import type {
|
||||
ScanAccountParams,
|
||||
AccountCache,
|
||||
ScanAccountCheckpoint,
|
||||
ScanAccountParams,
|
||||
ScanAccountProgress,
|
||||
ScanProgressInfo,
|
||||
Transaction,
|
||||
AccountCache,
|
||||
} from '../types/backend';
|
||||
import { getCoinjoinNetwork } from '../utils/settingsUtils';
|
||||
|
||||
interface Events {
|
||||
log: LogEvent;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import {
|
||||
scheduleAction,
|
||||
arrayShuffle,
|
||||
urlToOnion,
|
||||
getWeakRandomInt,
|
||||
TypedEmitter,
|
||||
} from '@trezor/utils';
|
||||
import type { BlockbookAPI } from '@trezor/blockchain-link/src/workers/blockbook/websocket';
|
||||
import {
|
||||
TypedEmitter,
|
||||
arrayShuffle,
|
||||
getWeakRandomInt,
|
||||
scheduleAction,
|
||||
urlToOnion,
|
||||
} from '@trezor/utils';
|
||||
|
||||
import { RequestOptions, resetIdentityCircuit } from '../utils/http';
|
||||
import type {
|
||||
BlockbookBlock,
|
||||
BlockFilterResponse,
|
||||
MempoolFilterResponse,
|
||||
BlockbookTransaction,
|
||||
} from '../types/backend';
|
||||
import type { CoinjoinBackendSettings, Logger } from '../types';
|
||||
import { FILTERS_REQUEST_TIMEOUT, HTTP_REQUEST_GAP, HTTP_REQUEST_TIMEOUT } from '../constants';
|
||||
import type { CoinjoinBackendSettings, Logger } from '../types';
|
||||
import { CoinjoinWebsocketController } from './CoinjoinWebsocketController';
|
||||
import { identifyWsError } from './backendUtils';
|
||||
import type {
|
||||
BlockFilterResponse,
|
||||
BlockbookBlock,
|
||||
BlockbookTransaction,
|
||||
MempoolFilterResponse,
|
||||
} from '../types/backend';
|
||||
import { RequestOptions, resetIdentityCircuit } from '../utils/http';
|
||||
|
||||
type CoinjoinBackendClientSettings = CoinjoinBackendSettings & {
|
||||
timeout?: number;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { createCooldown } from '@trezor/utils';
|
||||
|
||||
import { PROGRESS_INFO_COOLDOWN } from '../constants';
|
||||
import type { CoinjoinBackendSettings } from '../types';
|
||||
import type {
|
||||
FilterClient,
|
||||
FilterControllerParams,
|
||||
FilterControllerContext,
|
||||
FilterControllerParams,
|
||||
} from '../types/backend';
|
||||
import type { CoinjoinBackendSettings } from '../types';
|
||||
|
||||
export type FilterController = Pick<CoinjoinFilterController, 'getFilterIterator'>;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/* eslint no-underscore-dangle: ["error", { "allowAfterThis": true }] */
|
||||
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
import { arrayDistinct, createCooldown, promiseAllSequence } from '@trezor/utils';
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import type { Logger } from '../types';
|
||||
import type { BlockbookTransaction, MempoolClient, OnProgressInfo } from '../types/backend';
|
||||
import type { AddressController } from './CoinjoinAddressController';
|
||||
import { getAddressScript, getMultiFilter } from './filters';
|
||||
import { getAllTxAddresses, isDoublespend } from './backendUtils';
|
||||
import { getAddressScript, getMultiFilter } from './filters';
|
||||
import { MEMPOOL_PURGE_CYCLE, PROGRESS_INFO_COOLDOWN } from '../constants';
|
||||
import type { BlockbookTransaction, MempoolClient, OnProgressInfo } from '../types/backend';
|
||||
|
||||
type MempoolStatus = 'stopped' | 'running';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { BlockbookAPI } from '@trezor/blockchain-link/src/workers/blockbook/websocket';
|
||||
|
||||
import { HTTP_REQUEST_TIMEOUT, WS_CONNECT_TIMEOUT } from '../constants';
|
||||
import { resetIdentityCircuit } from '../utils/http';
|
||||
import type { Logger } from '../types';
|
||||
import { identifyWsError } from './backendUtils';
|
||||
import { resetIdentityCircuit } from '../utils/http';
|
||||
|
||||
export type BlockbookWS = Pick<
|
||||
BlockbookAPI,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { arrayDistinct } from '@trezor/utils';
|
||||
import { deriveAddresses as deriveNewAddresses, Network } from '@trezor/utxo-lib';
|
||||
import { Network, deriveAddresses as deriveNewAddresses } from '@trezor/utxo-lib';
|
||||
import { getAddressType } from '@trezor/utxo-lib/src/address';
|
||||
|
||||
import type { VinVout, PrederivedAddress } from '../types/backend';
|
||||
import type { PrederivedAddress, VinVout } from '../types/backend';
|
||||
|
||||
export const isTxConfirmed = ({ blockHeight = -1 }: { blockHeight?: number }) => blockHeight > 0;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
|
||||
import type { BroadcastedTransactionDetails } from '../types';
|
||||
import type { Transaction, AccountAddresses } from '../types/backend';
|
||||
import type { AccountAddresses, Transaction } from '../types/backend';
|
||||
|
||||
// create pending transaction, the result of successfully broadcasted CoinjoinRound
|
||||
export const createPendingTransaction = (
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Golomb from 'golomb';
|
||||
import { U64 } from 'n64';
|
||||
|
||||
import { address as addressBjs, Network } from '@trezor/utxo-lib';
|
||||
import { Network, address as addressBjs } from '@trezor/utxo-lib';
|
||||
|
||||
const P_DEFAULT = 20;
|
||||
const M_DEFAULT = 1 << 20;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
import { sortTxsFromLatest } from '@trezor/blockchain-link-utils';
|
||||
import { sumAddressValues } from '@trezor/blockchain-link/src/workers/electrum/methods/getAccountInfo';
|
||||
import { sortTxsFromLatest } from '@trezor/blockchain-link-utils';
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import { isTxConfirmed, doesTxContainAddress } from './backendUtils';
|
||||
import type {
|
||||
Transaction,
|
||||
AccountInfo,
|
||||
ScanAccountCheckpoint,
|
||||
PrederivedAddress,
|
||||
AccountCache,
|
||||
Address,
|
||||
} from '../types/backend';
|
||||
import { getAccountUtxo } from './getAccountUtxo';
|
||||
import { CoinjoinAddressController } from './CoinjoinAddressController';
|
||||
import { doesTxContainAddress, isTxConfirmed } from './backendUtils';
|
||||
import { getAccountUtxo } from './getAccountUtxo';
|
||||
import type {
|
||||
AccountCache,
|
||||
AccountInfo,
|
||||
Address,
|
||||
PrederivedAddress,
|
||||
ScanAccountCheckpoint,
|
||||
Transaction,
|
||||
} from '../types/backend';
|
||||
|
||||
const PAGE_SIZE_DEFAULT = 25;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { throwError } from '@trezor/utils';
|
||||
|
||||
import type { Utxo, VinVout, Transaction, AccountAddresses } from '../types/backend';
|
||||
import type { AccountAddresses, Transaction, Utxo, VinVout } from '../types/backend';
|
||||
|
||||
type AddressPaths = {
|
||||
[address: string]: string;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { createCooldown } from '@trezor/utils';
|
||||
import { transformTransaction } from '@trezor/blockchain-link-utils/src/blockbook';
|
||||
import { createCooldown } from '@trezor/utils';
|
||||
|
||||
import { getMultiFilter } from './filters';
|
||||
import { doesTxContainAddress } from './backendUtils';
|
||||
import { CoinjoinAddressController } from './CoinjoinAddressController';
|
||||
import { doesTxContainAddress } from './backendUtils';
|
||||
import { getMultiFilter } from './filters';
|
||||
import { CHECKPOINT_COOLDOWN } from '../constants';
|
||||
import type {
|
||||
Transaction,
|
||||
BlockbookTransaction,
|
||||
ScanAccountParams,
|
||||
ScanAccountCheckpoint,
|
||||
ScanAccountContext,
|
||||
ScanAccountParams,
|
||||
ScanAccountResult,
|
||||
Transaction,
|
||||
} from '../types/backend';
|
||||
import { CHECKPOINT_COOLDOWN } from '../constants';
|
||||
|
||||
const transformTx =
|
||||
({ receive, change }: CoinjoinAddressController) =>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import { getScriptPubKeyFromAddress, prefixScriptPubKey } from '../utils/coordinatorUtils';
|
||||
import { getRoundEvents, compareOutpoint } from '../utils/roundUtils';
|
||||
import { RegisterAccountParams } from '../types';
|
||||
import { AccountAddress, AccountUtxo } from '../types/account';
|
||||
import { AllowedScriptTypes, Round } from '../types/coordinator';
|
||||
import { RawLiquidityClue } from '../types/middleware';
|
||||
import { RegisterAccountParams } from '../types';
|
||||
import { AccountUtxo, AccountAddress } from '../types/account';
|
||||
import { getScriptPubKeyFromAddress, prefixScriptPubKey } from '../utils/coordinatorUtils';
|
||||
import { compareOutpoint, getRoundEvents } from '../utils/roundUtils';
|
||||
|
||||
const enhanceAccountUtxo = (
|
||||
utxos: Omit<AccountUtxo, 'scriptPubKey'>[],
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { getInputSize, getOutputSize, getWitnessFromSignature } from '../utils/coordinatorUtils';
|
||||
import { AccountUtxo } from '../types/account';
|
||||
import {
|
||||
AllowedScriptTypes,
|
||||
RegistrationData,
|
||||
ConfirmationData,
|
||||
RealCredentials,
|
||||
RegistrationData,
|
||||
} from '../types/coordinator';
|
||||
import { AccountUtxo } from '../types/account';
|
||||
import { Credentials } from '../types/middleware';
|
||||
import { SerializedAlice, CoinjoinRequestEvent } from '../types/round';
|
||||
import { CoinjoinRequestEvent, SerializedAlice } from '../types/round';
|
||||
import { getInputSize, getOutputSize, getWitnessFromSignature } from '../utils/coordinatorUtils';
|
||||
|
||||
interface AlicePendingRequest {
|
||||
type: CoinjoinRequestEvent['type'];
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { TypedEmitter } from '@trezor/utils';
|
||||
|
||||
import { Status } from './Status';
|
||||
import { Account } from './Account';
|
||||
import { CoinjoinPrison } from './CoinjoinPrison';
|
||||
import { CoinjoinRound } from './CoinjoinRound';
|
||||
import { getCoinjoinNetwork } from '../utils/settingsUtils';
|
||||
import { redacted } from '../utils/redacted';
|
||||
import { analyzeTransactions, AnalyzeTransactionsResult } from './analyzeTransactions';
|
||||
import { Status } from './Status';
|
||||
import { AnalyzeTransactionsResult, analyzeTransactions } from './analyzeTransactions';
|
||||
import type {
|
||||
CoinjoinClientSettings,
|
||||
RegisterAccountParams,
|
||||
CoinjoinStatusEvent,
|
||||
CoinjoinResponseEvent,
|
||||
CoinjoinClientEvents,
|
||||
Logger,
|
||||
CoinjoinClientSettings,
|
||||
CoinjoinResponseEvent,
|
||||
CoinjoinStatusEvent,
|
||||
LogLevel,
|
||||
Logger,
|
||||
RegisterAccountParams,
|
||||
} from '../types';
|
||||
import { redacted } from '../utils/redacted';
|
||||
import { getCoinjoinNetwork } from '../utils/settingsUtils';
|
||||
|
||||
export class CoinjoinClient extends TypedEmitter<CoinjoinClientEvents> {
|
||||
readonly settings: CoinjoinClientSettings;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { TypedEmitter } from '@trezor/utils';
|
||||
import { ImmediateId, TimerId } from '@trezor/type-utils';
|
||||
import { TypedEmitter } from '@trezor/utils';
|
||||
|
||||
import { CoinjoinPrisonInmate, CoinjoinPrisonEvents } from '../types/client';
|
||||
import { WabiSabiProtocolErrorCode } from '../enums';
|
||||
import { CoinjoinPrisonEvents, CoinjoinPrisonInmate } from '../types/client';
|
||||
|
||||
export type DetainObject =
|
||||
| {
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
import { TypedEmitter, scheduleAction, arrayDistinct, arrayPartition } from '@trezor/utils';
|
||||
import { TypedEmitter, arrayDistinct, arrayPartition, scheduleAction } from '@trezor/utils';
|
||||
import { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import {
|
||||
getCommitmentData,
|
||||
getRoundParameters,
|
||||
getCoinjoinRoundDeadlines,
|
||||
} from '../utils/roundUtils';
|
||||
import { ROUND_PHASE_PROCESS_TIMEOUT, ACCOUNT_BUSY_TIMEOUT } from '../constants';
|
||||
import { ACCOUNT_BUSY_TIMEOUT, ROUND_PHASE_PROCESS_TIMEOUT } from '../constants';
|
||||
import { EndRoundState, RoundPhase, SessionPhase } from '../enums';
|
||||
import { AccountAddress, RegisterAccountParams } from '../types/account';
|
||||
import {
|
||||
SerializedCoinjoinRound,
|
||||
CoinjoinRoundEvent,
|
||||
CoinjoinTransactionData,
|
||||
CoinjoinTransactionLiquidityClue,
|
||||
CoinjoinRequestEvent,
|
||||
CoinjoinResponseEvent,
|
||||
BroadcastedTransactionDetails,
|
||||
} from '../types/round';
|
||||
import { Round, CoinjoinRoundParameters, AffiliationId } from '../types/coordinator';
|
||||
import { Account } from './Account';
|
||||
import { Alice } from './Alice';
|
||||
import { CoinjoinPrison } from './CoinjoinPrison';
|
||||
import { selectRound } from './round/selectRound';
|
||||
import { inputRegistration } from './round/inputRegistration';
|
||||
import { connectionConfirmation } from './round/connectionConfirmation';
|
||||
import { outputRegistration } from './round/outputRegistration';
|
||||
import { transactionSigning } from './round/transactionSigning';
|
||||
import { ended } from './round/endedRound';
|
||||
import { CoinjoinClientEvents, Logger } from '../types';
|
||||
import { AccountAddress, RegisterAccountParams } from '../types/account';
|
||||
import { AffiliationId, CoinjoinRoundParameters, Round } from '../types/coordinator';
|
||||
import {
|
||||
BroadcastedTransactionDetails,
|
||||
CoinjoinRequestEvent,
|
||||
CoinjoinResponseEvent,
|
||||
CoinjoinRoundEvent,
|
||||
CoinjoinTransactionData,
|
||||
CoinjoinTransactionLiquidityClue,
|
||||
SerializedCoinjoinRound,
|
||||
} from '../types/round';
|
||||
import { connectionConfirmation } from './round/connectionConfirmation';
|
||||
import { ended } from './round/endedRound';
|
||||
import { inputRegistration } from './round/inputRegistration';
|
||||
import { outputRegistration } from './round/outputRegistration';
|
||||
import { selectRound } from './round/selectRound';
|
||||
import { transactionSigning } from './round/transactionSigning';
|
||||
import {
|
||||
getCoinjoinRoundDeadlines,
|
||||
getCommitmentData,
|
||||
getRoundParameters,
|
||||
} from '../utils/roundUtils';
|
||||
|
||||
export interface CoinjoinRoundOptions {
|
||||
network: Network;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { TypedEmitter } from '@trezor/utils';
|
||||
import { TimerId } from '@trezor/type-utils';
|
||||
import { TypedEmitter } from '@trezor/utils';
|
||||
|
||||
import * as coordinator from './coordinator';
|
||||
import { transformStatus } from '../utils/roundUtils';
|
||||
import { patchResponse } from '../utils/http';
|
||||
import { coordinatorRequest } from './coordinatorRequest';
|
||||
import { STATUS_TIMEOUT } from '../constants';
|
||||
import { RoundPhase } from '../enums';
|
||||
import {
|
||||
CoinjoinClientSettings,
|
||||
CoinjoinClientVersion,
|
||||
CoinjoinStatusEvent,
|
||||
LogEvent,
|
||||
CoinjoinClientVersion,
|
||||
} from '../types';
|
||||
import { Round } from '../types/coordinator';
|
||||
import { patchResponse } from '../utils/http';
|
||||
import { transformStatus } from '../utils/roundUtils';
|
||||
|
||||
type StatusMode = keyof typeof STATUS_TIMEOUT;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { address as addressBjs, Network } from '@trezor/utxo-lib';
|
||||
import { arrayPartition } from '@trezor/utils';
|
||||
import { Network, address as addressBjs } from '@trezor/utxo-lib';
|
||||
|
||||
import * as middleware from './middleware';
|
||||
import { Transaction, EnhancedVinVout } from '../types/backend';
|
||||
import { AnalyzeInternalVinVout, AnalyzeExternalVinVout } from '../types/middleware';
|
||||
import type { CoinjoinClient } from './CoinjoinClient';
|
||||
import * as middleware from './middleware';
|
||||
import { EnhancedVinVout, Transaction } from '../types/backend';
|
||||
import { AnalyzeExternalVinVout, AnalyzeInternalVinVout } from '../types/middleware';
|
||||
|
||||
interface AnalyzeTransactionsOptions {
|
||||
network: Network;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { coordinatorRequest, RequestOptions } from './coordinatorRequest';
|
||||
import { patchResponse } from '../utils/http';
|
||||
import { RequestOptions, coordinatorRequest } from './coordinatorRequest';
|
||||
import { AFFILIATION_ID } from '../constants';
|
||||
import {
|
||||
CoinjoinStatus,
|
||||
ZeroCredentials,
|
||||
RealCredentials,
|
||||
ConfirmationData,
|
||||
IssuanceData,
|
||||
RealCredentials,
|
||||
RegistrationData,
|
||||
ZeroCredentials,
|
||||
} from '../types/coordinator';
|
||||
import { AFFILIATION_ID } from '../constants';
|
||||
import { patchResponse } from '../utils/http';
|
||||
|
||||
const request = <T>(...args: Parameters<typeof coordinatorRequest>) =>
|
||||
coordinatorRequest<T>(...args).then<T>(patchResponse);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { scheduleAction, enumUtils } from '@trezor/utils';
|
||||
import { enumUtils, scheduleAction } from '@trezor/utils';
|
||||
|
||||
import { HTTP_REQUEST_TIMEOUT } from '../constants';
|
||||
import { WabiSabiProtocolErrorCode } from '../enums';
|
||||
import {
|
||||
httpPost,
|
||||
httpGet,
|
||||
patchResponse,
|
||||
RequestOptions,
|
||||
httpGet,
|
||||
httpPost,
|
||||
patchResponse,
|
||||
resetIdentityCircuit,
|
||||
} from '../utils/http';
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { coordinatorRequest as request, RequestOptions } from './coordinatorRequest';
|
||||
import { RequestOptions, coordinatorRequest as request } from './coordinatorRequest';
|
||||
import {
|
||||
AllowedRange,
|
||||
AllowedScriptTypes,
|
||||
IssuerParameter,
|
||||
ZeroCredentials,
|
||||
RealCredentials,
|
||||
CredentialsResponseValidation,
|
||||
CoordinationFeeRate,
|
||||
CredentialsResponseValidation,
|
||||
IssuerParameter,
|
||||
RealCredentials,
|
||||
ZeroCredentials,
|
||||
} from '../types/coordinator';
|
||||
import {
|
||||
Credentials,
|
||||
UtxoForRound,
|
||||
AnalyzeTransactionDetails,
|
||||
AnalyzeResult,
|
||||
AnalyzeTransactionDetails,
|
||||
Credentials,
|
||||
RawLiquidityClue,
|
||||
UtxoForRound,
|
||||
} from '../types/middleware';
|
||||
|
||||
export const getRealCredentials = async (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { readTimeSpan } from '../../utils/roundUtils';
|
||||
import type { Alice, AliceConfirmationInterval } from '../Alice';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
|
||||
/**
|
||||
* usage in RoundPhase: 0, InputRegistration
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { enumUtils, getWeakRandomNumberInRange } from '@trezor/utils';
|
||||
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { EndRoundState, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { getBroadcastedTxDetails } from '../../utils/roundUtils';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
|
||||
/**
|
||||
* RoundPhase: 4, Ending
|
||||
|
||||
@@ -4,9 +4,9 @@ import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
import { confirmationInterval } from './connectionConfirmation';
|
||||
import { ROUND_SELECTION_REGISTRATION_OFFSET } from '../../constants';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import type { Alice } from '../Alice';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
|
||||
/**
|
||||
* RoundPhase: 0, InputRegistration
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { arrayToDictionary, getWeakRandomId } from '@trezor/utils';
|
||||
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
import { getRoundEvents, compareOutpoint, sumCredentials } from '../../utils/roundUtils';
|
||||
import { getExternalOutputSize } from '../../utils/coordinatorUtils';
|
||||
import { compareOutpoint, getRoundEvents, sumCredentials } from '../../utils/roundUtils';
|
||||
import type { Account } from '../Account';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
|
||||
/**
|
||||
* RoundPhase: 2, step 1
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { getWeakRandomId, arrayShuffle, getWeakRandomInt } from '@trezor/utils';
|
||||
import { arrayShuffle, getWeakRandomId, getWeakRandomInt } from '@trezor/utils';
|
||||
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { AccountAddress } from '../../types';
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
import { outputDecomposition, Bob } from './outputDecomposition';
|
||||
import { Bob, outputDecomposition } from './outputDecomposition';
|
||||
import { scheduleDelay } from '../../utils/roundUtils';
|
||||
import type { Account } from '../Account';
|
||||
import type { Alice } from '../Alice';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { AccountAddress } from '../../types';
|
||||
import { scheduleDelay } from '../../utils/roundUtils';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
|
||||
/**
|
||||
* RoundPhase: 2, OutputRegistration
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { arrayPartition, arrayToDictionary } from '@trezor/utils';
|
||||
|
||||
import { Account } from '../Account';
|
||||
import { Alice } from '../Alice';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { CoinjoinPrison } from '../CoinjoinPrison';
|
||||
import * as middleware from '../middleware';
|
||||
import { Round } from '../coordinator';
|
||||
import { ROUND_SELECTION_REGISTRATION_OFFSET, ROUND_SELECTION_MAX_OUTPUTS } from '../../constants';
|
||||
import { ROUND_SELECTION_MAX_OUTPUTS, ROUND_SELECTION_REGISTRATION_OFFSET } from '../../constants';
|
||||
import { RoundPhase, SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { getInputSize, getOutputSize } from '../../utils/coordinatorUtils';
|
||||
import { Account } from '../Account';
|
||||
import { Alice } from '../Alice';
|
||||
import { CoinjoinPrison } from '../CoinjoinPrison';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { Round } from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
|
||||
export type CoinjoinRoundGenerator = (
|
||||
...args: ConstructorParameters<typeof CoinjoinRound>
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { arrayShuffle, getWeakRandomInt } from '@trezor/utils';
|
||||
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
import {
|
||||
getRoundEvents,
|
||||
compareOutpoint,
|
||||
getRoundParams,
|
||||
getAffiliateRequest,
|
||||
scheduleDelay,
|
||||
} from '../../utils/roundUtils';
|
||||
import { TX_SIGNING_DELAY } from '../../constants';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { CoinjoinTransactionData } from '../../types';
|
||||
import {
|
||||
getAddressFromScriptPubKey,
|
||||
mergePubkeys,
|
||||
prefixScriptPubKey,
|
||||
readOutpoint,
|
||||
sortInputs,
|
||||
sortOutputs,
|
||||
readOutpoint,
|
||||
prefixScriptPubKey,
|
||||
getAddressFromScriptPubKey,
|
||||
} from '../../utils/coordinatorUtils';
|
||||
import {
|
||||
compareOutpoint,
|
||||
getAffiliateRequest,
|
||||
getRoundEvents,
|
||||
getRoundParams,
|
||||
scheduleDelay,
|
||||
} from '../../utils/roundUtils';
|
||||
import type { Account } from '../Account';
|
||||
import type { Alice } from '../Alice';
|
||||
import type { CoinjoinRound, CoinjoinRoundOptions } from '../CoinjoinRound';
|
||||
import { CoinjoinTransactionData } from '../../types';
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../../enums';
|
||||
import { TX_SIGNING_DELAY } from '../../constants';
|
||||
import * as coordinator from '../coordinator';
|
||||
import * as middleware from '../middleware';
|
||||
|
||||
const getTransactionData = (
|
||||
round: CoinjoinRound,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
import type {
|
||||
Address,
|
||||
Utxo,
|
||||
Transaction,
|
||||
AccountAddresses,
|
||||
AccountInfo as AccountInfoBase,
|
||||
Address,
|
||||
EnhancedVinVout,
|
||||
Transaction,
|
||||
Utxo,
|
||||
} from '@trezor/blockchain-link-types';
|
||||
import type {
|
||||
Transaction as BlockbookTransaction,
|
||||
VinVout,
|
||||
FilterResponse,
|
||||
VinVout,
|
||||
} from '@trezor/blockchain-link-types/src/blockbook';
|
||||
import type { Network } from '@trezor/utxo-lib';
|
||||
|
||||
import type { CoinjoinBackendClient } from '../backend/CoinjoinBackendClient';
|
||||
import type { MempoolController } from '../backend/CoinjoinMempoolController';
|
||||
import type { FilterController } from '../backend/CoinjoinFilterController';
|
||||
import type { MempoolController } from '../backend/CoinjoinMempoolController';
|
||||
|
||||
export type { BlockbookTransaction, VinVout, EnhancedVinVout };
|
||||
export type { Address, Utxo, Transaction, AccountAddresses };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SessionPhase, WabiSabiProtocolErrorCode } from '../enums';
|
||||
import { Round } from './coordinator';
|
||||
import { CoinjoinRequestEvent, CoinjoinRoundEvent } from './round';
|
||||
import { LogEvent } from './logger';
|
||||
import { CoinjoinRequestEvent, CoinjoinRoundEvent } from './round';
|
||||
|
||||
export interface CoinjoinStatusEvent {
|
||||
rounds: Round[];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RoundPhase, EndRoundState } from '../enums';
|
||||
import { AFFILIATION_ID } from '../constants';
|
||||
import { EndRoundState, RoundPhase } from '../enums';
|
||||
|
||||
export type AffiliationId = keyof typeof AFFILIATION_ID;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AccountAddress } from './account';
|
||||
import { CoinjoinAffiliateRequest } from './coordinator';
|
||||
import { RawLiquidityClue } from './middleware';
|
||||
import { RoundPhase, EndRoundState } from '../enums';
|
||||
import { EndRoundState, RoundPhase } from '../enums';
|
||||
|
||||
export interface SerializedAlice {
|
||||
accountKey: string;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { bufferUtils } from '@trezor/utils';
|
||||
import {
|
||||
payments,
|
||||
Network,
|
||||
bufferutils as bUtils,
|
||||
address as baddress,
|
||||
script as bscript,
|
||||
bufferutils as bUtils,
|
||||
Network,
|
||||
payments,
|
||||
} from '@trezor/utxo-lib';
|
||||
|
||||
import {
|
||||
AllowedScriptTypes,
|
||||
CoinjoinOutputAddedEvent,
|
||||
CoinjoinInput,
|
||||
CoinjoinOutput,
|
||||
CoinjoinOutputAddedEvent,
|
||||
} from '../types/coordinator';
|
||||
|
||||
// WabiSabi coordinator is using custom format of address scriptPubKey
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { bufferutils, Transaction, Network } from '@trezor/utxo-lib';
|
||||
import { getWeakRandomNumberInRange } from '@trezor/utils';
|
||||
import { Network, Transaction, bufferutils } from '@trezor/utxo-lib';
|
||||
|
||||
import {
|
||||
COORDINATOR_FEE_RATE_FALLBACK,
|
||||
MAX_ALLOWED_AMOUNT_FALLBACK,
|
||||
MIN_ALLOWED_AMOUNT_FALLBACK,
|
||||
PLEBS_DONT_PAY_THRESHOLD_FALLBACK,
|
||||
ROUND_REGISTRATION_END_OFFSET,
|
||||
ROUND_MAXIMUM_REQUEST_DELAY,
|
||||
ROUND_REGISTRATION_END_OFFSET,
|
||||
} from '../constants';
|
||||
import { RoundPhase } from '../enums';
|
||||
import { CoinjoinTransactionData } from '../types';
|
||||
import {
|
||||
Round,
|
||||
CoinjoinStateEvent,
|
||||
CoinjoinRoundParameters,
|
||||
CoinjoinStatus,
|
||||
CoinjoinState,
|
||||
CoinjoinStateEvent,
|
||||
CoinjoinStatus,
|
||||
Round,
|
||||
} from '../types/coordinator';
|
||||
import { Credentials } from '../types/middleware';
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { networks } from '@trezor/utxo-lib';
|
||||
|
||||
import { CoinjoinAddressController } from '../../src/backend/CoinjoinAddressController';
|
||||
import {
|
||||
SEGWIT_XPUB,
|
||||
SEGWIT_RECEIVE_ADDRESSES,
|
||||
SEGWIT_CHANGE_ADDRESSES,
|
||||
SEGWIT_RECEIVE_ADDRESSES,
|
||||
SEGWIT_XPUB,
|
||||
} from '../fixtures/methods.fixture';
|
||||
|
||||
const getAddress = ({ address }: { address: string }) => address;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CoinjoinFilterController } from '../../src/backend/CoinjoinFilterController';
|
||||
import { MockBlockFilter, mockFilterSequence } from '../fixtures/filters.fixture';
|
||||
import { COINJOIN_BACKEND_SETTINGS } from '../fixtures/config.fixture';
|
||||
import { MockBlockFilter, mockFilterSequence } from '../fixtures/filters.fixture';
|
||||
import { MockFilterClient } from '../mocks/MockFilterClient';
|
||||
|
||||
const FILTER_COUNT = 16;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { networks } from '@trezor/utxo-lib';
|
||||
|
||||
import { AccountAddress } from '../../src/types/backend';
|
||||
import { CoinjoinMempoolController } from '../../src/backend/CoinjoinMempoolController';
|
||||
import { MockMempoolClient } from '../mocks/MockMempoolClient';
|
||||
import { AccountAddress } from '../../src/types/backend';
|
||||
import {
|
||||
BLOCKS,
|
||||
SEGWIT_CHANGE_ADDRESSES,
|
||||
SEGWIT_RECEIVE_ADDRESSES,
|
||||
} from '../fixtures/methods.fixture';
|
||||
import { MockMempoolClient } from '../mocks/MockMempoolClient';
|
||||
|
||||
const TXS = BLOCKS.flatMap(block => block.txs); // There is 6 of them
|
||||
const ADDRESS = SEGWIT_RECEIVE_ADDRESSES[1];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { deriveAddresses as deriveAddressesOriginal, networks } from '@trezor/utxo-lib';
|
||||
|
||||
import { deriveAddresses, isTaprootTx, doesTxContainAddress } from '../../src/backend/backendUtils';
|
||||
import { SEGWIT_XPUB, SEGWIT_RECEIVE_ADDRESSES } from '../fixtures/methods.fixture';
|
||||
import { deriveAddresses, doesTxContainAddress, isTaprootTx } from '../../src/backend/backendUtils';
|
||||
import { SEGWIT_RECEIVE_ADDRESSES, SEGWIT_XPUB } from '../fixtures/methods.fixture';
|
||||
|
||||
const PARAMS = [SEGWIT_XPUB, 'receive', 0, 10] as const;
|
||||
const ADDRESSES = deriveAddressesOriginal(...PARAMS);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { arrayDistinct } from '@trezor/utils';
|
||||
import { networks } from '@trezor/utxo-lib';
|
||||
|
||||
import { DISCOVERY_LOOKOUT } from '../../src/constants';
|
||||
import { scanAccount } from '../../src/backend/scanAccount';
|
||||
import { getAccountInfo } from '../../src/backend/getAccountInfo';
|
||||
import { CoinjoinFilterController } from '../../src/backend/CoinjoinFilterController';
|
||||
import { CoinjoinMempoolController } from '../../src/backend/CoinjoinMempoolController';
|
||||
import * as FIXTURES from '../fixtures/methods.fixture';
|
||||
import { COINJOIN_BACKEND_SETTINGS } from '../fixtures/config.fixture';
|
||||
import { MockBackendClient } from '../mocks/MockBackendClient';
|
||||
import { getAccountInfo } from '../../src/backend/getAccountInfo';
|
||||
import { scanAccount } from '../../src/backend/scanAccount';
|
||||
import { DISCOVERY_LOOKOUT } from '../../src/constants';
|
||||
import type {
|
||||
BlockFilterResponse,
|
||||
ScanAccountProgress,
|
||||
Transaction,
|
||||
} from '../../src/types/backend';
|
||||
import { COINJOIN_BACKEND_SETTINGS } from '../fixtures/config.fixture';
|
||||
import * as FIXTURES from '../fixtures/methods.fixture';
|
||||
import { MockBackendClient } from '../mocks/MockBackendClient';
|
||||
|
||||
const EMPTY_CHECKPOINT = {
|
||||
blockHash: FIXTURES.BASE_HASH,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CoinjoinClient } from '../../src';
|
||||
import { CoinjoinPrison } from '../../src/client/CoinjoinPrison';
|
||||
import { createServer } from '../mocks/server';
|
||||
import { AFFILIATE_INFO, DEFAULT_ROUND, FEE_RATE_MEDIANS } from '../fixtures/round.fixture';
|
||||
import { createServer } from '../mocks/server';
|
||||
|
||||
describe(`CoinjoinClient`, () => {
|
||||
let server: Awaited<ReturnType<typeof createServer>>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as trezorUtils from '@trezor/utils';
|
||||
|
||||
import { createServer } from '../mocks/server';
|
||||
import { DEFAULT_ROUND, createCoinjoinRound } from '../fixtures/round.fixture';
|
||||
import { createInput } from '../fixtures/input.fixture';
|
||||
import * as CONSTANTS from '../../src/constants';
|
||||
import { createInput } from '../fixtures/input.fixture';
|
||||
import { DEFAULT_ROUND, createCoinjoinRound } from '../fixtures/round.fixture';
|
||||
import { createServer } from '../mocks/server';
|
||||
|
||||
// mock random delay function
|
||||
jest.mock('@trezor/utils', () => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Status } from '../../src/client/Status';
|
||||
import * as http from '../../src/client/coordinatorRequest';
|
||||
import { STATUS_TIMEOUT } from '../../src/constants';
|
||||
import { createServer } from '../mocks/server';
|
||||
import {
|
||||
AFFILIATE_INFO,
|
||||
DEFAULT_ROUND,
|
||||
STATUS_EVENT,
|
||||
createCoinjoinRound,
|
||||
} from '../fixtures/round.fixture';
|
||||
import { createServer } from '../mocks/server';
|
||||
|
||||
// using fakeTimers and async callbacks
|
||||
const fastForward = (time: number) => jest.advanceTimersByTimeAsync(time);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user