Documentation ¶
Index ¶
- Constants
- Variables
- func AssembleTxWitnesses(txRaw []byte, witnesses [][]byte) ([]byte, error)
- func CreateTxWitness(txHash string, wallet ISigner) ([]byte, error)
- func GenerateKeyPair() ([]byte, []byte, error)
- func GetKeyHash(verificationKey []byte) (string, error)
- func GetKeyHashCli(verificationKeyPath string) (string, error)
- func GetOutputsSum(outputs []TxOutput) (receiversSum uint64)
- func GetTxHash(txRaw []byte) (string, error)
- func GetVerificationKeyFromSigningKey(signingKey []byte) []byte
- func GetWalletAddress(wallet IWallet, testNetMagic uint) (addr string, stakeAddr string, err error)
- func SaveKeyBytesToFile(keyBytes []byte, filePath string, isSigningKey bool, isStakeKey bool) error
- func SignMessage(signingKey, verificationKey, message []byte) (result []byte, err error)
- func SignTx(txRaw []byte, txHash string, wallet ISigner) ([]byte, error)
- func VerifyMessage(message, verificationKey, signature []byte) (err error)
- func VerifyWitness(txHash string, witness []byte) error
- func WaitForTransaction(ctx context.Context, txRetriever ITxRetriever, hash string, numRetries int, ...) (map[string]interface{}, error)
- type AddressInfo
- type IPolicyScript
- type ISigner
- type IStakeSigner
- type ITxDataRetriever
- type ITxProvider
- type ITxRetriever
- type ITxSubmitter
- type IUTxORetriever
- type IWallet
- type IWalletManager
- type Key
- type PolicyScript
- type QueryTipData
- type StakeWalletManager
- type TransactionUnwitnessedRaw
- type TransactionWitnessedRaw
- type TxBuilder
- func (b *TxBuilder) AddInputs(inputs ...TxInput) *TxBuilder
- func (b *TxBuilder) AddInputsWithScript(script IPolicyScript, inputs ...TxInput) *TxBuilder
- func (b *TxBuilder) AddInputsWithScripts(inputs []TxInput, scripts []IPolicyScript) *TxBuilder
- func (b *TxBuilder) AddOutputs(outputs ...TxOutput) *TxBuilder
- func (b *TxBuilder) Build() ([]byte, string, error)
- func (b *TxBuilder) CalculateFee(witnessCount int) (uint64, error)
- func (b *TxBuilder) Dispose()
- func (b *TxBuilder) SetFee(fee uint64) *TxBuilder
- func (b *TxBuilder) SetMetaData(metadata []byte) *TxBuilder
- func (b *TxBuilder) SetProtocolParameters(protocolParameters []byte) *TxBuilder
- func (b *TxBuilder) SetProtocolParametersAndTTL(ctx context.Context, retriever ITxDataRetriever, timeToLiveInc uint64) error
- func (b *TxBuilder) SetTestNetMagic(testNetMagic uint) *TxBuilder
- func (b *TxBuilder) SetTimeToLive(timeToLive uint64) *TxBuilder
- func (b *TxBuilder) UpdateOutputAmount(index int, amount uint64) *TxBuilder
- type TxInput
- type TxInputWithPolicyScript
- type TxInputs
- type TxOutput
- type TxProviderBlockFrost
- func (b *TxProviderBlockFrost) Dispose()
- func (b *TxProviderBlockFrost) GetProtocolParameters(ctx context.Context) ([]byte, error)
- func (b *TxProviderBlockFrost) GetTip(ctx context.Context) (QueryTipData, error)
- func (b *TxProviderBlockFrost) GetTxByHash(ctx context.Context, hash string) (map[string]interface{}, error)
- func (b *TxProviderBlockFrost) GetUtxos(ctx context.Context, addr string) ([]Utxo, error)
- func (b *TxProviderBlockFrost) SubmitTx(ctx context.Context, txSigned []byte) error
- type TxProviderCli
- func (b *TxProviderCli) Dispose()
- func (b *TxProviderCli) GetProtocolParameters(_ context.Context) ([]byte, error)
- func (b *TxProviderCli) GetTip(_ context.Context) (QueryTipData, error)
- func (b *TxProviderCli) GetUtxos(_ context.Context, addr string) ([]Utxo, error)
- func (b *TxProviderCli) SubmitTx(_ context.Context, txSigned []byte) error
- type TxWitnessRaw
- type Utxo
- type Wallet
- type WalletManager
Constants ¶
View Source
const FilePermission = 0750
View Source
const MainnetMagic = uint(764824073)
View Source
const (
MinUTxODefaultValue = uint64(1000000)
)
Variables ¶
Functions ¶
func AssembleTxWitnesses ¶
AssembleTxWitnesses assembles final signed transaction
func CreateTxWitness ¶
CreateTxWitness signs transaction hash and creates witness cbor
func GenerateKeyPair ¶
GenerateKeyPair generates ed25519 (signing key, verifying) key pair
func GetKeyHash ¶
GetKeyHash gets Cardano key hash from verification key
func GetKeyHashCli ¶
func GetOutputsSum ¶
func GetVerificationKeyFromSigningKey ¶
GetVerificationKeyFromSigningKey retrieves verification/public key from signing/private key
func GetWalletAddress ¶
GetWalletAddress returns address and stake address for wallet (if wallet is stake wallet)
func SaveKeyBytesToFile ¶
func SignMessage ¶
SignMessage signs message
func VerifyMessage ¶
VerifyMessage verifies message with verificationKey and signature
func VerifyWitness ¶
VerifyWitness verifies if txHash is signed by witness
Types ¶
type AddressInfo ¶
type AddressInfo struct { Address string `json:"address"` Base16 string `json:"base16"` Encoding string `json:"encoding"` Era string `json:"era"` Type string `json:"type"` }
func GetAddressInfo ¶
func GetAddressInfo(address string) (AddressInfo, error)
GetAddressInfo returns address info if string representation for address is valid or error
type IPolicyScript ¶
type IStakeSigner ¶
type ITxDataRetriever ¶
type ITxProvider ¶
type ITxProvider interface { ITxSubmitter ITxDataRetriever IUTxORetriever Dispose() }
type ITxRetriever ¶
type ITxSubmitter ¶
type IUTxORetriever ¶
type IWallet ¶
type IWallet interface { IStakeSigner GetKeyHash() string }
type IWalletManager ¶
type Key ¶
type Key struct { Type string `json:"type"` Description string `json:"description"` Hex string `json:"cborHex"` }
func (Key) GetKeyBytes ¶
func (Key) WriteToFile ¶
type PolicyScript ¶
func NewPolicyScript ¶
func NewPolicyScript(keyHashes []string, atLeastSignersCount int) (*PolicyScript, error)
func NewPolicyScriptFromKeyHash ¶
func NewPolicyScriptFromKeyHash(keyHash string) (*PolicyScript, error)
func (PolicyScript) CreateMultiSigAddress ¶
func (ps PolicyScript) CreateMultiSigAddress(testNetMagic uint) (string, error)
func (PolicyScript) GetCount ¶
func (ps PolicyScript) GetCount() int
func (PolicyScript) GetPolicyID ¶
func (ps PolicyScript) GetPolicyID() (string, error)
func (PolicyScript) GetPolicyScript ¶
func (ps PolicyScript) GetPolicyScript() []byte
type QueryTipData ¶
type StakeWalletManager ¶
type StakeWalletManager struct { }
func NewStakeWalletManager ¶
func NewStakeWalletManager() *StakeWalletManager
type TransactionUnwitnessedRaw ¶
type TransactionUnwitnessedRaw []byte
func NewTransactionUnwitnessedRawFromJSON ¶
func NewTransactionUnwitnessedRawFromJSON(bytes []byte) (TransactionUnwitnessedRaw, error)
func (TransactionUnwitnessedRaw) ToJSON ¶
func (tx TransactionUnwitnessedRaw) ToJSON() ([]byte, error)
type TransactionWitnessedRaw ¶
type TransactionWitnessedRaw []byte
func NewTransactionWitnessedRawFromJSON ¶
func NewTransactionWitnessedRawFromJSON(bytes []byte) (TransactionWitnessedRaw, error)
func (TransactionWitnessedRaw) ToJSON ¶
func (tx TransactionWitnessedRaw) ToJSON() ([]byte, error)
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
func NewTxBuilder ¶
func (*TxBuilder) AddInputsWithScript ¶
func (b *TxBuilder) AddInputsWithScript(script IPolicyScript, inputs ...TxInput) *TxBuilder
func (*TxBuilder) AddInputsWithScripts ¶
func (b *TxBuilder) AddInputsWithScripts(inputs []TxInput, scripts []IPolicyScript) *TxBuilder
func (*TxBuilder) AddOutputs ¶
func (*TxBuilder) SetMetaData ¶
func (*TxBuilder) SetProtocolParameters ¶
func (*TxBuilder) SetProtocolParametersAndTTL ¶
func (*TxBuilder) SetTestNetMagic ¶
func (*TxBuilder) SetTimeToLive ¶
type TxInputWithPolicyScript ¶
type TxInputWithPolicyScript struct { Input TxInput PolicyScript IPolicyScript }
type TxProviderBlockFrost ¶
type TxProviderBlockFrost struct {
// contains filtered or unexported fields
}
func NewTxProviderBlockFrost ¶
func NewTxProviderBlockFrost(url string, projectID string) (*TxProviderBlockFrost, error)
func (*TxProviderBlockFrost) Dispose ¶
func (b *TxProviderBlockFrost) Dispose()
func (*TxProviderBlockFrost) GetProtocolParameters ¶
func (b *TxProviderBlockFrost) GetProtocolParameters(ctx context.Context) ([]byte, error)
func (*TxProviderBlockFrost) GetTip ¶
func (b *TxProviderBlockFrost) GetTip(ctx context.Context) (QueryTipData, error)
func (*TxProviderBlockFrost) GetTxByHash ¶
type TxProviderCli ¶
type TxProviderCli struct {
// contains filtered or unexported fields
}
func NewTxProviderCli ¶
func NewTxProviderCli(testNetMagic uint, socketPath string) (*TxProviderCli, error)
func (*TxProviderCli) Dispose ¶
func (b *TxProviderCli) Dispose()
func (*TxProviderCli) GetProtocolParameters ¶
func (b *TxProviderCli) GetProtocolParameters(_ context.Context) ([]byte, error)
func (*TxProviderCli) GetTip ¶
func (b *TxProviderCli) GetTip(_ context.Context) (QueryTipData, error)
type TxWitnessRaw ¶
type TxWitnessRaw []byte // cbor slice of bytes
func (TxWitnessRaw) GetSignatureAndVKey ¶
func (w TxWitnessRaw) GetSignatureAndVKey() ([]byte, []byte, error)
func (TxWitnessRaw) ToJSON ¶
func (w TxWitnessRaw) ToJSON() ([]byte, error)
type Wallet ¶
type Wallet struct { VerificationKey []byte `json:"verificationKey"` SigningKey []byte `json:"signingKey"` KeyHash string `json:"keyHash"` StakeVerificationKey []byte `json:"stakeVerificationKey"` StakeSigningKey []byte `json:"stakeSigningKey"` }
func NewStakeWallet ¶
func (Wallet) GetKeyHash ¶
func (Wallet) GetSigningKey ¶
func (Wallet) GetStakeSigningKey ¶
func (Wallet) GetStakeVerificationKey ¶
func (Wallet) GetVerificationKey ¶
type WalletManager ¶
type WalletManager struct { }
func NewWalletManager ¶
func NewWalletManager() *WalletManager
Click to show internal directories.
Click to hide internal directories.