libgoal

package
v0.0.0-...-76c1feb Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultKMDDataDir = nodecontrol.DefaultKMDDataDir

DefaultKMDDataDir is the name of the directory within the algod data directory where kmd data goes

Variables

View Source
var UnencryptedWalletName = []byte("unencrypted-default-wallet")

UnencryptedWalletName is the name of the default, unencrypted wallet

Functions

func AlgorandDaemonSystemdManaged

func AlgorandDaemonSystemdManaged(dataDir string) bool

AlgorandDaemonSystemdManaged returns true if the algod process for a given data dir is managed by systemd if not, algod will be managed as an indivudal process for the dir

func AlgorandDataIsPrivate

func AlgorandDataIsPrivate(dataDir string) bool

AlgorandDataIsPrivate returns true if the algod data dir can be considered 'private' and we can store all related data there. Otherwise, some data will likely go under ${HOME}/.algorand/

func MakeDryrunState

func MakeDryrunState(client Client, txnOrStxn interface{}, other []transactions.SignedTxn, proto string) (dr v2.DryrunRequest, err error)

MakeDryrunState function creates v2.DryrunRequest data structure

func MakeDryrunStateBytes

func MakeDryrunStateBytes(client Client, txnOrStxn interface{}, other []transactions.SignedTxn, proto string, format string) (result []byte, err error)

MakeDryrunStateBytes function creates DryrunRequest data structure in serialized form according to the format

func MakeDryrunStateGenerated

func MakeDryrunStateGenerated(client Client, txnOrStxn interface{}, other []transactions.SignedTxn, proto string) (dr generatedV2.DryrunRequest, err error)

MakeDryrunStateGenerated function creates generatedV2.DryrunRequest data structure

Types

type BitcoinWIF

type BitcoinWIF string

func (BitcoinWIF) Public

func (w BitcoinWIF) Public() []byte

func (BitcoinWIF) Sign

func (w BitcoinWIF) Sign(rand io.Reader, digest []byte) ([]byte, error)

type Client

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

Client represents the entry point for all libgoal functions

func MakeClient

func MakeClient(dataDir, cacheDir string, clientType ClientType) (c Client, err error)

MakeClient creates and inits a libgoal.Client

func MakeClientFromConfig

func MakeClientFromConfig(config ClientConfig, clientType ClientType) (c Client, err error)

MakeClientFromConfig creates a libgoal.Client from a config struct with many options.

func MakeClientWithBinDir

func MakeClientWithBinDir(binDir, dataDir, cacheDir string, clientType ClientType) (c Client, err error)

MakeClientWithBinDir creates and inits a libgoal.Client, additionally allowing the user to specify a binary directory

func (*Client) AbortCatchup

func (c *Client) AbortCatchup() error

AbortCatchup aborts the currently running catchup

func (*Client) AccountData

func (c *Client) AccountData(account string) (accountData basics.AccountData, err error)

AccountData takes an address and returns its basics.AccountData

func (*Client) AccountInformation

func (c *Client) AccountInformation(account string) (resp v1.Account, err error)

AccountInformation takes an address and returns its information

func (*Client) AccountInformationV2

func (c *Client) AccountInformationV2(account string) (resp generatedV2.Account, err error)

AccountInformationV2 takes an address and returns its information

func (Client) AlgodVersions

func (c Client) AlgodVersions() (resp common.Version, err error)

AlgodVersions return the list of supported API versions in algod

func (*Client) ApplicationInformation

func (c *Client) ApplicationInformation(index uint64) (resp generatedV2.Application, err error)

ApplicationInformation takes an app's index and returns its information

func (*Client) AssetInformation

func (c *Client) AssetInformation(index uint64) (resp v1.AssetParams, err error)

AssetInformation takes an asset's index and returns its information

func (*Client) AssetInformationV2

func (c *Client) AssetInformationV2(index uint64) (resp generatedV2.Asset, err error)

AssetInformationV2 takes an asset's index and returns its information

func (*Client) Block

func (c *Client) Block(round uint64) (resp v1.Block, err error)

Block takes a round and returns its block

func (*Client) BookkeepingBlock

func (c *Client) BookkeepingBlock(round uint64) (block bookkeeping.Block, err error)

BookkeepingBlock takes a round and returns its block

func (*Client) BroadcastTransaction

func (c *Client) BroadcastTransaction(stx transactions.SignedTxn) (txid string, err error)

BroadcastTransaction broadcasts a signed transaction to the network using algod

func (*Client) BroadcastTransactionGroup

func (c *Client) BroadcastTransactionGroup(txgroup []transactions.SignedTxn) error

BroadcastTransactionGroup broadcasts a signed transaction group to the network using algod

func (*Client) Catchup

func (c *Client) Catchup(catchpointLabel string) error

Catchup start catching up to the give catchpoint label.

func (*Client) Compile

func (c *Client) Compile(program []byte) (compiledProgram []byte, compiledProgramHash crypto.Digest, err error)

Compile compiles the given program and returned the compiled program

func (*Client) ComputeValidityRounds

func (c *Client) ComputeValidityRounds(firstValid, lastValid, validRounds uint64) (uint64, uint64, error)

ComputeValidityRounds takes first, last and rounds provided by a user and resolves them into actual firstValid and lastValid. Resolution table

validRounds | lastValid | result (lastValid) -------------------------------------------------

  	 0     |     0     | firstValid + maxTxnLife
	 0     |     N     | lastValid
	 M     |     0     | first + validRounds - 1
	 M     |     M     | error

func (*Client) ConsensusParams

func (c *Client) ConsensusParams(round uint64) (consensus config.ConsensusParams, err error)

ConsensusParams returns the consensus parameters for the protocol active at the specified round

func (*Client) ConstructPayment

func (c *Client) ConstructPayment(from, to string, fee, amount uint64, note []byte, closeTo string, lease [32]byte, firstValid, lastValid basics.Round) (transactions.Transaction, error)

ConstructPayment builds a payment transaction to be signed If the fee is 0, the function will use the suggested one form the network Although firstValid and lastValid come pre-computed in a normal flow, additional validation is done by computeValidityRounds: if the lastValid is 0, firstValid + maxTxnLifetime will be used if the firstValid is 0, lastRound + 1 will be used

func (*Client) CreateMultisigAccount

func (c *Client) CreateMultisigAccount(walletHandle []byte, threshold uint8, addrs []string) (string, error)

CreateMultisigAccount takes a wallet handle, a list of (nonmultisig) addresses, and a threshold and creates (and returns) a multisig adress TODO: Should these be raw public keys instead of addresses so users can't shoot themselves in the foot by passing in a multisig addr? Probably will become irrelevant after CSID changes.

func (*Client) CreateWallet

func (c *Client) CreateWallet(name []byte, password []byte, mdk crypto.MasterDerivationKey) ([]byte, error)

CreateWallet creates a kmd wallet with the specified parameters

func (Client) CurrentRound

func (c Client) CurrentRound() (lastRound uint64, err error)

CurrentRound returns the current known round

func (*Client) DataDir

func (c *Client) DataDir() string

DataDir returns the Algorand's client data directory path

func (*Client) DeleteAccount

func (c *Client) DeleteAccount(walletHandle []byte, walletPassword []byte, addr string) error

DeleteAccount deletes an account.

func (*Client) DeleteMultisigAccount

func (c *Client) DeleteMultisigAccount(walletHandle []byte, walletPassword []byte, addr string) error

DeleteMultisigAccount deletes a multisig account.

func (*Client) Dryrun

func (c *Client) Dryrun(data []byte) (resp generatedV2.DryrunResponse, err error)

Dryrun takes an app's index and returns its information

func (*Client) ExportKey

func (c *Client) ExportKey(walletHandle []byte, password, account string) (resp kmdapi.APIV1POSTKeyExportResponse, err error)

ExportKey exports the private key of the passed account, assuming it's available

func (*Client) ExportMasterDerivationKey

func (c *Client) ExportMasterDerivationKey(wh []byte, pw []byte) (mdk crypto.MasterDerivationKey, err error)

ExportMasterDerivationKey returns the master derivation key from the given wallet

func (*Client) FillUnsignedTxTemplate

func (c *Client) FillUnsignedTxTemplate(sender string, firstValid, lastValid, fee uint64, tx transactions.Transaction) (transactions.Transaction, error)

FillUnsignedTxTemplate fills in header fields in a partially-filled-in transaction.

func (*Client) FindWalletIDByName

func (c *Client) FindWalletIDByName(name []byte) (wid []byte, duplicate bool, err error)

FindWalletIDByName searches the list of wallets for one with the passed name, and returns its ID. If there is more than one wallet with the passed name, it sets duplicate to true.

func (*Client) FindWalletNameByID

func (c *Client) FindWalletNameByID(wid []byte) (name []byte, duplicate bool, err error)

FindWalletNameByID searches the list of wallets for one with the passed ID, and returns its name. If there is more than one wallet with the passed ID, it sets duplicate to true.

func (*Client) FullStop

func (c *Client) FullStop() error

FullStop stops the clients including graceful shutdown to algod and kmd

func (*Client) GenParticipationKeys

func (c *Client) GenParticipationKeys(address string, firstValid, lastValid, keyDilution uint64) (part account.Participation, filePath string, err error)

GenParticipationKeys creates a .partkey database for a given address, fills it with keys, and installs it in the right place

func (*Client) GenParticipationKeysTo

func (c *Client) GenParticipationKeysTo(address string, firstValid, lastValid, keyDilution uint64, outDir string) (part account.Participation, filePath string, err error)

GenParticipationKeysTo creates a .partkey database for a given address, fills it with keys, and saves it in the specified output directory.

func (*Client) GenerateAddress

func (c *Client) GenerateAddress(walletHandle []byte) (string, error)

GenerateAddress takes a wallet handle, generate an additional address for it and returns the public address

func (*Client) GenesisID

func (c *Client) GenesisID() (string, error)

GenesisID fetches the genesis ID for the running algod node

func (*Client) GetBalance

func (c *Client) GetBalance(address string) (uint64, error)

GetBalance takes an address and returns its total balance; if the address doesn't exist, it returns 0.

func (*Client) GetInputBalance

func (c *Client) GetInputBalance(ticker, addr string) (uint64, error)

func (*Client) GetInputsBalance

func (c *Client) GetInputsBalance(inputs ...Input) (uint64, error)

GetInputsBalance gets the combined remaining balance of the specified inputs.

func (*Client) GetPendingTransactions

func (c *Client) GetPendingTransactions(maxTxns uint64) (resp v1.PendingTransactions, err error)

GetPendingTransactions gets a snapshot of current pending transactions on the node. If maxTxns = 0, fetches as many transactions as possible.

func (*Client) GetUnencryptedWalletHandle

func (c *Client) GetUnencryptedWalletHandle() ([]byte, error)

GetUnencryptedWalletHandle returns the unencrypted wallet handle. If there is no unencrypted wallet, it creates one first. This should never be used outside of tests, because it creates a wallet named unencrypted-default-wallet if it doesn't exist.

func (*Client) GetWalletHandleToken

func (c *Client) GetWalletHandleToken(wid, pw []byte) ([]byte, error)

GetWalletHandleToken inits the wallet with the given id, returning a wallet handle token

func (*Client) GetWalletHandleTokenCached

func (c *Client) GetWalletHandleTokenCached(walletID, pw []byte) ([]byte, error)

GetWalletHandleTokenCached first checks the cache for a valid token for this wallet and renews it if possible. If there aren't any valid cached tokens, it generates a new one and adds it to the cache.

func (*Client) GroupID

func (c *Client) GroupID(txgroup []transactions.Transaction) (gid crypto.Digest, err error)

GroupID computes the group ID for a group of transactions.

func (*Client) HealthCheck

func (c *Client) HealthCheck() error

HealthCheck returns an error if something is wrong

func (*Client) ImportKey

func (c *Client) ImportKey(walletHandle []byte, secretKey []byte) (response kmdapi.APIV1POSTKeyImportResponse, err error)

ImportKey wraps imports a secret key into the kmd wallet using the passed walletHandle

func (*Client) InstallParticipationKeys

func (c *Client) InstallParticipationKeys(inputfile string) (part account.Participation, filePath string, err error)

InstallParticipationKeys creates a .partkey database for a given address, based on an existing database from inputfile. On successful install, it deletes the input file.

func (Client) LedgerSupply

func (c Client) LedgerSupply() (resp v1.Supply, err error)

LedgerSupply returns the total number of algos in the system

func (*Client) ListAddresses

func (c *Client) ListAddresses(walletHandle []byte) ([]string, error)

ListAddresses takes a wallet handle and returns the list of addresses associated with it. If no addresses are associated with the wallet, it returns an empty list.

func (*Client) ListAddressesWithInfo

func (c *Client) ListAddressesWithInfo(walletHandle []byte) ([]ListedAddress, error)

ListAddressesWithInfo takes a wallet handle and returns the list of addresses associated with it, along with additional information to indicate if an address is multisig or not. If no addresses are associated with the wallet, it returns an empty list.

func (*Client) ListParticipationKeys

func (c *Client) ListParticipationKeys() (partKeyFiles map[string]account.Participation, err error)

ListParticipationKeys returns the available participation keys, as a map from database filename to Participation key object.

func (*Client) ListWallets

func (c *Client) ListWallets() (wallets []kmdapi.APIV1Wallet, err error)

ListWallets returns the list of wallets that kmd is aware of

func (*Client) LookupMultisigAccount

func (c *Client) LookupMultisigAccount(walletHandle []byte, multisigAddr string) (info MultisigInfo, err error)

LookupMultisigAccount returns the threshold and public keys for a multisig address.

func (*Client) MakeUnsignedAppClearStateTx

func (c *Client) MakeUnsignedAppClearStateTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64) (tx transactions.Transaction, err error)

MakeUnsignedAppClearStateTx makes a transaction for clearing out all account-specific state for an application. It may not be rejected by the application's logic.

func (*Client) MakeUnsignedAppCloseOutTx

func (c *Client) MakeUnsignedAppCloseOutTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64) (tx transactions.Transaction, err error)

MakeUnsignedAppCloseOutTx makes a transaction for closing out of (deallocating all account-specific state for) an application

func (*Client) MakeUnsignedAppCreateTx

func (c *Client) MakeUnsignedAppCreateTx(onComplete transactions.OnCompletion, approvalProg []byte, clearProg []byte, globalSchema basics.StateSchema, localSchema basics.StateSchema, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64, extrapages uint32) (tx transactions.Transaction, err error)

MakeUnsignedAppCreateTx makes a transaction for creating an application

func (*Client) MakeUnsignedAppDeleteTx

func (c *Client) MakeUnsignedAppDeleteTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64) (tx transactions.Transaction, err error)

MakeUnsignedAppDeleteTx makes a transaction for deleting an application

func (*Client) MakeUnsignedAppNoOpTx

func (c *Client) MakeUnsignedAppNoOpTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64) (tx transactions.Transaction, err error)

MakeUnsignedAppNoOpTx makes a transaction for interacting with an existing application, potentially updating any account-specific local state and global state associated with it.

func (*Client) MakeUnsignedAppOptInTx

func (c *Client) MakeUnsignedAppOptInTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64) (tx transactions.Transaction, err error)

MakeUnsignedAppOptInTx makes a transaction for opting in to (allocating some account-specific state for) an application

func (*Client) MakeUnsignedAppUpdateTx

func (c *Client) MakeUnsignedAppUpdateTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64, approvalProg []byte, clearProg []byte) (tx transactions.Transaction, err error)

MakeUnsignedAppUpdateTx makes a transaction for updating an application's programs

func (*Client) MakeUnsignedApplicationCallTx

func (c *Client) MakeUnsignedApplicationCallTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64, onCompletion transactions.OnCompletion, approvalProg []byte, clearProg []byte, globalSchema basics.StateSchema, localSchema basics.StateSchema, extrapages uint32) (tx transactions.Transaction, err error)

MakeUnsignedApplicationCallTx is a helper for the above ApplicationCall transaction constructors. A fully custom ApplicationCall transaction may be constructed using this method.

func (*Client) MakeUnsignedAssetConfigTx

func (c *Client) MakeUnsignedAssetConfigTx(creator string, index uint64, newManager *string, newReserve *string, newFreeze *string, newClawback *string) (transactions.Transaction, error)

MakeUnsignedAssetConfigTx creates a tx template for changing the keys for an asset. A nil pointer for a new key argument means no change to existing key. An empty string means a zero key (which cannot be changed after becoming zero).

Call FillUnsignedTxTemplate afterwards to fill out common fields in the resulting transaction template.

func (*Client) MakeUnsignedAssetCreateTx

func (c *Client) MakeUnsignedAssetCreateTx(total uint64, defaultFrozen bool, manager string, reserve string, freeze string, clawback string, unitName string, assetName string, url string, metadataHash []byte, decimals uint32) (transactions.Transaction, error)

MakeUnsignedAssetCreateTx creates a tx template for creating an asset.

Call FillUnsignedTxTemplate afterwards to fill out common fields in the resulting transaction template.

func (*Client) MakeUnsignedAssetDestroyTx

func (c *Client) MakeUnsignedAssetDestroyTx(index uint64) (transactions.Transaction, error)

MakeUnsignedAssetDestroyTx creates a tx template for destroying an asset.

Call FillUnsignedTxTemplate afterwards to fill out common fields in the resulting transaction template.

func (*Client) MakeUnsignedAssetFreezeTx

func (c *Client) MakeUnsignedAssetFreezeTx(index uint64, accountToChange string, newFreezeSetting bool) (transactions.Transaction, error)

MakeUnsignedAssetFreezeTx creates a tx template for freezing assets.

Call FillUnsignedTxTemplate afterwards to fill out common fields in the resulting transaction template.

func (*Client) MakeUnsignedAssetSendTx

func (c *Client) MakeUnsignedAssetSendTx(index uint64, amount uint64, recipient string, closeTo string, senderForClawback string) (transactions.Transaction, error)

MakeUnsignedAssetSendTx creates a tx template for sending assets. To allocate a slot for a particular asset, send a zero amount to self.

Call FillUnsignedTxTemplate afterwards to fill out common fields in the resulting transaction template.

func (*Client) MakeUnsignedBecomeNonparticipatingTx

func (c *Client) MakeUnsignedBecomeNonparticipatingTx(address string, firstValid, lastValid, fee uint64) (transactions.Transaction, error)

MakeUnsignedBecomeNonparticipatingTx creates a transaction that will mark an account as non-participating

func (*Client) MakeUnsignedGoOfflineTx

func (c *Client) MakeUnsignedGoOfflineTx(address string, firstValid, lastValid, fee uint64, leaseBytes [32]byte) (transactions.Transaction, error)

MakeUnsignedGoOfflineTx creates a transaction that will bring an address offline

func (*Client) MakeUnsignedGoOnlineTx

func (c *Client) MakeUnsignedGoOnlineTx(address string, part *account.Participation, firstValid, lastValid, fee uint64, leaseBytes [32]byte) (transactions.Transaction, error)

MakeUnsignedGoOnlineTx creates a transaction that will bring an address online using available participation keys

func (*Client) MultisigSignProgramWithWallet

func (c *Client) MultisigSignProgramWithWallet(walletHandle, pw, program []byte, signerAddr string, partial crypto.MultisigSig) (msig crypto.MultisigSig, err error)

MultisigSignProgramWithWallet creates a multisig (or adds to an existing partial multisig, if one is provided), signing with the key corresponding to the given address and using the specified wallet

func (*Client) MultisigSignTransactionWithWallet

func (c *Client) MultisigSignTransactionWithWallet(walletHandle, pw []byte, utx transactions.Transaction, signerAddr string, partial crypto.MultisigSig) (msig crypto.MultisigSig, err error)

MultisigSignTransactionWithWallet creates a multisig (or adds to an existing partial multisig, if one is provided), signing with the key corresponding to the given address and using the specified wallet TODO instead of returning MultisigSigs, accept and return blobs

func (*Client) MultisigSignTransactionWithWalletAndSigner

func (c *Client) MultisigSignTransactionWithWalletAndSigner(walletHandle, pw []byte, utx transactions.Transaction, signerAddr string, partial crypto.MultisigSig, signerMsig string) (msig crypto.MultisigSig, err error)

MultisigSignTransactionWithWalletAndSigner creates a multisig (or adds to an existing partial multisig, if one is provided), signing with the key corresponding to the given address and using the specified wallet

func (*Client) PendingTransactionInformation

func (c *Client) PendingTransactionInformation(txid string) (resp v1.Transaction, err error)

PendingTransactionInformation returns information about a recently issued transaction based on its txid.

func (*Client) RawBlock

func (c *Client) RawBlock(round uint64) (resp v1.RawBlock, err error)

RawBlock takes a round and returns its block

func (*Client) ReleaseWalletHandle

func (c *Client) ReleaseWalletHandle(wh []byte) error

ReleaseWalletHandle invalidates the passed wallet handle token

func (*Client) SendPaymentFromInput

func (c *Client) SendPaymentFromInput(walletHandle, pw []byte, input Input, to string, fee, amount uint64, note []byte, firstValid, lastValid basics.Round) (transactions.Transaction, error)

SendPaymentFromInput claims the specified input.

func (*Client) SendPaymentFromUnencryptedWallet

func (c *Client) SendPaymentFromUnencryptedWallet(from, to string, fee, amount uint64, note []byte) (transactions.Transaction, error)

SendPaymentFromUnencryptedWallet signs a transaction using the default wallet and returns the resulted transaction id

func (*Client) SendPaymentFromWallet

func (c *Client) SendPaymentFromWallet(walletHandle, pw []byte, from, to string, fee, amount uint64, note []byte, closeTo string, firstValid, lastValid basics.Round) (transactions.Transaction, error)

SendPaymentFromWallet signs a transaction using the given wallet and returns the resulted transaction id

func (*Client) SendPaymentFromWalletWithLease

func (c *Client) SendPaymentFromWalletWithLease(walletHandle, pw []byte, from, to string, fee, amount uint64, note []byte, closeTo string, lease [32]byte, firstValid, lastValid basics.Round) (transactions.Transaction, error)

SendPaymentFromWalletWithLease is like SendPaymentFromWallet, but with a custom lease.

func (*Client) SetAPIVersionAffinity

func (c *Client) SetAPIVersionAffinity(algodVersionAffinity algodclient.APIVersion, kmdVersionAffinity kmdclient.APIVersion)

SetAPIVersionAffinity sets the desired client API version affinity of the algod and kmd clients.

func (*Client) SetKMDStartArgs

func (c *Client) SetKMDStartArgs(args nodecontrol.KMDStartArgs)

SetKMDStartArgs sets the arguments used when starting kmd

func (*Client) SignAndBroadcastTransaction

func (c *Client) SignAndBroadcastTransaction(walletHandle, pw []byte, utx transactions.Transaction) (txid string, err error)

SignAndBroadcastTransaction signs the unsigned transaction with keys from the default wallet, and broadcasts it

func (*Client) SignProgramWithWallet

func (c *Client) SignProgramWithWallet(walletHandle, pw []byte, addr string, program []byte) (signature crypto.Signature, err error)

SignProgramWithWallet signs the passed transaction with keys from the wallet associated with the passed walletHandle

func (*Client) SignTransactionWithWallet

func (c *Client) SignTransactionWithWallet(walletHandle, pw []byte, utx transactions.Transaction) (stx transactions.SignedTxn, err error)

SignTransactionWithWallet signs the passed transaction with keys from the wallet associated with the passed walletHandle

func (*Client) SignTransactionWithWalletAndSigner

func (c *Client) SignTransactionWithWalletAndSigner(walletHandle, pw []byte, signerAddr string, utx transactions.Transaction) (stx transactions.SignedTxn, err error)

