Documentation ¶
Index ¶
- Constants
- Variables
- func AlgorandDaemonSystemdManaged(dataDir string) bool
- func AlgorandDataIsPrivate(dataDir string) bool
- func MakeDryrunState(client Client, txnOrStxn interface{}, otherTxns []transactions.SignedTxn, ...) (dr v2.DryrunRequest, err error)
- func MakeDryrunStateBytes(client Client, txnOrStxn interface{}, otherTxns []transactions.SignedTxn, ...) (result []byte, err error)
- func MakeDryrunStateGenerated(client Client, txnOrStxnOrSlice interface{}, ...) (dr model.DryrunRequest, err error)
- type Client
- func (c *Client) AbortCatchup() error
- func (c *Client) AccountApplicationInformation(accountAddress string, applicationID uint64) (resp model.AccountApplicationResponse, err error)
- func (c *Client) AccountAssetInformation(accountAddress string, assetID uint64) (resp model.AccountAssetResponse, err error)
- func (c *Client) AccountAssetsInformation(account string, next *string, limit *uint64) (resp model.AccountAssetsInformationResponse, err error)
- func (c *Client) AccountData(account string) (accountData basics.AccountData, err error)
- func (c *Client) AccountInformation(account string, includeCreatables bool) (resp model.Account, err error)
- func (c *Client) AddParticipationKey(keyfile string) (resp model.PostParticipationResponse, err error)
- func (c Client) AlgodVersions() (resp common.Version, err error)
- func (c *Client) ApplicationBoxes(appID uint64, maxBoxNum uint64) (resp model.BoxesResponse, err error)
- func (c *Client) ApplicationInformation(index uint64) (resp model.Application, err error)
- func (c *Client) AssetInformation(index uint64) (resp model.Asset, err error)
- func (c *Client) Block(round uint64) (resp v2.BlockResponseJSON, err error)
- func (c *Client) BlockLogs(round uint64) (resp model.BlockLogsResponse, err error)
- func (c *Client) BookkeepingBlock(round uint64) (block bookkeeping.Block, err error)
- func (c *Client) BroadcastTransaction(stx transactions.SignedTxn) (txid string, err error)
- func (c *Client) BroadcastTransactionAsync(stx transactions.SignedTxn) error
- func (c *Client) BroadcastTransactionGroup(txgroup []transactions.SignedTxn) error
- func (c *Client) Catchup(catchpointLabel string, min uint64) (model.CatchpointStartResponse, error)
- func (c *Client) Compile(program []byte, useSourceMap bool) (compiledProgram []byte, compiledProgramHash crypto.Digest, ...)
- func (c *Client) ComputeValidityRounds(firstValid, lastValid, validRounds uint64) (first, last, latest uint64, err error)
- func (c *Client) ConsensusParams(round uint64) (consensus config.ConsensusParams, err error)
- func (c *Client) ConstructPayment(from, to string, fee, amount uint64, note []byte, closeTo string, ...) (transactions.Transaction, error)
- func (c *Client) CreateMultisigAccount(walletHandle []byte, threshold uint8, addrs []string) (string, error)
- func (c *Client) CreateWallet(name []byte, password []byte, mdk crypto.MasterDerivationKey) ([]byte, error)
- func (c Client) CurrentRound() (lastRound uint64, err error)
- func (c *Client) DataDir() string
- func (c *Client) DeleteAccount(walletHandle []byte, walletPassword []byte, addr string) error
- func (c *Client) DeleteMultisigAccount(walletHandle []byte, walletPassword []byte, addr string) error
- func (c *Client) Dryrun(data []byte) (resp model.DryrunResponse, err error)
- func (c *Client) ExportKey(walletHandle []byte, password, account string) (resp kmdapi.APIV1POSTKeyExportResponse, err error)
- func (c *Client) ExportMasterDerivationKey(wh []byte, pw []byte) (mdk crypto.MasterDerivationKey, err error)
- func (c *Client) FillUnsignedTxTemplate(sender string, firstValid, lastValid, fee uint64, tx transactions.Transaction) (transactions.Transaction, error)
- func (c *Client) FindWalletIDByName(name []byte) (wid []byte, duplicate bool, err error)
- func (c *Client) FindWalletNameByID(wid []byte) (name []byte, duplicate bool, err error)
- func (c *Client) FullStop() error
- func (c *Client) GenParticipationKeys(address string, firstValid, lastValid, keyDilution uint64) (part account.Participation, filePath string, err error)
- func (c *Client) GenerateAddress(walletHandle []byte) (string, error)
- func (c *Client) GenesisID() (string, error)
- func (c *Client) GetApplicationBoxByName(index uint64, name string) (resp model.BoxResponse, err error)
- func (c *Client) GetBalance(address string) (uint64, error)
- func (c *Client) GetLedgerStateDelta(round uint64) (rep ledgercore.StateDelta, err error)
- func (c *Client) GetParsedPendingTransactions(maxTxns uint64) (txns PendingTransactions, err error)
- func (c *Client) GetParsedPendingTransactionsByAddress(addr string, maxTxns uint64) (txns PendingTransactions, err error)
- func (c *Client) GetParticipationKeyByID(id string) (resp model.ParticipationKeyResponse, err error)
- func (c *Client) GetParticipationKeys() (resp model.ParticipationKeysResponse, err error)
- func (c *Client) GetPendingTransactions(maxTxns uint64) (resp model.PendingTransactionsResponse, err error)
- func (c *Client) GetPendingTransactionsByAddress(addr string, maxTxns uint64) (resp model.PendingTransactionsResponse, err error)
- func (c *Client) GetSyncRound() (rep model.GetSyncRoundResponse, err error)
- func (c *Client) GetUnencryptedWalletHandle() ([]byte, error)
- func (c *Client) GetWalletHandleToken(wid, pw []byte) ([]byte, error)
- func (c *Client) GetWalletHandleTokenCached(walletID, pw []byte) ([]byte, error)
- func (c *Client) GroupID(txgroup []transactions.Transaction) (gid crypto.Digest, err error)
- func (c *Client) HealthCheck() error
- func (c *Client) ImportKey(walletHandle []byte, secretKey []byte) (response kmdapi.APIV1POSTKeyImportResponse, err error)
- func (c Client) LedgerSupply() (resp model.SupplyResponse, err error)
- func (c *Client) LightBlockHeaderProof(round uint64) (resp model.LightBlockHeaderProofResponse, err error)
- func (c *Client) ListAddresses(walletHandle []byte) ([]string, error)
- func (c *Client) ListAddressesWithInfo(walletHandle []byte) ([]ListedAddress, error)
- func (c *Client) ListParticipationKeys() (partKeyFiles model.ParticipationKeysResponse, err error)
- func (c *Client) ListWallets() (wallets []kmdapi.APIV1Wallet, err error)
- func (c *Client) LookupMultisigAccount(walletHandle []byte, multisigAddr string) (info MultisigInfo, err error)
- func (c *Client) MakeRegistrationTransactionWithGenesisID(part account.Participation, fee, txnFirstValid, txnLastValid uint64, ...) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedAppClearStateTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppCloseOutTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppCreateTx(onComplete transactions.OnCompletion, approvalProg []byte, clearProg []byte, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppDeleteTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppNoOpTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppOptInTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAppUpdateTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedApplicationCallTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, ...) (tx transactions.Transaction, err error)
- func (c *Client) MakeUnsignedAssetConfigTx(creator string, index uint64, newManager *string, newReserve *string, ...) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedAssetCreateTx(total uint64, defaultFrozen bool, manager string, reserve string, ...) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedAssetDestroyTx(index uint64) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedAssetFreezeTx(index uint64, accountToChange string, newFreezeSetting bool) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedAssetSendTx(index uint64, amount uint64, recipient string, closeTo string, ...) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedBecomeNonparticipatingTx(address string, firstValid, lastValid, fee uint64) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedGoOfflineTx(address string, firstValid, lastValid, fee uint64, leaseBytes [32]byte) (transactions.Transaction, error)
- func (c *Client) MakeUnsignedGoOnlineTx(address string, firstValid, lastValid, fee uint64, leaseBytes [32]byte) (transactions.Transaction, error)
- func (c *Client) MultisigSignProgramWithWallet(walletHandle, pw, program []byte, signerAddr string, ...) (msig crypto.MultisigSig, err error)
- func (c *Client) MultisigSignTransactionWithWallet(walletHandle, pw []byte, utx transactions.Transaction, signerAddr string, ...) (msig crypto.MultisigSig, err error)
- func (c *Client) MultisigSignTransactionWithWalletAndSigner(walletHandle, pw []byte, utx transactions.Transaction, signerAddr string, ...) (msig crypto.MultisigSig, err error)
- func (c *Client) ParsedPendingTransaction(txid string) (txn v2.PreEncodedTxInfo, err error)
- func (c *Client) PendingTransactionInformation(txid string) (resp model.PendingTransactionResponse, err error)
- func (c *Client) RawAccountApplicationInformation(accountAddress string, applicationID uint64) (accountResource modelV2.AccountApplicationModel, err error)
- func (c *Client) RawAccountAssetInformation(accountAddress string, assetID uint64) (accountResource modelV2.AccountAssetModel, err error)
- func (c *Client) RawBlock(round uint64) (resp []byte, err error)
- func (c *Client) ReleaseWalletHandle(wh []byte) error
- func (c *Client) RemoveParticipationKey(participationID string) error
- func (c *Client) SendPaymentFromUnencryptedWallet(from, to string, fee, amount uint64, note []byte) (transactions.Transaction, error)
- func (c *Client) SendPaymentFromWallet(walletHandle, pw []byte, from, to string, fee, amount uint64, note []byte, ...) (transactions.Transaction, error)
- func (c *Client) SendPaymentFromWalletWithLease(walletHandle, pw []byte, from, to string, fee, amount uint64, note []byte, ...) (transactions.Transaction, error)
- func (c *Client) SetKMDStartArgs(args nodecontrol.KMDStartArgs)
- func (c *Client) SetSuggestedParamsCacheAge(maxAge time.Duration)
- func (c *Client) SetSyncRound(round uint64) (err error)
- func (c *Client) SignAndBroadcastTransaction(walletHandle, pw []byte, utx transactions.Transaction) (txid string, err error)
- func (c *Client) SignProgramWithWallet(walletHandle, pw []byte, addr string, program []byte) (signature crypto.Signature, err error)
- func (c *Client) SignTransactionWithWallet(walletHandle, pw []byte, utx transactions.Transaction) (stx transactions.SignedTxn, err error)
- func (c *Client) SignTransactionWithWalletAndSigner(walletHandle, pw []byte, signerAddr string, utx transactions.Transaction) (stx transactions.SignedTxn, err error)
- func (c *Client) SimulateTransactions(request v2.PreEncodedSimulateRequest) (result v2.PreEncodedSimulateResponse, err error)
- func (c *Client) SimulateTransactionsRaw(encodedRequest []byte) (result v2.PreEncodedSimulateResponse, err error)
- func (c *Client) Status() (resp model.NodeStatusResponse, err error)
- func (c *Client) SuggestedFee() (fee uint64, err error)
- func (c *Client) SuggestedParams() (params model.TransactionParametersResponse, err error)
- func (c *Client) TransactionProof(txid string, round uint64, hashType crypto.HashType) (resp model.TransactionProofResponse, err error)
- func (c *Client) UnencryptedMultisigSignTransaction(utx transactions.Transaction, signerAddr string, partial crypto.MultisigSig) (msig crypto.MultisigSig, err error)
- func (c *Client) VerifyParticipationKey(timeout time.Duration, participationID string) error
- func (c *Client) WaitForRound(round uint64) (resp model.NodeStatusResponse, err error)
- func (c *Client) WalletIsUnencrypted(wid []byte) bool
- type ClientConfig
- type ClientType
- type ListedAddress
- type MultisigInfo
- type PendingTransactions
- type SystemConfig
Constants ¶
const DefaultKMDDataDir = nodecontrol.DefaultKMDDataDir
DefaultKMDDataDir is the name of the directory within the algod data directory where kmd data goes
Variables ¶
var UnencryptedWalletName = []byte("unencrypted-default-wallet")
UnencryptedWalletName is the name of the default, unencrypted wallet
Functions ¶
func AlgorandDaemonSystemdManaged ¶
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 ¶
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{}, otherTxns []transactions.SignedTxn, otherAccts []basics.Address, proto string) (dr v2.DryrunRequest, err error)
MakeDryrunState function creates v2.DryrunRequest data structure
func MakeDryrunStateBytes ¶
func MakeDryrunStateBytes(client Client, txnOrStxn interface{}, otherTxns []transactions.SignedTxn, otherAccts []basics.Address, 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, txnOrStxnOrSlice interface{}, otherTxns []transactions.SignedTxn, otherAccts []basics.Address, proto string) (dr model.DryrunRequest, err error)
MakeDryrunStateGenerated function creates model.DryrunRequest data structure
Types ¶
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 ¶
AbortCatchup aborts the currently running catchup
func (*Client) AccountApplicationInformation ¶
func (c *Client) AccountApplicationInformation(accountAddress string, applicationID uint64) (resp model.AccountApplicationResponse, err error)
AccountApplicationInformation gets account information about a given app.
func (*Client) AccountAssetInformation ¶
func (c *Client) AccountAssetInformation(accountAddress string, assetID uint64) (resp model.AccountAssetResponse, err error)
AccountAssetInformation gets account information about a given asset.
func (*Client) AccountAssetsInformation ¶
func (c *Client) AccountAssetsInformation(account string, next *string, limit *uint64) (resp model.AccountAssetsInformationResponse, err error)
AccountAssetsInformation returns the assets held by an account, including asset params for non-deleted assets.
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, includeCreatables bool) (resp model.Account, err error)
AccountInformation takes an address and returns its information
func (*Client) AddParticipationKey ¶
func (c *Client) AddParticipationKey(keyfile string) (resp model.PostParticipationResponse, err error)
AddParticipationKey takes a participation key file and sends it to the node. The key will be loaded into the system when the function returns successfully.
func (Client) AlgodVersions ¶
AlgodVersions return the list of supported API versions in algod
func (*Client) ApplicationBoxes ¶
func (c *Client) ApplicationBoxes(appID uint64, maxBoxNum uint64) (resp model.BoxesResponse, err error)
ApplicationBoxes takes an app's index and returns the names of boxes under it
func (*Client) ApplicationInformation ¶
func (c *Client) ApplicationInformation(index uint64) (resp model.Application, err error)
ApplicationInformation takes an app's index and returns its information
func (*Client) AssetInformation ¶
AssetInformation takes an asset's index and returns its information
func (*Client) Block ¶
func (c *Client) Block(round uint64) (resp v2.BlockResponseJSON, err error)
Block takes a round and returns its block
func (*Client) BlockLogs ¶
func (c *Client) BlockLogs(round uint64) (resp model.BlockLogsResponse, err error)
BlockLogs returns all the logs in a block for a given round
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) BroadcastTransactionAsync ¶
func (c *Client) BroadcastTransactionAsync(stx transactions.SignedTxn) error
BroadcastTransactionAsync broadcasts a signed transaction to the network by appending it into tx handler queue.
func (*Client) BroadcastTransactionGroup ¶
func (c *Client) BroadcastTransactionGroup(txgroup []transactions.SignedTxn) error
BroadcastTransactionGroup broadcasts a signed transaction group to the network using algod
func (*Client) Compile ¶
func (c *Client) Compile(program []byte, useSourceMap bool) (compiledProgram []byte, compiledProgramHash crypto.Digest, sourcemap *logic.SourceMap, err error)
Compile compiles the given program and returned the compiled program
func (*Client) ComputeValidityRounds ¶
func (c *Client) ComputeValidityRounds(firstValid, lastValid, validRounds uint64) (first, last, latest uint64, err 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 address 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 ¶
CurrentRound returns the current known round
func (*Client) DeleteAccount ¶
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 model.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 ¶
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 ¶
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) 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) GenerateAddress ¶
GenerateAddress takes a wallet handle, generate an additional address for it and returns the public address
func (*Client) GetApplicationBoxByName ¶
func (c *Client) GetApplicationBoxByName(index uint64, name string) (resp model.BoxResponse, err error)
GetApplicationBoxByName takes an app's index and box name and returns its value. The box name should be of the form `encoding:value`. See apps.AppCallBytes for more information.
func (*Client) GetBalance ¶
GetBalance takes an address and returns its total balance; if the address doesn't exist, it returns 0.
func (*Client) GetLedgerStateDelta ¶
func (c *Client) GetLedgerStateDelta(round uint64) (rep ledgercore.StateDelta, err error)
GetLedgerStateDelta gets the LedgerStateDelta on a node w/ EnableFollowMode
func (*Client) GetParsedPendingTransactions ¶
func (c *Client) GetParsedPendingTransactions(maxTxns uint64) (txns PendingTransactions, err error)
GetParsedPendingTransactions returns the parsed response with pending transactions.
func (*Client) GetParsedPendingTransactionsByAddress ¶
func (c *Client) GetParsedPendingTransactionsByAddress(addr string, maxTxns uint64) (txns PendingTransactions, err error)
GetParsedPendingTransactionsByAddress returns the parsed response with pending transactions by address.
func (*Client) GetParticipationKeyByID ¶
func (c *Client) GetParticipationKeyByID(id string) (resp model.ParticipationKeyResponse, err error)
GetParticipationKeyByID looks up a specific participation key by its participationID.
func (*Client) GetParticipationKeys ¶
func (c *Client) GetParticipationKeys() (resp model.ParticipationKeysResponse, err error)
GetParticipationKeys gets the currently installed participation keys.
func (*Client) GetPendingTransactions ¶
func (c *Client) GetPendingTransactions(maxTxns uint64) (resp model.PendingTransactionsResponse, err error)
GetPendingTransactions gets a snapshot of current pending transactions on the node. If maxTxns = 0, fetches as many transactions as possible.
func (*Client) GetPendingTransactionsByAddress ¶
func (c *Client) GetPendingTransactionsByAddress(addr string, maxTxns uint64) (resp model.PendingTransactionsResponse, err error)
GetPendingTransactionsByAddress gets a snapshot of current pending transactions on the node for the given address. If maxTxns = 0, fetches as many transactions as possible.
func (*Client) GetSyncRound ¶
func (c *Client) GetSyncRound() (rep model.GetSyncRoundResponse, err error)
GetSyncRound gets the sync round on a node w/ EnableFollowMode
func (*Client) GetUnencryptedWalletHandle ¶
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 ¶
GetWalletHandleToken inits the wallet with the given id, returning a wallet handle token
func (*Client) GetWalletHandleTokenCached ¶
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 ¶
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) LedgerSupply ¶
func (c Client) LedgerSupply() (resp model.SupplyResponse, err error)
LedgerSupply returns the total number of algos in the system
func (*Client) LightBlockHeaderProof ¶
func (c *Client) LightBlockHeaderProof(round uint64) (resp model.LightBlockHeaderProofResponse, err error)
LightBlockHeaderProof returns a Merkle proof for a block.
func (*Client) ListAddresses ¶
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 model.ParticipationKeysResponse, err error)
ListParticipationKeys returns the available participation keys, as a response 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) MakeRegistrationTransactionWithGenesisID ¶
func (c *Client) MakeRegistrationTransactionWithGenesisID(part account.Participation, fee, txnFirstValid, txnLastValid uint64, leaseBytes [32]byte, includeStateProofKeys bool) (transactions.Transaction, error)
MakeRegistrationTransactionWithGenesisID Generates a Registration transaction with the genesis ID set from the suggested parameters of the client
func (*Client) MakeUnsignedAppClearStateTx ¶
func (c *Client) MakeUnsignedAppClearStateTx(appIdx uint64, appArgs [][]byte, accounts []string, foreignApps []uint64, foreignAssets []uint64, boxes []transactions.BoxRef) (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, boxes []transactions.BoxRef) (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, boxes []transactions.BoxRef, 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, boxes []transactions.BoxRef) (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, boxes []transactions.BoxRef) (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, boxes []transactions.BoxRef) (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, boxes []transactions.BoxRef, 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, boxes []transactions.BoxRef, 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, 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) ParsedPendingTransaction ¶
func (c *Client) ParsedPendingTransaction(txid string) (txn v2.PreEncodedTxInfo, err error)
ParsedPendingTransaction takes a txid and returns the parsed PendingTransaction response.
func (*Client) PendingTransactionInformation ¶
func (c *Client) PendingTransactionInformation(txid string) (resp model.PendingTransactionResponse, err error)
PendingTransactionInformation returns information about a recently issued transaction based on its txid.
func (*Client) RawAccountApplicationInformation ¶
func (c *Client) RawAccountApplicationInformation(accountAddress string, applicationID uint64) (accountResource modelV2.AccountApplicationModel, err error)
RawAccountApplicationInformation gets account information about a given app.
func (*Client) RawAccountAssetInformation ¶
func (c *Client) RawAccountAssetInformation(accountAddress string, assetID uint64) (accountResource modelV2.AccountAssetModel, err error)
RawAccountAssetInformation gets account information about a given asset.
func (*Client) ReleaseWalletHandle ¶
ReleaseWalletHandle invalidates the passed wallet handle token
func (*Client) RemoveParticipationKey ¶
RemoveParticipationKey removes a participation key by its id
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) SetKMDStartArgs ¶
func (c *Client) SetKMDStartArgs(args nodecontrol.KMDStartArgs)
SetKMDStartArgs sets the arguments used when starting kmd
func (*Client) SetSuggestedParamsCacheAge ¶
SetSuggestedParamsCacheAge sets the maximum age for an internal cached version of SuggestedParams() used internally to many libgoal Client functions.
func (*Client) SetSyncRound ¶
SetSyncRound sets the sync round on a node w/ EnableFollowMode
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) SimulateTransactions ¶
func (c *Client) SimulateTransactions(request v2.PreEncodedSimulateRequest) (result v2.PreEncodedSimulateResponse, err error)
SimulateTransactions simulates transactions and returns relevant simulation results.
func (*Client) SimulateTransactionsRaw ¶
func (c *Client) SimulateTransactionsRaw(encodedRequest []byte) (result v2.PreEncodedSimulateResponse, err error)
SimulateTransactionsRaw simulates a transaction group by taking raw request bytes and returns relevant simulation results.
func (*Client) Status ¶
func (c *Client) Status() (resp model.NodeStatusResponse, err error)
Status returns the node status
func (*Client) SuggestedFee ¶
SuggestedFee returns the suggested fee per byte by the network
func (*Client) SuggestedParams ¶
func (c *Client) SuggestedParams() (params model.TransactionParametersResponse, err error)
SuggestedParams returns the suggested parameters for a new transaction
func (*Client) TransactionProof ¶
func (c *Client) TransactionProof(txid string, round uint64, hashType crypto.HashType) (resp model.TransactionProofResponse, err error)
TransactionProof 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) VerifyParticipationKey ¶
VerifyParticipationKey checks if a given participationID is installed in a loop until timeout has elapsed.
func (*Client) WaitForRound ¶
func (c *Client) WaitForRound(round uint64) (resp model.NodeStatusResponse, err error)
WaitForRound takes a round, waits up to one minute, for it to appear and returns the node status. This function blocks and fails if the block does not appear in one minute.
func (*Client) WalletIsUnencrypted ¶
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 ListedAddress ¶
ListedAddress is an address returned by ListAddresses, with a flag to indicate whether it's a multisig address.
type MultisigInfo ¶
MultisigInfo represents the information about a multisig account.
type PendingTransactions ¶
type PendingTransactions struct { TopTransactions []transactions.SignedTxn `json:"top-transactions"` TotalTransactions uint64 `json:"total-transactions"` }
PendingTransactions represents a parsed PendingTransactionsResponse struct.
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/ 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