sample

package
v0.0.0-...-a7498df Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// These are sample restricted addresses for e2e tests.
	RestrictedEVMAddressTest = "0x8a81Ba8eCF2c418CAe624be726F505332DF119C6"
	RestrictedBtcAddressTest = "bcrt1qzp4gt6fc7zkds09kfzaf9ln9c5rvrzxmy6qmpp"
	RestrictedSolAddressTest = "9fA4vYZfCa9k9UHjnvYCk4YoipsooapGciKMgaTBw9UH"
)

Variables

View Source
var ErrSample = errors.New("sample error")

Functions

func AccAddress

func AccAddress() string

AccAddress returns a sample account address in string

func AppState

func AppState(t *testing.T) map[string]json.RawMessage

func Authorization

func Authorization() authoritytypes.Authorization

func AuthorizationList

func AuthorizationList(val string) authoritytypes.AuthorizationList

func Ballot

func Ballot(t *testing.T, index string) *types.Ballot

func BallotList

func BallotList(n int, observerSet []string) []types.Ballot

func Bech32AccAddress

func Bech32AccAddress() sdk.AccAddress

Bech32AccAddress returns a sample account address

func BlameRecord

func BlameRecord(t *testing.T, index string) types.Blame

func BlameRecordsList

func BlameRecordsList(t *testing.T, n int) []types.Blame

func BlockHeader

func BlockHeader(blockHash []byte) proofs.BlockHeader

func BtcAddressP2WPKH

func BtcAddressP2WPKH(t *testing.T, net *chaincfg.Params) string

BtcAddressP2WPKH returns a sample btc P2WPKH address

func BtcHash

func BtcHash() chainhash.Hash

BtcHash returns a sample btc hash

func Bytes

func Bytes() []byte

Bytes returns a sample byte array

func Chain

func Chain(chainID int64) chains.Chain

func ChainInfo

func ChainInfo(startChainID int64) authoritytypes.ChainInfo

func ChainNonces

func ChainNonces(chainID int64) types.ChainNonces

func ChainNoncesList

func ChainNoncesList(n int) []types.ChainNonces

func ChainParams

func ChainParams(chainID int64) *types.ChainParams

func ChainParamsList

func ChainParamsList() (cpl types.ChainParamsList)

func ChainParamsSupported

func ChainParamsSupported(chainID int64) *types.ChainParams

func ChainState

func ChainState(chainID int64) lightclienttypes.ChainState

func Coins

func Coins() sdk.Coins

Coins returns a sample sdk.Coins

func ComplianceConfig

func ComplianceConfig() config.ComplianceConfig

ComplianceConfig returns a sample compliance config

func CreateTempDir

func CreateTempDir(t *testing.T) string

create a temporary directory for testing

func CrossChainTx

func CrossChainTx(t *testing.T, index string) *types.CrossChainTx

func CrosschainFlags

func CrosschainFlags() *types.CrosschainFlags

func CustomAssetRate

func CustomAssetRate(
	chainID int64,
	asset string,
	decimals uint32,
	coinType coin.CoinType,
	rate sdk.Dec,
) types.AssetRate

CustomAssetRate creates a custom asset rate with the given parameters

func CustomCctxsInBlockRange

func CustomCctxsInBlockRange(
	t *testing.T,
	lowBlock uint64,
	highBlock uint64,
	senderChainID int64,
	receiverChainID int64,
	coinType coin.CoinType,
	asset string,
	amount uint64,
	status types.CctxStatus,
) (cctxs []*types.CrossChainTx)

CustomCctxsInBlockRange create 1 cctx per block in block range [lowBlock, highBlock] (inclusive)

func EthAddress

func EthAddress() ethcommon.Address

EthAddress returns a sample ethereum address

func EthTx

func EthTx(t *testing.T, chainID int64, to ethcommon.Address, nonce uint64) (*ethtypes.Transaction, []byte)

EthTx returns a sample ethereum transaction with the associated tx data bytes

func EthTxSigned

func EthTxSigned(
	t *testing.T,
	chainID int64,
	to ethcommon.Address,
	nonce uint64,
) (*ethtypes.Transaction, []byte, ethcommon.Address)

