tpkg

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: 17 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FixedGenesisV3TestProtocolParameters = iotago.NewV3SnapshotProtocolParameters(
	iotago.WithTimeProviderOptions(65898, time.Unix(1690879505, 0).UTC().Unix(), 10, 13),
	iotago.WithLivenessOptions(15, 30, 10, 20, 60),
)

FixedGenesisV3TestProtocolParameters are protocol parameters with a fixed genesis value for testing purposes.

View Source
var IOTAMainnetV3TestProtocolParameters = iotago.NewV3SnapshotProtocolParameters()

IOTAMainnetV3TestProtocolParameters reflect the planned protocol parameters to be used for IOTA mainnet. TODO: provide a link to the IOTA mainnet protocol parameters TIP.

View Source
var ShimmerMainnetV3TestProtocolParameters = iotago.NewV3SnapshotProtocolParameters(
	iotago.WithStorageOptions(100, 1, 10, 100, 100, 100),
	iotago.WithWorkScoreOptions(500, 110_000, 7_500, 40_000, 90_000, 50_000, 40_000, 70_000, 5_000, 15_000),
	iotago.WithTimeProviderOptions(0, time.Now().Unix(), 10, 13),
	iotago.WithLivenessOptions(15, 30, 10, 20, 60),
	iotago.WithSupplyOptions(1813620509061365, 63, 1, 17, 32, 21, 70),
	iotago.WithCongestionControlOptions(1, 1, 1, 400_000_000, 250_000_000, 50_000_000, 1000, 100),
	iotago.WithStakingOptions(10, 10, 10),
	iotago.WithVersionSignalingOptions(7, 5, 7),
	iotago.WithRewardsOptions(8, 11, 2, 384),
	iotago.WithTargetCommitteeSize(32),
)

ShimmerMainnetV3TestProtocolParameters reflect the planned protocol parameters to be used for Shimmer mainnet. TODO: provide a link to the Shimmer mainnet protocol parameters TIP.

View Source
var TestNetworkID = IOTAMainnetV3TestProtocolParameters.NetworkID()

TestNetworkID is a test network ID.

View Source
var ZeroCostV3TestProtocolParameters = iotago.NewV3SnapshotProtocolParameters(
	iotago.WithStorageOptions(0, 0, 0, 0, 0, 0),
	iotago.WithWorkScoreOptions(0, 1, 0, 0, 0, 0, 0, 0, 0, 0),
)

ZeroCostV3TestProtocolParameters are protocol parameters that give zero storage costs and block workscore =1 for all blocks. This is useful for testing purposes.

Functions

func Must

func Must(err error)

Must panics if the given error is not nil.

func OneInputOutputTransaction

func OneInputOutputTransaction() *iotago.SignedTransaction

OneInputOutputTransaction generates a random transaction with one input and output.

func Rand12ByteArray

func Rand12ByteArray() [12]byte

Rand12ByteArray returns an array with 12 random bytes.

func Rand32ByteArray

func Rand32ByteArray() [32]byte

Rand32ByteArray returns an array with 32 random bytes.

func Rand36ByteArray

func Rand36ByteArray() [36]byte

Rand36ByteArray returns an array with 36 random bytes.

func Rand38ByteArray

func Rand38ByteArray() [38]byte

Rand38ByteArray returns an array with 38 random bytes.

func Rand40ByteArray

func Rand40ByteArray() [40]byte

Rand40ByteArray returns an array with 40 random bytes.

func Rand49ByteArray

func Rand49ByteArray() [49]byte

Rand49ByteArray returns an array with 49 random bytes.

func Rand50ByteArray

func Rand50ByteArray() [50]byte

Rand50ByteArray returns an array with 38 random bytes.

func Rand64ByteArray

func Rand64ByteArray() [64]byte

Rand64ByteArray returns an array with 64 random bytes.

func RandAccountAddress

func RandAccountAddress() *iotago.AccountAddress

RandAccountAddress returns a random AccountAddress.

func RandAccountID

func RandAccountID() iotago.AccountID

func RandAccountUnlock

func RandAccountUnlock() *iotago.AccountUnlock

