UNPKG

charms-js

Version:

TypeScript SDK for decoding Bitcoin transactions containing Charms data

83 lines (82 loc) 1.93 kB
import { AppType } from './utils'; export interface ParsedCharmData { version: number; apps: Record<string, string>; ins: InputSummary[]; outs: OutputSummary[]; verified?: boolean; proof?: string; error?: string; } export interface InputSummary { utxo_id: string; } export interface OutputSummary { address?: string; charms?: Record<string, number | CharmData>; } export interface CharmData { ticker: string; remaining: number; name?: string; description?: string; url?: string; image?: string; image_hash?: string; decimals?: number; ref?: string; genesis_network?: string; genesis_tx?: string; custom?: Record<string, any>; [key: string]: any; } export interface CharmInstance { utxo: { tx: string; index: number; }; address: string; appId: string; app: string | null; appType?: AppType; verified?: boolean; value?: number; ticker?: string; remaining?: number; name?: string; description?: string; url?: string; image?: string; image_hash?: string; decimals?: number; ref?: string; genesis_network?: string; genesis_tx?: string; custom?: Record<string, any>; [key: string]: any; } export type NormalizedCharms = Record<string, any>; export interface NormalizedTransaction { ins?: string[]; refs: string[]; outs: NormalizedCharms[]; beamed_outs?: Record<string, string>; } export interface NormalizedSpell { version: number; tx: NormalizedTransaction; app_public_inputs: Record<string, any>; } export type Proof = Uint8Array; export interface SpellAndProof { spell: NormalizedSpell; proof: Proof; } export interface ErrorResponse { error: string; } export type BitcoinNetwork = 'mainnet' | 'testnet4'; export interface NetworkConfig { network?: BitcoinNetwork; apiBaseUrl?: string; }