Documentation ¶
Index ¶
Examples ¶
Constants ¶
const ( MainnetAPIURI = "https://api.metalblockchain.org" TahoeAPIURI = "https://tahoe.metalblockchain.org" LocalAPIURI = "http://localhost:9650" )
Variables ¶
This section is empty.
Functions ¶
func AddAllUTXOs ¶
func AddAllUTXOs( ctx context.Context, utxos walletcommon.UTXOs, client UTXOClient, codec codec.Manager, sourceChainID ids.ID, destinationChainID ids.ID, addrs []ids.ShortID, ) error
AddAllUTXOs fetches all the UTXOs referenced by [addresses] that were sent from [sourceChainID] to [destinationChainID] from the [client]. It then uses codec to parse the returned UTXOs and it adds them into [utxos]. If [ctx] expires, then the returned error will be immediately reported.
Types ¶
type AVAXState ¶
type UTXOClient ¶
type Wallet ¶
Wallet provides chain wallets for the primary network.
Example ¶
Output:
func MakeWallet ¶
func MakeWallet(ctx context.Context, config *WalletConfig) (Wallet, error)
MakeWallet returns a wallet that supports issuing transactions to the chains living in the primary network.
On creation, the wallet attaches to the provided uri and fetches all UTXOs that reference any of the provided keys. If the UTXOs are modified through an external issuance process, such as another instance of the wallet, the UTXOs may become out of sync. The wallet will also fetch all requested P-chain transactions.
The wallet manages all state locally, and performs all tx signing locally.
type WalletConfig ¶
type WalletConfig struct { // Base URI to use for all node requests. URI string // required // Keys to use for signing all transactions. AVAXKeychain keychain.Keychain // required EthKeychain c.EthKeychain // required // Set of P-chain transactions that the wallet should know about to be able // to generate transactions. PChainTxs map[ids.ID]*txs.Tx // optional // Set of P-chain transactions that the wallet should fetch to be able to // generate transactions. PChainTxsToFetch set.Set[ids.ID] // optional }