utils

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckESDTBalance

func CheckESDTBalance(t *testing.T, testContext *vm.VMTestContext, addr []byte, tokenIdentifier []byte, expectedBalance *big.Int)

CheckESDTBalance -

func CheckESDTNFTBalance

func CheckESDTNFTBalance(tb testing.TB, testContext *vm.VMTestContext, addr []byte, tokenIdentifier []byte, esdtNonce uint64, expectedBalance *big.Int)

CheckESDTNFTBalance -

func CheckOwnerAddr

func CheckOwnerAddr(t *testing.T, testContext *vm.VMTestContext, scAddr []byte, owner []byte)

CheckOwnerAddr -

func CleanAccumulatedIntermediateTransactions

func CleanAccumulatedIntermediateTransactions(tb testing.TB, testContext *vm.VMTestContext)

CleanAccumulatedIntermediateTransactions -

func CreateAccountWithESDTBalance

func CreateAccountWithESDTBalance(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	egldValue *big.Int,
	tokenIdentifier []byte,
	esdtNonce uint64,
	esdtValue *big.Int,
)

CreateAccountWithESDTBalance -

func CreateAccountWithESDTBalanceAndRoles

func CreateAccountWithESDTBalanceAndRoles(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	egldValue *big.Int,
	tokenIdentifier []byte,
	esdtNonce uint64,
	esdtValue *big.Int,
	roles [][]byte,
)

CreateAccountWithESDTBalanceAndRoles -

func CreateAccountWithNFT

func CreateAccountWithNFT(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	egldValue *big.Int,
	tokenIdentifier []byte,
	attributes []byte,
)

CreateAccountWithNFT -

func CreateESDTLocalBurnTx

func CreateESDTLocalBurnTx(nonce uint64, sndAddr, rcvAddr []byte, tokenIdentifier []byte, esdtValue *big.Int, gasPrice, gasLimit uint64) *transaction.Transaction

CreateESDTLocalBurnTx -

func CreateESDTLocalMintTx

func CreateESDTLocalMintTx(nonce uint64, sndAddr, rcvAddr []byte, tokenIdentifier []byte, esdtValue *big.Int, gasPrice, gasLimit uint64) *transaction.Transaction

CreateESDTLocalMintTx -

func CreateESDTNFTBurnTx

func CreateESDTNFTBurnTx(nonce uint64, sndAddr, rcvAddr []byte, tokenIdentifier []byte, tokenNonce uint64, esdtValue *big.Int, gasPrice, gasLimit uint64) *transaction.Transaction

CreateESDTNFTBurnTx -

func CreateESDTNFTTransferTx

func CreateESDTNFTTransferTx(
	nonce uint64,
	sndAddr []byte,
	rcvAddr []byte,
	tokenIdentifier []byte,
	esdtNonce uint64,
	esdtValue *big.Int,
	gasPrice uint64,
	gasLimit uint64,
	endpointName string,
	arguments ...[]byte) *transaction.Transaction

CreateESDTNFTTransferTx -

func CreateESDTNFTUpdateAttributesTx

func CreateESDTNFTUpdateAttributesTx(
	nonce uint64,
	sndAddr []byte,
	tokenIdentifier []byte,
	gasPrice uint64,
	gasLimit uint64,
	newAttributes []byte,
) *transaction.Transaction

CreateESDTNFTUpdateAttributesTx -

func CreateESDTTransferTx

func CreateESDTTransferTx(nonce uint64, sndAddr, rcvAddr []byte, tokenIdentifier []byte, esdtValue *big.Int, gasPrice, gasLimit uint64) *transaction.Transaction

CreateESDTTransferTx -

func CreateMultiTransferTX

func CreateMultiTransferTX(nonce uint64, sender, dest []byte, gasPrice, gasLimit uint64, tds ...*TransferESDTData) *transaction.Transaction

CreateMultiTransferTX -

func CreateNFTSingleFreezeAndWipeTxs

func CreateNFTSingleFreezeAndWipeTxs(nonce uint64, tokenManager, addressToFreeze []byte, tokenIdentifier []byte, tokenNonce uint64, gasPrice, gasLimit uint64) (*transaction.Transaction, *transaction.Transaction)

CreateNFTSingleFreezeAndWipeTxs -

func CreateSmartContractCall

