builder

package
v4.0.0-...-3659144 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 5 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTransactionBuilder = ierrors.New("transaction builder error")

ErrTransactionBuilder defines a generic error occurring within the TransactionBuilder.

Functions

This section is empty.

Types

type AccountOutputBuilder

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

AccountOutputBuilder builds an iotago.AccountOutput.

func NewAccountOutputBuilder

func NewAccountOutputBuilder(targetAddr iotago.Address, amount iotago.BaseToken) *AccountOutputBuilder

NewAccountOutputBuilder creates a new AccountOutputBuilder with the address and base token amount.

func NewAccountOutputBuilderFromPrevious

func NewAccountOutputBuilderFromPrevious(previous *iotago.AccountOutput) *AccountOutputBuilder

NewAccountOutputBuilderFromPrevious creates a new AccountOutputBuilder starting from a copy of the previous iotago.AccountOutput.

func (*AccountOutputBuilder) AccountID

func (builder *AccountOutputBuilder) AccountID(accountID iotago.AccountID) *AccountOutputBuilder

AccountID sets the iotago.AccountID of this output. Do not call this function if the underlying iotago.AccountOutput is not new.

func (*AccountOutputBuilder) Address

func (builder *AccountOutputBuilder) Address(addr iotago.Address) *AccountOutputBuilder

Address sets/modifies an iotago.AddressUnlockCondition on the output.

func (*AccountOutputBuilder) Amount

func (builder *AccountOutputBuilder) Amount(amount iotago.BaseToken) *AccountOutputBuilder

Amount sets the base token amount of the output.

func (*AccountOutputBuilder) BlockIssuer

func (builder *AccountOutputBuilder) BlockIssuer(keys iotago.BlockIssuerKeys, expirySlot iotago.SlotIndex) *AccountOutputBuilder

BlockIssuer sets/modifies an iotago.BlockIssuerFeature as a mutable feature on the output.

func (*AccountOutputBuilder) BlockIssuerTransition

func (builder *AccountOutputBuilder) BlockIssuerTransition() *BlockIssuerTransition

BlockIssuerTransition narrows the builder functions to the ones available for an iotago.BlockIssuerFeature transition. If BlockIssuerFeature does not exist, it creates and sets an empty feature.

func (*AccountOutputBuilder) Build

func (builder *AccountOutputBuilder) Build() (*iotago.AccountOutput, error)

Build builds the iotago.AccountOutput.

func (*AccountOutputBuilder) FoundriesToGenerate

func (builder *AccountOutputBuilder) FoundriesToGenerate(count uint32) *AccountOutputBuilder

FoundriesToGenerate bumps the output's foundry counter by the amount of foundries to generate.

func (*AccountOutputBuilder) ImmutableIssuer

func (builder *AccountOutputBuilder) ImmutableIssuer(issuer iotago.Address) *AccountOutputBuilder

ImmutableIssuer sets/modifies an iotago.IssuerFeature as an immutable feature on the output. Only call this function on a new iotago.AccountOutput.

func (*AccountOutputBuilder) ImmutableMetadata

func (builder *AccountOutputBuilder) ImmutableMetadata(entries iotago.MetadataFeatureEntries) *AccountOutputBuilder

ImmutableMetadata sets/modifies an iotago.MetadataFeature as an immutable feature on the output. Only call this function on a new iotago.AccountOutput.

func (*AccountOutputBuilder) Mana

Mana sets the mana of the output.

func (*AccountOutputBuilder) Metadata

Metadata sets/modifies an iotago.MetadataFeature on the output.

func (*AccountOutputBuilder) MustBuild

func (builder *AccountOutputBuilder) MustBuild() *iotago.AccountOutput

MustBuild works like Build() but panics if an error is encountered.

func (*AccountOutputBuilder) RemoveFeature

func (builder *AccountOutputBuilder) RemoveFeature(featureType iotago.FeatureType) *AccountOutputBuilder

RemoveFeature removes a feature from the output.

func (*AccountOutputBuilder) Sender

func (builder *AccountOutputBuilder) Sender(senderAddr iotago.Address) *AccountOutputBuilder

Sender sets/modifies an iotago.SenderFeature as a mutable feature on the output.

func (*AccountOutputBuilder) Staking

func (builder *AccountOutputBuilder) Staking(amount iotago.BaseToken, fixedCost iotago.Mana, startEpoch iotago.EpochIndex, optEndEpoch ...iotago.EpochIndex) *AccountOutputBuilder

Staking sets/modifies an iotago.StakingFeature as a mutable feature on the output.

func (*AccountOutputBuilder) StakingTransition

func (builder *AccountOutputBuilder) StakingTransition() *StakingTransition

StakingTransition narrows the builder functions to the ones available for an iotago.StakingFeature transition. If StakingFeature does not exist, it creates and sets an empty feature.

type AnchorGovernanceTransition

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

func (*AnchorGovernanceTransition) Builder

Builder returns the AnchorOutputBuilder.

func (*AnchorGovernanceTransition) Governor

Governor sets the iotago.GovernorAddressUnlockCondition of the output.

func (*AnchorGovernanceTransition) Metadata

Metadata sets/modifies an iotago.MetadataFeature as a mutable feature on the output.

func (*AnchorGovernanceTransition) StateController

func (trans *AnchorGovernanceTransition) StateController(stateCtrl iotago.Address) *AnchorGovernanceTransition

StateController sets the iotago.StateControllerAddressUnlockCondition of the output.

type AnchorOutputBuilder

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

AnchorOutputBuilder builds an iotago.AnchorOutput.

func NewAnchorOutputBuilder

func NewAnchorOutputBuilder(stateCtrl iotago.Address, govAddr iotago.Address, amount iotago.BaseToken) *AnchorOutputBuilder

NewAnchorOutputBuilder creates a new AnchorOutputBuilder with the required state controller/governor addresses and base token amount.

func NewAnchorOutputBuilderFromPrevious

func NewAnchorOutputBuilderFromPrevious(previous *iotago.AnchorOutput) *AnchorOutputBuilder

NewAnchorOutputBuilderFromPrevious creates a new AnchorOutputBuilder starting from a copy of the previous iotago.AnchorOutput.

func (*AnchorOutputBuilder) Amount

func (builder *AnchorOutputBuilder) Amount(amount iotago.BaseToken) *AnchorOutputBuilder

Amount sets the base token amount of the output.

func (*AnchorOutputBuilder) AnchorID

func (builder *AnchorOutputBuilder) AnchorID(anchorID iotago.AnchorID) *AnchorOutputBuilder

AnchorID sets the iotago.AnchorID of this output. Do not call this function if the underlying iotago.AnchorOutput is not new.

func (*AnchorOutputBuilder) Build

func (builder *AnchorOutputBuilder) Build() (*iotago.AnchorOutput, error)

Build builds the iotago.AnchorOutput.

func (*AnchorOutputBuilder) GovernanceTransition

func (builder *AnchorOutputBuilder) GovernanceTransition() *AnchorGovernanceTransition

GovernanceTransition narrows the builder functions to the ones available for an anchor governance transition.

func (*AnchorOutputBuilder) Governor

func (builder *AnchorOutputBuilder) Governor(governor iotago.Address) *AnchorOutputBuilder

Governor sets the iotago.GovernorAddressUnlockCondition of the output.

func (*AnchorOutputBuilder) ImmutableIssuer

func (builder *AnchorOutputBuilder) ImmutableIssuer(issuer iotago.Address) *AnchorOutputBuilder

ImmutableIssuer sets/modifies an iotago.IssuerFeature as an immutable feature on the output. Only call this function on a new iotago.AnchorOutput.

func (*AnchorOutputBuilder) ImmutableMetadata

func (builder *AnchorOutputBuilder) ImmutableMetadata(entries iotago.MetadataFeatureEntries) *AnchorOutputBuilder

ImmutableMetadata sets/modifies an iotago.MetadataFeature as an immutable feature on the output. Only call this function on a new iotago.AnchorOutput.

func (*AnchorOutputBuilder) Mana

func (builder *AnchorOutputBuilder) Mana(mana iotago.Mana) *AnchorOutputBuilder

Mana sets the mana of the output.

func (*AnchorOutputBuilder) Metadata

Metadata sets/modifies an iotago.MetadataFeature on the output.

func (*AnchorOutputBuilder) MustBuild

func (builder *AnchorOutputBuilder) MustBuild() *iotago.AnchorOutput

MustBuild works like Build() but panics if an error is encountered.

func (*AnchorOutputBuilder) StateController

func (builder *AnchorOutputBuilder) StateController(stateCtrl iotago.Address) *AnchorOutputBuilder

StateController sets the iotago.StateControllerAddressUnlockCondition of the output.

func (*AnchorOutputBuilder) StateMetadata

StateMetadata sets/modifies an iotago.StateMetadataFeature on the output.

func (*AnchorOutputBuilder) StateTransition

func (builder *AnchorOutputBuilder) StateTransition() *AnchorStateTransition

StateTransition narrows the builder functions to the ones available for an anchor state transition.

type AnchorStateTransition

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

func (*AnchorStateTransition) Amount

Amount sets the base token amount of the output.

func (*AnchorStateTransition) Builder

func (trans *AnchorStateTransition) Builder() *AnchorOutputBuilder

Builder returns the AnchorOutputBuilder.

func (*AnchorStateTransition) Mana

Mana sets the mana of the output.

func (*AnchorStateTransition) StateMetadata

StateMetadata sets/modifies an iotago.StateMetadataFeature on the output.

type AvailableManaResult

type AvailableManaResult struct {
	TotalMana            iotago.Mana
	UnboundMana          iotago.Mana
	PotentialMana        iotago.Mana
	StoredMana           iotago.Mana
	UnboundPotentialMana iotago.Mana
	UnboundStoredMana    iotago.Mana
	AccountBoundMana     map[iotago.AccountID]iotago.Mana
	Rewards              iotago.Mana
}

func (*AvailableManaResult) AddAccountBoundMana

func (a *AvailableManaResult) AddAccountBoundMana(accountID iotago.AccountID, value iotago.Mana) error

func (*AvailableManaResult) AddPotentialMana

func (a *AvailableManaResult) AddPotentialMana(value iotago.Mana) error

func (*AvailableManaResult) AddRewards

func (a *AvailableManaResult) AddRewards(value iotago.Mana) error

func (*AvailableManaResult) AddStoredMana

func (a *AvailableManaResult) AddStoredMana(value iotago.Mana) error

func (*AvailableManaResult) AddUnboundPotentialMana

func (a *AvailableManaResult) AddUnboundPotentialMana(value iotago.Mana) error

func (*AvailableManaResult) AddUnboundStoredMana

func (a *AvailableManaResult) AddUnboundStoredMana(value iotago.Mana) error

type BasicBlockBuilder

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

BasicBlockBuilder is used to easily build up a Basic Block.

func NewBasicBlockBuilder

func NewBasicBlockBuilder(api iotago.API) *BasicBlockBuilder

NewBasicBlockBuilder creates a new BasicBlockBuilder.

func (*BasicBlockBuilder) Build

func (b *BasicBlockBuilder) Build() (*iotago.Block, error)

Build builds the Block or returns any error which occurred during the build steps.

func (*BasicBlockBuilder) CalculateAndSetMaxBurnedMana

func (b *BasicBlockBuilder) CalculateAndSetMaxBurnedMana(rmc iotago.Mana) *BasicBlockBuilder

CalculateAndSetMaxBurnedMana sets the maximum amount of mana allowed to be burned by the block based on the provided reference mana cost.

func (*BasicBlockBuilder) IssuingTime

func (b *BasicBlockBuilder) IssuingTime(time time.Time) *BasicBlockBuilder

func (*BasicBlockBuilder) LatestFinalizedSlot

func (b *BasicBlockBuilder) LatestFinalizedSlot(slot iotago.SlotIndex) *BasicBlockBuilder

LatestFinalizedSlot sets the latest finalized slot.

func (*BasicBlockBuilder) MaxBurnedMana

func (b *BasicBlockBuilder) MaxBurnedMana(maxBurnedMana iotago.Mana) *BasicBlockBuilder

MaxBurnedMana sets the maximum amount of mana allowed to be burned by the block.

func (*BasicBlockBuilder) Payload

Payload sets the payload.

func (*BasicBlockBuilder) ProtocolVersion

func (b *BasicBlockBuilder) ProtocolVersion(version iotago.Version) *BasicBlockBuilder

ProtocolVersion sets the protocol version.

func (*BasicBlockBuilder) ShallowLikeParents

func (b *BasicBlockBuilder) ShallowLikeParents(parents iotago.BlockIDs) *BasicBlockBuilder

ShallowLikeParents sets the shallow like parents.

func (*BasicBlockBuilder) Sign

func (*BasicBlockBuilder) SignWithSigner

func (b *BasicBlockBuilder) SignWithSigner(accountID iotago.AccountID, signer iotago.AddressSigner, addr iotago.Address) *BasicBlockBuilder

func (*BasicBlockBuilder) SlotCommitmentID

func (b *BasicBlockBuilder) SlotCommitmentID(commitment iotago.CommitmentID) *BasicBlockBuilder

SlotCommitmentID sets the slot commitment.

func (*BasicBlockBuilder) StrongParents

func (b *BasicBlockBuilder) StrongParents(parents iotago.BlockIDs) *BasicBlockBuilder

StrongParents sets the strong parents.

func (*BasicBlockBuilder) WeakParents

func (b *BasicBlockBuilder) WeakParents(parents iotago.BlockIDs) *BasicBlockBuilder

