atomical

package
v0.0.0-...-f6beff1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeLessAtomicalAmt    = 2011400
	ErrCodeAtomicalChangeFail = 2011401
	ErrCodeVoutDust           = 2011402
	ErrCodeCommon             = 2011403
	ErrCodeUnknownAsset       = 2011404
	ErrInsufficientBalance    = 1000001
	ErrCodeMul                = 2011420
)
View Source
const SellerSignatureIndex = 1

Variables

View Source
var (
	NFT = "NFT"
	FT  = "FT"
)
View Source
var (
	ErInsufficientBalance = "Insufficient Balance"
)

Functions

func AddrToPkScript

func AddrToPkScript(addr string, network *chaincfg.Params) ([]byte, error)

func GenerateAtomicalSignedBuyingTx

func GenerateAtomicalSignedBuyingTx(ins []*TxInput, outs []*TxOutput, dustSize, feePerB int64, sellerPsbt string, network *chaincfg.Params) (int64, string, error)

func GenerateAtomicalSignedListingPSBTBase64

func GenerateAtomicalSignedListingPSBTBase64(in *TxInput, out *TxOutput, network *chaincfg.Params) (string, error)

func NewAtomicalTransferTool

func NewAtomicalTransferTool(network *chaincfg.Params, request *AtomicalRequest) (*AtomicalTransferTool, *Err)

func PayToPubKeyHashScript

func PayToPubKeyHashScript(pubKeyHash []byte) ([]byte, error)

func PayToWitnessPubKeyHashScript

func PayToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error)

Types

type AtomicalData

type AtomicalData struct {
	AtomicalId string `json:"atomicalId"` // case:9527290d5f28479fa752f3eb9484ccbc5a951e2b2b5a49870318683e188e357ei0
	Type       string `json:"type"`       // FT | NFT
}

type AtomicalDatas

type AtomicalDatas []*AtomicalData

func (AtomicalDatas) Len

func (s AtomicalDatas) Len() int

func (AtomicalDatas) Less

func (x AtomicalDatas) Less(i, j int) bool

func (AtomicalDatas) Sort

func (s AtomicalDatas) Sort()

func (AtomicalDatas) Swap

func (x AtomicalDatas) Swap(i, j int)

type AtomicalRequest

type AtomicalRequest struct {
	Inputs   []*PrevOutput `json:"inputs"`
	Outputs  []*Output     `json:"outputs"`
	FeePerB  int64         `json:"feePerB"`
	Address  string        `json:"address"`
	DustSize int64         `json:"dustSize"`
}

func (*AtomicalRequest) Check

func (a *AtomicalRequest) Check(network *chaincfg.Params, minChangeValue int64) *Err

type AtomicalTransferTool

type AtomicalTransferTool struct {
	CommitTxPrevOutputFetcher *txscript.MultiPrevOutFetcher
	CommitTxPrivateKeyList    []*btcec.PrivateKey
	RevealTxPrevOutputFetcher *txscript.MultiPrevOutFetcher
	CommitTxPrevOutputList    []*PrevOutput
	CommitTx                  *wire.MsgTx
	MustCommitTxFee           int64
	CommitAddrs               []string
}

func (*AtomicalTransferTool) CalculateFee

func (tool *AtomicalTransferTool) CalculateFee() (int64, []int64)

func (*AtomicalTransferTool) GetCommitTxHex

func (tool *AtomicalTransferTool) GetCommitTxHex() (string, error)

type Err

type Err struct {
	ErrCode int         `json:"errCode"`
	Data    interface{} `json:"data"`
}

func AtomicalTransfer

func AtomicalTransfer(network *chaincfg.Params, request *AtomicalRequest) (*bitcoin.InscribeTxs, *Err)

type ErrAtomicalIdAmt

type ErrAtomicalIdAmt struct {
	AtomicalId string `json:"atomicalId"`
	Amount     int64  `json:"amount"`
}

type Output

type Output struct {
	Amount  int64         `json:"amount"`
	Address string        `json:"address"`
	Data    AtomicalDatas `json:"data"`
}

type PrevOutput

type PrevOutput struct {
	TxId       string        `json:"txId"`
	VOut       uint32        `json:"vOut"`
	Amount     int64         `json:"amount"`
	Address    string        `json:"address"`
	Data       AtomicalDatas `json:"data"`
	PrivateKey string        `json:"privateKey"`
}

type TxInput

type TxInput struct {
	TxId              string
	VOut              uint32
	Sequence          uint32
	Amount            int64
	Address           string
	PrivateKey        string
	NonWitnessUtxo    string
	MasterFingerprint uint32
	DerivationPath    string
	PublicKey         string
}

type TxOutput

type TxOutput struct {
	Address           string
	PkScript          string
	Amount            int64
	IsChange          bool
	MasterFingerprint uint32
	DerivationPath    string
	PublicKey         string
}

Jump to

Keyboard shortcuts

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