Documentation
¶
Index ¶
- Constants
- func GetKrc20Params(t *Krc20Params, pubKey []byte) (string, error)
- func NewAccount() signing.AccountHandler
- func NewAccountFromMnemonic(mnemonic, path string) (signing.AccountHandler, error)
- func NewAccountFromPrivateKey(privateKey []byte) (signing.AccountHandler, error)
- func NewAccountFromPrivateKeyHex(privateKey string) (signing.AccountHandler, error)
- func PayToScriptHashScript(redeemScript []byte) ([]byte, error)
- func PublicKey2Address(publicKey []byte) string
- func SignWithPrivateKeyWithBlake2b(privateKeyBytes, data []byte) ([]byte, error)
- func ValidAddress(address string) bool
- func VerifySignatureWithBlake2b(publicKey, data, sig []byte) bool
- type Account
- func (a *Account) Address() string
- func (a *Account) PrivateKey() []byte
- func (a *Account) PrivateKeyHex() string
- func (a *Account) PublicKey() []byte
- func (a *Account) PublicKeyHex() string
- func (a *Account) SignData(data []byte) ([]byte, error)
- func (a *Account) SignDataLikeOkx(data []byte) []byte
- func (a *Account) VerifySignData(data, sig []byte) bool
- func (a *Account) Wipe()
- type AddressData
- type DomainTransactionWrapper
- type Ingredient
- type InputWrapper
- type Krc20Params
- type OutputWrapper
- type ScriptBuilder
- type ScriptClass
- type TxBuilder
- func (tx *TxBuilder) Build() error
- func (tx *TxBuilder) ConcatSignature(signature string, isDerFormat bool) (string, error)
- func (tx *TxBuilder) GetSigHash() []string
- func (tx *TxBuilder) GetTxHash() string
- func (tx *TxBuilder) GetUnsignedHex() string
- func (tx *TxBuilder) SetSigHash(sigHash []string)
- func (tx *TxBuilder) SetUnsignedHex(unsignedHex string)
- func (tx *TxBuilder) Sign(privateKey []byte) (string, error)
Constants ¶
View Source
const ( OpCheckSig = 172 OpFalse = 0 OpIf = 99 OpEndIf = 104 )
View Source
const DefaultDust = 2000000
Variables ¶
This section is empty.
Functions ¶
func GetKrc20Params ¶
func GetKrc20Params(t *Krc20Params, pubKey []byte) (string, error)
func NewAccount ¶
func NewAccount() signing.AccountHandler
func NewAccountFromMnemonic ¶
func NewAccountFromMnemonic(mnemonic, path string) (signing.AccountHandler, error)
func NewAccountFromPrivateKey ¶
func NewAccountFromPrivateKey(privateKey []byte) (signing.AccountHandler, error)
func NewAccountFromPrivateKeyHex ¶
func NewAccountFromPrivateKeyHex(privateKey string) (signing.AccountHandler, error)
func PayToScriptHashScript ¶
func PublicKey2Address ¶
func ValidAddress ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) PrivateKey ¶
func (*Account) PrivateKeyHex ¶
func (*Account) PublicKeyHex ¶
func (*Account) SignDataLikeOkx ¶
func (*Account) VerifySignData ¶
type AddressData ¶
type AddressData struct {
// contains filtered or unexported fields
}
type DomainTransactionWrapper ¶
type DomainTransactionWrapper struct {
*externalapi.DomainTransaction
}
func (*DomainTransactionWrapper) MarshalJSON ¶
func (tw *DomainTransactionWrapper) MarshalJSON() ([]byte, error)
func (*DomainTransactionWrapper) UnmarshalJSON ¶
func (tw *DomainTransactionWrapper) UnmarshalJSON(data []byte) error
type Ingredient ¶
type Ingredient struct {
TxType string `json:"txType" validate:"required,oneof=0 1 2 3 4 5 6"`
ContractAddress string `json:"contractAddress,omitempty" validate:"omitempty,native"`
Sender string `json:"sender" validate:"required,kas_addr"`
Recipient string `json:"recipient,omitempty" validate:"omitempty,kas_addr"`
Amount string `json:"amount,omitempty" validate:"omitempty,bigint_gt0"`
Fee string `json:"fee,omitempty" validate:"omitempty,u64_gt0"`
Utxos *signing.UtxoList `json:"utxos" validate:"required"`
Krc20RedeemScript string `json:"krc20RedeemScript,omitempty" validate:"omitempty,hex_str"`
}
types
type InputWrapper ¶
type InputWrapper struct {
*externalapi.DomainTransactionInput
}
func (InputWrapper) MarshalJSON ¶
func (iw InputWrapper) MarshalJSON() ([]byte, error)
func (*InputWrapper) UnmarshalJSON ¶
func (iw *InputWrapper) UnmarshalJSON(data []byte) error
type Krc20Params ¶
type OutputWrapper ¶
type OutputWrapper struct {
*externalapi.DomainTransactionOutput
}
func (*OutputWrapper) MarshalJSON ¶
func (ow *OutputWrapper) MarshalJSON() ([]byte, error)
func (*OutputWrapper) UnmarshalJSON ¶
func (ow *OutputWrapper) UnmarshalJSON(data []byte) error
type ScriptBuilder ¶
type ScriptBuilder struct {
// contains filtered or unexported fields
}
func NewScriptBuilder ¶
func NewScriptBuilder() *ScriptBuilder
func (*ScriptBuilder) AddData ¶
func (b *ScriptBuilder) AddData(data []byte) *ScriptBuilder
func (*ScriptBuilder) AddInt64 ¶
func (b *ScriptBuilder) AddInt64(val int64) *ScriptBuilder
func (*ScriptBuilder) AddOp ¶
func (b *ScriptBuilder) AddOp(opcode byte) *ScriptBuilder
func (*ScriptBuilder) Script ¶
func (b *ScriptBuilder) Script() ([]byte, error)
type ScriptClass ¶
type ScriptClass byte
const ( NonStandardTy ScriptClass = iota PubKeyTy PubKeyECDSATy ScriptHashTy )
func ExtractScriptPubKeyAddress ¶
func ExtractScriptPubKeyAddress(scriptPubKey *externalapi.ScriptPublicKey, dagParams *dagconfig.Params) (ScriptClass, util.Address, error)
type TxBuilder ¶
type TxBuilder struct {
*Ingredient
// contains filtered or unexported fields
}
types
func NewTxBuilder ¶
func NewTxBuilder(ti *Ingredient) *TxBuilder
func (*TxBuilder) ConcatSignature ¶
func (*TxBuilder) GetSigHash ¶
func (*TxBuilder) GetUnsignedHex ¶
func (*TxBuilder) SetSigHash ¶
func (*TxBuilder) SetUnsignedHex ¶
Click to show internal directories.
Click to hide internal directories.