WeakParents sets the weak parents.

type BasicOutputBuilder

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

BasicOutputBuilder builds an iotago.BasicOutput.

func NewBasicOutputBuilder

func NewBasicOutputBuilder(targetAddr iotago.Address, amount iotago.BaseToken) *BasicOutputBuilder

NewBasicOutputBuilder creates a new BasicOutputBuilder with the required target address and base token amount.

func NewBasicOutputBuilderFromPrevious

func NewBasicOutputBuilderFromPrevious(previous *iotago.BasicOutput) *BasicOutputBuilder

NewBasicOutputBuilderFromPrevious creates a new BasicOutputBuilder starting from a copy of the previous iotago.BasicOutput.

func (*BasicOutputBuilder) Address

func (builder *BasicOutputBuilder) Address(addr iotago.Address) *BasicOutputBuilder

Address sets/modifies an iotago.AddressUnlockCondition on the output.

func (*BasicOutputBuilder) Amount

func (builder *BasicOutputBuilder) Amount(amount iotago.BaseToken) *BasicOutputBuilder

Amount sets the base token amount of the output.

func (*BasicOutputBuilder) Build

func (builder *BasicOutputBuilder) Build() (*iotago.BasicOutput, error)

Build builds the iotago.BasicOutput.

func (*BasicOutputBuilder) Expiration

func (builder *BasicOutputBuilder) Expiration(returnAddr iotago.Address, expiredAfterSlot iotago.SlotIndex) *BasicOutputBuilder

Expiration sets/modifies an iotago.ExpirationUnlockCondition on the output.

func (*BasicOutputBuilder) Mana

func (builder *BasicOutputBuilder) Mana(mana iotago.Mana) *BasicOutputBuilder

Mana sets the mana of the output.

func (*BasicOutputBuilder) Metadata

Metadata sets/modifies an iotago.MetadataFeature on the output.

func (*BasicOutputBuilder) MustBuild

func (builder *BasicOutputBuilder) MustBuild() *iotago.BasicOutput

MustBuild works like Build() but panics if an error is encountered.

func (*BasicOutputBuilder) NativeToken

NativeToken adds/modifies a native token to/on the output.

func (*BasicOutputBuilder) Sender

func (builder *BasicOutputBuilder) Sender(senderAddr iotago.Address) *BasicOutputBuilder

Sender sets/modifies an iotago.SenderFeature on the output.

func (*BasicOutputBuilder) StorageDepositReturn

func (builder *BasicOutputBuilder) StorageDepositReturn(returnAddr iotago.Address, amount iotago.BaseToken) *BasicOutputBuilder

StorageDepositReturn sets/modifies an iotago.StorageDepositReturnUnlockCondition on the output.

func (*BasicOutputBuilder) Tag

func (builder *BasicOutputBuilder) Tag(tag []byte) *BasicOutputBuilder

Tag sets/modifies an iotago.TagFeature on the output.

func (*BasicOutputBuilder) Timelock

func (builder *BasicOutputBuilder) Timelock(untilSlot iotago.SlotIndex) *BasicOutputBuilder

Timelock sets/modifies an iotago.TimelockUnlockCondition on the output.

type BlockIssuerTransition

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

func (*BlockIssuerTransition) AddKeys

AddKeys adds the keys of the BlockIssuerFeature.

func (*BlockIssuerTransition) Builder

func (trans *BlockIssuerTransition) Builder() *AccountOutputBuilder

Builder returns the AccountOutputBuilder.

func (*BlockIssuerTransition) ExpirySlot

ExpirySlot sets the ExpirySlot of iotago.BlockIssuerFeature.

func (*BlockIssuerTransition) Keys

Keys sets the keys of the iotago.BlockIssuerFeature.

func (*BlockIssuerTransition) RemoveKey

func (trans *BlockIssuerTransition) RemoveKey(keyToDelete iotago.BlockIssuerKey) *BlockIssuerTransition

RemoveKey deletes the key of the iotago.BlockIssuerFeature.

type DelegationOutputBuilder

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

DelegationOutputBuilder builds an iotago.DelegationOutput.

func NewDelegationOutputBuilder

func NewDelegationOutputBuilder(validatorAddress *iotago.AccountAddress, addr iotago.Address, amount iotago.BaseToken) *DelegationOutputBuilder

NewDelegationOutputBuilder creates a new DelegationOutputBuilder with the account address, serial number, token scheme and base token amount.

func NewDelegationOutputBuilderFromPrevious

func NewDelegationOutputBuilderFromPrevious(previous *iotago.DelegationOutput) *DelegationOutputBuilder

NewDelegationOutputBuilderFromPrevious creates a new DelegationOutputBuilder starting from a copy of the previous iotago.DelegationOutput.

func (*DelegationOutputBuilder) Address

Address sets/modifies an iotago.AddressUnlockCondition on the output.

func (*DelegationOutputBuilder) Amount

Amount sets the base token amount of the output.

func (*DelegationOutputBuilder) Build

Build builds the iotago.DelegationOutput.

func (*DelegationOutputBuilder) DelegatedAmount

func (builder *DelegationOutputBuilder) DelegatedAmount(delegatedAmount iotago.BaseToken) *DelegationOutputBuilder

DelegatedAmount sets the delegated amount of the output.

func (*DelegationOutputBuilder) DelegationID

func (builder *DelegationOutputBuilder) DelegationID(delegationID iotago.DelegationID) *DelegationOutputBuilder

DelegationID sets the delegation ID of the output.

func (*DelegationOutputBuilder) EndEpoch

EndEpoch sets the delegation end epoch.

func (*DelegationOutputBuilder) MustBuild

func (builder *DelegationOutputBuilder) MustBuild() *iotago.DelegationOutput

MustBuild works like Build() but panics if an error is encountered.

func (*DelegationOutputBuilder) StartEpoch

func (builder *DelegationOutputBuilder) StartEpoch(startEpoch iotago.EpochIndex) *DelegationOutputBuilder

StartEpoch sets the delegation start epoch.

func (*DelegationOutputBuilder) ValidatorAddress

func (builder *DelegationOutputBuilder) ValidatorAddress(validatorAddress *iotago.AccountAddress) *DelegationOutputBuilder

ValidatorAddress sets the validator address of the output.

type FoundryOutputBuilder

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

FoundryOutputBuilder builds an iotago.FoundryOutput.

func NewFoundryOutputBuilder

func NewFoundryOutputBuilder(accountAddr *iotago.AccountAddress, amount iotago.BaseToken, serialNumber uint32, tokenScheme iotago.TokenScheme) *FoundryOutputBuilder

NewFoundryOutputBuilder creates a new FoundryOutputBuilder with the account address, serial number, token scheme and base token amount.

func NewFoundryOutputBuilderFromPrevious

func NewFoundryOutputBuilderFromPrevious(previous *iotago.FoundryOutput) *FoundryOutputBuilder

NewFoundryOutputBuilderFromPrevious creates a new FoundryOutputBuilder starting from a copy of the previous iotago.FoundryOutput.

func (*FoundryOutputBuilder) Amount

func (builder *FoundryOutputBuilder) Amount(amount iotago.BaseToken) *FoundryOutputBuilder

Amount sets the base token amount of the output.

func (*FoundryOutputBuilder) Build

func (builder *FoundryOutputBuilder) Build() (*iotago.FoundryOutput, error)

Build builds the iotago.FoundryOutput.

func (*FoundryOutputBuilder) ImmutableMetadata

func (builder *FoundryOutputBuilder) ImmutableMetadata(entries iotago.MetadataFeatureEntries) *FoundryOutputBuilder

ImmutableMetadata sets/modifies an iotago.MetadataFeature as an immutable feature on the output. Only call this function on a new iotago.FoundryOutput.

func (*FoundryOutputBuilder) Metadata

Metadata sets/modifies an iotago.MetadataFeature on the output.

func (*FoundryOutputBuilder) MustBuild

func (builder *FoundryOutputBuilder) MustBuild() *iotago.FoundryOutput

MustBuild works like Build() but panics if an error is encountered.

func (*FoundryOutputBuilder) NativeToken

NativeToken adds/modifies a native token to/on the output.

func (*FoundryOutputBuilder) TokenScheme

func (builder *FoundryOutputBuilder) TokenScheme(tokenScheme iotago.TokenScheme) *FoundryOutputBuilder

type NFTOutputBuilder

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

NFTOutputBuilder builds an iotago.NFTOutput.

func NewNFTOutputBuilder

func NewNFTOutputBuilder(targetAddr iotago.Address, amount iotago.BaseToken) *NFTOutputBuilder

NewNFTOutputBuilder creates a new NFTOutputBuilder with the address and base token amount.

func NewNFTOutputBuilderFromPrevious

func NewNFTOutputBuilderFromPrevious(previous *iotago.NFTOutput) *NFTOutputBuilder

NewNFTOutputBuilderFromPrevious creates a new NFTOutputBuilder starting from a copy of the previous iotago.NFTOutput.

func (*NFTOutputBuilder) Address

func (builder *NFTOutputBuilder) Address(addr iotago.Address) *NFTOutputBuilder

Address sets/modifies an iotago.AddressUnlockCondition on the output.

func (*NFTOutputBuilder) Amount

func (builder *NFTOutputBuilder) Amount(amount iotago.BaseToken) *NFTOutputBuilder

Amount sets the base token amount of the output.

func (*NFTOutputBuilder) Build

func (builder *NFTOutputBuilder) Build() (*iotago.NFTOutput, error)

Build builds the iotago.FoundryOutput.

func (*NFTOutputBuilder) Expiration

func (builder *NFTOutputBuilder) Expiration(returnAddr iotago.Address, expiredAfterSlot iotago.SlotIndex) *NFTOutputBuilder

Expiration sets/modifies an iotago.ExpirationUnlockCondition on the output.

func (*NFTOutputBuilder) ImmutableIssuer

func (builder *NFTOutputBuilder) ImmutableIssuer(issuer iotago.Address) *NFTOutputBuilder

ImmutableIssuer sets/modifies an iotago.IssuerFeature as an immutable feature on the output. Only call this function on a new iotago.NFTOutput.

func (*NFTOutputBuilder) ImmutableMetadata

func (builder *NFTOutputBuilder) ImmutableMetadata(entries iotago.MetadataFeatureEntries) *NFTOutputBuilder

ImmutableMetadata sets/modifies an iotago.MetadataFeature as an immutable feature on the output. Only call this function on a new iotago.NFTOutput.

func (*NFTOutputBuilder) Mana

func (builder *NFTOutputBuilder) Mana(mana iotago.Mana) *NFTOutputBuilder

Amount sets the mana of the output.

func (*NFTOutputBuilder) Metadata

func (builder *NFTOutputBuilder) Metadata(entries iotago.MetadataFeatureEntries) *NFTOutputBuilder

Metadata sets/modifies an iotago.MetadataFeature on the output.

func (*NFTOutputBuilder) MustBuild

func (builder *NFTOutputBuilder) MustBuild() *iotago.NFTOutput

MustBuild works like Build() but panics if an error is encountered.

func (*NFTOutputBuilder) NFTID

func (builder *NFTOutputBuilder) NFTID(nftID iotago.NFTID) *NFTOutputBuilder

NFTID sets the iotago.NFTID of this output. Do not call this function if the underlying iotago.NFTID is not new.

func (*NFTOutputBuilder) Sender

func (builder *NFTOutputBuilder) Sender(senderAddr iotago.Address) *NFTOutputBuilder

Sender sets/modifies an iotago.SenderFeature on the output.

func (*NFTOutputBuilder) StorageDepositReturn

func (builder *NFTOutputBuilder) StorageDepositReturn(returnAddr iotago.Address, amount iotago.BaseToken) *NFTOutputBuilder

StorageDepositReturn sets/modifies an iotago.StorageDepositReturnUnlockCondition on the output.

func (*NFTOutputBuilder) Tag

func (builder *NFTOutputBuilder) Tag(tag []byte) *NFTOutputBuilder

Tag sets/modifies an iotago.TagFeature on the output.

func (*NFTOutputBuilder) Timelock

func (builder *NFTOutputBuilder) Timelock(untilSlot iotago.SlotIndex) *NFTOutputBuilder

Timelock sets/modifies an iotago.TimelockUnlockCondition on the output.

type StakingTransition

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

func (*StakingTransition) Builder

func (trans *StakingTransition) Builder() *AccountOutputBuilder

Builder returns the AccountOutputBuilder.

func (*StakingTransition) EndEpoch

func (trans *StakingTransition) EndEpoch(epoch iotago.EpochIndex) *StakingTransition

EndEpoch sets the EndEpoch of iotago.StakingFeature.

func (*StakingTransition) FixedCost

func (trans *StakingTransition) FixedCost(fixedCost iotago.Mana) *StakingTransition

FixedCost sets the FixedCost of iotago.StakingFeature.

func (*StakingTransition) StakedAmount

func (trans *StakingTransition) StakedAmount(amount iotago.BaseToken) *StakingTransition

StakedAmount sets the StakedAmount of iotago.StakingFeature.

func (*StakingTransition) StartEpoch

func (trans *StakingTransition) StartEpoch(epoch iotago.EpochIndex) *StakingTransition

StartEpoch sets the StartEpoch of iotago.StakingFeature.

type TransactionBuilder

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

TransactionBuilder is used to easily build up a SignedTransaction.

func NewTransactionBuilder

func NewTransactionBuilder(api iotago.API, signer iotago.AddressSigner) *TransactionBuilder

NewTransactionBuilder creates a new TransactionBuilder.

