Documentation ¶
Index ¶
- Constants
- func DecodeAndSignNFDTransactions(nfdnTxnResponse string, signer MultipleWalletSigner) (string, []byte, error)
- func FormattedAlgoAmount(microAlgos uint64) string
- func GetAlgoClient(log *slog.Logger, config NetworkConfig, maxConnections int) (*algod.Client, error)
- func GetBareAccount(ctx context.Context, algoClient *algod.Client, account string) (models.Account, error)
- func GetNetAndTokenFromFiles(netFile, tokenFile string) (string, string, error)
- func NewLocalKeyStore(log *slog.Logger) *localKeyStore
- func SignGroupTransactions(ctx context.Context, txns []types.Transaction, signers []TxnSigner) ([]byte, []string, error)
- func SignGroupTransactionsForFrontend(ctx context.Context, log *slog.Logger, txns []types.Transaction, ...) ([]byte, error)
- func SignWithAccountForATC(keyManager MultipleWalletSigner, publicAddress string) transaction.TransactionSigner
- func SuggestedParams(ctx context.Context, logger *slog.Logger, client *algod.Client) types.SuggestedParams
- type MultipleWalletSigner
- type NetworkConfig
- type TxnSigner
- func SignByUser(signers []TxnSigner) []TxnSigner
- func SignWithAccount(signers []TxnSigner, keyManager MultipleWalletSigner, publicAddress string) []TxnSigner
- func SignWithKey(signers []TxnSigner, privateKey ed25519.PrivateKey) []TxnSigner
- func SignWithLogicSig(signers []TxnSigner, logicSigAccount crypto.LogicSigAccount) []TxnSigner
Constants ¶
const DefaultValidRoundRange = 100
DefaultValidRoundRange - max valid round range to have transactions be valid for (and to check for confirmation)
Variables ¶
This section is empty.
Functions ¶
func DecodeAndSignNFDTransactions ¶
func DecodeAndSignNFDTransactions(nfdnTxnResponse string, signer MultipleWalletSigner) (string, []byte, error)
DecodeAndSignNFDTransactions decodes and signs transactions that came from an NFD API for user signing, signing each transaction which needs signed using the given signer
func FormattedAlgoAmount ¶
func GetAlgoClient ¶
func GetBareAccount ¶
func GetBareAccount(ctx context.Context, algoClient *algod.Client, account string) (models.Account, error)
GetBareAccount just returns account information without asset data
func GetNetAndTokenFromFiles ¶
GetNetAndTokenFromFiles reads the address and token from the specified files in the local Algorand data directory.
The function takes two arguments: netFile (string) and tokenFile (string), which represent the paths to the files. It returns the API URL (string), the API token (string), and any error encountered.
Example usage:
apiURL, apiToken, err := GetNetAndTokenFromFiles("algod.net", "algod.token")
The function internally uses os.ReadFile function to read the address and token files. It then trims any leading or trailing whitespace from the read contents and returns the cleaned values. If any error occurs during file reading, the function returns an empty string for both API URL and API token, along with an error indicating the specific file reading failure.
func NewLocalKeyStore ¶
func SignGroupTransactions ¶
func SignGroupTransactions(ctx context.Context, txns []types.Transaction, signers []TxnSigner) ([]byte, []string, error)
SignGroupTransactions takes the slice of Transactions and of TxnSigner implementations and signs each according to the matching TxnSigner implementation for each transaction.
func SignGroupTransactionsForFrontend ¶
func SignGroupTransactionsForFrontend(ctx context.Context, log *slog.Logger, txns []types.Transaction, signers []TxnSigner) ([]byte, error)
SignGroupTransactionsForFrontend takes the slice of Transactions and of TxnSigner implementations and signs each according to the matching TxnSigner implementation for each transaction - returning as a json array of base64 encoded strings
func SignWithAccountForATC ¶
func SignWithAccountForATC(keyManager MultipleWalletSigner, publicAddress string) transaction.TransactionSigner
func SuggestedParams ¶
Types ¶
type MultipleWalletSigner ¶
type NetworkConfig ¶
type NetworkConfig struct { NodeDataDir string NFDAPIUrl string NodeURL string NodeToken string NodeHeaders map[string]string }
func GetNetworkConfig ¶
func GetNetworkConfig(network string) NetworkConfig
type TxnSigner ¶
type TxnSigner interface { // SignTxn signs the specified transaction, returning Transaction ID, signed transaction bytes, and error SignTxn(ctx context.Context, tx types.Transaction) (string, []byte, error) }
func SignByUser ¶
func SignWithAccount ¶
func SignWithAccount(signers []TxnSigner, keyManager MultipleWalletSigner, publicAddress string) []TxnSigner
func SignWithKey ¶
func SignWithKey(signers []TxnSigner, privateKey ed25519.PrivateKey) []TxnSigner
func SignWithLogicSig ¶
func SignWithLogicSig(signers []TxnSigner, logicSigAccount crypto.LogicSigAccount) []TxnSigner