@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
53 lines • 2.85 kB
TypeScript
import type { Account, Operation, TokenAccount } from "@ledgerhq/types-live";
import BigNumber from "bignumber.js";
import type { HederaOperationExtra, Transaction, OperationERC20, HederaMirrorToken, HederaERC20TokenBalance, HederaThirdwebTransaction, ERC20OperationFields } from "../types";
interface CalculateAmountResult {
amount: BigNumber;
totalSpent: BigNumber;
}
export declare const calculateAmount: ({ account, transaction, }: {
account: Account;
transaction: Transaction;
}) => Promise<CalculateAmountResult>;
export declare const getSubAccounts: ({ ledgerAccountId, latestTokenOperations, mirrorTokens, erc20Tokens, }: {
ledgerAccountId: string;
latestTokenOperations: Operation[];
mirrorTokens: HederaMirrorToken[];
erc20Tokens: HederaERC20TokenBalance[];
}) => Promise<TokenAccount[]>;
export declare const prepareOperations: (coinOperations: Operation<HederaOperationExtra>[], tokenOperations: Operation<HederaOperationExtra>[]) => Promise<Operation<HederaOperationExtra>[]>;
/**
* In charge of smartly merging sub accounts while maintaining references as much as possible
*/
export declare const mergeSubAccounts: (initialAccount: Account | undefined, newSubAccounts: TokenAccount[]) => Array<TokenAccount>;
export declare const applyPendingExtras: (existing: Operation[], pending: Operation[]) => Operation[];
export declare function patchOperationWithExtra(operation: Operation, extra: HederaOperationExtra): Operation;
export declare const removeDuplicatedContractCallOperations: (operations: Operation[], pendingOperationHashes: Set<string>, erc20OperationHashes: Set<string>) => Operation[];
export declare const classifyERC20Operations: ({ latestERC20Operations, operationsByHash, evmAccountAddress, }: {
latestERC20Operations: OperationERC20[];
operationsByHash: Map<string, Operation>;
evmAccountAddress: string | null;
}) => {
erc20OperationsToPatch: Map<string, OperationERC20>;
erc20OperationsToAdd: Map<string, OperationERC20>;
};
export declare const patchContractCallOperation: ({ relatedExistingOperation, ledgerAccountId, hash, erc20Fields, tokenOperation, }: {
relatedExistingOperation: Operation;
ledgerAccountId: string;
hash: string;
erc20Fields: ERC20OperationFields;
tokenOperation: Operation;
}) => void;
export declare const integrateERC20Operations: ({ ledgerAccountId, address, allOperations, latestERC20Transactions, pendingOperationHashes, erc20OperationHashes, }: {
ledgerAccountId: string;
address: string;
allOperations: Operation[];
latestERC20Transactions: HederaThirdwebTransaction[];
pendingOperationHashes: Set<string>;
erc20OperationHashes: Set<string>;
}) => Promise<{
updatedOperations: Operation[];
newERC20TokenOperations: Operation[];
}>;
export {};
//# sourceMappingURL=utils.d.ts.map