inscriber

package
v0.0.0-...-6c424d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnableRbfNoLockTime = wire.MaxTxInSequenceNum - 2
	MaxStandardTxWeight = blockchain.MaxBlockWeight / 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BTCBaseClient

type BTCBaseClient interface {
	GetRawTransaction(txHash *chainhash.Hash) (*btcutil.Tx, error)
	SendRawTransaction(tx *wire.MsgTx) (*chainhash.Hash, error)
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(net *chaincfg.Params) *Builder

func (*Builder) BuildAllUsedWallet

func (b *Builder) BuildAllUsedWallet(req MintReq, payAddrPK string) ([]*WalletInfo, error)

func (*Builder) BuildMiddleTxWithEmptyInput

func (b *Builder) BuildMiddleTxWithEmptyInput(req MintReq, revealTxs []*WrapTx, prevScript []byte) (*WrapTx, error)

note: include reveal tx1 + commit tx2... + 手续费 + 找零

func (*Builder) BuildRevealTxsWithEmptyInput

func (b *Builder) BuildRevealTxsWithEmptyInput(pkAndScripts []*WalletInfo, req MintReq) ([]*WrapTx, error)

func (*Builder) CompleteMiddleTx

func (b *Builder) CompleteMiddleTx(privKey btcec.PrivateKey, middleTx *WrapTx, commitTxHash string, actualMiddlePrevOutputFee int64) error

1. fill commit tx value 2. sign transaction

func (*Builder) CompleteRevealTxs

func (b *Builder) CompleteRevealTxs(revealTxs []*WrapTx, pkAndScripts []*WalletInfo, middleTxHash chainhash.Hash) error

type Inscriber

type Inscriber struct {
	// contains filtered or unexported fields
}

func NewInscriber

func NewInscriber(btcClient BTCBaseClient) *Inscriber

func (*Inscriber) CalcFee

func (i *Inscriber) CalcFee(order *Order) (int64, string, error)

func (*Inscriber) CreateOrder

func (i *Inscriber) CreateOrder(who, runes string, count int64) (*Order, error)

func (*Inscriber) FirstStep

func (i *Inscriber) FirstStep(who, runes string, count int64) error

func (*Inscriber) SetTask

func (i *Inscriber) SetTask(task *SendTask)

type MintReq

type MintReq struct {
	RuneId   string `json:"rune_id"`  // blockNum:TxIdx
	Receiver string `json:"receiver"` // receiver address
	FeeRate  int64  `json:"fee_rate"`
	Count    int    `json:"count"` // number of mint times
}

type MintTxs

type MintTxs struct {
	PayTxHash string    `json:"pay_tx_hash"` // user who pay for mint address's transaction hash
	MiddleTx  *WrapTx   `json:"middle_tx"`   // which include one mint runes and other UTXO for reveals txs input
	RevealTxs []*WrapTx `json:"reveal_txs"`  // all txs which have mint runes
}

NOTE : len(middleTx) + len(RevealTxs) = MintReq.Count

type Order

type Order struct {
	Id            string
	Who           string
	Runes         string
	Count         int64
	FeeRate       int64
	WifPrivateKey string
	PayAddress    string
	MintFee       int64
}

type PayInfo

type PayInfo struct {
	Addr           string
	PkScript       string
	InscriptionFee int64
	MinerFee       int64
}

type RunesMinter

type RunesMinter struct {
	// contains filtered or unexported fields
}

func NewRunesMinter

func NewRunesMinter(net *chaincfg.Params, btcClient BTCBaseClient) *RunesMinter

func (*RunesMinter) BuildRunesTxs

func (rm *RunesMinter) BuildRunesTxs(commitTxHash string, actualMiddlePrevOutputFee int64, payAddrPK string, req MintReq) (*WrapTx, []*WrapTx, error)

func (*RunesMinter) CalcRunesTxsFee

func (rm *RunesMinter) CalcRunesTxsFee(payAddrPK string, req MintReq) (int64, error)

func (*RunesMinter) Inscribe

func (rm *RunesMinter) Inscribe(commitTxHash string, actualMiddlePrevOutputFee int64, payAddrPK string, req MintReq) (*SendResult, error)

func (*RunesMinter) SendRunesTxs

func (rm *RunesMinter) SendRunesTxs(middleTx *WrapTx, revealTxs []*WrapTx) map[string]bool

type SendResult

type SendResult struct {
	MiddleTx  *WrapTx
	RevealTxs []*WrapTx
	TxsStatus map[string]bool
}

type SendTask

type SendTask struct {
	// contains filtered or unexported fields
}

func NewSendTask

func NewSendTask(client BTCBaseClient, who, runes, orderId string, count int64) *SendTask

func (*SendTask) LoopSendTxs

func (s *SendTask) LoopSendTxs(sr *SendResult)

func (*SendTask) SaveToFile

func (s *SendTask) SaveToFile(sr *SendResult)

type WalletInfo

type WalletInfo struct {
	PrivateKey      *btcec.PrivateKey `json:"private_key"`
	Address         btcutil.Address   `json:"address"`
	PkScript        []byte            `json:"pk_script"`
	RecoveryPKofWIF string            `json:"recovery_pk_of_wif"`
}

func CreateWallet

func CreateWallet(net *chaincfg.Params, privateKey *btcec.PrivateKey) (*WalletInfo, error)

type WrapTx

type WrapTx struct {
	PrevOutput          *wire.TxOut                   `json:"prev_output"`
	TxPrevOutputFetcher *txscript.MultiPrevOutFetcher `json:"tx_prev_output_fetcher"`
	WireTx              *wire.MsgTx                   `json:"wire_tx"`
	MinerFee            int64                         `json:"miner_fee"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL