transaction

package
v0.5.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEnoughBaseTokens                  = errors.New("not enough base tokens")
	ErrNotEnoughBaseTokensForStorageDeposit = errors.New("not enough base tokens for storage deposit")
	ErrNotEnoughNativeTokens                = errors.New("not enough native tokens")
)
View Source
var ErrNoAliasOutputAtIndex0 = errors.New("origin AliasOutput not found at index 0")

Functions

func AssetsFromOutput added in v0.3.0

func AssetsFromOutput(o iotago.Output) *isc.Assets

func BasicOutputFromPostData added in v0.3.0

func BasicOutputFromPostData(
	senderAddress iotago.Address,
	senderContract isc.Hname,
	par isc.RequestParameters,
) *iotago.BasicOutput

BasicOutputFromPostData creates extended output object from parameters. It automatically adjusts amount of base tokens required for the storage deposit

func CreateAndSignTx added in v0.3.0

func CreateAndSignTx(inputs iotago.OutputIDs, inputsCommitment []byte, outputs iotago.Outputs, wallet *cryptolib.KeyPair, networkID uint64) (*iotago.Transaction, error)

func GetAliasOutput

func GetAliasOutput(tx *iotago.Transaction, aliasAddr iotago.Address) (*isc.AliasOutputWithID, error)

func GetAnchorFromTransaction added in v0.3.0

func GetAnchorFromTransaction(tx *iotago.Transaction) (*isc.StateAnchor, *iotago.AliasOutput, error)

GetAnchorFromTransaction analyzes the output at index 0 and extracts anchor information. Otherwise error

func MakeAnchorTransaction added in v0.3.0

func MakeAnchorTransaction(essence *iotago.TransactionEssence, sig iotago.Signature) *iotago.Transaction

func MakeBasicOutput added in v0.3.0

func MakeBasicOutput(
	targetAddress iotago.Address,
	senderAddress iotago.Address,
	assets *isc.Assets,
	metadata *isc.RequestMetadata,
	options isc.SendOptions,
	disableAutoAdjustStorageDeposit ...bool,
) *iotago.BasicOutput

MakeBasicOutput creates new output from input parameters. Auto adjusts minimal storage deposit if the notAutoAdjust flag is absent or false If auto adjustment to storage deposit is disabled and not enough base tokens, returns an error

func MakeSignatureAndAliasUnlockFeatures added in v0.3.0

func MakeSignatureAndAliasUnlockFeatures(totalInputs int, sig iotago.Signature) iotago.Unlocks

func MakeSignatureAndReferenceUnlocks added in v0.3.0

func MakeSignatureAndReferenceUnlocks(totalInputs int, sig iotago.Signature) iotago.Unlocks

func NFTOutputFromPostData added in v0.3.0

func NFTOutputFromPostData(
	senderAddress iotago.Address,
	senderContract isc.Hname,
	par isc.RequestParameters,
	nft *isc.NFT,
) *iotago.NFTOutput

func NewChainOriginTransaction

func NewChainOriginTransaction(
	keyPair *cryptolib.KeyPair,
	stateControllerAddress iotago.Address,
	governanceControllerAddress iotago.Address,
	deposit uint64,
	unspentOutputs iotago.OutputSet,
	unspentOutputIDs iotago.OutputIDs,
) (*iotago.Transaction, isc.ChainID, error)

NewChainOriginTransaction creates new origin transaction for the self-governed chain returns the transaction and newly minted chain ID

func NewMintNFTsTransaction added in v1.0.3

func NewMintNFTsTransaction(par MintNFTsTransactionParams) (*iotago.Transaction, error)

func NewRequestTransaction

func NewRequestTransaction(par NewRequestTransactionParams) (*iotago.Transaction, error)

NewRequestTransaction creates a transaction including one or more requests to a chain. Empty assets in the request data defaults to 1 base token, which later is adjusted to the minimum storage deposit Assumes all UnspentOutputs and corresponding UnspentOutputIDs can be used as inputs, i.e. are unlockable for the sender address

func NewRootInitRequestTransaction

func NewRootInitRequestTransaction(
	keyPair *cryptolib.KeyPair,
	chainID isc.ChainID,
	description string,
	unspentOutputs iotago.OutputSet,
	unspentOutputIDs iotago.OutputIDs,
	initParams ...dict.Dict,
) (*iotago.Transaction, error)