RandAccountUnlock returns a random account unlock.

func RandAddress

func RandAddress(addressType ...iotago.AddressType) iotago.Address

RandAddress returns a random address (Ed25519, Account, NFT, Anchor).

func RandAllotment

func RandAllotment() *iotago.Allotment

RandAllotment returns a random Allotment.

func RandAnchorAddress

func RandAnchorAddress() *iotago.AnchorAddress

RandAnchorAddress returns a random AnchorAddress.

func RandAnchorID

func RandAnchorID() iotago.AnchorID

func RandAnchorUnlock

func RandAnchorUnlock() *iotago.AnchorUnlock

RandAnchorUnlock returns a random anchor unlock.

func RandBaseToken

func RandBaseToken(max iotago.BaseToken) iotago.BaseToken

RandBaseToken returns a random amount of base token.

func RandBasicBlockBody

func RandBasicBlockBody(api iotago.API, withPayloadType iotago.PayloadType) *iotago.BasicBlockBody

func RandBasicBlockBodyWithPayload

func RandBasicBlockBodyWithPayload(api iotago.API, payload iotago.ApplicationPayload) *iotago.BasicBlockBody

func RandBasicBlockWithIssuerAndRMC

func RandBasicBlockWithIssuerAndRMC(api iotago.API, issuerID iotago.AccountID, rmc iotago.Mana) *iotago.Block

func RandBasicOutput

func RandBasicOutput(addressType ...iotago.AddressType) *iotago.BasicOutput

RandBasicOutput returns a random basic output (with no features).

func RandBlock

func RandBlock(blockBody iotago.BlockBody, api iotago.API, rmc iotago.Mana) *iotago.Block

RandBlock returns a random block with the given inner payload.

func RandBlockID

func RandBlockID() iotago.BlockID

RandBlockID produces a random block ID.

func RandBlockIssuanceCreditInput

func RandBlockIssuanceCreditInput() *iotago.BlockIssuanceCreditInput

RandBlockIssuanceCreditInput returns a random BlockIssuanceCreditInput.

func RandBlockIssuerKey

func RandBlockIssuerKey() iotago.BlockIssuerKey

func RandBlockIssuerKeys

func RandBlockIssuerKeys(count ...int) iotago.BlockIssuerKeys

func RandByte

func RandByte() byte

RandByte returns a random byte.

func RandBytes

func RandBytes(length int) []byte

RandBytes returns length amount random bytes.

func RandCommitment

func RandCommitment() *iotago.Commitment

func RandCommitmentID

func RandCommitmentID() iotago.CommitmentID

func RandCommitmentInput

func RandCommitmentInput() *iotago.CommitmentInput

RandCommitmentInput returns a random Commitment input.

func RandDelegationID

func RandDelegationID() iotago.DelegationID

func RandDuration

func RandDuration() time.Duration

func RandEd25519Address

func RandEd25519Address() *iotago.Ed25519Address

RandEd25519Address returns a random Ed25519 address.

func RandEd25519IdentitiesSortedByAddress

func RandEd25519IdentitiesSortedByAddress(count int) ([]iotago.Address, []iotago.AddressKeys)

RandEd25519IdentitiesSortedByAddress returns random Ed25519 addresses and keys lexically sorted by the address.

func RandEd25519Identity

func RandEd25519Identity() (ed25519.PrivateKey, *iotago.Ed25519Address, iotago.AddressKeys)

RandEd25519Identity produces a random Ed25519 identity.

func RandEd25519PrivateKey

func RandEd25519PrivateKey() ed25519.PrivateKey

RandEd25519PrivateKey returns a random Ed25519 private key.

func RandEd25519PublicKey

func RandEd25519PublicKey() hiveEd25519.PublicKey

func RandEd25519Seed

func RandEd25519Seed() [ed25519.SeedSize]byte

RandEd25519Seed returns a random Ed25519 seed.

func RandEd25519Signature

func RandEd25519Signature() *iotago.Ed25519Signature

RandEd25519Signature returns a random Ed25519 signature.

func RandEd25519SignatureUnlock

