@ledgerhq/types-live
Version:
131 lines • 3.38 kB
TypeScript
import type { BigNumber } from "bignumber.js";
import type { Unit } from "@ledgerhq/types-cryptoassets";
import type { DomainServiceResolution } from "./domain";
import type { Operation, OperationRaw } from "./operation";
/**
*
*/
export type SignedOperation = {
operation: Operation;
signature: string;
rawData?: Record<string, unknown>;
expirationDate?: Date;
};
/**
*
*/
export type SignedOperationRaw = {
operation: OperationRaw;
signature: string;
rawData?: Record<string, unknown>;
expirationDate?: string;
};
/**
*
*/
export type SignOperationEvent = {
type: "device-streaming";
progress: number;
index: number;
total: number;
} | {
type: "device-signature-requested";
} | {
type: "device-signature-granted";
} | {
type: "signed";
signedOperation: SignedOperation;
} | {
type: "transaction-checks-opt-in-triggered";
} | {
type: "transaction-checks-opt-in";
} | {
type: "transaction-checks-opt-out";
};
/**
*
*/
export type SignOperationEventRaw = {
type: "device-streaming";
progress: number;
index: number;
total: number;
} | {
type: "device-signature-requested";
} | {
type: "device-signature-granted";
} | {
type: "signed";
signedOperation: SignedOperationRaw;
} | {
type: "transaction-checks-opt-in-triggered";
} | {
type: "transaction-checks-opt-in";
} | {
type: "transaction-checks-opt-out";
};
/**
* Transaction is a generic object that holds all state for all transactions
* there are generic fields and coin specific fields. That's why almost all fields are optionals
*/
export type TransactionCommon = {
amount: BigNumber;
recipient: string;
recipientDomain?: DomainServiceResolution;
useAllAmount?: boolean;
subAccountId?: string | null | undefined;
feesStrategy?: "slow" | "medium" | "fast" | "custom" | null | undefined;
};
/**
*
*/
export type TransactionCommonRaw = {
amount: string;
recipient: string;
recipientDomain?: DomainServiceResolution;
useAllAmount?: boolean;
subAccountId?: string | null | undefined;
feesStrategy?: "slow" | "medium" | "fast" | "custom" | null | undefined;
};
/**
* User can have 3 differents choice for their fee
* Most of the time mid is low * 1.25 and high is low * 1.5
* They are some exception as eth that got his own meter
*/
export type FeeStrategy = {
amount: BigNumber;
displayedAmount?: BigNumber;
txParameters?: FeeStrategyTxParameters;
label: string;
unit?: Unit;
disabled?: boolean;
extra?: Record<string, BigNumber>;
};
export type FeeStrategyTxParameters = {
maxBaseFeePerGas?: BigNumber;
maxPriorityFeePerGas?: BigNumber;
};
/**
* TransactionStatus is a view of Transaction with general info to be used on the UI and status info.
*/
export type TransactionStatusCommon = {
errors: Record<string, Error>;
warnings: Record<string, Error>;
estimatedFees: BigNumber;
amount: BigNumber;
totalSpent: BigNumber;
recipientIsReadOnly?: boolean | undefined;
};
/**
*
*/
export type TransactionStatusCommonRaw = {
errors: Record<string, string>;
warnings: Record<string, string>;
estimatedFees: string;
amount: string;
totalSpent: string;
useAllAmount?: boolean;
recipientIsReadOnly?: boolean | undefined;
};
//# sourceMappingURL=transaction.d.ts.map