NewRootInitRequestTransaction is a transaction with one request output. It is the first request to be sent to the uninitialized chain. At this moment it is only able to process this specific request. The request contains the minimum data needed to bootstrap the chain. The signer must be the same that created the origin transaction.

func NewRotateChainStateControllerTx added in v0.3.0

func NewRotateChainStateControllerTx(
	aliasID iotago.AliasID,
	newStateController iotago.Address,
	chainOutputID iotago.OutputID,
	chainOutput iotago.Output,
	kp *cryptolib.KeyPair,
) (*iotago.Transaction, error)

func NewTransferTransaction added in v0.3.0

func NewTransferTransaction(params NewTransferTransactionParams) (*iotago.Transaction, error)

NewTransferTransaction creates a basic output transaction that sends L1 Token to another L1 address

func NftOutputFromBasicOutput added in v0.3.0

func NftOutputFromBasicOutput(o *iotago.BasicOutput, nft *isc.NFT) *iotago.NFTOutput

Types

type IRC27NFTMetadata

type IRC27NFTMetadata struct {
	Standard string `json:"standard"`
	Version  string `json:"version"`
	MIMEType string `json:"type"`
	URI      string `json:"uri"`
	Name     string `json:"name"`
}

IRC27NFTMetadata represents an NFT metadata according to IRC27. See: https://github.com/iotaledger/tips/blob/main/tips/TIP-0027/tip-0027.md

func IRC27NFTMetadataFromBytes

func IRC27NFTMetadataFromBytes(b []byte) (*IRC27NFTMetadata, error)

func NewIRC27NFTMetadata

func NewIRC27NFTMetadata(mimeType, uri, name string) *IRC27NFTMetadata

func (*IRC27NFTMetadata) Bytes

func (m *IRC27NFTMetadata) Bytes() ([]byte, error)

func (*IRC27NFTMetadata) MustBytes

func (m *IRC27NFTMetadata) MustBytes() []byte

type MintNFTsTransactionParams added in v1.0.3

type MintNFTsTransactionParams struct {
	IssuerKeyPair      *cryptolib.KeyPair
	CollectionOutputID *iotago.OutputID
	Target             iotago.Address
	ImmutableMetadata  [][]byte
	UnspentOutputs     iotago.OutputSet
	UnspentOutputIDs   iotago.OutputIDs
}

type NewRequestTransactionParams

type NewRequestTransactionParams struct {
	SenderKeyPair                   *cryptolib.KeyPair
	SenderAddress                   iotago.Address // might be different from the senderKP address (when sending as NFT or alias)
	UnspentOutputs                  iotago.OutputSet
	UnspentOutputIDs                iotago.OutputIDs
	Request                         *isc.RequestParameters
	NFT                             *isc.NFT
	DisableAutoAdjustStorageDeposit bool // if true, the minimal storage deposit won't be adjusted automatically
}

type NewTransferTransactionParams added in v0.3.0

type NewTransferTransactionParams struct {
	DisableAutoAdjustStorageDeposit bool // if true, the minimal storage deposit won't be adjusted automatically
	FungibleTokens                  *isc.Assets
	SendOptions                     isc.SendOptions
	SenderAddress                   iotago.Address
	SenderKeyPair                   *cryptolib.KeyPair
	TargetAddress                   iotago.Address
	UnspentOutputs                  iotago.OutputSet
	UnspentOutputIDs                iotago.OutputIDs
}

type StorageDepositAssumption added in v0.3.0

type StorageDepositAssumption struct {
	AnchorOutput      uint64
	NativeTokenOutput uint64
	NFTOutput         uint64
}

func NewStorageDepositEstimate added in v0.3.0

func NewStorageDepositEstimate() *StorageDepositAssumption

func StorageDepositAssumptionFromBytes added in v0.3.0

func StorageDepositAssumptionFromBytes(data []byte) (*StorageDepositAssumption, error)

func (*StorageDepositAssumption) Bytes added in v0.3.0

func (d *StorageDepositAssumption) Bytes() []byte

func (*StorageDepositAssumption) Clone

func (*StorageDepositAssumption) String added in v0.3.0

func (d *StorageDepositAssumption) String() string

Jump to

Keyboard shortcuts

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