Skip to content

Simplicity covenant helpers & PSET builder #26

@ardier16

Description

@ardier16

Describe the feature

Description:
Port all Simplicity covenant integration code, transaction builders, and utilities for Jade signing.

Acceptance Criteria:

  • Covenant source registry ported from web/src/simplicity/sources.ts and covenants/ folder:
    • p2pk.ts — P2PK program
    • lending.ts — lending covenant
    • asset_auth.ts — asset authorization
    • pre_lock.ts — pre-lock covenant
    • script_auth.ts — script hash verification
  • preLockCovenants.ts ported — address derivation chain computation:
    • AssetAuth → Lending → ScriptAuth → PreLock chain
    • Script pubkey derivation for outputs
  • PSET builder ported from web/src/tx/psetBuilder.ts:
    • Wrapper over LWK PsetBuilder
    • Input/output management
    • Asset issuance (entropy-based asset ID)
    • Script compilation from addresses
    • Fallback nLockTime for liquidation covenants
    • Txid byte order conversion (display ↔ internal)
  • Utility helpers ported:
    • parametersEncoding.ts — NFT parameter encoding
    • addressP2pk.ts — P2PK address derivation
    • esploraPrevout.ts — prevout tx fetching
    • finalizeSimplicityInputs.ts — Simplicity input finalization
    • taprootUnspendableKey.ts — taproot key helpers
  • All transaction builders ported:
    • preLockCreation/ — create pre-lock covenant
    • issueUtilityNfts/ — issue 4 utility NFTs
    • prepareUtilityNfts/ — prepare 4 utility UTXOs
    • acceptOffer/ — accept offer (build lending covenant input)
    • loanRepayment/ — repay loan
    • loanLiquidation/ — liquidate expired loan
    • preLockCancellation/ — cancel pending offer
  • All TX types updated for Jade signing (no P2PK seed-based signing)
  • Manual test: createP2trAddress(source, args, internalKey, testnet) output matches web/ for identical inputs

Notes:

  • Transaction builders adapted for Jade PSET signing (remove seed-based signing)
  • Keep covenant source compilation logic identical to web/
  • All outputs should be testable against web/ equivalents

Metadata

Metadata

Assignees

Labels

webWebsite-related issues
No fields configured for Feature.

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions