UNPKG

mnee

Version:

Legacy package for interacting with MNEE USD stablecoin. Includes experimental features.

266 lines (265 loc) 5.96 kB
import { Transaction } from '@bsv/sdk'; export type Environment = 'production' | 'sandbox'; export type SdkConfig = { environment: Environment; apiKey?: string; }; export type MNEEFee = { min: number; max: number; fee: number; }; export type MNEEConfig = { approver: string; feeAddress: string; burnAddress: string; mintAddress: string; fees: MNEEFee[]; decimals: number; tokenId: string; }; export type TxOperation = 'transfer' | 'burn' | 'deploy' | 'mint' | 'redeem'; export type MNEEUtxo = { data: { bsv21: { amt: number; dec: number; icon: string; id: string; op: string; sym: string; }; cosign: { address: string; cosigner: string; }; }; height: number; idx: number; outpoint: string; owners: string[]; satoshis: number; score: number; script: string; txid: string; vout: number; }; export type SignatureRequest = { prevTxid: string; outputIndex: number; inputIndex: number; satoshis: number; address: string | string[]; script?: string; sigHashType?: number; csIdx?: number; data?: unknown; }; export type TransactionFormat = 'tx' | 'beef' | 'ef'; export type MNEEBalance = { address: string; amount: number; decimalAmount: number; }; export type SendMNEE = { address: string; amount: number; }; export type GetSignatures = { rawtx: string; sigRequests: SignatureRequest[]; format?: TransactionFormat; }; export type SignatureResponse = { inputIndex: number; sig: string; pubKey: string; sigHashType: number; csIdx?: number; }; export type MneeInscription = { p: string; op: string; id: string; amt: string; metadata?: { action?: 'mint' | 'redeem'; [key: string]: any; }; }; export type ParsedCosigner = { cosigner: string; address: string; }; export interface File { hash: string; size: number; type: string; content: number[]; } export interface Inscription { file?: File; fields?: { [key: string]: any; }; parent?: string; } export type BalanceResponse = Array<{ address: string; amt: number; precised: number; }>; export type TransferResponse = { ticketId?: string; rawtx?: string; }; export type TransferStatus = { id: string; tx_id: string; tx_hex: string; action_requested: 'transfer'; status: 'BROADCASTING' | 'SUCCESS' | 'MINED' | 'FAILED'; createdAt: string; updatedAt: string; errors: string | null; }; export type TransferOptions = { broadcast?: boolean; callbackUrl?: string; }; export type TransferWebhookResponse = { id: string; tx_id: string; tx_hex: string; action_requested: 'transfer'; callback_url: string; status: 'SUCCESS' | 'BROADCASTING' | 'MINED' | 'FAILED'; createdAt: string; updatedAt: string; errors: string | null; }; export interface TransferMultiOptions { inputs: Array<{ txid: string; vout: number; wif: string; }>; recipients: SendMNEE[]; changeAddress?: string | Array<{ address: string; amount: number; }>; } export type MneeSync = { txid: string; outs: null; height: number; idx: number; score: number; rawtx: string; senders: string[]; receivers: string[]; }; export type Counterparty = { address: string; amount: number; }; export type TxStatus = 'confirmed' | 'unconfirmed'; export type TxType = 'send' | 'receive'; export type TxHistory = { txid: string; height: number; status: TxStatus; type: TxType; amount: number; counterparties: Counterparty[]; fee: number; score: number; }; export type TxHistoryResponse = { address: string; history: TxHistory[]; nextScore: number; }; export type TxAddressAmount = { address: string; amount: number; }; export type ParseTxResponse = { txid: string; environment: Environment; type: TxOperation; inputs: TxAddressAmount[]; outputs: TxAddressAmount[]; isValid: boolean; inputTotal: string; outputTotal: string; }; export interface ParseOptions { includeRaw?: boolean; } export interface ParseTxExtendedResponse extends ParseTxResponse { raw?: { txHex: string; inputs: Array<{ txid: string; vout: number; scriptSig: string; sequence: number; satoshis: number; address?: string; tokenData?: any; }>; outputs: Array<{ value: number; scriptPubKey: string; address?: string; tokenData?: any; }>; }; } export interface AddressHistoryParams { address: string; fromScore?: number; limit?: number; order?: 'asc' | 'desc'; } export interface ProcessedInput { address?: string; amount: number; satoshis: number; inscription?: MneeInscription | null; cosigner?: ParsedCosigner; } export interface ProcessedOutput { address?: string; amount: number; satoshis: number; inscription?: MneeInscription | null; cosigner?: ParsedCosigner; } export interface TxInputResponse { inputs: ProcessedInput[]; total: bigint; environment?: Environment; type?: TxOperation; } export interface TxOutputResponse { outputs: ProcessedOutput[]; total: bigint; environment?: Environment; type?: TxOperation; } export interface UnsignedTransactionResult { transaction: Transaction; sigRequests: SignatureRequest[]; sourceTransactions: Map<number, Transaction>; } export interface MultisigBuildOptions { inputs: Array<{ txid: string; vout: number; }>; recipients: SendMNEE[]; changeAddress?: string | SendMNEE[]; }