UNPKG

bitmask-core

Version:

Core functionality for the BitMask wallet

359 lines 10.6 kB
export declare const getVersion: () => string; export declare const getContract: (nostrHexSk: string, request: string) => Promise<ContractResponse>; export declare const listContracts: (nostrHexSk: string, hidden: boolean) => Promise<ContractResponse[]>; export declare const importContract: (nostrHexSk: string, request: string) => Promise<ContractResponse>; export declare const issueContract: (nostrHexSk: string, request: IssueRequest) => Promise<IssueResponse>; export declare const createInvoice: (nostrHexSk: string, request: RgbInvoiceRequest) => Promise<RgbInvoiceResponse>; export declare const canCreateTransfer: (nostrHexSk: string, request: RgbTransferRequest) => Promise<RgbValidationResponse>; export declare const createTransfer: (nostrHexSk: string, request: RgbTransferRequest) => Promise<RgbTransferResponse>; export declare const createAndPublishTransfer: (nostrHexSk: string, request: RgbTransferRequest, secrets: string[]) => Promise<RgbTransferResponse>; export declare const acceptTransfer: (nostrHexSk: string, request: AcceptRequest) => Promise<AcceptResponse>; export declare const removeInvoice: (nostrHexSk: string, request: string) => Promise<void>; export declare const listInvoices: (nostrHexSk: string) => Promise<RgbInvoiceStatusResponse[]>; export declare const saveTransfer: (nostrHexSk: string, request: SaveTransferRequest) => Promise<RgbTransferItem>; export declare const listTransfers: (nostrHexSk: string) => Promise<RgbTransferItem[]>; export declare const verifyTransfers: (nostrHexSk: string) => Promise<RgbTransferItem[]>; export declare const listOffers: (nostrHexSk: string) => Promise<RgbOfferResponse[]>; export declare const offers: (nostrHexSk: string) => Promise<RgbOfferResponse[]>; export declare const bids: (nostrHexSk: string) => Promise<WatcherWalletResponse>; export declare const offerSwapSuppl: (nostrHexSk: string, offerId: string) => Promise<SwapSupplement>; export declare const bidSwapSuppl: (nostrHexSk: string, bidId: string) => Promise<SwapSupplement>; export declare const canCreateOffer: (nostrHexSk: string, request: RgbOfferRequest, secrets: string[]) => Promise<RgbValidationResponse>; export declare const createOffer: (nostrHexSk: string, request: RgbOfferRequest, secrets: string[]) => Promise<RgbOfferResponse>; export declare const cancelOffer: (nostrHexSk: string, request: RgbCancelOffersRequest) => Promise<RgbSwapCancelResponse>; export declare const canCreateBid: (nostrHexSk: string, request: RgbBidRequest, secrets: string[]) => Promise<RgbValidationResponse>; export declare const createBid: (nostrHexSk: string, request: RgbBidRequest, secrets: string[]) => Promise<RgbBidResponse>; export declare const cancelBid: (nostrHexSk: string, request: RgbCancelBidsRequest) => Promise<RgbSwapCancelResponse>; export declare const backupWallet: (nostrHexSk: string) => Promise<boolean>; export declare const restoreWallet: (nostrHexSk: string) => Promise<boolean>; export declare const getRgbWallet: (nostrHexSk: string) => Promise<WatcherWalletResponse>; export declare const decodeInvoice: (invoice: string) => Promise<RgbInvoiceDecoded>; export declare const psbtPublishFile: (request: PublishPsbtRequest) => Promise<SignedPsbtResponse>; export declare const psbtSignAndPublishFile: (_nostrHexSk: string, request: SignPsbtRequest) => Promise<PublishedPsbtResponse>; export declare const toContractAmountRaw: (decimal: string, precision: number) => string; export declare const toContractAmountStr: (amount: bigint, precision: number) => string; export declare const toContractAmount: (amount: string) => ContractAmount; export declare const toContractPrecision: (amount: string, precision: number) => string; export interface RgbContainer { rgbStock?: string; rgbAccount?: string; rgbTransfers?: string; } export interface IssueRequest { ticker: string; name: string; iface: string; description: string; supply: string; precision: number; seal: string; chain: string; meta?: IssueMedia; } export type ChainFee = { value?: bigint; feeRate?: number; none?: string; }; export interface IssueMedia { preview?: MediaData; media?: MediaData; attachments: MediaData[]; } export interface MediaData { type: string; uri: string; } export type ContractResponse = IssueResponse; export interface IssueResponse { contractId: string; iface: string; issueUtxo: string; ticker: string; name: string; created: bigint; description: string; supply: bigint; precision: number; balance: ContractValue; contract: string; allocations: ContractAllocation[]; meta?: UDAItem; } export type ContractValue = { value?: bigint; uda?: UDAValue; }; export interface UDAValue { tokenIndex: number; fraction: bigint; } export interface ContractAllocation { utxo: string; value: ContractValue; derivation: string; isMine: boolean; isSpent: boolean; } export interface UDAItem { tokenIndex: number; media: IssueMedia; } export interface RgbInvoiceRequest { contractId?: string; iface?: string; amount: RgbInvoiceValue; seal: RgbSelection; expireAt?: number; } export interface RgbSelection { next_utxo?: string; next_address?: string; utxo?: string; address?: string; } export interface RgbInvoiceValue { value?: string; uda?: UDAValue; } export interface RgbInvoiceResponse { invoice: string; } export interface RgbInvoiceStatusResponse { assetName: String; assetTicker: String; contractId: String; amount: RgbInvoiceValue; status: RgbInvoiceStatus; invoice: String; } export type RgbInvoiceStatusItem = RgbInvoiceStatusResponse; export interface RgbInvoiceStatus { opened?: string; payed?: string; canceled?: string; } export interface RgbTransferRequest { contractId: string; iface: string; invoice: string; senderAmount?: RgbInvoiceValue; chain: string; chainFee: ChainFee; } export interface RgbTransferResponse { consigId: string; consig: string; txid: string; psbt: string; commit?: string; } export interface AcceptRequest { consignment: string; force: boolean; } export interface SaveTransferRequest { consignment: string; } export interface AcceptResponse { transferId: string; contractId: string; valid: boolean; txid: string; } export interface RgbTransferItem { contractId: String; iface: String; direction: Direction; } export interface Direction { in?: TransferIn; out?: TransferOut; } export interface TransferIn { txId: String; txStatus: TxStatus; invoice: String; transfer?: TransferItem; amount?: ContractAmount; } export interface TransferOut { txId: String; txStatus: TxStatus; invoice: String; transfer: TransferItem; amount?: ContractAmount; } export interface TransferItem { transferId: String; transfer: String; isAccept: boolean; } export interface SignPsbtRequest { psbt: string; descriptors: string[]; } export interface SignedPsbtResponse { sign: boolean; psbt: string; } export interface PublishPsbtRequest { psbt: string; } export interface PublishedPsbtResponse { sign: boolean; txid: string; } export interface WatcherRequest { name: string; btcXpub: string; rgbXpub: string; recover: boolean; } export interface WatcherResponse { name: string; network: string; migrate: boolean; } export interface WatcherStatusResponse { name: string; created: boolean; } export interface WatcherStatusResponse { name: string; created: boolean; } export interface WatcherWalletResponse { nextUtxo?: string; nextUtxoValue?: number; nextAddress?: string; listContracts: ContractResponse[]; transfers: RgbTransferItem[]; invoices: RgbInvoiceStatusItem[]; } export interface NextUtxoResponse { utxo?: string; value?: number; } export interface NextAddressResponse { address: string; network: string; } export interface TxStatus { notFound?: any; error?: string; mempool?: any; block?: { height: number; timestamp: number; }; confirmed?: string; } export interface RgbInvoiceDecoded { contractId: string; amount: RgbInvoiceValue; } export interface ContractAmount { int: number; fract: number; precision: number; } export interface RgbOfferRequest { strategy: RgbSwap; offers: RgbOfferItem[]; } export declare enum RgbSwap { auction = "auction", p2p = "p2p", hotSwap = "hotswap", airdrop = "airdrop" } export interface RgbOfferItem { contractId: string; contractAmount: string; counterParty: OrderValue; expireAt?: number; } export interface RgbOfferResponse { id: string; status: string; contract: ContractKit; amount: ContractAmount; counterParty: OrderValue; } export interface RgbBidRequest { offerId: string; assetPrice: OrderValue; fee: ChainFee; bundle?: string; } export interface RgbBidResponse { id: string; offerId: string; status: string; asset: AssetKit; amount: ContractAmount; counter_party: OrderValue; txid: string; } export interface RgbAuctionCloseRequest { bundleId: string; } export interface RgbSwapRequest { offerId: string; bidId: string; sharedKey: string; } export interface RgbSwapResponse { consigId: string; consig: string; txid: string; psbt: string; } export interface RgbCancelOffersRequest { offers: string[]; } export interface RgbCancelBidsRequest { bids: string[]; } export interface RgbSwapCancelResponse { records: number; offers: string[]; bids: string[]; } export interface RgbValidationResponse { valid: boolean; message: string; warnings: string[]; failures: string[]; } export interface ContractKit { info: ContractInfo; armored: string; } export interface ContractInfo { contractId: string; contractType: string; name: string; ticker: string; precision: number; } export interface AssetKit { bitcoin?: string; contract?: ContractKit; } export interface OrderValue { bitcoin?: BigInt; contract?: ContractCounterParty; } export interface ContractCounterParty { kit: ContractKit; amount: ContractAmount; } export interface SwapSupplement { transferId: string; transfer: string; tapret: string; psbt: string; } //# sourceMappingURL=rgb.d.ts.map