UNPKG

@ledgerhq/coin-cardano

Version:
90 lines 3.63 kB
import { types as TyphonTypes, address as TyphonAddress } from "@stricahq/typhonjs"; import { CardanoAccount, BipPath, PaymentChain, PaymentCredential, StakeChain, StakeCredential, Token, ProtocolParams } from "./types"; import { Bip32PublicKey } from "@stricahq/bip32ed25519"; import BigNumber from "bignumber.js"; import { APITransaction } from "./api/api-types"; import type { OperationType } from "@ledgerhq/types-live"; import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets"; /** * returns BipPath object with account, chain and index field for cardano * * @param {string} path */ export declare function getBipPathFromString(path: string): BipPath; /** * * @returns true if the account can stake, false otherwise */ export declare function canStake(account: CardanoAccount): boolean; /** * * @returns true if account is staked, false otherwise */ export declare function isAlreadyStaking(account: CardanoAccount): boolean; /** * returns complete bipPath with purpose, coin, account, chain and index for cardano */ export declare function getBipPath({ account, chain, index, }: { account: number; chain: PaymentChain | StakeChain; index: number; }): BipPath; /** * returns bipPathString from account, chain and index for cardano */ export declare function getBipPathString({ account, chain, index, }: { account: number; chain: number; index: number; }): string; export declare function getExtendedPublicKeyFromHex(keyHex: string): Bip32PublicKey; export declare function getCredentialKey(accountKey: Bip32PublicKey, path: BipPath): { key: string; path: BipPath; }; /** * returns cardano base address by paymentKey and stakeKey */ export declare function getBaseAddress({ networkId, paymentCred, stakeCred, }: { networkId: number; paymentCred: PaymentCredential; stakeCred: StakeCredential; }): TyphonAddress.BaseAddress; /** * Returns true if address is a valid * * @param {string} address */ export declare const isValidAddress: (address: string, networkId: number) => boolean; export declare const getAbsoluteSlot: (networkName: string, time: Date) => number; /** * Returns the time to live for transaction * * @returns {number} */ export declare function getTTL(networkName: string): number; export declare function getEpoch(networkName: string, time: Date): number; export declare function mergeTokens(tokens: Array<TyphonTypes.Token>): Array<TyphonTypes.Token>; /** * @param { Array<TyphonTypes.Token> } b * @param { Array<TyphonTypes.Token> } a * @returns a - b */ export declare function getTokenDiff(a: Array<TyphonTypes.Token>, b: Array<TyphonTypes.Token>): Array<TyphonTypes.Token>; export declare function getAccountStakeCredential(xpub: string, index: number): StakeCredential; export declare function getOperationType({ valueChange, fees, }: { valueChange: BigNumber; fees: BigNumber; }): OperationType; export declare function isTestnet(currency: CryptoCurrency): boolean; export declare function getAccountChange(t: APITransaction, accountCredentialsMap: Record<string, PaymentCredential>): { ada: BigNumber; tokens: Array<Token>; }; export declare function getMemoFromTx(tx: APITransaction): string | undefined; export declare function isHexString(value: string): boolean; export declare function decodeTokenName(assetName: string): string; export declare function getBech32PoolId(poolId: string, networkName: string): string; export declare function isValidNumString(value: unknown): boolean; export declare function isProtocolParamsValid(pp: ProtocolParams): boolean; //# sourceMappingURL=logic.d.ts.map