All shared TypeScript interfaces and types used across @bsv/simple.
Source: src/core/types.ts
type Network = 'main' | 'testnet'interface WalletDefaults {
network: Network
description: string
outputDescription: string
changeBasket?: string
tokenBasket: string
tokenProtocolID: [SecurityLevel, string]
tokenKeyID: string
messageBoxHost: string
registryUrl?: string
}Default values:
| Field | Default |
|---|---|
network |
'main' |
description |
'BSV-Simplify transaction' |
outputDescription |
'BSV-Simplify output' |
changeBasket |
undefined |
tokenBasket |
'tokens' |
tokenProtocolID |
[0, 'token'] |
tokenKeyID |
'1' |
messageBoxHost |
'https://messagebox.babbage.systems' |
registryUrl |
undefined |
interface WalletStatus {
isConnected: boolean
identityKey: string | null
network: string
}interface WalletInfo {
identityKey: string
address: string
network: string
isConnected: boolean
}interface TransactionResult {
txid: string
tx: any // AtomicBEEF bytes (number[])
outputs?: OutputInfo[]
reinternalized?: ReinternalizeResult
}interface OutputInfo {
index: number
satoshis: number
lockingScript: string
description?: string
}interface ReinternalizeResult {
count: number // Number of change outputs recovered
errors: string[] // Any errors encountered
}interface SendResult extends TransactionResult {
outputDetails: SendOutputDetail[]
}interface SendOutputDetail {
index: number
type: 'p2pkh' | 'op_return' | 'pushdrop'
satoshis: number
description: string
}interface PaymentOptions {
to: string // Recipient public key
satoshis: number // Amount
memo?: string // OP_RETURN memo
description?: string // Transaction description
basket?: string // Track output in basket
changeBasket?: string // Reinternalize change
derivationPrefix?: string // BRC-29 derivation prefix
derivationSuffix?: string // BRC-29 derivation suffix
}interface SendOptions {
outputs: SendOutputSpec[]
description?: string
changeBasket?: string
}interface SendOutputSpec {
to?: string // Recipient public key
satoshis?: number // Amount
data?: (string | object | number[])[] // Data fields
description?: string // Output description
basket?: string // Track in basket
protocolID?: [number, string] // PushDrop protocol ID
keyID?: string // PushDrop key ID
}Output routing rules:
to |
data |
Result |
|---|---|---|
| Yes | No | P2PKH |
| No | Yes | OP_RETURN |
| Yes | Yes | PushDrop |
interface DerivationInfo {
counterparty: string
protocolID: WalletProtocol
keyID: string
publicKey: string
}interface PaymentDerivation {
derivationPrefix: string
derivationSuffix: string
publicKey: string
}interface TokenOptions {
to?: string // Recipient (default: self)
data: any // Token data (serialized to JSON)
basket?: string // Basket (default: 'tokens')
protocolID?: [number, string] // PushDrop protocol
keyID?: string // PushDrop key ID
satoshis?: number // Locked sats (default: 1)
}interface TokenResult extends TransactionResult {
basket: string
encrypted: boolean
}interface TokenDetail {
outpoint: string // "txid.vout"
satoshis: number
data: any // Decrypted token data
protocolID: any
keyID: string
counterparty: string
}interface SendTokenOptions {
basket: string // Source basket
outpoint: string // Token outpoint
to: string // Recipient public key
}interface RedeemTokenOptions {
basket: string // Source basket
outpoint: string // Token outpoint
}type InscriptionType = 'text' | 'json' | 'file-hash' | 'image-hash'interface InscriptionOptions {
data: string | object
type: InscriptionType
basket?: string
description?: string
}interface InscriptionResult extends TransactionResult {
type: InscriptionType
dataSize: number
basket: string
}interface MessageBoxConfig {
host?: string
enableLogging?: boolean
}interface CertifierConfig {
privateKey?: string
certificateType?: string
defaultFields?: Record<string, string>
includeTimestamp?: boolean
}interface CertificateData {
type: string
serialNumber: string
subject: string
certifier: string
revocationOutpoint: string
fields: Record<string, string>
signature: string
keyringForSubject: Record<string, string>
}interface ServerWalletConfig {
privateKey: string
network?: Network
storageUrl?: string
}interface PaymentRequest {
serverIdentityKey: string
derivationPrefix: string
derivationSuffix: string
satoshis: number
memo?: string
}interface IncomingPayment {
tx: number[] | Uint8Array
senderIdentityKey: string
derivationPrefix: string
derivationSuffix: string
outputIndex: number
description?: string
}interface OverlayConfig {
topics: string[]
network?: 'mainnet' | 'testnet' | 'local'
requireAckFromAllHosts?: 'all' | 'any' | string[]
requireAckFromAnyHost?: 'all' | 'any' | string[]
slapTrackers?: string[]
hostOverrides?: Record<string, string[]>
additionalHosts?: Record<string, string[]>
}interface OverlayInfo {
topics: string[]
network: string
admittanceInstructions?: string
}interface OverlayBroadcastResult {
success: boolean
txid?: string
steak?: Record<string, {
outputsToAdmit: number[]
coinsToRetain: number[]
coinsRemoved?: number[]
}>
code?: string
description?: string
}interface OverlayOutput {
beef: number[]
outputIndex: number
context?: number[]
}interface DIDDocument {
'@context': string[]
id: string
controller: string
verificationMethod: DIDVerificationMethod[]
authentication: string[]
assertionMethod: string[]
}interface DIDVerificationMethod {
id: string
type: string // 'EcdsaSecp256k1VerificationKey2019'
controller: string
publicKeyHex: string
}interface DIDParseResult {
method: string // 'bsv'
identityKey: string
}type CredentialFieldType =
| 'text' | 'email' | 'date' | 'number'
| 'textarea' | 'checkbox' | 'select'interface CredentialFieldSchema {
key: string
label: string
type: CredentialFieldType
required?: boolean
placeholder?: string
format?: string
options?: { value: string; label: string }[]
helpText?: string
group?: string
}interface CredentialSchemaConfig {
id: string
name: string
description?: string
certificateTypeBase64?: string
fields: CredentialFieldSchema[]
fieldGroups?: { key: string; label: string }[]
validate?: (values: Record<string, string>) => string | null
computedFields?: (values: Record<string, string>) => Record<string, string>
}interface CredentialIssuerConfig {
privateKey: string
schemas?: CredentialSchemaConfig[]
revocation?: {
enabled: boolean
wallet?: any // WalletInterface
store?: RevocationStore
}
}interface VerifiableCredential {
'@context': string[]
type: string[]
id?: string
issuer: string // 'did:bsv:...'
issuanceDate: string
expirationDate?: string
credentialSubject: {
id: string // 'did:bsv:...'
[key: string]: any
}
credentialStatus?: {
id: string // 'bsv:txid.vout'
type: string // 'BSVHashLockRevocation2024'
}
proof: {
type: string // 'BSVMasterCertificateProof2024'
created: string
proofPurpose: string
verificationMethod: string
signatureValue: string
}
_bsv: {
certificate: CertificateData
}
}interface VerifiablePresentation {
'@context': string[]
type: string[]
holder: string // 'did:bsv:...'
verifiableCredential: VerifiableCredential[]
proof: {
type: string
created: string
proofPurpose: string
verificationMethod: string
}
}interface VerificationResult {
valid: boolean
revoked: boolean
errors: string[]
issuer?: string
subject?: string
type?: string
}interface RevocationRecord {
secret: string // Hex-encoded secret
outpoint: string // "txid.vout"
beef: number[] // BEEF bytes of the revocation UTXO tx
}interface RevocationStore {
save(serialNumber: string, record: RevocationRecord): Promise<void>
load(serialNumber: string): Promise<RevocationRecord | undefined>
delete(serialNumber: string): Promise<void>
has(serialNumber: string): Promise<boolean>
findByOutpoint(outpoint: string): Promise<boolean>
}