mock

package
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 42 Imported by: 3

Documentation

Index

Constants

View Source
const NetworkMainPartition = "main"

Variables

View Source
var (
	ErrBlockAttacherInvalidBlock              = ierrors.New("invalid block")
	ErrBlockAttacherAttachingNotPossible      = ierrors.New("attaching not possible")
	ErrBlockAttacherIncompleteBlockNotAllowed = ierrors.New("incomplete block is not allowed on this node")
	ErrBlockTooRecent                         = ierrors.New("block is too recent compared to latest commitment")
)

Functions

func AccountConversionManaCost

func AccountConversionManaCost(protocolParameters iotago.ProtocolParameters) iotago.Mana

TODO: add the correct formula later.

func MaxBlockManaCost

func MaxBlockManaCost(protocolParameters iotago.ProtocolParameters) iotago.Mana

TODO: add the correct formula later.

func MinDelegationAmount

func MinDelegationAmount(protocolParameters iotago.ProtocolParameters) iotago.BaseToken

func MinIssuerAccountAmount

func MinIssuerAccountAmount(protocolParameters iotago.ProtocolParameters) iotago.BaseToken

func MinValidatorAccountAmount

func MinValidatorAccountAmount(protocolParameters iotago.ProtocolParameters) iotago.BaseToken

func RegisterIDAlias

func RegisterIDAlias(id peer.ID, alias string)

RegisterIDAlias registers an alias that will modify the String() output of the ID to show a human readable string instead of the base58 encoded version of itself.

func UnregisterIDAliases

func UnregisterIDAliases()

UnregisterIDAliases removes all aliases registered through the RegisterIDAlias function.

func WithAccountIncreasedFoundryCounter

func WithAccountIncreasedFoundryCounter(diff uint32) options.Option[builder.AccountOutputBuilder]

func WithAccountInput

func WithAccountInput(input *OutputData) options.Option[builder.TransactionBuilder]

func WithAllotAllManaToAccount

func WithAllotAllManaToAccount(slot iotago.SlotIndex, accountID iotago.AccountID) options.Option[builder.TransactionBuilder]

func WithAllotments

func WithAllotments(allotments iotago.Allotments) options.Option[builder.TransactionBuilder]

func WithBasicBlockHeader

func WithBasicBlockHeader(opts ...options.Option[BlockHeaderParams]) func(builder *BasicBlockParams)

func WithBlockIssuerExpirySlot

func WithBlockIssuerExpirySlot(expirySlot iotago.SlotIndex) options.Option[builder.AccountOutputBuilder]

func WithCreationSlot

func WithCreationSlot(creationSlot iotago.SlotIndex) options.Option[builder.TransactionBuilder]

func WithDelegatedAmount

func WithDelegatedAmount(delegatedAmount iotago.BaseToken) options.Option[builder.DelegationOutputBuilder]

func WithDelegatedValidatorAddress

func WithDelegatedValidatorAddress(validatorAddress *iotago.AccountAddress) options.Option[builder.DelegationOutputBuilder]

func WithDelegationStartEpoch

func WithDelegationStartEpoch(startEpoch iotago.EpochIndex) options.Option[builder.DelegationOutputBuilder]

func WithHighestSupportedVersion

func WithHighestSupportedVersion(highestSupportedVersion iotago.Version) func(builder *ValidationBlockParams)

func WithInputs

func WithInputs(inputs ...*OutputData) options.Option[builder.TransactionBuilder]

func WithIssuer

func WithIssuer(issuer wallet.Account) func(builder *BlockHeaderParams)

func WithIssuingTime

func WithIssuingTime(issuingTime time.Time) func(builder *BlockHeaderParams)

func WithLatestFinalizedSlot

func WithLatestFinalizedSlot(commitmentIndex iotago.SlotIndex) func(builder *BlockHeaderParams)

func WithOutputs

func WithOutputs(outputs ...iotago.Output) options.Option[builder.TransactionBuilder]

func WithParentsCount

func WithParentsCount(parentsCount int) func(builder *BlockHeaderParams)

func WithPayload

func WithPayload(payload iotago.Payload) func(builder *BasicBlockParams)

func WithProtocolParametersHash

func WithProtocolParametersHash(protocolParametersHash iotago.Identifier) func(builder *ValidationBlockParams)

func WithProtocolVersion

func WithProtocolVersion(version iotago.Version) func(builder *BlockHeaderParams)

func WithReferenceValidation

func WithReferenceValidation(referenceValidation bool) func(builder *BlockHeaderParams)

func WithShallowLikeParents

func WithShallowLikeParents(blockIDs ...iotago.BlockID) func(builder *BlockHeaderParams)

func WithSlotCommitment

func WithSlotCommitment(commitment *iotago.Commitment) func(builder *BlockHeaderParams)

func WithStakingFeature

func WithStakingFeature(amount iotago.BaseToken, fixedCost iotago.Mana, startEpoch iotago.EpochIndex, optEndEpoch ...iotago.EpochIndex) options.Option[builder.AccountOutputBuilder]

func WithStrongParents

func WithStrongParents(blockIDs ...iotago.BlockID) func(builder *BlockHeaderParams)

func WithTaggedDataPayload

func WithTaggedDataPayload(payload *iotago.TaggedData) options.Option[builder.TransactionBuilder]

func WithValidationBlockHeaderOptions

func WithValidationBlockHeaderOptions(opts ...options.Option[BlockHeaderParams]) func(builder *ValidationBlockParams)

func WithWeakParents

func WithWeakParents(blockIDs ...iotago.BlockID) func(builder *BlockHeaderParams)

func WithoutBlockIssuerFeature

func WithoutBlockIssuerFeature() options.Option[builder.AccountOutputBuilder]

func WithoutStakingFeature

func WithoutStakingFeature() options.Option[builder.AccountOutputBuilder]

Types

type AccountData

type AccountData struct {
	// ID is the unique identifier of the account.
	ID iotago.AccountID
	// AddressIndex is the index of the address in the keyManager.
	AddressIndex uint32
	// Address is the Address of the account output.
	Address *iotago.AccountAddress
	// Output is the latest iotago AccountOutput of the account.
	Output *iotago.AccountOutput
	// OutputID is the unique identifier of the Output.
	OutputID iotago.OutputID
}

AccountData holds the details of an account that can be used to issue a block or account transition.

type BasicBlockParams

type BasicBlockParams struct {
	BlockHeader *BlockHeaderParams
	Payload     iotago.Payload
}

type BlockHeaderParams

type BlockHeaderParams struct {
	ParentsCount        int
	References          model.ParentReferences
	SlotCommitment      *iotago.Commitment
	LatestFinalizedSlot *iotago.SlotIndex
	IssuingTime         *time.Time
	ProtocolVersion     *iotago.Version
	Issuer              wallet.Account
	ReferenceValidation bool
}

type BlockIssuer

type BlockIssuer struct {
	Testing *testing.T

	Name      string
	Validator bool

	Client Client

	AccountData AccountData
	// contains filtered or unexported fields
}

BlockIssuer contains logic to create and issue blocks signed by the given account.

func NewBlockIssuer

func NewBlockIssuer(t *testing.T, name string, keyManager *wallet.KeyManager, client Client, addressIndex uint32, accountID iotago.AccountID, validator bool, opts ...options.Option[BlockIssuer]) *BlockIssuer

func (*BlockIssuer) Address

func (i *BlockIssuer) Address() iotago.Address

func (*BlockIssuer) BlockIssuerKey

func (i *BlockIssuer) BlockIssuerKey() iotago.BlockIssuerKey

func (*BlockIssuer) BlockIssuerKeys

func (i *BlockIssuer) BlockIssuerKeys() iotago.BlockIssuerKeys

func (*BlockIssuer) CopyIdentityFromBlockIssuer

func (i *BlockIssuer) CopyIdentityFromBlockIssuer(otherBlockIssuer *BlockIssuer)

func (*BlockIssuer) CreateBasicBlock

func (i *BlockIssuer) CreateBasicBlock(ctx context.Context, alias string, opts ...options.Option[BasicBlockParams]) (*blocks.Block, error)

CreateBlock creates a new block with the options.

func (*BlockIssuer) CreateValidationBlock

func (i *BlockIssuer) CreateValidationBlock(ctx context.Context, alias string, node *Node, opts ...options.Option[ValidationBlockParams]) (*blocks.Block, error)

func (*BlockIssuer) GetNewBlockIssuanceResponse

func (i *BlockIssuer) GetNewBlockIssuanceResponse() *api.IssuanceBlockHeaderResponse

func (*BlockIssuer) IssueActivity

func (i *BlockIssuer) IssueActivity(ctx context.Context, wg *sync.WaitGroup, startSlot iotago.SlotIndex, node *Node)

func (*BlockIssuer) IssueBasicBlock

func (i *BlockIssuer) IssueBasicBlock(ctx context.Context, alias string, opts ...options.Option[BasicBlockParams]) (*blocks.Block, error)

func (*BlockIssuer) IssueValidationBlock

func (i *BlockIssuer) IssueValidationBlock(ctx context.Context, alias string, node *Node, opts ...options.Option[ValidationBlockParams]) (*blocks.Block, error)

func (*BlockIssuer) SubmitBlock

func (i *BlockIssuer) SubmitBlock(ctx context.Context, block *model.Block) error

func (*BlockIssuer) SubmitBlockWithoutAwaitingBooking

func (i *BlockIssuer) SubmitBlockWithoutAwaitingBooking(block *model.Block, node *Node) error

type Client

type Client interface {
	APIForEpoch(epoch iotago.EpochIndex) iotago.API
	APIForSlot(slot iotago.SlotIndex) iotago.API
	APIForTime(t time.Time) iotago.API
	APIForVersion(version iotago.Version) (iotago.API, error)
	BlockByBlockID(ctx context.Context, blockID iotago.BlockID) (*iotago.Block, error)
	BlockIssuance(ctx context.Context) (*api.IssuanceBlockHeaderResponse, error)
	BlockIssuer(ctx context.Context) (nodeclient.BlockIssuerClient, error)
	BlockMetadataByBlockID(ctx context.Context, blockID iotago.BlockID) (*api.BlockMetadataResponse, error)
	BlockWithMetadataByBlockID(ctx context.Context, blockID iotago.BlockID) (*api.BlockWithMetadataResponse, error)
	CommitmentByID(ctx context.Context, commitmentID iotago.CommitmentID) (*iotago.Commitment, error)
	CommitmentBySlot(ctx context.Context, slot iotago.SlotIndex) (*iotago.Commitment, error)
	CommitmentUTXOChangesByID(ctx context.Context, commitmentID iotago.CommitmentID) (*api.UTXOChangesResponse, error)
	CommitmentUTXOChangesBySlot(ctx context.Context, slot iotago.SlotIndex) (*api.UTXOChangesResponse, error)
	CommitmentUTXOChangesFullByID(ctx context.Context, commitmentID iotago.CommitmentID) (*api.UTXOChangesFullResponse, error)
	CommitmentUTXOChangesFullBySlot(ctx context.Context, slot iotago.SlotIndex) (*api.UTXOChangesFullResponse, error)
	CommittedAPI() iotago.API
	Committee(ctx context.Context, optEpochIndex ...iotago.EpochIndex) (*api.CommitteeResponse, error)
	Congestion(ctx context.Context, accountAddress *iotago.AccountAddress, workScore iotago.WorkScore, optCommitmentID ...iotago.CommitmentID) (*api.CongestionResponse, error)
	Do(ctx context.Context, method string, route string, reqObj interface{}, resObj interface{}) (*http.Response, error)
	DoWithRequestHeaderHook(ctx context.Context, method string, route string, requestHeaderHook nodeclient.RequestHeaderHook, reqObj interface{}, resObj interface{}) (*http.Response, error)
	EventAPI(ctx context.Context) (*nodeclient.EventAPIClient, error)
	HTTPClient() *http.Client
	Health(ctx context.Context) (bool, error)
	Indexer(ctx context.Context) (nodeclient.IndexerClient, error)
	Info(ctx context.Context) (*api.InfoResponse, error)
	LatestAPI() iotago.API
	Management(ctx context.Context) (nodeclient.ManagementClient, error)
	Name() string
	NetworkMetrics(ctx context.Context) (*api.NetworkMetricsResponse, error)
	NodeSupportsRoute(ctx context.Context, route string) (bool, error)
	OutputByID(ctx context.Context, outputID iotago.OutputID) (iotago.Output, error)
	OutputMetadataByID(ctx context.Context, outputID iotago.OutputID) (*api.OutputMetadata, error)
	OutputWithMetadataByID(ctx context.Context, outputID iotago.OutputID) (iotago.Output, *api.OutputMetadata, error)
	Rewards(ctx context.Context, outputID iotago.OutputID) (*api.ManaRewardsResponse, error)
	Routes(ctx context.Context) (*api.RoutesResponse, error)
	SubmitBlock(ctx context.Context, m *iotago.Block) (iotago.BlockID, error)
	TransactionIncludedBlock(ctx context.Context, txID iotago.TransactionID) (*iotago.Block, error)
	TransactionIncludedBlockMetadata(ctx context.Context, txID iotago.TransactionID) (*api.BlockMetadataResponse, error)
	TransactionMetadata(ctx context.Context, txID iotago.TransactionID) (*api.TransactionMetadataResponse, error)
	Validator(ctx context.Context, accountAddress *iotago.AccountAddress) (*api.ValidatorResponse, error)
	Validators(ctx context.Context, pageSize uint64, cursor ...string) (*api.ValidatorsResponse, error)
	ValidatorsAll(ctx context.Context, maxPages ...int) (validators *api.ValidatorsResponse, allRetrieved bool, err error)
}

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func (*Endpoint) LocalPeerID

func (e *Endpoint) LocalPeerID() peer.ID

func (*Endpoint) RegisterProtocol

func (e *Endpoint) RegisterProtocol(_ func() proto.Message, handler func(peer.ID, proto.Message) error)

func (*Endpoint) Send

func (e *Endpoint) Send(packet proto.Message, to ...peer.ID)

func (*Endpoint) Shutdown

func (e *Endpoint) Shutdown()

func (*Endpoint) UnregisterProtocol

func (e *Endpoint) UnregisterProtocol()

type InvalidSignedTransactionEvent

type InvalidSignedTransactionEvent struct {
	Metadata mempool.SignedTransactionMetadata
	Error    error
}

type Network

type Network struct {
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork() *Network

func (*Network) JoinWithEndpoint

func (n *Network) JoinWithEndpoint(endpoint *Endpoint, newPartition string) *Endpoint

func (*Network) JoinWithEndpointID

func (n *Network) JoinWithEndpointID(endpointID peer.ID, partition string) *Endpoint

func (*Network) MergePartitionsToMain

func (n *Network) MergePartitionsToMain(partitions ...string)

type Node

type Node struct {
	Testing *testing.T

	Name string

	Client *TestSuiteClient

	Validator      *BlockIssuer
	KeyManager     *wallet.KeyManager
	RequestHandler *requesthandler.RequestHandler

	PeerID peer.ID

	Partition string
	Endpoint  *Endpoint
	Workers   *workerpool.Group

	Protocol *protocol.Protocol
	// contains filtered or unexported fields
}

func NewNode

func NewNode(t *testing.T, parentLogger log.Logger, net *Network, partition string, name string, isValidator bool) *Node

func Nodes

func Nodes(nodes ...*Node) []*Node

Nodes is a helper function that creates a slice of nodes.

func (*Node) CandidateEngineActivatedCount

func (n *Node) CandidateEngineActivatedCount() int

func (*Node) FilteredBlocks

func (n *Node) FilteredBlocks() []*postsolidfilter.BlockFilteredEvent

func (*Node) ForkDetectedCount

func (n *Node) ForkDetectedCount() int

func (*Node) HighestSupportedVersion

func (n *Node) HighestSupportedVersion() iotago.Version

func (*Node) Initialize

func (n *Node) Initialize(failOnBlockFiltered bool, opts ...options.Option[protocol.Protocol])

func (*Node) IsValidator

func (n *Node) IsValidator() bool

func (*Node) IssueValidationBlock

func (n *Node) IssueValidationBlock(ctx context.Context, alias string, opts ...options.Option[ValidationBlockParams]) (*blocks.Block, error)

func (*Node) MainEngineSwitchedCount

func (n *Node) MainEngineSwitchedCount() int

func (*Node) ProtocolParametersHash

func (n *Node) ProtocolParametersHash() iotago.Identifier

func (*Node) SetCurrentSlot

func (n *Node) SetCurrentSlot(slot iotago.SlotIndex)

func (*Node) SetHighestSupportedVersion

func (n *Node) SetHighestSupportedVersion(version iotago.Version)

func (*Node) SetProtocolParametersHash

func (n *Node) SetProtocolParametersHash(hash iotago.Identifier)

func (*Node) Shutdown

func (n *Node) Shutdown()

func (*Node) TransactionFailure

func (n *Node) TransactionFailure(txID iotago.SignedTransactionID) (InvalidSignedTransactionEvent, bool)

func (*Node) Wait

func (n *Node) Wait()

type OutputData

type OutputData struct {
	// ID is the unique identifier of the output.
	ID iotago.OutputID
	// Output is the iotago Output.
	Output iotago.Output
	// Address is the address of the output.
	Address iotago.Address
	// AddressIndex is the index of the address in the keyManager.
	AddressIndex uint32
}

func OutputDataFromUTXOLedgerOutput

func OutputDataFromUTXOLedgerOutput(output *utxoledger.Output) *OutputData

type TestSuiteClient

type TestSuiteClient struct {
	Node *Node
}

func NewTestSuiteClient

func NewTestSuiteClient(node *Node) *TestSuiteClient

func (*TestSuiteClient) APIForEpoch

func (c *TestSuiteClient) APIForEpoch(epoch iotago.EpochIndex) iotago.API

func (*TestSuiteClient) APIForSlot

func (c *TestSuiteClient) APIForSlot(slot iotago.SlotIndex) iotago.API

func (*TestSuiteClient) APIForTime

func (c *TestSuiteClient) APIForTime(t time.Time) iotago.API

func (*TestSuiteClient) APIForVersion

func (c *TestSuiteClient) APIForVersion(version iotago.Version) (iotago.API, error)

func (*TestSuiteClient) BlockByBlockID

func (c *TestSuiteClient) BlockByBlockID(_ context.Context, blockID iotago.BlockID) (*iotago.Block, error)

func (*TestSuiteClient) BlockIssuance

func (*TestSuiteClient) BlockIssuer

func (*TestSuiteClient) BlockMetadataByBlockID

func (c *TestSuiteClient) BlockMetadataByBlockID(_ context.Context, blockID iotago.BlockID) (*api.BlockMetadataResponse, error)

func (*TestSuiteClient) BlockWithMetadataByBlockID

func (c *TestSuiteClient) BlockWithMetadataByBlockID(_ context.Context, blockID iotago.BlockID) (*api.BlockWithMetadataResponse, error)

func (*TestSuiteClient) CommitmentByID

func (c *TestSuiteClient) CommitmentByID(_ context.Context, commitmentID iotago.CommitmentID) (*iotago.Commitment, error)

func (*TestSuiteClient) CommitmentBySlot

func (c *TestSuiteClient) CommitmentBySlot(_ context.Context, slot iotago.SlotIndex) (*iotago.Commitment, error)

func (*TestSuiteClient) CommitmentUTXOChangesByID

func (c *TestSuiteClient) CommitmentUTXOChangesByID(_ context.Context, commitmentID iotago.CommitmentID) (*api.UTXOChangesResponse, error)

func (*TestSuiteClient) CommitmentUTXOChangesBySlot

func (c *TestSuiteClient) CommitmentUTXOChangesBySlot(_ context.Context, slot iotago.SlotIndex) (*api.UTXOChangesResponse, error)

func (*TestSuiteClient) CommitmentUTXOChangesFullByID

func (c *TestSuiteClient) CommitmentUTXOChangesFullByID(_ context.Context, commitmentID iotago.CommitmentID) (*api.UTXOChangesFullResponse, error)

func (*TestSuiteClient) CommitmentUTXOChangesFullBySlot

func (c *TestSuiteClient) CommitmentUTXOChangesFullBySlot(_ context.Context, slot iotago.SlotIndex) (*api.UTXOChangesFullResponse, error)

func (*TestSuiteClient) CommittedAPI

func (c *TestSuiteClient) CommittedAPI() iotago.API

func (*TestSuiteClient) Committee

func (c *TestSuiteClient) Committee(_ context.Context, optEpochIndex ...iotago.EpochIndex) (*api.CommitteeResponse, error)

func (*TestSuiteClient) Congestion

func (c *TestSuiteClient) Congestion(_ context.Context, accountAddress *iotago.AccountAddress, workScore iotago.WorkScore, optCommitmentID ...iotago.CommitmentID) (*api.CongestionResponse, error)

func (*TestSuiteClient) Do

func (c *TestSuiteClient) Do(_ context.Context, _ string, _ string, _ interface{}, _ interface{}) (*http.Response, error)

func (*TestSuiteClient) DoWithRequestHeaderHook

func (c *TestSuiteClient) DoWithRequestHeaderHook(_ context.Context, _ string, _ string, _ nodeclient.RequestHeaderHook, _ interface{}, _ interface{}) (*http.Response, error)

func (*TestSuiteClient) EventAPI

func (*TestSuiteClient) HTTPClient

func (c *TestSuiteClient) HTTPClient() *http.Client

func (*TestSuiteClient) Health

func (c *TestSuiteClient) Health(_ context.Context) (bool, error)

func (*TestSuiteClient) Indexer

func (*TestSuiteClient) Info

func (*TestSuiteClient) LatestAPI

func (c *TestSuiteClient) LatestAPI() iotago.API

func (*TestSuiteClient) Management

func (*TestSuiteClient) Name

func (c *TestSuiteClient) Name() string

func (*TestSuiteClient) NetworkMetrics

func (*TestSuiteClient) NodeSupportsRoute

func (c *TestSuiteClient) NodeSupportsRoute(_ context.Context, _ string) (bool, error)

func (*TestSuiteClient) OutputByID

func (c *TestSuiteClient) OutputByID(_ context.Context, outputID iotago.OutputID) (iotago.Output, error)

func (*TestSuiteClient) OutputMetadataByID

func (c *TestSuiteClient) OutputMetadataByID(_ context.Context, outputID iotago.OutputID) (*api.OutputMetadata, error)

func (*TestSuiteClient) OutputWithMetadataByID

func (c *TestSuiteClient) OutputWithMetadataByID(_ context.Context, outputID iotago.OutputID) (iotago.Output, *api.OutputMetadata, error)

func (*TestSuiteClient) Rewards

TODO: check if we should have slot parameter on this interface like we do on rewards endpoint of API.

func (*TestSuiteClient) Routes

func (*TestSuiteClient) SubmitBlock

func (c *TestSuiteClient) SubmitBlock(ctx context.Context, block *iotago.Block) (iotago.BlockID, error)

func (*TestSuiteClient) TransactionIncludedBlock

func (c *TestSuiteClient) TransactionIncludedBlock(_ context.Context, txID iotago.TransactionID) (*iotago.Block, error)

func (*TestSuiteClient) TransactionIncludedBlockMetadata

func (c *TestSuiteClient) TransactionIncludedBlockMetadata(_ context.Context, txID iotago.TransactionID) (*api.BlockMetadataResponse, error)

func (*TestSuiteClient) TransactionMetadata

func (*TestSuiteClient) Validator

func (c *TestSuiteClient) Validator(_ context.Context, accountAddress *iotago.AccountAddress) (*api.ValidatorResponse, error)

func (*TestSuiteClient) Validators

func (c *TestSuiteClient) Validators(_ context.Context, _ uint64, _ ...string) (*api.ValidatorsResponse, error)

func (*TestSuiteClient) ValidatorsAll

func (c *TestSuiteClient) ValidatorsAll(_ context.Context, _ ...int) (*api.ValidatorsResponse, bool, error)

type TestSuiteWalletClock

type TestSuiteWalletClock struct {
	// contains filtered or unexported fields
}

func (*TestSuiteWalletClock) CurrentSlot

func (c *TestSuiteWalletClock) CurrentSlot() iotago.SlotIndex

func (*TestSuiteWalletClock) SetCurrentSlot

func (c *TestSuiteWalletClock) SetCurrentSlot(slot iotago.SlotIndex)

type ValidationBlockParams

type ValidationBlockParams struct {
	BlockHeader             *BlockHeaderParams
	HighestSupportedVersion *iotago.Version
	ProtocolParametersHash  *iotago.Identifier
}

type Wallet

type Wallet struct {
	Testing *testing.T

	Name string

	Client Client

	BlockIssuer   *BlockIssuer
	IssuerAccount *AccountData
	// contains filtered or unexported fields
}

Wallet is an object representing a wallet (similar to a FireFly wallet) capable of the following: - hierarchical deterministic key management - signing transactions - signing blocks - keeping track of unspent outputs.

func NewWallet

func NewWallet(t *testing.T, name string, client Client, keyManager ...*wallet.KeyManager) *Wallet

func (*Wallet) AccountOutputData

func (w *Wallet) AccountOutputData(outputName string) *OutputData

func (*Wallet) AddOutput

func (w *Wallet) AddOutput(outputName string, output *OutputData)

func (*Wallet) Address

func (w *Wallet) Address(index ...uint32) iotago.DirectUnlockableAddress

func (*Wallet) AddressSigner

func (w *Wallet) AddressSigner(indexes ...uint32) iotago.AddressSigner

func (*Wallet) AllotManaFromBasicOutput

func (w *Wallet) AllotManaFromBasicOutput(transactionName string, inputName string, accountIDs ...iotago.AccountID) *iotago.SignedTransaction

func (*Wallet) AllotManaFromInputs

func (w *Wallet) AllotManaFromInputs(transactionName string, allotments iotago.Allotments, inputNames ...string) *iotago.SignedTransaction

func (*Wallet) AllotManaToWallet

func (w *Wallet) AllotManaToWallet(transactionName string, inputName string, recipientWallet *Wallet) *iotago.SignedTransaction

func (*Wallet) Balance

func (w *Wallet) Balance() iotago.BaseToken

func (*Wallet) ClaimDelegatorRewards

func (w *Wallet) ClaimDelegatorRewards(transactionName string, inputName string) *iotago.SignedTransaction

func (*Wallet) ClaimValidatorRewards

func (w *Wallet) ClaimValidatorRewards(transactionName string, inputName string) *iotago.SignedTransaction

func (*Wallet) CreateAccountFromInput

func (w *Wallet) CreateAccountFromInput(transactionName string, inputName string, recipientWallet *Wallet, opts ...options.Option[builder.AccountOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) CreateAccountsFromInput

func (w *Wallet) CreateAccountsFromInput(transactionName string, inputName string, outputCount int, opts ...options.Option[builder.AccountOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) CreateBasicOutputsAtAddressesFromInput

func (w *Wallet) CreateBasicOutputsAtAddressesFromInput(transactionName string, addressIndexes []uint32, inputName string) *iotago.SignedTransaction

func (*Wallet) CreateBasicOutputsEquallyFromInput

func (w *Wallet) CreateBasicOutputsEquallyFromInput(transactionName string, outputCount int, inputName string) *iotago.SignedTransaction

func (*Wallet) CreateBasicOutputsEquallyFromInputs

func (w *Wallet) CreateBasicOutputsEquallyFromInputs(transactionName string, inputNames []string, inputAddressIndexes []uint32, outputsCount int) *iotago.SignedTransaction

func (*Wallet) CreateDelegationFromInput

func (w *Wallet) CreateDelegationFromInput(transactionName string, inputName string, opts ...options.Option[builder.DelegationOutputBuilder]) *iotago.SignedTransaction

CreateDelegationFromInput creates a new DelegationOutput with given options from an input. If the remainder Output is not created, then StoredMana from the input is not passed and can potentially be burned. In order not to burn it, it needs to be assigned manually in another output in the transaction.

func (*Wallet) CreateFoundryAndNativeTokensFromInput

func (w *Wallet) CreateFoundryAndNativeTokensFromInput(transactionName string, inputName string, accountName string, addressIndexes ...uint32) *iotago.SignedTransaction

func (*Wallet) CreateImplicitAccountAndBasicOutputFromInput

func (w *Wallet) CreateImplicitAccountAndBasicOutputFromInput(transactionName string, inputName string, recipientWallet *Wallet) *iotago.SignedTransaction

CreateImplicitAccountAndBasicOutputFromInput creates an implicit account output and a remainder basic output from a basic output.

func (*Wallet) CreateImplicitAccountFromInput

func (w *Wallet) CreateImplicitAccountFromInput(transactionName string, inputName string, recipientWallet *Wallet) *iotago.SignedTransaction

CreateImplicitAccountFromInput creates an implicit account output.

func (*Wallet) CreateNFTFromInput

func (w *Wallet) CreateNFTFromInput(transactionName string, inputName string, opts ...options.Option[builder.NFTOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) CreateNativeTokenFromInput

func (w *Wallet) CreateNativeTokenFromInput(transactionName string, inputName string, accountOutputName string, mintedAmount iotago.BaseToken, maxSupply iotago.BaseToken) *iotago.SignedTransaction

func (*Wallet) CurrentSlot

func (w *Wallet) CurrentSlot() iotago.SlotIndex

func (*Wallet) DelayedClaimingTransition

func (w *Wallet) DelayedClaimingTransition(transactionName string, inputName string, delegationEndEpoch iotago.EpochIndex) *iotago.SignedTransaction

DelayedClaimingTransition transitions DelegationOutput into delayed claiming state by setting DelegationID and EndEpoch.

func (*Wallet) DelegationEndFromSlot

func (w *Wallet) DelegationEndFromSlot(slot, latestCommitmentSlot iotago.SlotIndex) iotago.EpochIndex

func (*Wallet) DelegationStartFromSlot

func (w *Wallet) DelegationStartFromSlot(slot, latestCommitmentSlot iotago.SlotIndex) iotago.EpochIndex

func (*Wallet) DestroyAccount

func (w *Wallet) DestroyAccount(transactionName string, inputName string) *iotago.SignedTransaction

func (*Wallet) GetNewBlockIssuanceResponse

func (w *Wallet) GetNewBlockIssuanceResponse() *api.IssuanceBlockHeaderResponse

func (*Wallet) HasAddress

func (w *Wallet) HasAddress(address iotago.Address, index ...uint32) bool

func (*Wallet) ImplicitAccountCreationAddress

func (w *Wallet) ImplicitAccountCreationAddress(index ...uint32) *iotago.ImplicitAccountCreationAddress

func (*Wallet) IssueBasicBlock

func (w *Wallet) IssueBasicBlock(ctx context.Context, blockName string, opts ...options.Option[BasicBlockParams]) (*blocks.Block, error)

func (*Wallet) KeyPair

func (w *Wallet) KeyPair() (ed25519.PrivateKey, ed25519.PublicKey)

func (*Wallet) OutputData

func (w *Wallet) OutputData(outputName string) *OutputData

func (*Wallet) PotentialMana

func (w *Wallet) PotentialMana(api iotago.API, input *OutputData) iotago.Mana

Computes the Potential Mana that the output generates until the current slot.

func (*Wallet) RemoveFeatureFromAccount

func (w *Wallet) RemoveFeatureFromAccount(featureType iotago.FeatureType, transactionName string, inputName string) *iotago.SignedTransaction

func (*Wallet) SendFundsFromAccount

func (w *Wallet) SendFundsFromAccount(transactionName string, accountOutputName string, commitmentID iotago.CommitmentID, inputNames ...string) *iotago.SignedTransaction

func (*Wallet) SendFundsToAccount

func (w *Wallet) SendFundsToAccount(transactionName string, accountID iotago.AccountID, inputNames ...string) *iotago.SignedTransaction

func (*Wallet) SendFundsToWallet

func (w *Wallet) SendFundsToWallet(transactionName string, receiverWallet *Wallet, inputNames ...string) *iotago.SignedTransaction

func (*Wallet) SetBlockIssuer

func (w *Wallet) SetBlockIssuer(accountData *AccountData)

func (*Wallet) SetCurrentSlot

func (w *Wallet) SetCurrentSlot(slot iotago.SlotIndex)

func (*Wallet) SetDefaultClient

func (w *Wallet) SetDefaultClient(client Client)

func (*Wallet) StoredMana

func (w *Wallet) StoredMana(api iotago.API, input *OutputData) iotago.Mana

Computes the decay on stored mana that the output holds until the current slot.

func (*Wallet) Transaction

func (w *Wallet) Transaction(alias string) *iotago.Transaction

func (*Wallet) TransactionID

func (w *Wallet) TransactionID(alias string) iotago.TransactionID

func (*Wallet) Transactions

func (w *Wallet) Transactions(transactionNames ...string) []*iotago.Transaction

func (*Wallet) TransitionAccount

func (w *Wallet) TransitionAccount(transactionName string, inputName string, opts ...options.Option[builder.AccountOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) TransitionAccounts

func (w *Wallet) TransitionAccounts(transactionName string, inputNames []string, opts ...options.Option[builder.AccountOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) TransitionFoundry

func (w *Wallet) TransitionFoundry(transactionName string, inputName string, accountName string) *iotago.SignedTransaction

TransitionFoundry transitions a FoundryOutput by increasing the native token amount on the output by one.

func (*Wallet) TransitionImplicitAccountToAccountOutput

func (w *Wallet) TransitionImplicitAccountToAccountOutput(transactionName string, inputNames []string, opts ...options.Option[builder.AccountOutputBuilder]) *iotago.SignedTransaction

func (*Wallet) TransitionNFTWithTransactionOpts

func (w *Wallet) TransitionNFTWithTransactionOpts(transactionName string, inputName string, opts ...options.Option[builder.TransactionBuilder]) *iotago.SignedTransaction

type WalletClock

type WalletClock interface {
	SetCurrentSlot(slot iotago.SlotIndex)
	CurrentSlot() iotago.SlotIndex
}

WalletClock is an interface that provides the current slot.

Jump to

Keyboard shortcuts

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