utils

package
v0.0.0-...-08f901d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDCDTBalance

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

CheckDCDTBalance -

func CheckDCDTNFTBalance

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

CheckDCDTNFTBalance -

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 CreateAccountWithDCDTBalance

func CreateAccountWithDCDTBalance(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	rewaValue *big.Int,
	tokenIdentifier []byte,
	dcdtNonce uint64,
	dcdtValue *big.Int,
)

CreateAccountWithDCDTBalance -

func CreateAccountWithDCDTBalanceAndRoles

func CreateAccountWithDCDTBalanceAndRoles(
	t *testing.T,
	accnts state.AccountsAdapter,
	pubKey []byte,
	rewaValue *big.Int,
	tokenIdentifier []byte,
	dcdtNonce uint64,
	dcdtValue *big.Int,
	roles [][]byte,
)

CreateAccountWithDCDTBalanceAndRoles -

func CreateAccountWithNFT

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

CreateAccountWithNFT -

func CreateDCDTLocalBurnTx

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

CreateDCDTLocalBurnTx -

func CreateDCDTLocalMintTx

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

CreateDCDTLocalMintTx -

func CreateDCDTNFTBurnTx

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

CreateDCDTNFTBurnTx -

func CreateDCDTNFTTransferTx

func CreateDCDTNFTTransferTx(
	nonce uint64,
	sndAddr []byte,
	rcvAddr []byte,
	tokenIdentifier []byte,
	dcdtNonce uint64,
	dcdtValue *big.Int,
	gasPrice uint64,
	gasLimit uint64,
	endpointName string,
	arguments ...[]byte) *transaction.Transaction

CreateDCDTNFTTransferTx -

func CreateDCDTNFTUpdateAttributesTx

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

CreateDCDTNFTUpdateAttributesTx -

func CreateDCDTTransferTx

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

CreateDCDTTransferTx -

func CreateMultiTransferTX

func CreateMultiTransferTX(nonce uint64, sender, dest []byte, gasPrice, gasLimit uint64, tds ...*TransferDCDTData) *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

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

func GenerateUserNameForDNSContract(contractAddress []byte) []byte

GenerateUserNameForDNSContract -

func GenerateUserNameForDefaultDNSContract

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 SetDCDTRoles

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

SetDCDTRoles -

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 TransferDCDTData

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

TransferDCDTData -

Jump to

Keyboard shortcuts

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