func RandEd25519SignatureUnlock() *iotago.SignatureUnlock

RandEd25519SignatureUnlock returns a random Ed25519 signature unlock.

func RandEpoch

func RandEpoch() iotago.EpochIndex

func RandFloat64

func RandFloat64(max float64) float64

RandFloat64 returns a random float64.

func RandIdentifier

func RandIdentifier() iotago.Identifier

func RandImplicitAccountCreationAddress

func RandImplicitAccountCreationAddress() *iotago.ImplicitAccountCreationAddress

RandImplicitAccountCreationAddress returns a random ImplicitAccountCreationAddress.

func RandImplicitAccountIdentity

func RandImplicitAccountIdentity() (ed25519.PrivateKey, *iotago.ImplicitAccountCreationAddress, iotago.AddressKeys)

RandImplicitAccountIdentity produces a random Implicit Account identity.

func RandInt

func RandInt(max int) int

RandInt returns a random int.

func RandInt16

func RandInt16(max int16) int16

RandInt16 returns a random int16.

func RandInt32

func RandInt32(max uint32) int32

RandInt32 returns a random int32.

func RandInt64

func RandInt64(max uint64) int64

RandInt64 returns a random int64.

func RandInt8

func RandInt8(max int8) int8

RandInt8 returns a random int8.

func RandMana

func RandMana(max iotago.Mana) iotago.Mana

RandMana returns a random amount of mana.

func RandMultiAddress

func RandMultiAddress() *iotago.MultiAddress

RandMultiAddress returns a random MultiAddress.

func RandMultiUnlock

func RandMultiUnlock() *iotago.MultiUnlock

RandMultiUnlock returns a random multi unlock.

func RandNFTAddress

func RandNFTAddress() *iotago.NFTAddress

RandNFTAddress returns a random NFTAddress.

func RandNFTID

func RandNFTID() iotago.NFTID

func RandNFTUnlock

func RandNFTUnlock() *iotago.NFTUnlock

RandNFTUnlock returns a random account unlock.

func RandNativeTokenFeature

func RandNativeTokenFeature() *iotago.NativeTokenFeature

RandNativeTokenFeature returns a random NativeToken feature.

func RandNativeTokenID

func RandNativeTokenID() iotago.NativeTokenID

func RandOutput

func RandOutput(outputType iotago.OutputType) iotago.Output

func RandOutputID

func RandOutputID(index ...uint16) iotago.OutputID

func RandOutputIDProof

func RandOutputIDProof(api iotago.API) *iotago.OutputIDProof

func RandOutputIDWithCreationSlot

func RandOutputIDWithCreationSlot(slot iotago.SlotIndex, index ...uint16) iotago.OutputID

func RandOutputIDs

func RandOutputIDs(count uint16) iotago.OutputIDs

func RandOutputIDsWithCreationSlot

func RandOutputIDsWithCreationSlot(slot iotago.SlotIndex, count uint16) iotago.OutputIDs

func RandOutputOnAddress

func RandOutputOnAddress(outputType iotago.OutputType, address iotago.Address) iotago.Output

func RandOutputOnAddressWithAmount

func RandOutputOnAddressWithAmount(outputType iotago.OutputType, address iotago.Address, amount iotago.BaseToken) iotago.Output

func RandOutputType

func RandOutputType() iotago.OutputType

func RandProtocolParameters

func RandProtocolParameters() iotago.ProtocolParameters

RandProtocolParameters produces random protocol parameters. Some protocol parameters are subject to sanity checks when the protocol parameters are created so we use default values here to avoid panics rather than random ones.

func RandReferenceUnlock

func RandReferenceUnlock() *iotago.ReferenceUnlock

RandReferenceUnlock returns a random reference unlock.

func RandRestrictedAccountAddress

func RandRestrictedAccountAddress(capabilities iotago.AddressCapabilitiesBitMask) *iotago.RestrictedAddress

RandRestrictedAccountAddress returns a random restricted account address.

func RandRestrictedAnchorAddress

func RandRestrictedAnchorAddress(capabilities iotago.AddressCapabilitiesBitMask) *iotago.RestrictedAddress

