/// import { AccountId, H256, Permill } from "@polkadot/types/interfaces"; import Big from "big.js"; import { ApiPromise } from "@polkadot/api"; import type { Struct } from "@polkadot/types"; import { Network } from "bitcoinjs-lib"; import { StorageKey } from "@polkadot/types/primitive/StorageKey"; import { Codec } from "@polkadot/types/types"; import { Moment } from "@polkadot/types/interfaces"; import { Option } from "@polkadot/types/codec"; import { Bytes } from "@polkadot/types-codec"; import { u32 } from "@polkadot/types"; import { ExtrinsicStatus } from "@polkadot/types/interfaces"; import { InterbtcPrimitivesRedeemRedeemRequest, InterbtcPrimitivesReplaceReplaceRequest, InterbtcPrimitivesIssueIssueRequest, BitcoinAddress, VaultRegistrySystemVault, InterbtcPrimitivesVaultId, InterbtcPrimitivesVaultCurrencyPair, InterbtcPrimitivesCurrencyId } from "@polkadot/types/lookup"; import { SystemVaultExt } from "../types/vault"; import { Issue, Redeem, RedeemStatus, ReplaceRequestExt } from "../types/requestTypes"; import { NumberOrHex, SignedFixedPoint, UnsignedFixedPoint, VaultId } from "../interfaces"; import { CollateralCurrencyExt, CurrencyExt, HexString, WrappedCurrency } from "../types"; import { VaultsAPI } from "../parachain"; import { AddressOrPair } from "@polkadot/api/types"; import { MonetaryAmount } from "@interlay/monetary-js"; export declare function intoAccountTruncating(api: ApiPromise, palletId: Uint8Array): AccountId; /** * Converts endianness of a Uint8Array * @param bytes Uint8Array, to be converted LE<>BE */ export declare function reverseEndianness(bytes: Uint8Array): Uint8Array; /** * Remove the `0x` hex prefix if present * @param str */ export declare function stripHexPrefix(str: string): string; /** * Ensure the `0x` hex prefix is present * @param str **/ export declare function addHexPrefix(str: string): string; /** * Ensure a hash value is an encoded H256 * @param api The polkadot API promise used to encode if necessary * @param hash The either H256 or string encoded hash **/ export declare function ensureHashEncoded(api: ApiPromise, hash: H256 | string): H256; /** * Reverse the endianness of the given hex string * @dev Will remove `0x` prefix if present * @param hex */ export declare function reverseEndiannessHex(hex: string): string; /** * Converts a Uint8Array to string * @dev Will remove `0x` prefix if present * @param bytes */ export declare function uint8ArrayToString(bytes: Uint8Array): string; export declare function decodeFixedPointType(x: SignedFixedPoint | UnsignedFixedPoint): Big; /** * Convert Bytes to a string. Will remove `0x` prefix if present. * @param bytes Bytes to decode * @returns the decoded string */ export declare function decodeBytesAsString(bytes: Bytes): string; export declare function encodeUnsignedFixedPoint(api: ApiPromise, x: Big): UnsignedFixedPoint; export declare function storageKeyToNthInner(s: StorageKey, n?: number): T; export interface DecodedRequest extends Struct { readonly btc_address: BitcoinAddress; } export interface DecodedRequestExt extends Omit { btc_address: string; } export declare function parseSystemVault(api: ApiPromise, vault: VaultRegistrySystemVault, wrappedCurrency: WrappedCurrency, collateralCurrency: CollateralCurrencyExt): Promise; export declare function newAccountId(api: ApiPromise, accountId: string): AccountId; export declare function newVaultId(api: ApiPromise, accountId: string, collateralCurrency: CollateralCurrencyExt, wrappedCurrency: WrappedCurrency): InterbtcPrimitivesVaultId; export declare function decodeRpcVaultId(api: ApiPromise, vaultId: VaultId): Promise; export declare function newVaultCurrencyPair(api: ApiPromise, collateralCurrency: CollateralCurrencyExt, wrappedCurrency: WrappedCurrency): InterbtcPrimitivesVaultCurrencyPair; export declare function newCurrencyId(api: ApiPromise, currency: CurrencyExt): InterbtcPrimitivesCurrencyId; export declare function newForeignAssetId(api: ApiPromise, id: number): u32; export declare function addressOrPairAsAccountId(api: ApiPromise, addyOrpair: AddressOrPair): AccountId; export declare function parseReplaceRequest(api: ApiPromise, req: InterbtcPrimitivesReplaceReplaceRequest, network: Network, wrappedCurrency: WrappedCurrency, id: H256 | string): Promise; export declare function parseIssueRequest(api: ApiPromise, vaultsAPI: VaultsAPI, req: InterbtcPrimitivesIssueIssueRequest, network: Network, id: H256 | string): Promise; export declare function parseRedeemRequestStatus(req: InterbtcPrimitivesRedeemRedeemRequest, redeemPeriod: number, activeBlockCount: number): RedeemStatus; export declare function parseRedeemRequest(api: ApiPromise, vaultsAPI: VaultsAPI, req: InterbtcPrimitivesRedeemRedeemRequest, network: Network, id: H256 | string, redeemPeriod: number, activeBlockCount: number): Promise; export declare function convertMoment(moment: Moment): Date; export declare function unwrapRawExchangeRate(option: Option): UnsignedFixedPoint | undefined; export declare function encodeVaultId(api: ApiPromise, id: InterbtcPrimitivesVaultId): Promise; export declare function queryNominationsMap(api: ApiPromise, map: Map, vaultId: InterbtcPrimitivesVaultId): Promise; export declare function getSS58Prefix(api: ApiPromise): number; export declare function decodePermill(amount: Permill, inPercentage?: boolean): Big; export declare function decodeNumberOrHex(value: NumberOrHex): Big; export declare function monetaryAmountToRawString(amount: MonetaryAmount): string; export declare function newExtrinsicStatus(api: ApiPromise, type: ExtrinsicStatus["type"]): ExtrinsicStatus; export declare function bufferToHexString(buffer: Buffer): HexString;