@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
73 lines • 4.81 kB
TypeScript
import { Account, AccountLike, AnyMessage, SignedOperation } from "@ledgerhq/types-live";
import type { TrackingAPI } from "./tracking";
import { AppManifest, TranslatableString, WalletAPITransaction } from "./types";
import { Transaction } from "../generated/types";
import { Exchange } from "../exchange/types";
import { WalletState } from "@ledgerhq/live-wallet/store";
export declare function translateContent(content: string | TranslatableString, locale?: string): string;
export type WalletAPIContext = {
manifest: AppManifest;
accounts: AccountLike[];
tracking: TrackingAPI;
};
export declare function receiveOnAccountLogic(walletState: WalletState, { manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, uiNavigation: (account: AccountLike, parentAccount: Account | undefined, accountAddress: string) => Promise<string>, tokenCurrency?: string): Promise<string>;
export declare function signTransactionLogic({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, transaction: WalletAPITransaction, uiNavigation: (account: AccountLike, parentAccount: Account | undefined, signFlowInfos: {
canEditFees: boolean;
hasFeesProvided: boolean;
liveTx: Partial<Transaction>;
}) => Promise<SignedOperation>, tokenCurrency?: string, isEmbeddedSwap?: boolean, partner?: string): Promise<SignedOperation>;
export declare function signRawTransactionLogic({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, transaction: string, uiNavigation: (account: AccountLike, parentAccount: Account | undefined, transaction: string) => Promise<SignedOperation>): Promise<SignedOperation>;
export declare function broadcastTransactionLogic({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, signedOperation: SignedOperation, uiNavigation: (account: AccountLike, parentAccount: Account | undefined, signedOperation: SignedOperation) => Promise<string>, tokenCurrency?: string): Promise<string>;
export declare function signMessageLogic({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, message: string, uiNavigation: (account: AccountLike, message: AnyMessage) => Promise<Buffer>): Promise<Buffer>;
export declare const bitcoinFamilyAccountGetAddressLogic: ({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, derivationPath?: string) => Promise<string>;
export declare const bitcoinFamilyAccountGetPublicKeyLogic: ({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, derivationPath?: string) => Promise<string>;
export declare const bitcoinFamilyAccountGetXPubLogic: ({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string) => Promise<string>;
export interface BitcoinGetAddressesResultItem {
address: string;
publicKey?: string;
path?: string;
intention?: string;
}
export declare const bitcoinFamilyAccountGetAddressesLogic: ({ manifest, accounts, tracking }: WalletAPIContext, walletAccountId: string, intentions?: string[]) => Promise<BitcoinGetAddressesResultItem[]>;
export declare function startExchangeLogic({ manifest, tracking }: WalletAPIContext, exchangeType: "SWAP" | "FUND" | "SELL" | "SWAP_NG" | "SELL_NG" | "FUND_NG", uiNavigation: (exchangeType: "SWAP" | "FUND" | "SELL" | "SWAP_NG" | "SELL_NG" | "FUND_NG") => Promise<string>): Promise<string>;
export type CompleteExchangeRequest = {
provider: string;
fromAccountId: string;
toAccountId?: string;
transaction: WalletAPITransaction;
binaryPayload: string;
signature: string;
feesStrategy: string;
exchangeType: number;
swapId?: string;
rate?: number;
amountExpectedTo?: number;
tokenCurrency?: string;
};
export type CompleteExchangeUiRequest = {
provider: string;
exchange: Exchange;
transaction: Transaction;
binaryPayload: string;
signature: string;
feesStrategy: string;
exchangeType: number;
swapId?: string;
rate?: number;
amountExpectedTo?: number;
tokenCurrency?: string;
};
export declare function completeExchangeLogic({ manifest, accounts, tracking }: WalletAPIContext, { provider, fromAccountId, toAccountId, transaction, binaryPayload, signature, feesStrategy, exchangeType, swapId, rate, tokenCurrency, }: CompleteExchangeRequest, uiNavigation: (request: CompleteExchangeUiRequest) => Promise<string>): Promise<string>;
type StorageGetArgs = {
key: string;
storeId: string;
};
type StorageSetArgs = {
key: string;
value: unknown;
storeId: string;
};
type StorageHandlerArgs = StorageGetArgs | StorageSetArgs;
export declare function protectStorageLogic<T extends StorageHandlerArgs, R>(manifest: AppManifest, handler: (args: T) => R): (args: T) => R;
export {};
//# sourceMappingURL=logic.d.ts.map