RandRestrictedAnchorAddress returns a random restricted anchor address.

func RandRestrictedEd25519Address

func RandRestrictedEd25519Address(capabilities iotago.AddressCapabilitiesBitMask) *iotago.RestrictedAddress

RandRestrictedEd25519Address returns a random restricted Ed25519 address.

func RandRestrictedMultiAddress

func RandRestrictedMultiAddress(capabilities iotago.AddressCapabilitiesBitMask) *iotago.RestrictedAddress

RandRestrictedMultiAddress returns a random restricted multi address.

func RandRestrictedNFTAddress

func RandRestrictedNFTAddress(capabilities iotago.AddressCapabilitiesBitMask) *iotago.RestrictedAddress

RandRestrictedNFTAddress returns a random restricted NFT address.

func RandSignedTransaction

func RandSignedTransaction(api iotago.API, opts ...options.Option[iotago.Transaction]) *iotago.SignedTransaction

RandSignedTransaction returns a random transaction.

func RandSignedTransactionID

func RandSignedTransactionID() iotago.SignedTransactionID

func RandSignedTransactionIDWithCreationSlot

func RandSignedTransactionIDWithCreationSlot(slot iotago.SlotIndex) iotago.SignedTransactionID

func RandSignedTransactionWithAllotmentCount

func RandSignedTransactionWithAllotmentCount(api iotago.API, allotmentCount int) *iotago.SignedTransaction

RandSignedTransactionWithAllotmentCount returns a random transaction with a specific amount of allotments.

func RandSignedTransactionWithInputOutputCount

func RandSignedTransactionWithInputOutputCount(api iotago.API, inputCount int, outputCount int) *iotago.SignedTransaction

RandSignedTransactionWithInputOutputCount returns a random transaction with a specific amount of inputs and outputs.

func RandSignedTransactionWithOutputCount

func RandSignedTransactionWithOutputCount(api iotago.API, outputCount int) *iotago.SignedTransaction

RandSignedTransactionWithOutputCount returns a random transaction with a specific amount of outputs.

func RandSignedTransactionWithTransaction

func RandSignedTransactionWithTransaction(api iotago.API, transaction *iotago.Transaction) *iotago.SignedTransaction

RandSignedTransactionWithTransaction returns a random transaction with a specific essence.

func RandSignedTransactionWithUTXOInputCount

func RandSignedTransactionWithUTXOInputCount(api iotago.API, inputCount int) *iotago.SignedTransaction

RandSignedTransactionWithUTXOInputCount returns a random transaction with a specific amount of inputs.

func RandSlot

func RandSlot() iotago.SlotIndex

func RandSortAllotment

func RandSortAllotment(count int) iotago.Allotments

RandSortAllotment returns count sorted Allotments.

func RandStorageScoreParameters

func RandStorageScoreParameters() *iotago.StorageScoreParameters

RandStorageScoreParameters produces random set of parameters.

func RandString

func RandString(length int) string

func RandTaggedData

func RandTaggedData(tag []byte, dataLength ...int) *iotago.TaggedData

RandTaggedData returns a random tagged data payload.

func RandTokenScheme

func RandTokenScheme() iotago.TokenScheme

func RandTransaction

func RandTransaction(api iotago.API, opts ...options.Option[iotago.Transaction]) *iotago.Transaction

RandTransaction returns a random transaction essence.

func RandTransactionID

func RandTransactionID() iotago.TransactionID

func RandTransactionIDWithCreationSlot

func RandTransactionIDWithCreationSlot(slot iotago.SlotIndex) iotago.TransactionID

func RandTransactionWithAllotmentCount

func RandTransactionWithAllotmentCount(api iotago.API, allotmentCount int) *iotago.Transaction

RandTransactionWithAllotmentCount returns a random transaction essence with a specific amount of outputs.

func RandTransactionWithInputCount

func RandTransactionWithInputCount(api iotago.API, inputCount int) *iotago.Transaction

RandTransactionWithInputCount returns a random transaction essence with a specific amount of inputs..

func RandTransactionWithOptions

func RandTransactionWithOptions(api iotago.API, opts ...options.Option[iotago.Transaction]) *iotago.Transaction

