@ledgerhq/types-live

Ledger Live main types.

Usage no npm install needed!

<script type="module">
  import ledgerhqTypesLive from 'https://cdn.skypack.dev/@ledgerhq/types-live';
</script>

README

@ledgerhq/types-live

Ledger Live main types.

API

Table of Contents

TokenAccount

A token belongs to an Account and share the parent account address

Type: {type: "TokenAccount", id: string, parentId: string, token: TokenCurrency, balance: BigNumber, spendableBalance: BigNumber, compoundBalance: BigNumber?, creationDate: Date, operationsCount: number, operations: Array<Operation>, pendingOperations: Array<Operation>, starred: boolean, balanceHistoryCache: BalanceHistoryCache, swapHistory: Array<SwapOperation>, approvals: Array<{sender: string, value: string}>?}

Properties

ChildAccount

A child account belongs to an Account but has its own address.

Type: {type: "ChildAccount", id: string, name: string, starred: boolean, parentId: string, currency: CryptoCurrency, address: string, balance: BigNumber, creationDate: Date, operationsCount: number, operations: Array<Operation>, pendingOperations: Array<Operation>, balanceHistoryCache: BalanceHistoryCache, swapHistory: Array<SwapOperation>}

Properties

Address

Type: {address: string, derivationPath: string}

Properties

Account

Account type is the main level account of a blockchain currency. Each family maybe need an extra field, to solve this, you can have some subtyping like this:

export type BitcoinAccount = Account & { bitcoinResources: BitcoinResources }

and all parts where we would need it, we would need to cast,

const bitcoinAccount = account as BitcoinAccount;

and that BitcoinAccount type would be part of a coin integration family specific indeed.

Type: {type: "Account", id: string, seedIdentifier: string, xpub: string?, derivationMode: DerivationMode, index: number, freshAddress: string, freshAddressPath: string, freshAddresses: Array<Address>, name: string, starred: boolean, used: boolean, balance: BigNumber, spendableBalance: BigNumber, creationDate: Date, blockHeight: number, currency: CryptoCurrency, unit: Unit, operationsCount: number, operations: Array<Operation>, pendingOperations: Array<Operation>, lastSyncDate: Date, subAccounts: Array<SubAccount>?, balanceHistoryCache: BalanceHistoryCache, swapHistory: Array<SwapOperation>, syncHash: string?, nfts: Array<NFT>?}

Properties

SubAccount

super type that is either a token or a child account

Type: (TokenAccount | ChildAccount)

AccountLike

One of the Account type

Type: (Account | SubAccount)

AccountLikeArray

an array of AccountLikes

Type: (Array<AccountLike> | Array<TokenAccount> | Array<ChildAccount> | Array<Account>)

TokenAccountRaw

Type: {type: "TokenAccountRaw", id: string, starred: boolean?, parentId: string, tokenId: string, creationDate: string?, operationsCount: number?, operations: Array<OperationRaw>, pendingOperations: Array<OperationRaw>, balance: string, spendableBalance: string?, compoundBalance: string?, balanceHistoryCache: BalanceHistoryCache?, swapHistory: Array<SwapOperationRaw>?, approvals: Array<{sender: string, value: string}>?}

Properties

ChildAccountRaw

Type: {type: "ChildAccountRaw", id: string, name: string, starred: boolean?, parentId: string, currencyId: string, address: string, creationDate: string?, operationsCount: number?, operations: Array<OperationRaw>, pendingOperations: Array<OperationRaw>, balance: string, balanceHistoryCache: BalanceHistoryCache?, swapHistory: Array<SwapOperationRaw>?}

Properties

AccountRaw

Type: {id: string, seedIdentifier: string, xpub: string?, derivationMode: DerivationMode, index: number, freshAddress: string, freshAddressPath: string, freshAddresses: Array<Address>, name: string, starred: boolean?, used: boolean?, balance: string, spendableBalance: string?, blockHeight: number, creationDate: string?, operationsCount: number?, currencyId: string, operations: Array<OperationRaw>, pendingOperations: Array<OperationRaw>, unitMagnitude: number, lastSyncDate: string, endpointConfig: (string | null | undefined)?, subAccounts: Array<SubAccountRaw>?, balanceHistoryCache: BalanceHistoryCache?, swapHistory: Array<SwapOperationRaw>?, syncHash: string?, nfts: Array<NFTRaw>?}