func (*TransactionBuilder) AddBlockIssuanceCreditInput

func (b *TransactionBuilder) AddBlockIssuanceCreditInput(blockIssuanceCreditInput *iotago.BlockIssuanceCreditInput) *TransactionBuilder

AddBlockIssuanceCreditInput adds the given block issuance credit input to the builder.

func (*TransactionBuilder) AddCommitmentInput

func (b *TransactionBuilder) AddCommitmentInput(commitmentInput *iotago.CommitmentInput) *TransactionBuilder

AddCommitmentInput adds the given commitment input to the builder.

func (*TransactionBuilder) AddInput

func (b *TransactionBuilder) AddInput(input *TxInput) *TransactionBuilder

AddInput adds the given input to the builder.

func (*TransactionBuilder) AddOutput

func (b *TransactionBuilder) AddOutput(output iotago.Output) *TransactionBuilder

AddOutput adds the given output to the builder.

func (*TransactionBuilder) AddRewardInput

func (b *TransactionBuilder) AddRewardInput(rewardInput *iotago.RewardInput, mana iotago.Mana) *TransactionBuilder

AddRewardInput adds the given reward input to the builder.

func (*TransactionBuilder) AddTaggedDataPayload

func (b *TransactionBuilder) AddTaggedDataPayload(payload *iotago.TaggedData) *TransactionBuilder

AddTaggedDataPayload adds the given TaggedData as the inner payload.

func (*TransactionBuilder) AllotAllMana

func (b *TransactionBuilder) AllotAllMana(targetSlot iotago.SlotIndex, accountID iotago.AccountID, minRequiredMana iotago.Mana) *TransactionBuilder

AllotAllMana allots all remaining account bound mana to the accounts, as well as the remaining unbound mana to the given account. It checks if at least the given "minRequiredMana" was allotted to the given account.

func (*TransactionBuilder) AllotMinRequiredManaAndStoreRemainingManaInOutput

func (b *TransactionBuilder) AllotMinRequiredManaAndStoreRemainingManaInOutput(targetSlot iotago.SlotIndex, rmc iotago.Mana, blockIssuerAccountID iotago.AccountID, storedManaOutputIndex int) *TransactionBuilder

AllotMinRequiredManaAndStoreRemainingManaInOutput allots the minimum required mana needed to issue a block to the block issuer account and moves the remaining unbound mana to stored mana on the specified output index as well as it's account bound mana if available and if the output belongs to an account. The remaining account bound mana is allotted to the respective accounts.

func (*TransactionBuilder) AllotRemainingAccountBoundMana

func (b *TransactionBuilder) AllotRemainingAccountBoundMana(targetSlot iotago.SlotIndex, onAllotment func(iotago.AccountID, iotago.Mana), ignoreAccountIDs ...iotago.AccountID) *TransactionBuilder

AllotRemainingAccountBoundMana allots all remaining account bound mana to the accounts, except the ignored accounts.

func (*TransactionBuilder) Build

Build signs the transaction essence and returns the built payload.

func (*TransactionBuilder) BuildAndSwapToBlockBuilder

func (b *TransactionBuilder) BuildAndSwapToBlockBuilder(txFunc TransactionFunc) *BasicBlockBuilder

BuildAndSwapToBlockBuilder builds the transaction and then swaps to a BasicBlockBuilder with the transaction set as its payload. txFunc can be nil.

func (*TransactionBuilder) CalculateAvailableManaInputs

func (b *TransactionBuilder) CalculateAvailableManaInputs(targetSlot iotago.SlotIndex) (*AvailableManaResult, error)

CalculateAvailableManaInputs calculates the available mana on the input side including mana generation and decay and the rewards.

func (*TransactionBuilder) CalculateAvailableManaRemaining

func (b *TransactionBuilder) CalculateAvailableManaRemaining(targetSlot iotago.SlotIndex) (*AvailableManaResult, error)

CalculateAvailableManaRemaining calculates the available mana on the input side, subtracts all the mana on the output side and on the allotments and returns the remaining mana. It takes the account bound mana into consideration. It will return an error if there is not enough mana available.

func (*TransactionBuilder) Clone

func (*TransactionBuilder) CreationSlot

func (b *TransactionBuilder) CreationSlot() iotago.SlotIndex

func (*TransactionBuilder) IncreaseAllotment

func (b *TransactionBuilder) IncreaseAllotment(accountID iotago.AccountID, value iotago.Mana) *TransactionBuilder

IncreaseAllotment adds or increases the given allotment to the builder.

func (*TransactionBuilder) MinRequiredAllottedMana

func (b *TransactionBuilder) MinRequiredAllottedMana(rmc iotago.Mana, blockIssuerAccountID iotago.AccountID) (iotago.Mana, error)

MinRequiredAllottedMana returns the minimum allotted mana required to issue a Block with the transaction payload from the builder and 1 allotment for the block issuer.

func (*TransactionBuilder) SetCreationSlot

func (b *TransactionBuilder) SetCreationSlot(creationSlot iotago.SlotIndex) *TransactionBuilder

func (*TransactionBuilder) StoreRemainingManaInOutputAndAllotRemainingAccountBoundMana

func (b *TransactionBuilder) StoreRemainingManaInOutputAndAllotRemainingAccountBoundMana(targetSlot iotago.SlotIndex, storedManaOutputIndex int) *TransactionBuilder

StoreRemainingManaInOutputAndAllotRemainingAccountBoundMana moves the remaining unbound mana to stored mana on the specified output index as well as it's account bound mana if available and if the output belongs to an account. The remaining account bound mana is allotted to the respective accounts.

func (*TransactionBuilder) WithTransactionCapabilities

func (b *TransactionBuilder) WithTransactionCapabilities(capabilities iotago.TransactionCapabilitiesBitMask) *TransactionBuilder

WithTransactionCapabilities sets the capabilities of the transaction.

type TransactionBuilderInputFilter

type TransactionBuilderInputFilter func(outputID iotago.OutputID, input iotago.Output) bool

TransactionBuilderInputFilter is a filter function which determines whether an input should be used or not. (returning true = pass). The filter can also be used to accumulate data over the set of inputs, i.e. the input sum etc.

type TransactionFunc

type TransactionFunc func(tx *iotago.SignedTransaction)

TransactionFunc is a function which receives a SignedTransaction as its parameter.

type TxInput

type TxInput struct {
	// The address which needs to be unlocked to spend this input.
	UnlockTarget iotago.Address `json:"address"`
	// The ID of the referenced input.
	InputID iotago.OutputID `json:"inputId"`
	// The output which is used as an input.
	Input iotago.Output `json:"input"`
}

TxInput defines an input with the address to unlock.

type ValidationBlockBuilder

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

ValidationBlockBuilder is used to easily build up a Validation Block.

func NewValidationBlockBuilder

func NewValidationBlockBuilder(api iotago.API) *ValidationBlockBuilder

NewValidationBlockBuilder creates a new ValidationBlockBuilder.

func (*ValidationBlockBuilder) Build

func (v *ValidationBlockBuilder) Build() (*iotago.Block, error)

Build builds the Block or returns any error which occurred during the build steps.

func (*ValidationBlockBuilder) HighestSupportedVersion

func (v *ValidationBlockBuilder) HighestSupportedVersion(highestSupportedVersion iotago.Version) *ValidationBlockBuilder

HighestSupportedVersion sets the highest supported version.

func (*ValidationBlockBuilder) IssuingTime

func (*ValidationBlockBuilder) LatestFinalizedSlot

func (v *ValidationBlockBuilder) LatestFinalizedSlot(slot iotago.SlotIndex) *ValidationBlockBuilder

LatestFinalizedSlot sets the latest finalized slot.

func (*ValidationBlockBuilder) ProtocolParametersHash

func (v *ValidationBlockBuilder) ProtocolParametersHash(hash iotago.Identifier) *ValidationBlockBuilder

ProtocolParametersHash sets the ProtocolParametersHash of the highest supported version.

func (*ValidationBlockBuilder) ProtocolVersion

func (v *ValidationBlockBuilder) ProtocolVersion(version iotago.Version) *ValidationBlockBuilder

ProtocolVersion sets the protocol version.

func (*ValidationBlockBuilder) ShallowLikeParents

func (v *ValidationBlockBuilder) ShallowLikeParents(parents iotago.BlockIDs) *ValidationBlockBuilder

ShallowLikeParents sets the shallow like parents.

func (*ValidationBlockBuilder) Sign

func (*ValidationBlockBuilder) SignWithSigner

func (*ValidationBlockBuilder) SlotCommitmentID

func (v *ValidationBlockBuilder) SlotCommitmentID(commitmentID iotago.CommitmentID) *ValidationBlockBuilder

SlotCommitmentID sets the slot commitment.

func (*ValidationBlockBuilder) StrongParents

func (v *ValidationBlockBuilder) StrongParents(parents iotago.BlockIDs) *ValidationBlockBuilder

StrongParents sets the strong parents.

func (*ValidationBlockBuilder) WeakParents

WeakParents sets the weak parents.

Jump to

Keyboard shortcuts

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