RandTransactionWithOptions returns a random transaction essence with options applied.

func RandTransactionWithOutputCount

func RandTransactionWithOutputCount(api iotago.API, outputCount int) *iotago.Transaction

RandTransactionWithOutputCount returns a random transaction essence with a specific amount of outputs.

func RandUTCTime

func RandUTCTime() time.Time

RandUTCTime returns a random time from current year until now in UTC.

func RandUTXOInput

func RandUTXOInput() *iotago.UTXOInput

RandUTXOInput returns a random UTXO input.

func RandUTXOInputWithIndex

func RandUTXOInputWithIndex(index uint16) *iotago.UTXOInput

RandUTXOInputWithIndex returns a random UTXO input with a specific index.

func RandUint

func RandUint(max uint) uint

RandUint returns a random uint.

func RandUint16

func RandUint16(max uint16) uint16

RandUint16 returns a random uint16.

func RandUint256

func RandUint256() *big.Int

func RandUint32

func RandUint32(max uint32) uint32

RandUint32 returns a random uint32.

func RandUint64

func RandUint64(max uint64) uint64

RandUint64 returns a random uint64.

func RandUint8

func RandUint8(max uint8) uint8

RandUint8 returns a random uint8.

func RandUnlock

func RandUnlock(allowEmptyUnlock bool) iotago.Unlock

RandUnlock returns a random unlock (except Signature, Reference, Account, Anchor, NFT).

func RandValidationBlockBody

func RandValidationBlockBody(api iotago.API) *iotago.ValidationBlockBody

func RandWorkScore

func RandWorkScore(max uint32) iotago.WorkScore

RandWorkScore returns a random workscore.

func RandWorkScoreParameters

func RandWorkScoreParameters() *iotago.WorkScoreParameters

RandWorkScoreParameters produces random workscore structure.

func RandomRead

func RandomRead(p []byte) (n int, err error)

func ReferenceUnlock

func ReferenceUnlock(index uint16) *iotago.ReferenceUnlock

ReferenceUnlock returns a reference unlock with the given index.

func SortedRand32ByteArray

func SortedRand32ByteArray(count int) [][32]byte

SortedRand32ByteArray returns a count length slice of sorted 32 byte arrays.

func SortedRand36ByteArray

func SortedRand36ByteArray(count int) [][36]byte

SortedRand36ByteArray returns a count length slice of sorted 36 byte arrays.

func SortedRand40ByteArray

func SortedRand40ByteArray(count int) [][40]byte

SortedRand40ByteArray returns a count length slice of sorted 32 byte arrays.

func SortedRandBlockIDs

func SortedRandBlockIDs(count int) iotago.BlockIDs

SortedRandBlockIDs returned random block IDs.

func WithAllotmentCount

func WithAllotmentCount(allotmentCount int) options.Option[iotago.Transaction]

func WithBlockIssuanceCreditInputCount

func WithBlockIssuanceCreditInputCount(inputCount int) options.Option[iotago.Transaction]

func WithCommitmentInput

func WithCommitmentInput() options.Option[iotago.Transaction]

func WithOutputCount

func WithOutputCount(outputCount int) options.Option[iotago.Transaction]

func WithRewardInputCount

func WithRewardInputCount(inputCount uint16) options.Option[iotago.Transaction]

func WithTxEssencePayload

func WithTxEssencePayload(payload iotago.TxEssencePayload) options.Option[iotago.Transaction]

func WithUTXOInputCount

func WithUTXOInputCount(inputCount int) options.Option[iotago.Transaction]

Types

type HexBytes

type HexBytes []byte

HexBytes is a slice of bytes that marshals/unmarshals as a string in hexadecimal encoding. It is a simple utility to parse hex encoded test vectors.

func (HexBytes) MarshalText

func (b HexBytes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (HexBytes) String

func (b HexBytes) String() string

String returns the hex encoding of b.

func (*HexBytes) UnmarshalText

func (b *HexBytes) UnmarshalText(text []byte) (err error)

UnmarshalText implements the encoding.TextUnmarshaler interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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