libgoal

package
v0.0.0-...-b6e5bca Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: AGPL-3.0 Imports: 29 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{}, 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

func (c *Client) AbortCatchup() error

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

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

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

func (c *Client) AssetInformation(index uint64) (resp model.Asset, err error)

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) Catchup

func (c *Client) Catchup(catchpointLabel string, min uint64) (model.CatchpointStartResponse, error)

Catchup start catching up to the give catchpoint label.

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

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 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

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) 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) 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

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) 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

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) 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

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 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) RawBlock

func (c *Client) RawBlock(round uint64) (resp []byte, 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) RemoveParticipationKey

func (c *Client) RemoveParticipationKey(participationID string) error

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

func (c *Client) SetSuggestedParamsCacheAge(maxAge time.Duration)

SetSuggestedParamsCacheAge sets the maximum age for an internal cached version of SuggestedParams() used internally to many libgoal Client functions.

func (*Client) SetSyncRound

func (c *Client) SetSyncRound(round uint64) (err error)

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

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 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

func (c *Client) VerifyParticipationKey(timeout time.Duration, participationID string) error

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

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 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 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/
	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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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