Properties

SubAccountRaw

Type: (TokenAccountRaw | ChildAccountRaw)

AccountRawLike

Type: (AccountRaw | SubAccountRaw)

ScanAccountEvent

Type: {type: "discovered", account: Account}

Properties

  • type "discovered"
  • account Account

ScanAccountEventRaw

more events will come in the future

Type: {type: "discovered", account: AccountRaw}

Properties

DeviceId

unique identifier of a device. it will depends on the underlying implementation.

Type: string

PreloadStrategy

Type: Partial<{preloadMaxAge: number}>

BroadcastArg0

Type: {account: Account, signedOperation: SignedOperation}

Properties

SignOperationArg0

Type: {account: Account, transaction: T, deviceId: DeviceId}

Properties

SignOperationFnSignature

Type: function (arg0: SignOperationArg0<T>): Observable<SignOperationEvent>

CurrencyBridge

DerivationMode

DerivationMode is a string identifier of a specific derivation scheme in a list defined in live-common derivation.ts

Type: string

NFTStandards

Type: ("ERC721" | "ERC1155")

NFT

Type: {id: string, tokenId: string, amount: BigNumber, collection: {contract: string, standard: (NFTStandards | string)}}

Properties

NFTRaw

Type: any

NFTMetadataLinksProviders

Type: ("opensea" | "rarible" | "etherscan")

NFTMetadataResponse

Type: {status: (200 | 404 | 500), result: ({contract: string, tokenId: string, tokenName: (string | null), nftName: (string | null), media: (string | null), description: (string | null), properties: Array<Record<("key" | "value"), string>>, links: Record<NFTMetadataLinksProviders, string>} | null)?}

Properties

OperationType

Type: ("IN" | "OUT" | "NONE" | "CREATE" | "REVEAL" | "DELEGATE" | "UNDELEGATE" | "REDELEGATE" | "REWARD" | "FEES" | "FREEZE" | "UNFREEZE" | "VOTE" | "REWARD_PAYOUT" | "BOND" | "UNBOND" | "WITHDRAW_UNBONDED" | "SET_CONTROLLER" | "SLASH" | "NOMINATE" | "CHILL" | "SUPPLY" | "REDEEM" | "APPROVE" | "OPT_IN" | "OPT_OUT" | "NFT_IN" | "NFT_OUT")

Operation

Type: {id: string, hash: string, type: OperationType, value: BigNumber, fee: BigNumber, senders: Array<string>, recipients: Array<string>, blockHeight: (number | null | undefined), blockHash: (string | null | undefined), transactionSequenceNumber: number?, accountId: string, standard: (NFTStandards | string)?, operator: string?, contract: string?, tokenId: string?, date: Date, extra: Record<string, any>, hasFailed: boolean?, subOperations: Array<Operation>?, internalOperations: Array<Operation>?, nftOperations: Array<Operation>?}

Properties

OperationRaw

Type: {id: string, hash: string, type: OperationType, value: string, fee: string, senders: Array<string>, recipients: Array<string>, blockHeight: (number | null | undefined), blockHash: (string | null | undefined), transactionSequenceNumber: number?, accountId: string, hasFailed: boolean?, standard: (NFTStandards | string)?, operator: string?, contract: string?, tokenId: string?, date: string, extra: Record<string, any>, subOperations: Array<OperationRaw>?, internalOperations: Array<OperationRaw>?, nftOperations: Array<OperationRaw>?}

Properties

PaginationConfig

A pagination config holds the user's pagination state this is a state that usually should leave during the app lifecycle, but is not persisted it drives the number of operations to poll in accounts when a user paginate more, the number should accordingly be incremented The UI should manage scrolling ahead of time (e.g. if 30 ops is displayed and UI have pages of 20 ops, the UI can already request to poll 70 ops so it have 2 pages in advance) The UI must always do max() to keep the increasing the counter and not going back to lower value: that optim the sync to not recompute things too much