EthTxSigned returns a sample signed ethereum transaction with the address of the sender

func EventIndex

func EventIndex() uint64

func ForeignCoinList

func ForeignCoinList(t *testing.T, zrc20ETH, zrc20BTC, zrc20ERC20, erc20Asset string) []types.ForeignCoins

func ForeignCoins

func ForeignCoins(t *testing.T, address string) types.ForeignCoins

func GasPrice

func GasPrice(t *testing.T, index string) *types.GasPrice

func GasPriceIncreaseFlags

func GasPriceIncreaseFlags() types.GasPriceIncreaseFlags

func GasPriceWithChainID

func GasPriceWithChainID(t *testing.T, chainID int64) types.GasPrice

func GenDoc

func GenDoc(t *testing.T) *types.GenesisDoc

func GenerateTONAccountID

func GenerateTONAccountID() ton.AccountID

func GetCctxIndexFromString

func GetCctxIndexFromString(index string) string

func Hash

func Hash() ethcommon.Hash

Hash returns a sample hash

func HeaderSupportedChains

func HeaderSupportedChains() []lightclienttypes.HeaderSupportedChain

func InboundEvent

func InboundEvent(chainID int64, sender string, receiver string, amount uint64, memo []byte) *types.InboundEvent

InboundEvent returns a sample InboundEvent.

func InboundHashToCctx

func InboundHashToCctx(t *testing.T, inboundHash string) types.InboundHashToCctx

func InboundParams

func InboundParams(r *rand.Rand) *types.InboundParams

func InboundParamsValidChainID

func InboundParamsValidChainID(r *rand.Rand) *types.InboundParams

func InboundTracker

func InboundTracker(t *testing.T, index string) types.InboundTracker

func InboundVote

func InboundVote(coinType coin.CoinType, from, to int64) types.MsgVoteInbound

func Int64InRange

func Int64InRange(low, high int64) int64

Int64InRange returns a sample int64 in the given ranges

func IntInRange

func IntInRange(low, high int64) sdkmath.Int

func InvalidZRC20WithdrawToExternalReceipt

func InvalidZRC20WithdrawToExternalReceipt(t *testing.T) (receipt ethtypes.Receipt)

InvalidZRC20WithdrawToExternalReceipt is a receipt for a invalid ZRC20 withdrawal to an external address receiver is 1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3

func Keygen

func Keygen(t *testing.T) *types.Keygen

func LastBlockHeight

func LastBlockHeight(t *testing.T, index string) *types.LastBlockHeight

func LastObserverCount

func LastObserverCount(lastChangeHeight int64) *types.LastObserverCount

func NodeAccount

func NodeAccount() *types.NodeAccount

func NonceToCCTX

func NonceToCCTX(t *testing.T, seed string) types.NonceToCctx

func NonceToCctxList

func NonceToCctxList(t *testing.T, index string, count int) []types.NonceToCctx

func ObserverSet

func ObserverSet(n int) types.ObserverSet

func OutboundParams

func OutboundParams(r *rand.Rand) *types.OutboundParams

func OutboundParamsValidChainID

func OutboundParamsValidChainID(r *rand.Rand) *types.OutboundParams

func OutboundTracker

func OutboundTracker(t *testing.T, index string) types.OutboundTracker

func PendingNoncesList

func PendingNoncesList(t *testing.T, index string, count int) []types.PendingNonces

func Policies

func Policies() authoritytypes.Policies

func PrivKeyAddressPair

func PrivKeyAddressPair() (*ed25519.PrivKey, sdk.AccAddress)

PrivKeyAddressPair returns a private key, address pair

func Proof

Proof generates a proof and block header returns the proof, block header, block hash, tx index, chain id, and tx hash

func PubKey

func PubKey(r *rand.Rand) cryptotypes.PubKey

PubKey returns a sample account PubKey

func PubKeySet

func PubKeySet() *crypto.PubKeySet

func PubKeyString

func PubKeyString() string

PubKeyString returns a sample public key string

func Rand

func Rand() *rand.Rand

Rand returns a new random number generator

func RateLimiterFlags

func RateLimiterFlags() types.RateLimiterFlags

func SolanaAddress

func SolanaAddress(t *testing.T) string