SignTransactionWithWalletAndSigner signs the passed transaction under a specific signer (which may differ from the sender's address). This is necessary after an account has been rekeyed. If signerAddr is the empty string, just infer spending key from the sender address.

func (*Client) Status

func (c *Client) Status() (resp generatedV2.NodeStatusResponse, err error)

Status returns the node status

func (*Client) SuggestedFee

func (c *Client) SuggestedFee() (fee uint64, err error)

SuggestedFee returns the suggested fee per byte by the network

func (*Client) SuggestedParams

func (c *Client) SuggestedParams() (params v1.TransactionParams, err error)

SuggestedParams returns the suggested parameters for a new transaction

func (*Client) TransactionInformation

func (c *Client) TransactionInformation(addr, txid string) (resp v1.Transaction, err error)

TransactionInformation takes an address and associated txid and return its information

func (*Client) TxnProof

func (c *Client) TxnProof(txid string, round uint64) (resp generatedV2.ProofResponse, err error)

TxnProof returns a Merkle proof for a transaction in a block.

func (*Client) UnencryptedMultisigSignTransaction

func (c *Client) UnencryptedMultisigSignTransaction(utx transactions.Transaction, signerAddr string, partial crypto.MultisigSig) (msig crypto.MultisigSig, err error)

UnencryptedMultisigSignTransaction is MultisigSignTransactionWithWallet for the default wallet

func (*Client) WaitForRound

func (c *Client) WaitForRound(round uint64) (resp generatedV2.NodeStatusResponse, err error)

WaitForRound takes a round, waits until it appears and returns its status. This function blocks.

func (*Client) WalletIsUnencrypted

func (c *Client) WalletIsUnencrypted(wid []byte) bool

WalletIsUnencrypted is a helper that checks if the passed wallet ID requires a password. This function will also return false if there are any other errors when contacting kmd. TODO: return errors when the kmd API has proper error codes

type ClientConfig

type ClientConfig struct {
	// AlgodDataDir is the data dir for `algod`
	AlgodDataDir string

	// KMDDataDir is the data dir for `kmd`, default ${HOME}/.algorand/kmd
	KMDDataDir string

	// CacheDir is a place to store some stuff
	CacheDir string

	// BinDir may be "" and it will be guesed
	BinDir string
}

ClientConfig is data to configure a Client

type ClientType

type ClientType int

ClientType represents the type of client you need It ensures the specified type(s) can be initialized when the libgoal client is created. Any client type not specified will be initialized on-demand.

const (
	// DynamicClient creates clients on-demand
	DynamicClient ClientType = iota
	// KmdClient ensures the kmd client can be initialized when created
	KmdClient
	// AlgodClient ensures the algod client can be initialized when created
	AlgodClient
	// FullClient ensures all clients can be initialized when created
	FullClient
)

type EthereumPrivateKey

type EthereumPrivateKey string

func (EthereumPrivateKey) Public

func (k EthereumPrivateKey) Public() []byte

func (EthereumPrivateKey) Sign

func (k EthereumPrivateKey) Sign(rand io.Reader, digest []byte) ([]byte, error)

type Input

type Input struct {
	Ticker, Address string
	Signer          InputSigner
}

func (Input) Source

func (in Input) Source() basics.InputAddress

type InputSigner

type InputSigner interface {
	Public() []byte
	Sign(rand io.Reader, digest []byte) ([]byte, error)
}

type ListedAddress

type ListedAddress struct {
	Addr     string
	Multisig bool
}

ListedAddress is an address returned by ListAddresses, with a flag to indicate whether it's a multisig address.

type MultisigInfo

type MultisigInfo struct {
	Version   uint8
	Threshold uint8
	PKs       []string
}

MultisigInfo represents the information about a multisig account.

type SystemConfig

type SystemConfig struct {
	// SharedServer is true if this is a daemon on a multiuser system.
	// If not shared, kmd and other files are often stored under $ALGORAND_DATA when otherwise they might go under $HOME/.algorand/
	SharedServer   bool `json:"shared_server,omitempty"`
	SystemdManaged bool `json:"systemd_managed,omitempty"`
}

SystemConfig is the json object in $ALGORAND_DATA/system.json

func ReadSystemConfig

func ReadSystemConfig(dataDir string) (sc SystemConfig, err error)

ReadSystemConfig read and parse $ALGORAND_DATA/system.json

Jump to

Keyboard shortcuts

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