README
@ledgerhq/types-live
Ledger Live main types.
API
Table of Contents
- TokenAccount
- ChildAccount
- Address
- Account
- SubAccount
- AccountLike
- AccountLikeArray
- TokenAccountRaw
- ChildAccountRaw
- AccountRaw
- SubAccountRaw
- AccountRawLike
- ScanAccountEvent
- ScanAccountEventRaw
- DeviceId
- PreloadStrategy
- BroadcastArg0
- SignOperationArg0
- SignOperationFnSignature
- CurrencyBridge
- DerivationMode
- NFTStandards
- NFT
- NFTRaw
- NFTMetadataLinksProviders
- NFTMetadataResponse
- OperationType
- Operation
- OperationRaw
- PaginationConfig
- BalanceHistoryData
- BalanceHistory
- BalanceHistoryRaw
- BalanceHistoryWithCountervalue
- ValueChange
- AccountPortfolio
- CurrencyPortfolio
- Portfolio
- PortfolioRangeConfig
- PortfolioRange
- AssetsDistribution
- SwapOperation
- SwapOperationRaw
- BitcoinInput
- BitcoinInputRaw
- BitcoinOutput
- BitcoinOutputRaw
- SignedOperation
- SignedOperationRaw
- SignOperationEvent
- SignOperationEventRaw
- TransactionCommon
- TransactionCommonRaw
- FeeStrategy
- TransactionStatus
- TransactionStatusRaw
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
type
"TokenAccount"
id
stringparentId
stringtoken
TokenCurrencybalance
BigNumberspendableBalance
BigNumbercompoundBalance
BigNumber?creationDate
DateoperationsCount
numberoperations
Array<Operation>pendingOperations
Array<Operation>starred
booleanbalanceHistoryCache
BalanceHistoryCacheswapHistory
Array<SwapOperation>approvals
Array<{sender: string, value: string}>?
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
type
"ChildAccount"
id
stringname
stringstarred
booleanparentId
stringcurrency
CryptoCurrencyaddress
stringbalance
BigNumbercreationDate
DateoperationsCount
numberoperations
Array<Operation>pendingOperations
Array<Operation>balanceHistoryCache
BalanceHistoryCacheswapHistory
Array<SwapOperation>
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
type
"Account"
id
stringseedIdentifier
stringxpub
string?derivationMode
DerivationModeindex
numberfreshAddress
stringfreshAddressPath
stringfreshAddresses
Array<Address>name
stringstarred
booleanused
booleanbalance
BigNumberspendableBalance
BigNumbercreationDate
DateblockHeight
numbercurrency
CryptoCurrencyunit
UnitoperationsCount
numberoperations
Array<Operation>pendingOperations
Array<Operation>lastSyncDate
DatesubAccounts
Array<SubAccount>?balanceHistoryCache
BalanceHistoryCacheswapHistory
Array<SwapOperation>syncHash
string?nfts
Array<NFT>?
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
type
"TokenAccountRaw"
id
stringstarred
boolean?parentId
stringtokenId
stringcreationDate
string?operationsCount
number?operations
Array<OperationRaw>pendingOperations
Array<OperationRaw>balance
stringspendableBalance
string?compoundBalance
string?balanceHistoryCache
BalanceHistoryCache?swapHistory
Array<SwapOperationRaw>?approvals
Array<{sender: string, value: string}>?
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
type
"ChildAccountRaw"
id
stringname
stringstarred
boolean?parentId
stringcurrencyId
stringaddress
stringcreationDate
string?operationsCount
number?operations
Array<OperationRaw>pendingOperations
Array<OperationRaw>balance
stringbalanceHistoryCache
BalanceHistoryCache?swapHistory
Array<SwapOperationRaw>?
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
id
stringseedIdentifier
stringxpub
string?derivationMode
DerivationModeindex
numberfreshAddress
stringfreshAddressPath
stringfreshAddresses
Array<Address>name
stringstarred
boolean?used
boolean?balance
stringspendableBalance
string?blockHeight
numbercreationDate
string?operationsCount
number?currencyId
stringoperations
Array<OperationRaw>pendingOperations
Array<OperationRaw>unitMagnitude
numberlastSyncDate
stringendpointConfig
(string | null | undefined)?subAccounts
Array<SubAccountRaw>?balanceHistoryCache
BalanceHistoryCache?swapHistory
Array<SwapOperationRaw>?syncHash
string?nfts
Array<NFTRaw>?
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
type
"discovered"
account
AccountRaw
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
account
AccountsignedOperation
SignedOperation
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
id
stringtokenId
stringamount
BigNumbercollection
{contract: string, standard: (NFTStandards | string)}
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
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)?
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
id
stringhash
stringtype
OperationTypevalue
BigNumberfee
BigNumbersenders
Array<string>recipients
Array<string>blockHeight
(number | null | undefined)blockHash
(string | null | undefined)transactionSequenceNumber
number?accountId
stringstandard
(NFTStandards | string)?operator
string?contract
string?tokenId
string?date
Dateextra
Record<string, any>hasFailed
boolean?subOperations
Array<Operation>?internalOperations
Array<Operation>?nftOperations
Array<Operation>?
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
id
stringhash
stringtype
OperationTypevalue
stringfee
stringsenders
Array<string>recipients
Array<string>blockHeight
(number | null | undefined)blockHash
(string | null | undefined)transactionSequenceNumber
number?accountId
stringhasFailed
boolean?standard
(NFTStandards | string)?operator
string?contract
string?tokenId
string?date
stringextra
Record<string, any>subOperations
Array<OperationRaw>?internalOperations
Array<OperationRaw>?nftOperations
Array<OperationRaw>?
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
Datevalue
BigNumber
BalanceHistory
Type: Array<BalanceHistoryData>
BalanceHistoryRaw
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
history
BalanceHistoryWithCountervaluecountervalueAvailable
booleancountervalueReceiveSum
BigNumbercountervalueSendSum
BigNumbercryptoChange
ValueChangecountervalueChange
ValueChange
CurrencyPortfolio
Type: {history: BalanceHistoryWithCountervalue, countervalueAvailable: boolean, histories: Array<BalanceHistoryWithCountervalue>, accounts: AccountLikeArray, cryptoChange: ValueChange, countervalueChange: ValueChange}
Properties
history
BalanceHistoryWithCountervaluecountervalueAvailable
booleanhistories
Array<BalanceHistoryWithCountervalue>accounts
AccountLikeArraycryptoChange
ValueChangecountervalueChange
ValueChange
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
balanceHistory
BalanceHistorybalanceAvailable
booleanavailableAccounts
Array<AccountLike>unavailableCurrencies
Array<(CryptoCurrency | TokenCurrency)>accounts
Array<AccountLike>range
PortfolioRangehistories
Array<BalanceHistoryWithCountervalue>countervalueReceiveSum
BigNumbercountervalueSendSum
BigNumbercountervalueChange
ValueChange
PortfolioRangeConfig
Type: {count: number, granularityId: ("HOUR"
| "DAY"
| "WEEK"
), startOf: function (arg0: Date): Date, increment: number}
Properties
count
numbergranularityId
("HOUR"
|"DAY"
|"WEEK"
)startOf
function (arg0: Date): Dateincrement
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
booleanlist
Array<{currency: (CryptoCurrency | TokenCurrency), distribution: number, amount: BigNumber, countervalue: BigNumber}>showFirst
numbersum
BigNumber
SwapOperation
Type: {provider: string, swapId: string, status: string, receiverAccountId: string, tokenId: string?, operationId: string, fromAmount: BigNumber, toAmount: BigNumber}
Properties
provider
stringswapId
stringstatus
stringreceiverAccountId
stringtokenId
string?operationId
stringfromAmount
BigNumbertoAmount
BigNumber
SwapOperationRaw
Type: {provider: string, swapId: string, status: string, receiverAccountId: string, tokenId: string?, operationId: string, fromAmount: string, toAmount: string}
Properties
provider
stringswapId
stringstatus
stringreceiverAccountId
stringtokenId
string?operationId
stringfromAmount
stringtoAmount
string
BitcoinInput
Type: {address: (string | null | undefined), value: (BigNumber | null | undefined), previousTxHash: (string | null | undefined), previousOutputIndex: number}
Properties
address
(string | null | undefined)value
(BigNumber | null | undefined)previousTxHash
(string | null | undefined)previousOutputIndex
number
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
hash
stringoutputIndex
numberblockHeight
(number | null | undefined)address
(string | null | undefined)path
(string | null | undefined)value
BigNumberrbf
booleanisChange
boolean
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
operation
Operationsignature
stringsignatureRaw
Record<string, any>?expirationDate
(Date | null | undefined)
SignedOperationRaw
Type: {operation: OperationRaw, signature: string, signatureRaw: Record<string, any>?, expirationDate: (string | null | undefined)}
Properties
operation
OperationRawsignature
stringsignatureRaw
Record<string, any>?expirationDate
(string | null | undefined)
SignOperationEvent
Type: ({type: "device-streaming"
, progress: number, index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_O