flow

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedOperation = errors.New("operation not supported for this blockchain")

Functions

func CreateAccountCreationTx

func CreateAccountCreationTx(wallet types.Wallet, payer flow.Address, network flow.ChainID) (*flow.Transaction, flow.Address, error)

CreateAccountCreationTx prepares a transaction to create a new Flow account and calculates the expected address for this account.

Parameters:

  • wallet: The Flow wallet containing the public key for the new account.
  • payer: The address of the account that will pay for the account creation.
  • network: The Flow network (e.g., Mainnet, Testnet) where the account will be created.

Returns:

  • A pointer to the prepared transaction (*flow.Transaction).
  • The expected address of the new account (flow.Address).
  • An error if the transaction preparation or address calculation fails.

Note: This function only prepares the transaction and calculates the expected address. The transaction still needs to be signed and submitted to the blockchain to actually create the account. The actual address may differ if other accounts are created before this transaction is executed.

Types

type Flow

type Flow struct {
	Host string
}

func (Flow) CreateWallet

func (f Flow) CreateWallet(cwp types.CWParam) (types.Wallet, error)

func (Flow) GetAddressFromPrivateKey

func (f Flow) GetAddressFromPrivateKey(privateKey string) (types.Address, error)

func (Flow) GetBalance

func (f Flow) GetBalance(bp types.BalanceParam) (types.Balance, error)

func (Flow) GetTokenBalance

func (f Flow) GetTokenBalance(tbp types.TBParam) (types.TokenBalance, error)

func (Flow) GetTokenInfo

func (f Flow) GetTokenInfo(tip types.TokenInfoParam) (types.TokenInfo, error)

func (Flow) GetTxByHash

func (f Flow) GetTxByHash(hp types.HashParam) (types.TransactionByHash, error)

func (Flow) SmartContractCall

func (f Flow) SmartContractCall(payload types.SmartContractCallPayload) ([]interface{}, error)

func (Flow) Transfer

func (f Flow) Transfer(tp types.TransferParam) (types.TransferData, error)

func (Flow) TransferToken

func (f Flow) TransferToken(ttp types.TransferTokenParam) (types.TransferData, error)

func (Flow) WalletFromMnemonic

func (f Flow) WalletFromMnemonic(wp types.WalletParam) (types.Wallet, error)
CreateWalletfromMnemonic generates a Flow wallet from a mnemonic phrase.

This function does not create an on-chain Flow account or address. Instead, it generates a private/public key pair from the mnemonic and prepares the information needed to create an account later...

A key pair alone does not constitute an account or address on Flow. An actual account is created through a separate transaction on the blockchain. Use CreateAccountCreationTx to prepare a transaction for creating an account and to get an expected address for the new account.

Jump to

Keyboard shortcuts

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