SolanaAddress returns a sample solana address

func SolanaPrivateKey

func SolanaPrivateKey(t *testing.T) solana.PrivateKey

SolanaPrivateKey returns a sample solana private key

func SolanaSignature

func SolanaSignature(t *testing.T) solana.Signature

SolanaSignature returns a sample solana signature

func Status

func Status(t *testing.T, index string) *types.Status

func String

func String() string

String returns a sample string

func StringRandom

func StringRandom(r *rand.Rand, length int) string

StringRandom returns a sample string with random alphanumeric characters

func SystemContract

func SystemContract() *types.SystemContract

func TONDeposit

func TONDeposit(t *testing.T, acc ton.AccountID, d toncontracts.Deposit) ton.Transaction

func TONDonation

func TONDonation(t *testing.T, acc ton.AccountID, d toncontracts.Donation) ton.Transaction

func TONTransaction

func TONTransaction(t *testing.T, p TONTransactionProps) ton.Transaction

TONTransaction creates a sample TON transaction.

func Tss

func Tss() types.TSS

func TssFundsMigrator

func TssFundsMigrator(chainID int64) types.TssFundMigratorInfo

func TssList

func TssList(n int) (tssList []types.TSS)

func Uint64InRange

func Uint64InRange(low, high uint64) uint64

Uint64InRange returns a sample uint64 in the given ranges

func UintInRange

func UintInRange(low, high uint64) sdkmath.Uint

func ValAddress

func ValAddress(r *rand.Rand) sdk.ValAddress

ValAddress returns a sample validator operator address

func ValidZRC20WithdrawToBTCReceipt

func ValidZRC20WithdrawToBTCReceipt(t *testing.T) (receipt ethtypes.Receipt)

ValidZRC20WithdrawToBTCReceipt is a receipt for a ZRC20 withdrawal to a BTC address receiver is bc1qysd4sp9q8my59ul9wsf5rvs9p387hf8vfwatzu

func ValidZetaSentDestinationExternalReceipt

func ValidZetaSentDestinationExternalReceipt(t *testing.T) (receipt ethtypes.Receipt)

ValidZetaSentDestinationExternalReceipt is a receipt for a Zeta sent to an external destination

func ValidZrc20WithdrawToETHReceipt

func ValidZrc20WithdrawToETHReceipt(t *testing.T) (receipt ethtypes.Receipt)

ValidZrc20WithdrawToETHReceipt is a receipt for a ZRC20 withdrawal to an external address

func Validator

func Validator(t testing.TB, r *rand.Rand) stakingtypes.Validator

Validator returns a sample staking validator

func VotesSuccessOnly

func VotesSuccessOnly(voteCount int) []types.VoteType

func WithdrawableEmissions

func WithdrawableEmissions(t *testing.T) types.WithdrawableEmissions

func ZRC20Withdrawal

func ZRC20Withdrawal(to []byte, value *big.Int) *zrc20.ZRC20Withdrawal

func ZetaAccounting

func ZetaAccounting(t *testing.T, index string) types.ZetaAccounting

func ZetaIndex

func ZetaIndex(t *testing.T) string

Types

type MultipleSignerMessage

type MultipleSignerMessage struct{}

MultipleSignerMessage is a sample message which has two signers instead of one. This is used to test cases when we have checks for number of signers such as authorized transactions.

func (*MultipleSignerMessage) GetSigners

func (m *MultipleSignerMessage) GetSigners() []sdk.AccAddress

func (*MultipleSignerMessage) ProtoMessage

func (m *MultipleSignerMessage) ProtoMessage()

func (*MultipleSignerMessage) Reset

func (m *MultipleSignerMessage) Reset()

func (*MultipleSignerMessage) String

func (m *MultipleSignerMessage) String() string

func (*MultipleSignerMessage) ValidateBasic

func (m *MultipleSignerMessage) ValidateBasic() error

type TONTransactionProps

type TONTransactionProps struct {
	Account ton.AccountID
	GasUsed uint64
	BlockID ton.BlockIDExt

	// For simplicity let's have only one input
	// and one output (both optional)
	Input  *tlb.Message
	Output *tlb.Message
}

Jump to

Keyboard shortcuts

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