Documentation
¶
Index ¶
- Constants
- func BoolPointer(b bool) *bool
- func BuildContract(t *testing.T, contractPath string)
- func BuildSetup(t *testing.T, packagePath string) string
- func CalculateSignedHash(rootHash [32]byte, validUntil uint64) [32]byte
- func ComputeMessageDataHash(metadataHash [32]byte, messageID [32]byte, receiver []byte, ...) ([32]byte, error)
- func ComputeMetadataHash(sourceChainSelector uint64, destinationChainSelector uint64, onRamp []byte) ([32]byte, error)
- func ConfigureOnRampChainWriter(log logger.Logger, ccipPackageId string, ccipOnrampPackageId string, ...) (cwConfig.ChainWriterConfig, error)
- func DrainAccountCoins(t *testing.T, ctx context.Context, lgr logger.Logger, accountAddress string, ...) error
- func ExtractStruct[T any](t *testing.T, payload any) *T
- func FundWithFaucet(log logger.Logger, network string, recipient string) error
- func GenerateAccountKeyPair(t *testing.T) (ed25519.PrivateKey, ed25519.PublicKey, string, error)
- func GenerateFromHexSeed(seed string) (*ecdsa.PrivateKey, error)
- func GenerateKeyPair() (*ecdsa.PrivateKey, error)
- func GenerateSignatures(t *testing.T, signers []ecdsa.PrivateKey, signedHash [32]byte) [][]byte
- func GetAccountAndKeyFromSui(testKeystore *TestKeystore) (string, []byte)
- func GetActiveAddressFromSuiConfig() (string, error)
- func GetFaucetHost(network string) string
- func HashOp(op *Op) common.Hash
- func HashPair(left, right [32]byte) [32]byte
- func HashRootMetadata(metadata RootMetadata) common.Hash
- func IntPointer(i int) *int
- func Keccak256Fixed(in []byte) [32]byte
- func LoadCompiledModules(packageName string, contractPath string) ([]string, error)
- func PatchContractAddressTOML(t *testing.T, contractPath, name, address string)
- func PatchContractDevAddressTOML(t *testing.T, contractPath, name, address string)
- func PrettyPrintDebug(log logger.Logger, data any, label string)
- func QueryCreatedObjectID(objectChanges []ObjectChange, packageID, module, structName string) (string, error)
- func SerializeCommitReport(report CommitReport) ([]byte, error)
- func SerializeExecutionReport(report ExecutionReport) ([]byte, error)
- func SerializeScheduleBatchParams(ops []TimelockOperation, predecessor []byte, salt []byte, delay uint64) ([]byte, error)
- func SetupClients(t *testing.T, rpcURL string, keystore loop.Keystore, logg logger.Logger, ...) (*client.PTBClient, *txm.SuiTxm, *txm.InMemoryStore)
- func StartSuiNode(nodeType NodeEnvType) (*exec.Cmd, error)
- func StringPointer(s string) *string
- func Uint16Pointer(i uint16) *uint16
- func Uint32Pointer(i uint32) *uint32
- func Uint64Pointer(i uint64) *uint64
- func Uint8Pointer(i uint8) *uint8
- func ValidateJSON(input any, schemaJSON string) error
- func VerifySignatureRecovery(t *testing.T, signature []byte, signedHash []byte, address []byte) []byte
- type Any2SuiRampMessage
- type Any2SuiTokenTransfer
- type CommitReport
- type ContractObject
- type Contracts
- type ECDSAKeyPair
- type ExecutionReport
- type FakeSuiPTBClient
- func (c *FakeSuiPTBClient) BlockByDigest(ctx context.Context, txDigest string) (*client.SuiTransactionBlockResponse, error)
- func (c *FakeSuiPTBClient) EstimateGas(ctx context.Context, txBytes string) (uint64, error)
- func (c *FakeSuiPTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, ...) (client.SuiTransactionBlockResponse, error)
- func (c *FakeSuiPTBClient) GetBlockById(ctx context.Context, checkpointId string) (models.CheckpointResponse, error)
- func (c *FakeSuiPTBClient) GetCCIPPackageID(ctx context.Context, offRampPackageID string, signerAddress string) (string, error)
- func (c *FakeSuiPTBClient) GetCache() *cache.Cache
- func (c *FakeSuiPTBClient) GetCachedValue(key string) (any, bool)
- func (c *FakeSuiPTBClient) GetCachedValues(keys []string) (map[string]any, bool)
- func (c *FakeSuiPTBClient) GetClient() sui.ISuiAPI
- func (c *FakeSuiPTBClient) GetCoinsByAddress(ctx context.Context, address string) ([]models.CoinData, error)
- func (c *FakeSuiPTBClient) GetLatestEpoch(ctx context.Context) (string, error)
- func (c *FakeSuiPTBClient) GetLatestPackageId(ctx context.Context, packageId string, module string) (string, error)
- func (c *FakeSuiPTBClient) GetNormalizedModule(ctx context.Context, packageId string, module string) (models.GetNormalizedMoveModuleResponse, error)
- func (c *FakeSuiPTBClient) GetParentObjectID(ctx context.Context, packageID string, moduleID string, ...) (string, error)
- func (c *FakeSuiPTBClient) GetReferenceGasPrice(ctx context.Context) (*big.Int, error)
- func (c *FakeSuiPTBClient) GetSUIBalance(ctx context.Context, address string) (*big.Int, error)
- func (c *FakeSuiPTBClient) GetTokenPoolConfigByPackageAddress(ctx context.Context, accountAddress string, tokenPoolAddress string, ...) (module_token_admin_registry.TokenConfig, error)
- func (c *FakeSuiPTBClient) GetTransactionStatus(ctx context.Context, digest string) (client.TransactionResult, error)
- func (c *FakeSuiPTBClient) GetValuesFromPackageOwnedObjectField(ctx context.Context, packageID string, moduleID string, objectName string, ...) (map[string]string, error)
- func (c *FakeSuiPTBClient) HashTxBytes(txBytes []byte) []byte
- func (c *FakeSuiPTBClient) LoadModulePackageIds(ctx context.Context, packageId string, module string) ([]string, error)
- func (c *FakeSuiPTBClient) MoveCall(ctx context.Context, req client.MoveCallRequest) (client.TxnMetaData, error)
- func (c *FakeSuiPTBClient) QueryCoinsByAddress(ctx context.Context, address string, coinType string) ([]models.CoinData, error)
- func (c *FakeSuiPTBClient) QueryEvents(ctx context.Context, filter client.EventFilterByMoveEventModule, limit *uint, ...) (*models.PaginatedEventsResponse, error)
- func (c *FakeSuiPTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *string, limit *uint64) (models.SuiXQueryTransactionBlocksResponse, error)
- func (c *FakeSuiPTBClient) ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor string) ([]models.SuiObjectData, error)
- func (c *FakeSuiPTBClient) ReadFunction(ctx context.Context, signerAddress string, packageId string, module string, ...) ([]any, error)
- func (c *FakeSuiPTBClient) ReadObjectId(ctx context.Context, objectId string) (models.SuiObjectData, error)
- func (c *FakeSuiPTBClient) ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor *models.ObjectId) ([]models.SuiObjectResponse, error)
- func (c *FakeSuiPTBClient) SendTransaction(ctx context.Context, payload client.TransactionBlockRequest) (client.SuiTransactionBlockResponse, error)
- func (c *FakeSuiPTBClient) SetCachedValue(key string, value any)
- func (c *FakeSuiPTBClient) SetCachedValues(keyValues map[string]any)
- func (c *FakeSuiPTBClient) SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte, ...) (client.SuiTransactionBlockResponse, error)
- func (c *FakeSuiPTBClient) SuiXGetReferenceGasPrice(ctx context.Context) (string, error)
- func (c *FakeSuiPTBClient) ToPTBArg(ctx context.Context, builder any, argValue any, isMutable bool) (any, error)
- func (c *FakeSuiPTBClient) WithRateLimit(ctx context.Context, methodName string, f func(ctx context.Context) error) error
- type GasPriceUpdate
- type MerkleRoot
- type MerkleTree
- type NodeEnvType
- type ObjectChange
- type Op
- type Owner
- type PriceUpdates
- type RampMessageHeader
- type RootMetadata
- type SharedOwner
- type StatefulFakeSuiPTBClient
- func (c *StatefulFakeSuiPTBClient) BlockByDigest(ctx context.Context, txDigest string) (*client.SuiTransactionBlockResponse, error)
- func (c *StatefulFakeSuiPTBClient) EstimateGas(ctx context.Context, txBytes string) (uint64, error)
- func (c *StatefulFakeSuiPTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, ...) (client.SuiTransactionBlockResponse, error)
- func (c *StatefulFakeSuiPTBClient) GetBlockById(ctx context.Context, checkpointId string) (models.CheckpointResponse, error)
- func (c *StatefulFakeSuiPTBClient) GetCCIPPackageID(ctx context.Context, offRampPackageID string, signerAddress string) (string, error)
- func (c *StatefulFakeSuiPTBClient) GetCache() *cache.Cache
- func (c *StatefulFakeSuiPTBClient) GetCachedValue(key string) (any, bool)
- func (c *StatefulFakeSuiPTBClient) GetCachedValues(keys []string) (map[string]any, bool)
- func (c *StatefulFakeSuiPTBClient) GetClient() sui.ISuiAPI
- func (c *StatefulFakeSuiPTBClient) GetCoinsByAddress(ctx context.Context, address string) ([]models.CoinData, error)
- func (c *StatefulFakeSuiPTBClient) GetLatestEpoch(ctx context.Context) (string, error)
- func (c *StatefulFakeSuiPTBClient) GetLatestPackageId(ctx context.Context, packageId string, module string) (string, error)
- func (c *StatefulFakeSuiPTBClient) GetNormalizedModule(ctx context.Context, packageId string, module string) (models.GetNormalizedMoveModuleResponse, error)
- func (c *StatefulFakeSuiPTBClient) GetParentObjectID(ctx context.Context, packageID string, moduleID string, ...) (string, error)
- func (c *StatefulFakeSuiPTBClient) GetReferenceGasPrice(ctx context.Context) (*big.Int, error)
- func (c *StatefulFakeSuiPTBClient) GetSUIBalance(ctx context.Context, address string) (*big.Int, error)
- func (c *StatefulFakeSuiPTBClient) GetTokenPoolConfigByPackageAddress(ctx context.Context, accountAddress string, tokenPoolAddress string, ...) (module_token_admin_registry.TokenConfig, error)
- func (c *StatefulFakeSuiPTBClient) GetTransactionStatus(ctx context.Context, digest string) (client.TransactionResult, error)
- func (c *StatefulFakeSuiPTBClient) GetValuesFromPackageOwnedObjectField(ctx context.Context, packageID string, moduleID string, objectName string, ...) (map[string]string, error)
- func (c *StatefulFakeSuiPTBClient) HashTxBytes(txBytes []byte) []byte
- func (c *StatefulFakeSuiPTBClient) LoadModulePackageIds(ctx context.Context, packageId string, module string) ([]string, error)
- func (c *StatefulFakeSuiPTBClient) MoveCall(ctx context.Context, req client.MoveCallRequest) (client.TxnMetaData, error)
- func (c *StatefulFakeSuiPTBClient) QueryCoinsByAddress(ctx context.Context, address string, coinType string) ([]models.CoinData, error)
- func (c *StatefulFakeSuiPTBClient) QueryEvents(ctx context.Context, filter client.EventFilterByMoveEventModule, limit *uint, ...) (*models.PaginatedEventsResponse, error)
- func (c *StatefulFakeSuiPTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *string, limit *uint64) (models.SuiXQueryTransactionBlocksResponse, error)
- func (c *StatefulFakeSuiPTBClient) ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor string) ([]models.SuiObjectData, error)
- func (c *StatefulFakeSuiPTBClient) ReadFunction(ctx context.Context, signerAddress string, packageId string, module string, ...) ([]any, error)
- func (c *StatefulFakeSuiPTBClient) ReadObjectId(ctx context.Context, objectId string) (models.SuiObjectData, error)
- func (c *StatefulFakeSuiPTBClient) ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor *models.ObjectId) ([]models.SuiObjectResponse, error)
- func (c *StatefulFakeSuiPTBClient) SendTransaction(ctx context.Context, payload client.TransactionBlockRequest) (client.SuiTransactionBlockResponse, error)
- func (c *StatefulFakeSuiPTBClient) SetCachedValue(key string, value any)
- func (c *StatefulFakeSuiPTBClient) SetCachedValues(keyValues map[string]any)
- func (c *StatefulFakeSuiPTBClient) SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte, ...) (client.SuiTransactionBlockResponse, error)
- func (c *StatefulFakeSuiPTBClient) SuiXGetReferenceGasPrice(ctx context.Context) (string, error)
- func (c *StatefulFakeSuiPTBClient) ToPTBArg(ctx context.Context, builder any, argValue any, isMutable bool) (any, error)
- func (c *StatefulFakeSuiPTBClient) WithRateLimit(ctx context.Context, methodName string, f func(ctx context.Context) error) error
- type TestKeystore
- func NewTestKeystore(t *testing.T) *TestKeystore
- func SetupTestEnv(t *testing.T, ctx context.Context, lgr logger.Logger, gasLimit int64) (*client.PTBClient, *txm.SuiTxm, *txm.InMemoryStore, string, *TestKeystore, ...)
- func SetupTestSigner(t *testing.T, ctx context.Context, lgr logger.Logger, gasLimit int64) (*TestKeystore, string, []byte)
- func (tk *TestKeystore) Accounts(ctx context.Context) ([]string, error)
- func (tk *TestKeystore) AddKey(key ed25519.PrivateKey)
- func (u *TestKeystore) Decrypt(ctx context.Context, account string, encrypted []byte) (decrypted []byte, err error)
- func (tk *TestKeystore) GetSuiSigner(ctx context.Context, publicKey string) *signer.Signer
- func (tk *TestKeystore) Sign(ctx context.Context, id string, hash []byte) ([]byte, error)
- type TestState
- type TimelockOperation
- type TokenPoolType
- type TokenPriceUpdate
- type TokenToolDetails
- type TxnMetaWithObjectChanges
Constants ¶
const ( DevnetUrl = "https://fullnode.devnet.sui.io:443" TestnetUrl = "https://fullnode.testnet.sui.io:443" LocalUrl = "http://127.0.0.1:9000" LocalFaucetUrl = "http://127.0.0.1:9123/gas" )
Network URLs
const ( SuiMainnet = "mainnet" SuiTestnet = "testnet" SuiDevnet = "devnet" SuiLocalnet = "localnet" )
Network environments
const ( ACCOUNT_1_SEED = "0000000000000000000000000000000000000000000000000000000000000001" ACCOUNT_2_SEED = "0000000000000000000000000000000000000000000000000000000000000002" ACCOUNT_3_SEED = "0000000000000000000000000000000000000000000000000000000000000003" )
const ( TokenPoolTypeLockRelease TokenPoolType = "lock_release_token_pool" TokenPoolTypeBurnMint TokenPoolType = "burn_mint_token_pool" TokenPoolTypeManaged TokenPoolType = "managed_token_pool" TokenPoolTypeBase TokenPoolType = "token_pool" TokenPoolTypeUSDC TokenPoolType = "usdc_token_pool" ZeroAddress string = "0x0000000000000000000000000000000000000000000000000000000000000000" )
const ADDRESS_LENGTH = 20
const DefaultByteSize = 32
const KEYPAIR_LENGTH = 64
const PUBKEY_LENGTH = 32
const SignatureComponents = 2 // R and S components in ECDSA signature
Variables ¶
This section is empty.
Functions ¶
func BoolPointer ¶
func BuildContract ¶
func CalculateSignedHash ¶
func ComputeMessageDataHash ¶
func ComputeMessageDataHash( metadataHash [32]byte, messageID [32]byte, receiver []byte, sequenceNumber uint64, gasLimit *big.Int, nonce uint64, sender []byte, data []byte, tokenAmounts []ccipocr3.RampTokenAmount, destGasAmount uint32, ) ([32]byte, error)
This is the equivalent of ccip_offramp::calculate_message_hash. This is similar to the EVM version, except for 32-byte addresses and no dynamic offsets.
func ComputeMetadataHash ¶
func ComputeMetadataHash( sourceChainSelector uint64, destinationChainSelector uint64, onRamp []byte, ) ([32]byte, error)
This is the equivalent of ccip_offramp::calculate_metadata_hash. This is similar to the EVM version, except for the separator, 32-byte addresses, and no dynamic offsets. See https://github.com/smartcontractkit/chainlink-aptos/blob/d2cf1852ffdbf80fa55b0c834ebef7f44a46d843/contracts/ccip/ccip_offramp/sources/offramp.move#L1044
func ConfigureOnRampChainWriter ¶
func ConfigureOnRampChainWriter( log logger.Logger, ccipPackageId string, ccipOnrampPackageId string, tokenPools []TokenToolDetails, publicKeyBytes []byte, feeTokenType string, linkTokenType string, ethTokenType string, ) (cwConfig.ChainWriterConfig, error)
ConfigureOnRampChainWriter creates a single ChainWriterConfig that contains two PTB configurations: one for message passing and one for token transfers with messaging
func DrainAccountCoins ¶
func FundWithFaucet ¶
FundWithFaucet Funds a Sui account with test tokens using the Sui faucet API. NOTE: The Sui faucet must be already running.
It logs the funding details and attempts to request tokens from the faucet. Parameters: - logger: A logger instance used to log the funding process. - network: The network from which the faucet tokens are requested. Use "sui/constant" (e.g., "SuiLocalnet"). - recipient: The recipient's address to fund. Returns an error if the faucet request fails or if there is an issue determining the faucet host.
func GenerateAccountKeyPair ¶
GenerateAccountKeyPair Generates a public/private keypair with the ed25519 signature algorithm, then derives the address from the public key. Returns (private key, public key, address, error).
func GenerateFromHexSeed ¶
func GenerateFromHexSeed(seed string) (*ecdsa.PrivateKey, error)
GenerateFromHexSeed generates a deterministic Ethereum key pair from a hex seed
func GenerateKeyPair ¶
func GenerateKeyPair() (*ecdsa.PrivateKey, error)
GenerateKeyPair generates a new Ethereum key pair for testing
func GenerateSignatures ¶
func GetAccountAndKeyFromSui ¶
func GetAccountAndKeyFromSui(testKeystore *TestKeystore) (string, []byte)
func GetActiveAddressFromSuiConfig ¶
GetActiveAddressFromSuiConfig retrieves the active address from the Sui client configuration file located at ~/.sui/sui_config/client.yaml
func GetFaucetHost ¶
func HashRootMetadata ¶
func HashRootMetadata(metadata RootMetadata) common.Hash
func IntPointer ¶
func Keccak256Fixed ¶
func LoadCompiledModules ¶
LoadCompiledModules given a path to an already built contract, this method will find all the files ending with `.mv`
func PatchContractAddressTOML ¶
PatchContractAddressTOML edits one entry under [addresses]. Same as PatchContractDevAddressTOML, but for [addresses] section.
func PatchContractDevAddressTOML ¶
PatchContractDevAddressTOML edits one entry under [dev-addresses]. contractPath : folder that contains Move.toml name : key to patch (e.g. "mcms") address : new hex value (e.g. "0x0000")
func QueryCreatedObjectID ¶
func QueryCreatedObjectID(objectChanges []ObjectChange, packageID, module, structName string) (string, error)
QueryCreatedObjectID queries the created object ID for a given package ID, module, and struct name.
func SerializeCommitReport ¶
func SerializeCommitReport(report CommitReport) ([]byte, error)
SerializeCommitReport serializes a CommitReport using BCS format to match the Move contract's expected deserialization format. The Move contract expects the following order: 1. TokenPriceUpdates (vector of TokenPriceUpdate) 2. GasPriceUpdates (vector of GasPriceUpdate) 3. BlessedMerkleRoots (vector of MerkleRoot) 4. UnblessedMerkleRoots (vector of MerkleRoot) 5. RMNSignatures (vector of fixed 64-byte vectors)
func SerializeExecutionReport ¶
func SerializeExecutionReport(report ExecutionReport) ([]byte, error)
SerializeExecutionReport serializes an ExecutionReport using BCS format to match the Move contract's expected deserialization format. The Move contract expects the following order: 1. SourceChainSelector (u64) 2. Message (Any2SuiRampMessage) 3. OffchainTokenData (vector<vector<u8>>) 4. Proofs (vector<vector<u8>>)
func SetupClients ¶
func SetupClients( t *testing.T, rpcURL string, keystore loop.Keystore, logg logger.Logger, gasLimit int64, ) (*client.PTBClient, *txm.SuiTxm, *txm.InMemoryStore)
setupClients initializes the Sui and relayer clients.
func StartSuiNode ¶
func StartSuiNode(nodeType NodeEnvType) (*exec.Cmd, error)
StartSuiNode starts a local Sui node using Docker
func StringPointer ¶
func Uint16Pointer ¶
func Uint32Pointer ¶
func Uint64Pointer ¶
func Uint8Pointer ¶
func ValidateJSON ¶
Types ¶
type Any2SuiRampMessage ¶
type Any2SuiRampMessage struct {
Header RampMessageHeader `json:"header"`
Sender []byte `json:"sender"`
Data []byte `json:"data"`
Receiver []byte `json:"receiver"` // address in Move becomes []byte for 32-byte Sui address
GasLimit *big.Int `json:"gas_limit"` // u256 in Move becomes *big.Int in Go
TokenReceiver []byte `json:"token_receiver"`
TokenAmounts []Any2SuiTokenTransfer `json:"token_amounts"`
}
Any2SuiRampMessage represents the ramp message structure from offramp.move Matches the Move struct: public struct Any2SuiRampMessage has drop
func NewAny2SuiRampMessage ¶
func NewAny2SuiRampMessage( header RampMessageHeader, sender []byte, data []byte, receiver []byte, gasLimit *big.Int, tokenReceiver []byte, tokenAmounts []Any2SuiTokenTransfer, ) Any2SuiRampMessage
Helper function to create an Any2SuiRampMessage
type Any2SuiTokenTransfer ¶
type Any2SuiTokenTransfer struct {
SourcePoolAddress []byte `json:"source_pool_address"`
DestTokenAddress []byte `json:"dest_token_address"` // address in Move becomes []byte for 32-byte Sui address
DestGasAmount uint32 `json:"dest_gas_amount"`
ExtraData []byte `json:"extra_data"`
Amount *big.Int `json:"amount"` // u256 in Move becomes *big.Int in Go
}
Any2SuiTokenTransfer represents a token transfer structure from offramp.move Matches the Move struct: public struct Any2SuiTokenTransfer has drop
func NewAny2SuiTokenTransfer ¶
func NewAny2SuiTokenTransfer( sourcePoolAddress []byte, destTokenAddress []byte, destGasAmount uint32, extraData []byte, amount *big.Int, ) Any2SuiTokenTransfer
Helper function to create an Any2SuiTokenTransfer
type CommitReport ¶
type CommitReport struct {
PriceUpdates PriceUpdates
BlessedMerkleRoots []MerkleRoot
UnblessedMerkleRoots []MerkleRoot
RMNSignatures [][]byte
}
CommitReport represents the commit report structure from offramp.move Matches the Move struct: public struct CommitReport has store, drop, copy
func GetCommitReport ¶
func NewCommitReport ¶
func NewCommitReport() *CommitReport
Helper function to create a CommitReport with proper byte slice initialization
type ContractObject ¶
type Contracts ¶
type Contracts struct {
Path string
Name string
ModuleID string
Objects []ContractObject
}
type ECDSAKeyPair ¶
type ECDSAKeyPair struct {
PrivateKey ecdsa.PrivateKey
PublicKey ecdsa.PublicKey
Address []byte
}
type ExecutionReport ¶
type ExecutionReport struct {
SourceChainSelector uint64 `json:"source_chain_selector"`
Message Any2SuiRampMessage `json:"message"`
OffchainTokenData [][]byte `json:"offchain_token_data"`
Proofs [][]byte `json:"proofs"`
}
ExecutionReport represents the execution report structure from offramp.move Matches the Move struct: public struct ExecutionReport has drop
func GetExecutionReportFromCCIP ¶
func GetExecutionReportFromCCIP( sourceChainSelector uint64, message cciptypes.Message, offchainTokenData [][]byte, proofs [][]byte, gasAmount uint32, tokenReceiver []byte, ) ExecutionReport
Helper function to create an ExecutionReport from CCIP types
func NewExecutionReport ¶
func NewExecutionReport(sourceChainSelector uint64) *ExecutionReport
Helper function to create a new ExecutionReport with proper initialization
type FakeSuiPTBClient ¶
type FakeSuiPTBClient struct {
// Status controls the simulated response for GetTransactionStatus
Status client.TransactionResult
// CoinsData controls the simulated response for GetCoinsByAddress
CoinsData []models.CoinData
MockClient sui.ISuiAPI
}
FakeSuiPTBClient implements the SuiPTBClient interface for testing
func (*FakeSuiPTBClient) BlockByDigest ¶
func (c *FakeSuiPTBClient) BlockByDigest(ctx context.Context, txDigest string) (*client.SuiTransactionBlockResponse, error)
func (*FakeSuiPTBClient) EstimateGas ¶
func (*FakeSuiPTBClient) FinishPTBAndSend ¶
func (c *FakeSuiPTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, requestType client.TransactionRequestType) (client.SuiTransactionBlockResponse, error)
func (*FakeSuiPTBClient) GetBlockById ¶
func (c *FakeSuiPTBClient) GetBlockById(ctx context.Context, checkpointId string) (models.CheckpointResponse, error)
func (*FakeSuiPTBClient) GetCCIPPackageID ¶
func (*FakeSuiPTBClient) GetCache ¶
func (c *FakeSuiPTBClient) GetCache() *cache.Cache
func (*FakeSuiPTBClient) GetCachedValue ¶
func (c *FakeSuiPTBClient) GetCachedValue(key string) (any, bool)
func (*FakeSuiPTBClient) GetCachedValues ¶
func (c *FakeSuiPTBClient) GetCachedValues(keys []string) (map[string]any, bool)
func (*FakeSuiPTBClient) GetClient ¶
func (c *FakeSuiPTBClient) GetClient() sui.ISuiAPI
func (*FakeSuiPTBClient) GetCoinsByAddress ¶
func (*FakeSuiPTBClient) GetLatestEpoch ¶
func (c *FakeSuiPTBClient) GetLatestEpoch(ctx context.Context) (string, error)
func (*FakeSuiPTBClient) GetLatestPackageId ¶
func (*FakeSuiPTBClient) GetNormalizedModule ¶
func (c *FakeSuiPTBClient) GetNormalizedModule(ctx context.Context, packageId string, module string) (models.GetNormalizedMoveModuleResponse, error)
func (*FakeSuiPTBClient) GetParentObjectID ¶
func (*FakeSuiPTBClient) GetReferenceGasPrice ¶
func (*FakeSuiPTBClient) GetSUIBalance ¶
func (*FakeSuiPTBClient) GetTokenPoolConfigByPackageAddress ¶
func (c *FakeSuiPTBClient) GetTokenPoolConfigByPackageAddress(ctx context.Context, accountAddress string, tokenPoolAddress string, ccipPackageAddress string) (module_token_admin_registry.TokenConfig, error)
func (*FakeSuiPTBClient) GetTransactionStatus ¶
func (c *FakeSuiPTBClient) GetTransactionStatus(ctx context.Context, digest string) (client.TransactionResult, error)
func (*FakeSuiPTBClient) GetValuesFromPackageOwnedObjectField ¶
func (*FakeSuiPTBClient) HashTxBytes ¶
func (c *FakeSuiPTBClient) HashTxBytes(txBytes []byte) []byte
func (*FakeSuiPTBClient) LoadModulePackageIds ¶
func (*FakeSuiPTBClient) MoveCall ¶
func (c *FakeSuiPTBClient) MoveCall(ctx context.Context, req client.MoveCallRequest) (client.TxnMetaData, error)
func (*FakeSuiPTBClient) QueryCoinsByAddress ¶
func (*FakeSuiPTBClient) QueryEvents ¶
func (c *FakeSuiPTBClient) QueryEvents(ctx context.Context, filter client.EventFilterByMoveEventModule, limit *uint, cursor *client.EventId, sortOptions *client.QuerySortOptions) (*models.PaginatedEventsResponse, error)
func (*FakeSuiPTBClient) QueryTransactions ¶
func (c *FakeSuiPTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *string, limit *uint64) (models.SuiXQueryTransactionBlocksResponse, error)
func (*FakeSuiPTBClient) ReadFilterOwnedObjectIds ¶
func (c *FakeSuiPTBClient) ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor string) ([]models.SuiObjectData, error)
func (*FakeSuiPTBClient) ReadFunction ¶
func (*FakeSuiPTBClient) ReadObjectId ¶
func (c *FakeSuiPTBClient) ReadObjectId(ctx context.Context, objectId string) (models.SuiObjectData, error)
func (*FakeSuiPTBClient) ReadOwnedObjects ¶
func (c *FakeSuiPTBClient) ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor *models.ObjectId) ([]models.SuiObjectResponse, error)
func (*FakeSuiPTBClient) SendTransaction ¶
func (c *FakeSuiPTBClient) SendTransaction(ctx context.Context, payload client.TransactionBlockRequest) (client.SuiTransactionBlockResponse, error)
func (*FakeSuiPTBClient) SetCachedValue ¶
func (c *FakeSuiPTBClient) SetCachedValue(key string, value any)
func (*FakeSuiPTBClient) SetCachedValues ¶
func (c *FakeSuiPTBClient) SetCachedValues(keyValues map[string]any)
func (*FakeSuiPTBClient) SignAndSendTransaction ¶
func (c *FakeSuiPTBClient) SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte, executionRequestType client.TransactionRequestType) (client.SuiTransactionBlockResponse, error)
func (*FakeSuiPTBClient) SuiXGetReferenceGasPrice ¶
func (c *FakeSuiPTBClient) SuiXGetReferenceGasPrice(ctx context.Context) (string, error)
func (*FakeSuiPTBClient) WithRateLimit ¶
func (c *FakeSuiPTBClient) WithRateLimit(ctx context.Context, methodName string, f func(ctx context.Context) error) error
WithRateLimit is provided to maintain compatibility with previous implementations
type GasPriceUpdate ¶
type GasPriceUpdate struct {
DestChainSelector uint64 // u64 in Move
UsdPerUnitGas *big.Int // u256 in Move becomes *big.Int in Go
}
GasPriceUpdate represents a gas price update from offramp.move Matches the Move struct: public struct GasPriceUpdate has store, drop, copy
func NewGasPriceUpdate ¶
func NewGasPriceUpdate(destChainSelector uint64, usdPerUnitGas *big.Int) GasPriceUpdate
Helper function to create a GasPriceUpdate
type MerkleRoot ¶
type MerkleRoot struct {
SourceChainSelector uint64 // u64 in Move
OnRampAddress []byte // vector<u8> in Move
MinSeqNr uint64 // u64 in Move
MaxSeqNr uint64 // u64 in Move
MerkleRoot []byte // vector<u8> in Move (32 bytes)
}
MerkleRoot represents a merkle root structure from offramp.move Matches the Move struct: public struct MerkleRoot has store, drop, copy
func NewMerkleRoot ¶
func NewMerkleRoot(sourceChainSelector uint64, onRampAddress []byte, minSeqNr, maxSeqNr uint64, merkleRoot []byte) MerkleRoot
Helper function to create a MerkleRoot with proper byte slice initialization
type MerkleTree ¶
type MerkleTree [][32]byte
func GenerateMerkleTree ¶
func GenerateMerkleTree(ops []Op, rootMetadata RootMetadata) (MerkleTree, error)
func NewMerkleTree ¶
func NewMerkleTree(leaves [][32]byte) (MerkleTree, error)
func (MerkleTree) GetProof ¶
func (mt MerkleTree) GetProof(index int) [][32]byte
func (MerkleTree) VerifyProof ¶
func (mt MerkleTree) VerifyProof(proof [][32]byte, leaf [32]byte) bool
type NodeEnvType ¶
type NodeEnvType int
NodeEnvType represents the type of Sui node environment to run the localnet with
const ( // Docker represents running a Sui node in a Docker container Docker NodeEnvType = iota // CLI represents running a Sui node via the Sui CLI CLI )
type ObjectChange ¶
type ObjectChange struct {
Type string `json:"type"` // "published", "created", etc.
Sender string `json:"sender,omitempty"`
Owner Owner `json:"owner,omitempty"`
ObjectType string `json:"objectType,omitempty"`
ObjectID string `json:"objectId,omitempty"`
Version string `json:"version,omitempty"`
PreviousVersion string `json:"previousVersion,omitempty"`
Digest string `json:"digest,omitempty"`
PackageID string `json:"packageId,omitempty"` // Only in type == "published"
Modules []string `json:"modules,omitempty"` // Only in type == "published"
}
type PriceUpdates ¶
type PriceUpdates struct {
TokenPriceUpdates []TokenPriceUpdate
GasPriceUpdates []GasPriceUpdate
}
PriceUpdates represents the price updates structure from offramp.move Matches the Move struct: public struct PriceUpdates has store, drop, copy
type RampMessageHeader ¶
type RampMessageHeader struct {
MessageId []byte `json:"message_id"`
SourceChainSelector uint64 `json:"source_chain_selector"`
DestChainSelector uint64 `json:"dest_chain_selector"`
SequenceNumber uint64 `json:"sequence_number"`
Nonce uint64 `json:"nonce"`
}
RampMessageHeader represents the message header structure from offramp.move Matches the Move struct: public struct RampMessageHeader has drop
func NewRampMessageHeader ¶
func NewRampMessageHeader( messageId []byte, sourceChainSelector uint64, destChainSelector uint64, sequenceNumber uint64, nonce uint64, ) RampMessageHeader
Helper function to create a RampMessageHeader
type RootMetadata ¶
type SharedOwner ¶
type SharedOwner struct {
}
type StatefulFakeSuiPTBClient ¶
type StatefulFakeSuiPTBClient struct {
CoinsData []models.CoinData
GasBudgetThreshold uint64 // Minimum gas budget required for success
CallCount int // Track number of calls to GetTransactionStatus
ForcedTransactionStatusError string // Force the transaction status to be this value
CurrentGasBudget uint64 // Track the current gas budget being tested
// MockClient allows tests to inject custom ISuiAPI behavior when GetClient() is called.
// If nil, GetClient() will return nil, which is fine for most tests that don't use it.
// Tests that need specific ISuiAPI behavior should set this field explicitly.
MockClient sui.ISuiAPI
}
StatefulFakeSuiPTBClient is a more sophisticated fake client that can change behavior based on gas budget and track call counts for testing gas bump scenarios
func (*StatefulFakeSuiPTBClient) BlockByDigest ¶
func (c *StatefulFakeSuiPTBClient) BlockByDigest(ctx context.Context, txDigest string) (*client.SuiTransactionBlockResponse, error)
func (*StatefulFakeSuiPTBClient) EstimateGas ¶
func (*StatefulFakeSuiPTBClient) FinishPTBAndSend ¶
func (c *StatefulFakeSuiPTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, requestType client.TransactionRequestType) (client.SuiTransactionBlockResponse, error)
func (*StatefulFakeSuiPTBClient) GetBlockById ¶
func (c *StatefulFakeSuiPTBClient) GetBlockById(ctx context.Context, checkpointId string) (models.CheckpointResponse, error)
func (*StatefulFakeSuiPTBClient) GetCCIPPackageID ¶
func (*StatefulFakeSuiPTBClient) GetCache ¶
func (c *StatefulFakeSuiPTBClient) GetCache() *cache.Cache
func (*StatefulFakeSuiPTBClient) GetCachedValue ¶
func (c *StatefulFakeSuiPTBClient) GetCachedValue(key string) (any, bool)
func (*StatefulFakeSuiPTBClient) GetCachedValues ¶
func (c *StatefulFakeSuiPTBClient) GetCachedValues(keys []string) (map[string]any, bool)
func (*StatefulFakeSuiPTBClient) GetClient ¶
func (c *StatefulFakeSuiPTBClient) GetClient() sui.ISuiAPI
func (*StatefulFakeSuiPTBClient) GetCoinsByAddress ¶
func (*StatefulFakeSuiPTBClient) GetLatestEpoch ¶
func (c *StatefulFakeSuiPTBClient) GetLatestEpoch(ctx context.Context) (string, error)
func (*StatefulFakeSuiPTBClient) GetLatestPackageId ¶
func (*StatefulFakeSuiPTBClient) GetNormalizedModule ¶
func (c *StatefulFakeSuiPTBClient) GetNormalizedModule(ctx context.Context, packageId string, module string) (models.GetNormalizedMoveModuleResponse, error)
func (*StatefulFakeSuiPTBClient) GetParentObjectID ¶
func (*StatefulFakeSuiPTBClient) GetReferenceGasPrice ¶
func (*StatefulFakeSuiPTBClient) GetSUIBalance ¶
func (*StatefulFakeSuiPTBClient) GetTokenPoolConfigByPackageAddress ¶
func (c *StatefulFakeSuiPTBClient) GetTokenPoolConfigByPackageAddress(ctx context.Context, accountAddress string, tokenPoolAddress string, ccipPackageAddress string) (module_token_admin_registry.TokenConfig, error)
func (*StatefulFakeSuiPTBClient) GetTransactionStatus ¶
func (c *StatefulFakeSuiPTBClient) GetTransactionStatus(ctx context.Context, digest string) (client.TransactionResult, error)
func (*StatefulFakeSuiPTBClient) GetValuesFromPackageOwnedObjectField ¶
func (*StatefulFakeSuiPTBClient) HashTxBytes ¶
func (c *StatefulFakeSuiPTBClient) HashTxBytes(txBytes []byte) []byte
func (*StatefulFakeSuiPTBClient) LoadModulePackageIds ¶
func (*StatefulFakeSuiPTBClient) MoveCall ¶
func (c *StatefulFakeSuiPTBClient) MoveCall(ctx context.Context, req client.MoveCallRequest) (client.TxnMetaData, error)
func (*StatefulFakeSuiPTBClient) QueryCoinsByAddress ¶
func (*StatefulFakeSuiPTBClient) QueryEvents ¶
func (c *StatefulFakeSuiPTBClient) QueryEvents(ctx context.Context, filter client.EventFilterByMoveEventModule, limit *uint, cursor *client.EventId, sortOptions *client.QuerySortOptions) (*models.PaginatedEventsResponse, error)
func (*StatefulFakeSuiPTBClient) QueryTransactions ¶
func (c *StatefulFakeSuiPTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *string, limit *uint64) (models.SuiXQueryTransactionBlocksResponse, error)
func (*StatefulFakeSuiPTBClient) ReadFilterOwnedObjectIds ¶
func (c *StatefulFakeSuiPTBClient) ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor string) ([]models.SuiObjectData, error)
func (*StatefulFakeSuiPTBClient) ReadFunction ¶
func (*StatefulFakeSuiPTBClient) ReadObjectId ¶
func (c *StatefulFakeSuiPTBClient) ReadObjectId(ctx context.Context, objectId string) (models.SuiObjectData, error)
func (*StatefulFakeSuiPTBClient) ReadOwnedObjects ¶
func (c *StatefulFakeSuiPTBClient) ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor *models.ObjectId) ([]models.SuiObjectResponse, error)
func (*StatefulFakeSuiPTBClient) SendTransaction ¶
func (c *StatefulFakeSuiPTBClient) SendTransaction(ctx context.Context, payload client.TransactionBlockRequest) (client.SuiTransactionBlockResponse, error)
func (*StatefulFakeSuiPTBClient) SetCachedValue ¶
func (c *StatefulFakeSuiPTBClient) SetCachedValue(key string, value any)
func (*StatefulFakeSuiPTBClient) SetCachedValues ¶
func (c *StatefulFakeSuiPTBClient) SetCachedValues(keyValues map[string]any)
func (*StatefulFakeSuiPTBClient) SignAndSendTransaction ¶
func (c *StatefulFakeSuiPTBClient) SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte, executionRequestType client.TransactionRequestType) (client.SuiTransactionBlockResponse, error)
func (*StatefulFakeSuiPTBClient) SuiXGetReferenceGasPrice ¶
func (c *StatefulFakeSuiPTBClient) SuiXGetReferenceGasPrice(ctx context.Context) (string, error)
func (*StatefulFakeSuiPTBClient) WithRateLimit ¶
type TestKeystore ¶
type TestKeystore struct {
Keys map[string]ed25519.PrivateKey
// contains filtered or unexported fields
}
TestKeystore is a simple keystore for testing
func NewTestKeystore ¶
func NewTestKeystore(t *testing.T) *TestKeystore
NewTestKeystore creates a new test keystore
func SetupTestEnv ¶
func SetupTestSigner ¶
func (*TestKeystore) Accounts ¶
func (tk *TestKeystore) Accounts(ctx context.Context) ([]string, error)
func (*TestKeystore) AddKey ¶
func (tk *TestKeystore) AddKey(key ed25519.PrivateKey)
AddKey adds a private key to the keystore
func (*TestKeystore) GetSuiSigner ¶
type TimelockOperation ¶
type TokenPoolType ¶
type TokenPoolType string
TokenPoolType represents the different types of token pools available
func (TokenPoolType) String ¶
func (t TokenPoolType) String() string
String returns the string representation of TokenPoolType
type TokenPriceUpdate ¶
type TokenPriceUpdate struct {
SourceToken []byte // address in Move becomes []byte for 32-byte Sui address
UsdPerToken *big.Int // u256 in Move becomes *big.Int in Go
}
TokenPriceUpdate represents a token price update from offramp.move Matches the Move struct: public struct TokenPriceUpdate has store, drop, copy
func NewTokenPriceUpdate ¶
func NewTokenPriceUpdate(sourceToken string, usdPerToken *big.Int) TokenPriceUpdate
Helper function to create a TokenPriceUpdate with proper address formatting
type TokenToolDetails ¶
type TokenToolDetails struct {
TokenPoolPackageId string
TokenPoolType TokenPoolType
}
type TxnMetaWithObjectChanges ¶
type TxnMetaWithObjectChanges struct {
ObjectChanges []ObjectChange `json:"objectChanges"`
}
func PublishContract ¶
func PublishContract(t *testing.T, packageName string, contractPath string, accountAddress string, gasBudget *int) (string, TxnMetaWithObjectChanges, error)
PublishContract publishes a Move contract to the Sui network and extracts its package ID.
The function constructs and executes a "sui client publish" command using the provided contractPath and gasBudget (if specified). It cleans the command output to remove any unwanted header text, unmarshals the resulting JSON, and iterates over the "objectChanges" array to find an entry of type "published". Once found, it returns the associated packageId along with the full cleaned JSON output.
Parameters:
t - A testing.T instance for error reporting.
packageName - A string representing the contract name (package name in Move.toml).
contractPath - A string representing the filesystem path to the Move contract.
gasBudget - A pointer to an int that specifies the gas budget for the publish transaction.
If nil, a default value is used.
Returns:
packageId - The package ID extracted from the JSON output, typically for a published contract. output - The cleaned JSON output from the publish command. error - An error if the publish operation fails or if a valid package ID is not found.