func CreateSmartContractCall(
	nonce uint64,
	sndAddr []byte,
	rcvAddr []byte,
	gasPrice uint64,
	gasLimit uint64,
	endpointName string,
	arguments ...[]byte) *transaction.Transaction

CreateSmartContractCall -

func DoColdDeploy

func DoColdDeploy(
	tb testing.TB,
	testContext *vm.VMTestContext,
	pathToContract string,
	senderBalance *big.Int,
	codeMetadata string,
) (scAddr []byte, owner []byte)

DoColdDeploy will deploy the SC code but won't call the constructor

func DoDeploy

func DoDeploy(
	t *testing.T,
	testContext *vm.VMTestContext,
	pathToContract string,
) (scAddr []byte, owner []byte)

DoDeploy -

func DoDeployDNS

func DoDeployDNS(t *testing.T, testContext *vm.VMTestContext, pathToContract string) (scAddr []byte, owner []byte)

DoDeployDNS -

func DoDeployNoChecks

func DoDeployNoChecks(t *testing.T, testContext *vm.VMTestContext, pathToContract string) (scAddr []byte, owner []byte)

DoDeployNoChecks -

func DoDeployOldCounter added in v1.6.0

func DoDeployOldCounter(
	t *testing.T,
	testContext *vm.VMTestContext,
	pathToContract string,
) (scAddr []byte, owner []byte)

DoDeployOldCounter -

func DoDeploySecond

func DoDeploySecond(
	t *testing.T,
	testContext *vm.VMTestContext,
	pathToContract string,
	senderAccount vmcommon.AccountHandler,
	gasPrice uint64,
	gasLimit uint64,
	args [][]byte,
	value *big.Int,
) (scAddr []byte)

DoDeploySecond -

func DoDeployWithCustomParams

func DoDeployWithCustomParams(
	tb testing.TB,
	testContext *vm.VMTestContext,
	pathToContract string,
	senderBalance *big.Int,
	gasLimit uint64,
	contractHexParams []string,
) (scAddr []byte, owner []byte)

DoDeployWithCustomParams -

func DoDeployWithMetadata

func DoDeployWithMetadata(
	t *testing.T,
	testContext *vm.VMTestContext,
	pathToContract string,
	senderAccount vmcommon.AccountHandler,
	gasPrice uint64,
	gasLimit uint64,
	metadata []byte,
	args [][]byte,
	value *big.Int,
) (scAddr []byte)

DoDeployWithMetadata -

func GenerateUserNameForDNSContract added in v1.6.0

func GenerateUserNameForDNSContract(contractAddress []byte) []byte

GenerateUserNameForDNSContract -

func GenerateUserNameForDefaultDNSContract added in v1.6.0

func GenerateUserNameForDefaultDNSContract() []byte

GenerateUserNameForDefaultDNSContract -

func OverwriteAccountStorageWithHexFileContent

func OverwriteAccountStorageWithHexFileContent(tb testing.TB, testContext *vm.VMTestContext, address []byte, pathToData string)

OverwriteAccountStorageWithHexFileContent applies pairs of <key,value> from provided file to the state of the provided address Before applying the data it does a cleanup on the old state the data from the file must be in the following format:

hex(key1),hex(value1) hex(key2),hex(value2) ...

Example: 61750100,0000 61750101,0001

func ProcessSCRResult

func ProcessSCRResult(
	tb testing.TB,
	testContext *vm.VMTestContext,
	tx data.TransactionHandler,
	expectedCode vmcommon.ReturnCode,
	expectedErr error,
)

ProcessSCRResult -

func SetESDTRoles

func SetESDTRoles(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	tokenIdentifier []byte,
	roles [][]byte,
)

SetESDTRoles -

func SetLastNFTNonce

func SetLastNFTNonce(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	tokenIdentifier []byte,
	lastNonce uint64,
)

SetLastNFTNonce -

func TestAccount

func TestAccount(
	t *testing.T,
	accnts state.AccountsAdapter,
	senderAddressBytes []byte,
	expectedNonce uint64,
	expectedBalance *big.Int,
) *big.Int

TestAccount -

Types

type TransferESDTData

type TransferESDTData struct {
	Token []byte
	Nonce uint64
	Value *big.Int
}

TransferESDTData -

Jump to

Keyboard shortcuts

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