Type: {operationsPerAccountId: Record<string, number>?, operations: number?}

Properties

BalanceHistoryData

Type: {date: Date, value: BigNumber}

Properties

  • date Date
  • value BigNumber

BalanceHistory

Type: Array<BalanceHistoryData>

BalanceHistoryRaw

Type: Array<[string, string]>

BalanceHistoryWithCountervalue

Type: Array<{date: Date, value: BigNumber, countervalue: BigNumber}>

ValueChange

Type: {percentage: (BigNumber | null | undefined), value: BigNumber}

Properties

  • percentage (BigNumber | null | undefined)
  • value BigNumber

AccountPortfolio

Type: {history: BalanceHistoryWithCountervalue, countervalueAvailable: boolean, countervalueReceiveSum: BigNumber, countervalueSendSum: BigNumber, cryptoChange: ValueChange, countervalueChange: ValueChange}

Properties

CurrencyPortfolio

Type: {history: BalanceHistoryWithCountervalue, countervalueAvailable: boolean, histories: Array<BalanceHistoryWithCountervalue>, accounts: AccountLikeArray, cryptoChange: ValueChange, countervalueChange: ValueChange}

Properties

Portfolio

Type: {balanceHistory: BalanceHistory, balanceAvailable: boolean, availableAccounts: Array<AccountLike>, unavailableCurrencies: Array<(CryptoCurrency | TokenCurrency)>, accounts: Array<AccountLike>, range: PortfolioRange, histories: Array<BalanceHistoryWithCountervalue>, countervalueReceiveSum: BigNumber, countervalueSendSum: BigNumber, countervalueChange: ValueChange}

Properties

PortfolioRangeConfig

Type: {count: number, granularityId: ("HOUR" | "DAY" | "WEEK"), startOf: function (arg0: Date): Date, increment: number}

Properties

  • count number
  • granularityId ("HOUR" | "DAY" | "WEEK")
  • startOf function (arg0: Date): Date
  • increment number

PortfolioRange

Type: ("year" | "month" | "week" | "day")

AssetsDistribution

Type: {isAvailable: boolean, list: Array<{currency: (CryptoCurrency | TokenCurrency), distribution: number, amount: BigNumber, countervalue: BigNumber}>, showFirst: number, sum: BigNumber}

Properties

  • isAvailable boolean
  • list Array<{currency: (CryptoCurrency | TokenCurrency), distribution: number, amount: BigNumber, countervalue: BigNumber}>
  • showFirst number
  • sum BigNumber

SwapOperation

Type: {provider: string, swapId: string, status: string, receiverAccountId: string, tokenId: string?, operationId: string, fromAmount: BigNumber, toAmount: BigNumber}

Properties

SwapOperationRaw

Type: {provider: string, swapId: string, status: string, receiverAccountId: string, tokenId: string?, operationId: string, fromAmount: string, toAmount: string}

Properties

BitcoinInput

Type: {address: (string | null | undefined), value: (BigNumber | null | undefined), previousTxHash: (string | null | undefined), previousOutputIndex: number}

Properties

BitcoinInputRaw

Type: [(string | null | undefined), (string | null | undefined), (string | null | undefined), number]

BitcoinOutput

Type: {hash: string, outputIndex: number, blockHeight: (number | null | undefined), address: (string | null | undefined), path: (string | null | undefined), value: BigNumber, rbf: boolean, isChange: boolean}

Properties

BitcoinOutputRaw

Type: [string, number, (number | null | undefined), (string | null | undefined), (string | null | undefined), string, number, number]

SignedOperation

Type: {operation: Operation, signature: string, signatureRaw: Record<string, any>?, expirationDate: (Date | null | undefined)}

Properties

SignedOperationRaw

Type: {operation: OperationRaw, signature: string, signatureRaw: Record<string, any>?, expirationDate: (string | null | undefined)}

Properties

SignOperationEvent

Type: ({type: "device-streaming", progress: number, index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_O