Documentation ¶
Index ¶
- Constants
- Variables
- type AddressManager
- func (addressManager *AddressManager) Address(addressIndex uint64) address.Address
- func (addressManager *AddressManager) Addresses() (addresses []address.Address)
- func (addressManager *AddressManager) FirstUnspentAddress() address.Address
- func (addressManager *AddressManager) IsAddressSpent(addressIndex uint64) bool
- func (addressManager *AddressManager) LastUnspentAddress() address.Address
- func (addressManager *AddressManager) MarkAddressSpent(addressIndex uint64)
- func (addressManager *AddressManager) NewAddress() address.Address
- func (addressManager *AddressManager) SpentAddresses() (addresses []address.Address)
- func (addressManager *AddressManager) UnspentAddresses() (addresses []address.Address)
- type Asset
- type AssetRegistry
- func (a *AssetRegistry) Bytes() []byte
- func (a *AssetRegistry) LoadAsset(id devnetvm.Color) (*Asset, error)
- func (a *AssetRegistry) Name(color devnetvm.Color) string
- func (a *AssetRegistry) Network() string
- func (a *AssetRegistry) Precision(color devnetvm.Color) int
- func (a *AssetRegistry) RegisterAsset(color devnetvm.Color, asset Asset) error
- func (a *AssetRegistry) SetRegistryURL(url string)
- func (a *AssetRegistry) Supply(color devnetvm.Color) string
- func (a *AssetRegistry) Symbol(color devnetvm.Color) string
- func (a *AssetRegistry) TransactionID(color devnetvm.Color) string
- type Connector
- type Option
- func AssetRegistryNetwork(network string) Option
- func ConfirmationPollingInterval(interval time.Duration) Option
- func ConfirmationTimeout(timeout time.Duration) Option
- func FaucetPowDifficulty(powTarget int) Option
- func GenericConnector(connector Connector) Option
- func Import(seed *seed.Seed, lastAddressIndex uint64, spentAddresses []bitmask.BitMask, ...) Option
- func ReusableAddress(enabled bool) Option
- func WebAPI(baseURL string, setters ...client.Option) Option
- type Output
- type OutputManager
- func (o *OutputManager) MarkOutputSpent(addy address.Address, outputID utxo.OutputID)
- func (o *OutputManager) Refresh(includeSpentAddresses ...bool) error
- func (o *OutputManager) UnspentAliasOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
- func (o *OutputManager) UnspentConditionalOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
- func (o *OutputManager) UnspentOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
- func (o *OutputManager) UnspentValueOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
- type OutputMetadata
- type OutputsByAddressAndOutputID
- func (o OutputsByAddressAndOutputID) AliasOutputsOnly() OutputsByAddressAndOutputID
- func (o OutputsByAddressAndOutputID) ConditionalOutputsOnly() OutputsByAddressAndOutputID
- func (o OutputsByAddressAndOutputID) OutputCount() int
- func (o OutputsByAddressAndOutputID) OutputsByID() (outputsByID OutputsByID)
- func (o OutputsByAddressAndOutputID) SplitIntoChunksOfMaxInputCount() []OutputsByAddressAndOutputID
- func (o OutputsByAddressAndOutputID) ToLedgerStateOutputs() devnetvm.Outputs
- func (o OutputsByAddressAndOutputID) TotalFundsInOutputs() map[devnetvm.Color]uint64
- func (o OutputsByAddressAndOutputID) ValueOutputsOnly() OutputsByAddressAndOutputID
- type OutputsByID
- type ServerStatus
- type TimedBalance
- type TimedBalanceSlice
- type Wallet
- func (wallet *Wallet) AddressManager() *AddressManager
- func (wallet *Wallet) AliasBalance(refresh ...bool) (...)
- func (wallet *Wallet) AllowedPledgeNodeIDs() (res map[mana.Type][]string, err error)
- func (wallet *Wallet) AssetRegistry() *AssetRegistry
- func (wallet *Wallet) AvailableBalance(refresh ...bool) (confirmedBalance, pendingBalance map[devnetvm.Color]uint64, err error)
- func (wallet Wallet) AvailableOutputsOnNFT(nftID string) (owned, governed devnetvm.Outputs, err error)
- func (wallet *Wallet) Balance(refresh ...bool) (confirmedBalance, pendingBalance map[devnetvm.Color]uint64, err error)
- func (wallet *Wallet) ClaimConditionalFunds(options ...claimconditionaloptions.ClaimConditionalFundsOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) ConditionalBalances(refresh ...bool) (confirmed, pending TimedBalanceSlice, err error)
- func (wallet *Wallet) ConsolidateFunds(options ...consolidateoptions.ConsolidateFundsOption) (txs []*devnetvm.Transaction, err error)
- func (wallet *Wallet) CreateAsset(asset Asset, waitForConfirmation ...bool) (assetColor devnetvm.Color, err error)
- func (wallet *Wallet) CreateNFT(options ...createnftoptions.CreateNFTOption) (tx *devnetvm.Transaction, nftID *devnetvm.AliasAddress, err error)
- func (wallet *Wallet) DelegateFunds(options ...delegateoptions.DelegateFundsOption) (tx *devnetvm.Transaction, delegationIDs []*devnetvm.AliasAddress, err error)
- func (wallet *Wallet) DelegatedAliasBalance(refresh ...bool) (confirmedDelegatedAliases map[devnetvm.AliasAddress]*devnetvm.AliasOutput, ...)
- func (wallet *Wallet) DepositFundsToNFT(options ...deposittonftoptions.DepositFundsToNFTOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) DestroyNFT(options ...destroynftoptions.DestroyNFTOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) ExportState() []byte
- func (wallet *Wallet) NewReceiveAddress() address.Address
- func (wallet *Wallet) ReceiveAddress() address.Address
- func (wallet *Wallet) ReclaimDelegatedFunds(options ...reclaimoptions.ReclaimFundsOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) Refresh(rescanSpentAddresses ...bool) (err error)
- func (wallet *Wallet) RemainderAddress() address.Address
- func (wallet *Wallet) RequestFaucetFunds(waitForConfirmation ...bool) (err error)
- func (wallet *Wallet) Seed() *seed.Seed
- func (wallet *Wallet) SendFunds(options ...sendoptions.SendFundsOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) ServerStatus() (status ServerStatus, err error)
- func (wallet Wallet) SweepNFTOwnedFunds(options ...sweepnftownedoptions.SweepNFTOwnedFundsOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) SweepNFTOwnedNFTs(options ...sweepnftownednftsoptions.SweepNFTOwnedNFTsOption) (tx *devnetvm.Transaction, sweptNFTs []*devnetvm.AliasAddress, err error)
- func (wallet *Wallet) TimelockedBalances(refresh ...bool) (confirmed, pending TimedBalanceSlice, err error)
- func (wallet *Wallet) TransferNFT(options ...transfernftoptions.TransferNFTOption) (tx *devnetvm.Transaction, err error)
- func (wallet *Wallet) UnspentAliasOutputs(includePending bool) map[address.Address]map[utxo.OutputID]*Output
- func (wallet *Wallet) UnspentOutputs() map[address.Address]map[utxo.OutputID]*Output
- func (wallet *Wallet) UnspentValueOutputs() map[address.Address]map[utxo.OutputID]*Output
- func (wallet *Wallet) WaitForTxConfirmation(txID utxo.TransactionID) (err error)
- func (wallet *Wallet) WithdrawFundsFromNFT(options ...withdrawfromnftoptions.WithdrawFundsFromNFTOption) (tx *devnetvm.Transaction, err error)
- type WebConnector
- func (webConnector WebConnector) GetAllowedPledgeIDs() (pledgeIDMap map[mana.Type][]string, err error)
- func (webConnector WebConnector) GetTransactionGoF(txID utxo.TransactionID) (gradeOfFinality gof.GradeOfFinality, err error)
- func (webConnector WebConnector) GetUnspentAliasOutput(addr *devnetvm.AliasAddress) (output *devnetvm.AliasOutput, err error)
- func (webConnector *WebConnector) RequestFaucetFunds(addr address.Address, powTarget int) (err error)
- func (webConnector WebConnector) SendTransaction(tx *devnetvm.Transaction) (err error)
- func (webConnector *WebConnector) ServerStatus() (status ServerStatus, err error)
- func (webConnector WebConnector) UnspentOutputs(addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID, err error)
Constants ¶
const ( // DefaultPollingInterval is the polling interval of the wallet when waiting for confirmation (in ms). DefaultPollingInterval = 500 * time.Millisecond // DefaultConfirmationTimeout is the timeout of waiting for confirmation. (in ms). DefaultConfirmationTimeout = 150000 * time.Millisecond // DefaultAssetRegistryNetwork is the default asset registry network. DefaultAssetRegistryNetwork = "nectar" )
const (
// RegistryHostURL is the host url of the central registry.
RegistryHostURL = "http://asset-registry.tokenizedassetsdemo.iota.cafe"
)
Variables ¶
var ErrTooManyOutputs = errors.New("number of outputs is more, than supported for a single transaction")
ErrTooManyOutputs is an error returned when the number of outputs/inputs exceeds the protocol wide constant.
Functions ¶
This section is empty.
Types ¶
type AddressManager ¶
type AddressManager struct {
// contains filtered or unexported fields
}
AddressManager is an manager struct that allows us to keep track of the used and spent addresses.
func NewAddressManager ¶
func NewAddressManager(seed *seed.Seed, lastAddressIndex uint64, spentAddresses []bitmask.BitMask) (addressManager *AddressManager)
NewAddressManager is the constructor for the AddressManager type.
func (*AddressManager) Address ¶
func (addressManager *AddressManager) Address(addressIndex uint64) address.Address
Address returns the address that belongs to the given index.
func (*AddressManager) Addresses ¶
func (addressManager *AddressManager) Addresses() (addresses []address.Address)
Addresses returns a list of all addresses of the wallet.
func (*AddressManager) FirstUnspentAddress ¶
func (addressManager *AddressManager) FirstUnspentAddress() address.Address
FirstUnspentAddress returns the first unspent address that we know.
func (*AddressManager) IsAddressSpent ¶
func (addressManager *AddressManager) IsAddressSpent(addressIndex uint64) bool
IsAddressSpent returns true if the address given by the address index was spent already.
func (*AddressManager) LastUnspentAddress ¶
func (addressManager *AddressManager) LastUnspentAddress() address.Address
LastUnspentAddress returns the last unspent address that we know.
func (*AddressManager) MarkAddressSpent ¶
func (addressManager *AddressManager) MarkAddressSpent(addressIndex uint64)
MarkAddressSpent marks the given address as spent.
func (*AddressManager) NewAddress ¶
func (addressManager *AddressManager) NewAddress() address.Address
NewAddress generates and returns a new unused address.
func (*AddressManager) SpentAddresses ¶
func (addressManager *AddressManager) SpentAddresses() (addresses []address.Address)
SpentAddresses returns a list of all spent addresses of the wallet.
func (*AddressManager) UnspentAddresses ¶
func (addressManager *AddressManager) UnspentAddresses() (addresses []address.Address)
UnspentAddresses returns a list of all unspent addresses of the wallet.
type Asset ¶
type Asset struct { // Color contains the identifier of this asset Color devnetvm.Color // Name of the asset Name string `serix:"1,lengthPrefixType=uint32"` // currency symbol of the asset (optional) Symbol string `serix:"2,lengthPrefixType=uint32"` // Precision defines how many decimal places are shown when showing this asset in wallets Precision uint32 `serix:"3"` // Supply is the amount of tokens that we want to create Supply uint64 `serix:"4"` // TransactionID that created the asset TransactionID utxo.TransactionID `serix:"5"` }
Asset represents a container for all the information regarding a colored coin.
func AssetFromRegistryEntry ¶ added in v0.6.2
AssetFromRegistryEntry creates a wallet asset from a registry asset.
func (*Asset) ToRegistry ¶ added in v0.6.2
ToRegistry creates a registry asset from a wallet asset.
type AssetRegistry ¶
type AssetRegistry struct {
// contains filtered or unexported fields
}
AssetRegistry represents a registry for colored coins, that stores the relevant metadata in a dictionary.
func NewAssetRegistry ¶
func NewAssetRegistry(network string, registryURL ...string) *AssetRegistry
NewAssetRegistry is the constructor for the AssetRegistry.
func ParseAssetRegistry ¶
func ParseAssetRegistry(marshalUtil *marshalutil.MarshalUtil) (assetRegistry *AssetRegistry, consumedBytes int, err error)
ParseAssetRegistry is a utility function that can be used to parse a marshaled version of the registry.
func (*AssetRegistry) Bytes ¶
func (a *AssetRegistry) Bytes() []byte
Bytes marshal the registry into a sequence of bytes.
func (*AssetRegistry) LoadAsset ¶ added in v0.6.2
func (a *AssetRegistry) LoadAsset(id devnetvm.Color) (*Asset, error)
LoadAsset returns an asset either from local or from central registry.
func (*AssetRegistry) Name ¶
func (a *AssetRegistry) Name(color devnetvm.Color) string
Name returns the name of the given asset.
func (*AssetRegistry) Network ¶ added in v0.6.2
func (a *AssetRegistry) Network() string
Network returns the current network the asset registry connects to.
func (*AssetRegistry) Precision ¶
func (a *AssetRegistry) Precision(color devnetvm.Color) int
Precision returns the amount of decimal places that this token uses.
func (*AssetRegistry) RegisterAsset ¶
func (a *AssetRegistry) RegisterAsset(color devnetvm.Color, asset Asset) error
RegisterAsset registers an asset in the registry, so we can look up names and symbol of colored coins.
func (*AssetRegistry) SetRegistryURL ¶ added in v0.6.2
func (a *AssetRegistry) SetRegistryURL(url string)
SetRegistryURL sets the url of the registry api server.
func (*AssetRegistry) Supply ¶ added in v0.6.2
func (a *AssetRegistry) Supply(color devnetvm.Color) string
Supply returns the initial supply of the token.
func (*AssetRegistry) Symbol ¶
func (a *AssetRegistry) Symbol(color devnetvm.Color) string
Symbol return the symbol of the token.
func (*AssetRegistry) TransactionID ¶ added in v0.6.2
func (a *AssetRegistry) TransactionID(color devnetvm.Color) string
TransactionID returns the ID of the transaction that created the token.
type Connector ¶
type Connector interface { UnspentOutputs(addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID, err error) SendTransaction(transaction *devnetvm.Transaction) (err error) RequestFaucetFunds(address address.Address, powTarget int) (err error) GetAllowedPledgeIDs() (pledgeIDMap map[mana.Type][]string, err error) GetTransactionGoF(txID utxo.TransactionID) (gradeOfFinality gof.GradeOfFinality, err error) GetUnspentAliasOutput(address *devnetvm.AliasAddress) (output *devnetvm.AliasOutput, err error) }
Connector represents an interface that defines how the wallet interacts with the network. A wallet can either be used locally on a server or it can connect remotely using the web API.
type Option ¶
type Option func(*Wallet)
Option represents an optional parameter .
func AssetRegistryNetwork ¶ added in v0.6.2
AssetRegistryNetwork defines which network we intend to use for asset lookups.
func ConfirmationPollingInterval ¶ added in v0.6.0
ConfirmationPollingInterval defines how often the wallet polls the node for confirmation info.
func ConfirmationTimeout ¶ added in v0.6.0
ConfirmationTimeout defines the timeout for waiting for tx confirmation.
func FaucetPowDifficulty ¶ added in v0.6.0
FaucetPowDifficulty configures the wallet with the faucet's target PoW difficulty.
func GenericConnector ¶
GenericConnector allows us to provide a generic connector to the wallet. It can be used to mock the behavior of a real connector in tests or to provide new connection methods for nodes.
func Import ¶
func Import(seed *seed.Seed, lastAddressIndex uint64, spentAddresses []bitmask.BitMask, assetRegistry *AssetRegistry) Option
Import restores a wallet that has previously been created.
func ReusableAddress ¶
ReusableAddress configures the wallet to run in "single address" mode where all the funds are always managed on a single reusable address.
type Output ¶
type Output struct { Address address.Address Object devnetvm.Output Metadata OutputMetadata GradeOfFinalityReached bool // Spent is a local wallet-only property that gets set once an output is spent from within the same wallet. Spent bool }
Output is a wallet specific representation of an output in the IOTA network.
type OutputManager ¶ added in v0.6.0
type OutputManager struct {
// contains filtered or unexported fields
}
OutputManager keeps track of the outputs.
func NewUnspentOutputManager ¶
func NewUnspentOutputManager(addressManager *AddressManager, connector Connector) (outputManager *OutputManager)
NewUnspentOutputManager creates a new UnspentOutputManager.
func (*OutputManager) MarkOutputSpent ¶ added in v0.6.0
func (o *OutputManager) MarkOutputSpent(addy address.Address, outputID utxo.OutputID)
MarkOutputSpent marks the output identified by the given parameters as spent.
func (*OutputManager) Refresh ¶ added in v0.6.0
func (o *OutputManager) Refresh(includeSpentAddresses ...bool) error
Refresh checks for unspent outputs on the addresses provided by address manager and updates the internal state.
func (*OutputManager) UnspentAliasOutputs ¶ added in v0.6.0
func (o *OutputManager) UnspentAliasOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
UnspentAliasOutputs returns the alias type outputs that have not been spent, yet.
func (*OutputManager) UnspentConditionalOutputs ¶ added in v0.6.0
func (o *OutputManager) UnspentConditionalOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
UnspentConditionalOutputs returns the ExtendedLockedoutputs that are conditionally owned by the wallet right now and have not been spent yet. Such outputs can be claimed by the wallet.
func (*OutputManager) UnspentOutputs ¶ added in v0.6.0
func (o *OutputManager) UnspentOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
UnspentOutputs returns the all outputs that have not been spent, yet.
func (*OutputManager) UnspentValueOutputs ¶ added in v0.6.0
func (o *OutputManager) UnspentValueOutputs(includePending bool, addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID)
UnspentValueOutputs returns the value type outputs that have not been spent, yet.
type OutputMetadata ¶ added in v0.5.0
type OutputMetadata struct { // Timestamp is the timestamp of the tx that created the output. Timestamp time.Time }
OutputMetadata is metadata about the output.
type OutputsByAddressAndOutputID ¶ added in v0.4.0
func NewAddressToOutputs ¶ added in v0.6.0
func NewAddressToOutputs() OutputsByAddressAndOutputID
NewAddressToOutputs creates an empty container.
func (OutputsByAddressAndOutputID) AliasOutputsOnly ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) AliasOutputsOnly() OutputsByAddressAndOutputID
AliasOutputsOnly filters out any non-alias outputs.
func (OutputsByAddressAndOutputID) ConditionalOutputsOnly ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) ConditionalOutputsOnly() OutputsByAddressAndOutputID
ConditionalOutputsOnly return ExtendedLockedOutputs that are currently conditionally owned by the wallet.
func (OutputsByAddressAndOutputID) OutputCount ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) OutputCount() int
OutputCount returns the number of outputs in the struct.
func (OutputsByAddressAndOutputID) OutputsByID ¶ added in v0.4.0
func (o OutputsByAddressAndOutputID) OutputsByID() (outputsByID OutputsByID)
OutputsByID returns a collection of Outputs associated with their OutputID.
func (OutputsByAddressAndOutputID) SplitIntoChunksOfMaxInputCount ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) SplitIntoChunksOfMaxInputCount() []OutputsByAddressAndOutputID
SplitIntoChunksOfMaxInputCount splits the mapping into chunks that contain at most ledgerstate.MaxInputCount outputs.
func (OutputsByAddressAndOutputID) ToLedgerStateOutputs ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) ToLedgerStateOutputs() devnetvm.Outputs
ToLedgerStateOutputs transforms all outputs in the mapping into a slice of ledgerstate outputs.
func (OutputsByAddressAndOutputID) TotalFundsInOutputs ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) TotalFundsInOutputs() map[devnetvm.Color]uint64
TotalFundsInOutputs returns the total funds present in the outputs.
func (OutputsByAddressAndOutputID) ValueOutputsOnly ¶ added in v0.6.0
func (o OutputsByAddressAndOutputID) ValueOutputsOnly() OutputsByAddressAndOutputID
ValueOutputsOnly filters out non-value type outputs (aliases).
type OutputsByID ¶ added in v0.4.0
OutputsByID is a collection of Outputs associated with their OutputID.
func (OutputsByID) OutputsByAddressAndOutputID ¶ added in v0.4.0
func (o OutputsByID) OutputsByAddressAndOutputID() (outputsByAddressAndOutputID OutputsByAddressAndOutputID)
OutputsByAddressAndOutputID returns a collection of Outputs associated with their Address and OutputID.
type ServerStatus ¶
type ServerStatus struct { ID string Synced bool Version string ManaDecay float64 DelegationAddress string }
ServerStatus defines the information of connected server
type TimedBalance ¶ added in v0.6.0
TimedBalance represents a balance that is time dependent.
type TimedBalanceSlice ¶ added in v0.6.0
type TimedBalanceSlice []*TimedBalance
TimedBalanceSlice is a slice containing TimedBalances.
func (TimedBalanceSlice) Sort ¶ added in v0.6.0
func (t TimedBalanceSlice) Sort()
Sort sorts the balances based on their Time.
type Wallet ¶
type Wallet struct { ConfirmationPollInterval time.Duration ConfirmationTimeout time.Duration // contains filtered or unexported fields }
Wallet is a wallet that can handle aliases and extendedlockedoutputs.
func New ¶
New is the factory method of the wallet. It either creates a new wallet or restores the wallet backup that is handed in as an optional parameter.
func (*Wallet) AddressManager ¶
func (wallet *Wallet) AddressManager() *AddressManager
AddressManager returns the manager for the addresses of this wallet.
func (*Wallet) AliasBalance ¶ added in v0.6.0
func (wallet *Wallet) AliasBalance(refresh ...bool) ( confirmedGovernedAliases, confirmedStateControlledAliases, pendingGovernedAliases, pendingStateControlledAliases map[devnetvm.AliasAddress]*devnetvm.AliasOutput, err error, )
AliasBalance returns the aliases held by this wallet.
func (*Wallet) AllowedPledgeNodeIDs ¶ added in v0.5.0
AllowedPledgeNodeIDs retrieves the allowed pledge node IDs.
func (*Wallet) AssetRegistry ¶
func (wallet *Wallet) AssetRegistry() *AssetRegistry
AssetRegistry return the internal AssetRegistry instance of the wallet.
func (*Wallet) AvailableBalance ¶ added in v0.6.0
func (wallet *Wallet) AvailableBalance(refresh ...bool) (confirmedBalance, pendingBalance map[devnetvm.Color]uint64, err error)
AvailableBalance returns the balance that is not held in aliases, and therefore can be used to fund transfers.
func (Wallet) AvailableOutputsOnNFT ¶ added in v0.6.0
func (wallet Wallet) AvailableOutputsOnNFT(nftID string) (owned, governed devnetvm.Outputs, err error)
AvailableOutputsOnNFT returns all outputs that are either owned (SigLocked***, Extended, stateControlled Alias) or governed (governance controlled alias outputs) and are not currently locked.
func (*Wallet) Balance ¶
func (wallet *Wallet) Balance(refresh ...bool) (confirmedBalance, pendingBalance map[devnetvm.Color]uint64, err error)
Balance returns the confirmed and pending balance of the funds managed by this wallet.
func (*Wallet) ClaimConditionalFunds ¶ added in v0.6.0
func (wallet *Wallet) ClaimConditionalFunds(options ...claimconditionaloptions.ClaimConditionalFundsOption) (tx *devnetvm.Transaction, err error)
ClaimConditionalFunds gathers all currently conditionally owned outputs and consolidates them into the output.
func (*Wallet) ConditionalBalances ¶ added in v0.6.0
func (wallet *Wallet) ConditionalBalances(refresh ...bool) (confirmed, pending TimedBalanceSlice, err error)
ConditionalBalances returns all confirmed and pending balances that can be claimed by the wallet up to a certain time.
func (*Wallet) ConsolidateFunds ¶ added in v0.6.0
func (wallet *Wallet) ConsolidateFunds(options ...consolidateoptions.ConsolidateFundsOption) (txs []*devnetvm.Transaction, err error)
ConsolidateFunds consolidates available wallet funds into one output.
func (*Wallet) CreateAsset ¶
func (wallet *Wallet) CreateAsset(asset Asset, waitForConfirmation ...bool) (assetColor devnetvm.Color, err error)
CreateAsset creates a new colored token with the given details.
func (*Wallet) CreateNFT ¶ added in v0.6.0
func (wallet *Wallet) CreateNFT(options ...createnftoptions.CreateNFTOption) (tx *devnetvm.Transaction, nftID *devnetvm.AliasAddress, err error)
CreateNFT spends funds from the wallet to create an NFT.
func (*Wallet) DelegateFunds ¶ added in v0.6.0
func (wallet *Wallet) DelegateFunds(options ...delegateoptions.DelegateFundsOption) (tx *devnetvm.Transaction, delegationIDs []*devnetvm.AliasAddress, err error)
DelegateFunds delegates funds to a given address by creating a delegated alias output.
func (*Wallet) DelegatedAliasBalance ¶ added in v0.6.0
func (wallet *Wallet) DelegatedAliasBalance(refresh ...bool) ( confirmedDelegatedAliases map[devnetvm.AliasAddress]*devnetvm.AliasOutput, pendingDelegatedAliases map[devnetvm.AliasAddress]*devnetvm.AliasOutput, err error, )
DelegatedAliasBalance returns the pending and confirmed aliases that are delegated.
func (*Wallet) DepositFundsToNFT ¶ added in v0.6.0
func (wallet *Wallet) DepositFundsToNFT(options ...deposittonftoptions.DepositFundsToNFTOption) (tx *devnetvm.Transaction, err error)
DepositFundsToNFT deposits funds to the given alias from the wallet funds. If the wallet is not the state controller, an error is returned.
func (*Wallet) DestroyNFT ¶ added in v0.6.0
func (wallet *Wallet) DestroyNFT(options ...destroynftoptions.DestroyNFTOption) (tx *devnetvm.Transaction, err error)
DestroyNFT destroys the given nft (alias).
func (*Wallet) ExportState ¶
ExportState exports the current state of the wallet to a marshaled version.
func (*Wallet) NewReceiveAddress ¶
NewReceiveAddress generates and returns a new unused receive address.
func (*Wallet) ReceiveAddress ¶
ReceiveAddress returns the last receive address of the wallet.
func (*Wallet) ReclaimDelegatedFunds ¶ added in v0.6.0
func (wallet *Wallet) ReclaimDelegatedFunds(options ...reclaimoptions.ReclaimFundsOption) (tx *devnetvm.Transaction, err error)
ReclaimDelegatedFunds reclaims delegated funds (alias outputs).
func (*Wallet) Refresh ¶
Refresh scans the addresses for incoming transactions. If the optional rescanSpentAddresses parameter is set to true we also scan the spent addresses again (this can take longer).
func (*Wallet) RemainderAddress ¶
RemainderAddress returns the address that is used for the remainder of funds.
func (*Wallet) RequestFaucetFunds ¶
RequestFaucetFunds requests some funds from the faucet for testing purposes.
func (*Wallet) Seed ¶
Seed returns the seed of this wallet that is used to generate all of the wallets addresses and private keys.
func (*Wallet) SendFunds ¶
func (wallet *Wallet) SendFunds(options ...sendoptions.SendFundsOption) (tx *devnetvm.Transaction, err error)
SendFunds sends funds from the wallet.
func (*Wallet) ServerStatus ¶
func (wallet *Wallet) ServerStatus() (status ServerStatus, err error)
ServerStatus retrieves the connected server status.
func (Wallet) SweepNFTOwnedFunds ¶ added in v0.6.0
func (wallet Wallet) SweepNFTOwnedFunds(options ...sweepnftownedoptions.SweepNFTOwnedFundsOption) (tx *devnetvm.Transaction, err error)
SweepNFTOwnedFunds collects all funds from non-alias outputs that are owned by the nft into the wallet.
func (*Wallet) SweepNFTOwnedNFTs ¶ added in v0.6.0
func (wallet *Wallet) SweepNFTOwnedNFTs(options ...sweepnftownednftsoptions.SweepNFTOwnedNFTsOption) (tx *devnetvm.Transaction, sweptNFTs []*devnetvm.AliasAddress, err error)
func (*Wallet) TimelockedBalances ¶ added in v0.6.0
func (wallet *Wallet) TimelockedBalances(refresh ...bool) (confirmed, pending TimedBalanceSlice, err error)
TimelockedBalances returns all confirmed and pending balances that are currently timelocked.
func (*Wallet) TransferNFT ¶ added in v0.6.0
func (wallet *Wallet) TransferNFT(options ...transfernftoptions.TransferNFTOption) (tx *devnetvm.Transaction, err error)
TransferNFT transfers an NFT to a given address.
func (*Wallet) UnspentAliasOutputs ¶ added in v0.6.0
func (wallet *Wallet) UnspentAliasOutputs(includePending bool) map[address.Address]map[utxo.OutputID]*Output
UnspentAliasOutputs returns the unspent alias outputs that are available for spending.
func (*Wallet) UnspentOutputs ¶
UnspentOutputs returns the unspent outputs that are available for spending.
func (*Wallet) UnspentValueOutputs ¶ added in v0.6.0
UnspentValueOutputs returns the unspent value type outputs that are available for spending.
func (*Wallet) WaitForTxConfirmation ¶ added in v0.6.0
func (wallet *Wallet) WaitForTxConfirmation(txID utxo.TransactionID) (err error)
WaitForTxConfirmation waits for the given tx to reach a high grade of finalty.
func (*Wallet) WithdrawFundsFromNFT ¶ added in v0.6.0
func (wallet *Wallet) WithdrawFundsFromNFT(options ...withdrawfromnftoptions.WithdrawFundsFromNFTOption) (tx *devnetvm.Transaction, err error)
WithdrawFundsFromNFT withdraws funds from the given alias. If the wallet is not the state controller, or too much funds are withdrawn, an error is returned.
type WebConnector ¶
type WebConnector struct {
// contains filtered or unexported fields
}
WebConnector implements a connector that uses the web API to connect to a node to implement the required functions for the wallet.
func NewWebConnector ¶
func NewWebConnector(baseURL string, setters ...client.Option) *WebConnector
NewWebConnector is the constructor for the WebConnector.
func (WebConnector) GetAllowedPledgeIDs ¶ added in v0.5.0
func (webConnector WebConnector) GetAllowedPledgeIDs() (pledgeIDMap map[mana.Type][]string, err error)
GetAllowedPledgeIDs gets the list of nodeIDs that the node accepts as pledgeIDs in a transaction.
func (WebConnector) GetTransactionGoF ¶ added in v0.8.0
func (webConnector WebConnector) GetTransactionGoF(txID utxo.TransactionID) (gradeOfFinality gof.GradeOfFinality, err error)
GetTransactionGoF fetches the GoF of the transaction.
func (WebConnector) GetUnspentAliasOutput ¶ added in v0.6.0
func (webConnector WebConnector) GetUnspentAliasOutput(addr *devnetvm.AliasAddress) (output *devnetvm.AliasOutput, err error)
GetUnspentAliasOutput returns the current unspent alias output that belongs to a given alias address.
func (*WebConnector) RequestFaucetFunds ¶
func (webConnector *WebConnector) RequestFaucetFunds(addr address.Address, powTarget int) (err error)
RequestFaucetFunds request some funds from the faucet for test purposes.
func (WebConnector) SendTransaction ¶
func (webConnector WebConnector) SendTransaction(tx *devnetvm.Transaction) (err error)
SendTransaction sends a new transaction to the network.
func (*WebConnector) ServerStatus ¶
func (webConnector *WebConnector) ServerStatus() (status ServerStatus, err error)
ServerStatus retrieves the connected server status with Info api.
func (WebConnector) UnspentOutputs ¶
func (webConnector WebConnector) UnspentOutputs(addresses ...address.Address) (unspentOutputs OutputsByAddressAndOutputID, err error)
UnspentOutputs returns the outputs of transactions on the given addresses that have not been spent yet.