tpkg

package
v3.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 15 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// TestTokenSupply is a test token supply constant.
	// Do not use this constant outside of unit tests, instead, query it via a node.
	TestTokenSupply = 2_779_530_283_277_761

	// TestProtocolVersion is a dummy protocol version.
	// Do not use this constant outside of unit tests, instead, query it via a node.
	TestProtocolVersion = 2
)

Variables

View Source
var TestNetworkID = TestProtoParas.NetworkID()

TestNetworkID is a test network ID.

View Source
var TestProtoParas = &iotago.ProtocolParameters{
	Version:     2,
	NetworkName: "TestJungle",
	Bech32HRP:   "tgl",
	MinPoWScore: 0,
	RentStructure: iotago.RentStructure{
		VByteCost:    0,
		VBFactorData: 0,
		VBFactorKey:  0,
	},
	TokenSupply: TestTokenSupply,
}

TestProtoParas is an instance of iotago.ProtocolParameters for testing purposes. It contains a zero vbyte rent cost. Only use this var in testing. Do not modify or use outside unit tests.

Functions

func Must

func Must(err error)

Must panics if the given error is not nil.

func OneInputOutputTransaction

func OneInputOutputTransaction() *iotago.Transaction

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 Rand38ByteArray

func Rand38ByteArray() [38]byte

Rand38ByteArray returns an array with 38 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 RandAliasAddress

func RandAliasAddress() *iotago.AliasAddress

RandAliasAddress returns a random AliasAddress.

func RandAliasUnlock

func RandAliasUnlock() *iotago.AliasUnlock

RandAliasUnlock returns a random alias unlock.

func RandBasicOutput

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

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

func RandBlock

func RandBlock(withPayloadType iotago.PayloadType) *iotago.Block

RandBlock returns a random block with the given inner payload.

func RandByte

func RandByte() byte

RandByte returns a random byte.

func RandBytes

func RandBytes(length int) []byte

RandBytes returns length amount random bytes.

func RandEd25519Address

func RandEd25519Address() *iotago.Ed25519Address

RandEd25519Address returns a random Ed25519 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 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 RandFloat64

func RandFloat64(max float64) float64

RandFloat64 returns a random float64.

func RandMigratedFundsEntry

func RandMigratedFundsEntry() *iotago.MigratedFundsEntry

RandMigratedFundsEntry returns a random migrated funds entry.

func RandMilestone

func RandMilestone(parents iotago.BlockIDs) *iotago.Milestone

RandMilestone returns a random milestone with the given parent blocks.

func RandMilestoneID

func RandMilestoneID() iotago.MilestoneID

RandMilestoneID produces a random milestone ID.

func RandMilestoneMerkleProof

func RandMilestoneMerkleProof() iotago.MilestoneMerkleProof

RandMilestoneMerkleProof produces a random milestone merkle proof.

func RandNFTAddress

func RandNFTAddress() *iotago.NFTAddress

RandNFTAddress returns a random NFTAddress.

func RandNFTUnlock

func RandNFTUnlock() *iotago.NFTUnlock

RandNFTUnlock returns a random alias unlock.

func RandNativeToken

func RandNativeToken() *iotago.NativeToken

RandNativeToken returns a random NativeToken.

func RandOutputID

func RandOutputID(index uint16) iotago.OutputID

func RandOutputIDs

func RandOutputIDs(count uint16) iotago.OutputIDs

func RandProtocolParameters

func RandProtocolParameters() *iotago.ProtocolParameters

RandProtocolParameters produces random protocol parameters.

func RandReceipt

func RandReceipt() *iotago.ReceiptMilestoneOpt

RandReceipt returns a random receipt.

func RandReferenceUnlock

func RandReferenceUnlock() *iotago.ReferenceUnlock

RandReferenceUnlock returns a random reference unlock.

func RandRentStructure

func RandRentStructure() *iotago.RentStructure

RandRentStructure produces random rent structure.

func RandSortNativeTokens

func RandSortNativeTokens(count int) iotago.NativeTokens

RandSortNativeTokens returns count sorted NativeToken.

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 RandTransaction

func RandTransaction() *iotago.Transaction

RandTransaction returns a random transaction.

func RandTransactionEssence

func RandTransactionEssence() *iotago.TransactionEssence

RandTransactionEssence returns a random transaction essence.

func RandTransactionEssenceWithInputCount

func RandTransactionEssenceWithInputCount(inputCount int) *iotago.TransactionEssence

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

func RandTransactionEssenceWithInputOutputCount

func RandTransactionEssenceWithInputOutputCount(inputCount int, outputCount int) *iotago.TransactionEssence

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

func RandTransactionEssenceWithInputs

func RandTransactionEssenceWithInputs(inputs iotago.Inputs) *iotago.TransactionEssence

RandTransactionEssenceWithInputs returns a random transaction essence with a specific slice of inputs.

func RandTransactionEssenceWithOutputCount

func RandTransactionEssenceWithOutputCount(outputCount int) *iotago.TransactionEssence

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

func RandTransactionID

func RandTransactionID() iotago.TransactionID

func RandTransactionWithEssence

func RandTransactionWithEssence(essence *iotago.TransactionEssence) *iotago.Transaction

RandTransactionWithEssence returns a random transaction with a specific essence.

func RandTransactionWithInputCount

func RandTransactionWithInputCount(inputCount int) *iotago.Transaction

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

func RandTransactionWithInputOutputCount

func RandTransactionWithInputOutputCount(inputCount int, outputCount int) *iotago.Transaction

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

func RandTransactionWithOutputCount

func RandTransactionWithOutputCount(outputCount int) *iotago.Transaction

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

func RandTreasuryInput

func RandTreasuryInput() *iotago.TreasuryInput

RandTreasuryInput returns a random treasury input.

func RandTreasuryOutput

func RandTreasuryOutput() *iotago.TreasuryOutput

RandTreasuryOutput returns a random treasury output.

func RandTreasuryTransaction

func RandTreasuryTransaction() *iotago.TreasuryTransaction

RandTreasuryTransaction returns a random treasury transaction.

func RandTrytes

func RandTrytes(length int) trinary.Trytes

RandTrytes returns length amount of random trytes.

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 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 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 SortedRandBlockIDs

func SortedRandBlockIDs(count int) iotago.BlockIDs

SortedRandBlockIDs returns random block IDs.

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.

Jump to

Keyboard shortcuts

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