signing

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicAddressForZeroEVM          = "0x0000000000000000000000000000000000000000"
	MagicContactAddressForNative    = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
	MagicContactAddressForNativeTRX = "TXka46PPwttNPWfFDPtt3GUodbPThyufaV"
	MagicContactAddressForNativeSOL = "So11111111111111111111111111111111111111112"
	MagicNumberForMaxAmount         = "115792089237316195423570985008687907853269984665640564039457584007913129639935"
)

Magic sentinel addresses used to denote a chain's native asset (as opposed to a token contract) when building transfers.

View Source
const (
	TxTypeTransfer        = "0"
	TxTypeMint            = "1"
	TxTypeBurn            = "2"
	TxTypeContractCall    = "3"
	TxTypeAccountActivate = "4"
	TxTypeKrc20Commit     = "5"
	TxTypeKrc20Reveal     = "6"
)

Transaction kinds understood by the per-chain transaction builders.

View Source
const (
	FamilyOfNone      = 0
	FamilyOfEVM       = 1
	FamilyOfUTXO      = 2
	FamilyOfCOSMOS    = 3
	FamilyOfSUBSTRATE = 4
	FamilyOfTRX       = 5
	FamilyOfKAS       = 6
	FamilyOfSOL       = 7
	FamilyOfAPT       = 8
	FamilyOfSUI       = 9
	FamilyOfEGLD      = 10
)

Chain family identifiers, grouping chains that share an address/signature scheme.

View Source
const (
	TxStatusUnknown    = "Unknown"
	TxStatusPending    = "Pending"
	TxStatusVerified   = "Verified"
	TxStatusSucceeded  = "Succeeded"
	TxStatusFailed     = "Failed"
	TxStatusDropped    = "Dropped"
	TxStatusWaitVerify = "WaitVerify"
	TxStatusRefunding  = "Refunding"
	TxStatusRefunded   = "Refunded"
)

Variables

View Source
var Validator = validator.New()

Functions

func RegisterAddressValidator

func RegisterAddressValidator(tag string, fn func(string) bool) error

Types

type AccountHandler

type AccountHandler interface {
	PrivateKey() []byte
	PublicKey() []byte
	PrivateKeyHex() string
	PublicKeyHex() string
	Address() string
	SignData(data []byte) ([]byte, error)
	VerifySignData(data, sig []byte) bool
	Wipe()
}

type TxBuilderHandler

type TxBuilderHandler interface {
	Build() error
	Sign(privateKey []byte) (string, error)
	ConcatSignature(signature string, isDerFormat bool) (string, error)
	GetTxHash() string
	GetSigHash() []string
	GetUnsignedHex() string
	SetSigHash(sigHash []string)
	SetUnsignedHex(unsignedHex string)
}

type UtxoInfo

type UtxoInfo struct {
	Hash   string `json:"hash" validate:"required,hex_str"`
	Script string `json:"script" validate:"required,hex_str"`
	Index  string `json:"index" validate:"required,u64"`
	Value  string `json:"value" validate:"required,u64_gt0"`

	Version       string `json:"version,omitempty" validate:"omitempty,u64"`
	IsCoinbase    string `json:"isCoinbase,omitempty" validate:"omitempty,bool_str"`
	BlockDAAScore string `json:"blockDAAScore,omitempty" validate:"omitempty,u64"`
}

type UtxoList

type UtxoList struct {
	List []*UtxoInfo `json:"list" validate:"required,min=1,dive"`
}

func NewUtxoList

func NewUtxoList() *UtxoList

func (*UtxoList) AddUtxoInfo

func (u *UtxoList) AddUtxoInfo(info *UtxoInfo)

func (*UtxoList) CalcValue

func (u *UtxoList) CalcValue() string

func (*UtxoList) IsEmpty

func (u *UtxoList) IsEmpty() bool

func (*UtxoList) SelectUtxo

func (u *UtxoList) SelectUtxo(targetValue string) error

func (*UtxoList) SerializeFromStr

func (u *UtxoList) SerializeFromStr(jsonStr string) error

func (*UtxoList) String

func (u *UtxoList) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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