Documentation
¶
Index ¶
- Constants
- Variables
- func DeriveObjectIDWithVectorU8Key(parentAddress string, keyBytes []byte) (string, error)
- func GetAddressFromPublicKey(pubKey []byte) (string, error)
- func NewSuiGrpcClient(config GrpcClientConfig) *suigrpcconn.Connection
- func SerializeSuiSignature(signature, pubKey []byte) string
- type BindingsClient
- type CheckpointData
- type EventData
- type EventFilterByMoveEventModule
- type EventId
- type EventSelector
- type FunctionReadResponse
- type GrpcClientConfig
- type MoveCallRequest
- type ObjectMetadataCache
- type PTBClient
- func (c *PTBClient) Close() error
- func (c *PTBClient) CreateTypeTag(typeStr string) (transaction.TypeTag, error)
- func (c *PTBClient) EstimateGas(ctx context.Context, tx *transaction.Transaction) (uint64, error)
- func (c *PTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, ...) (*suirpcv2.ExecuteTransactionResponse, error)
- func (c *PTBClient) GetBlockById(ctx context.Context, checkpointDigest string) (*suirpcv2.Checkpoint, error)
- func (c *PTBClient) GetCCIPPackageID(ctx context.Context, offRampPackageID string) (string, error)
- func (c *PTBClient) GetCache() *cache.Cache
- func (c *PTBClient) GetCachedValue(key string) (any, bool)
- func (c *PTBClient) GetCachedValues(keys []string) (map[string]any, bool)
- func (c *PTBClient) GetCheckpointData(ctx context.Context, checkpointSequenceNumber uint64) (*CheckpointData, error)
- func (c *PTBClient) GetCoinBalanceByAddress(ctx context.Context, address string, coinType string) (*suirpcv2.Balance, error)
- func (c *PTBClient) GetCoinMetadata(ctx context.Context, coinType string) (models.CoinMetadataResponse, error)
- func (c *PTBClient) GetCoinsByAddress(ctx context.Context, address string) ([]*suirpcv2.Object, error)
- func (c *PTBClient) GetEventsByCheckpoint(ctx context.Context, checkpointSequenceNumber uint64, eventTypes []string) ([]*suirpcv2.Event, error)
- func (c *PTBClient) GetLatestCheckpoint(ctx context.Context) (*suirpcv2.Checkpoint, error)
- func (c *PTBClient) GetLatestEpoch(ctx context.Context) (*suirpcv2.Epoch, error)
- func (c *PTBClient) GetLatestPackageId(ctx context.Context, packageId string, module string) (string, error)
- func (c *PTBClient) GetMoveModuleFunction(ctx context.Context, packageId string, moduleId string, functionName string) (*suirpcv2.FunctionDescriptor, error)
- func (c *PTBClient) GetNormalizedModule(ctx context.Context, packageId string, module string) (models.GetNormalizedMoveModuleResponse, error)
- func (c *PTBClient) GetParentObjectID(ctx context.Context, packageID string, moduleID string, ...) (string, error)
- func (c *PTBClient) GetReferenceGasPrice(ctx context.Context) (*big.Int, error)
- func (c *PTBClient) GetSUIBalance(ctx context.Context, address string) (*suirpcv2.Balance, error)
- func (c *PTBClient) GetTransactionChangedObjects(ctx context.Context, digest string) ([]*suirpcv2.ChangedObject, error)
- func (c *PTBClient) GetTransactionPaymentCoinForAddress(ctx context.Context, payer string) (models.SuiAddressBytes, uint64, models.ObjectDigestBytes, error)
- func (c *PTBClient) GetTransactionStatus(ctx context.Context, digest string) (TransactionResult, error)
- func (c *PTBClient) GetTransactionsByCheckpoint(ctx context.Context, checkpointSequenceNumber uint64) ([]*suirpcv2.ExecutedTransaction, error)
- func (c *PTBClient) GetValuesFromPackageOwnedObjectField(ctx context.Context, packageID string, moduleID string, objectName string, ...) (map[string]string, error)
- func (c *PTBClient) HashTxBytes(txBytes []byte) []byte
- func (c *PTBClient) HealthCheckGrpc(ctx context.Context) (chainID string, err error)
- func (c *PTBClient) HydrateTransactionEvents(ctx context.Context, tx *suirpcv2.ExecutedTransaction)
- func (c *PTBClient) LoadModulePackageIds(ctx context.Context, packageId string, module string) ([]string, error)
- func (c *PTBClient) MoveCall(ctx context.Context, req MoveCallRequest) (TxnMetaData, error)
- func (c *PTBClient) QueryCoinsByAddress(ctx context.Context, address string, coinType string) ([]*suirpcv2.Object, error)
- func (c *PTBClient) QueryEvents(ctx context.Context, filter EventFilterByMoveEventModule, limit *uint, ...) (*models.PaginatedEventsResponse, error)
- func (c *PTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *suirpcv2.Checkpoint, ...) ([]*suirpcv2.ExecutedTransaction, error)
- func (c *PTBClient) ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor []byte) ([]*suirpcv2.Object, error)
- func (c *PTBClient) ReadFunction(ctx context.Context, packageId string, module string, function string, ...) ([]any, error)
- func (c *PTBClient) ReadObjectId(ctx context.Context, objectId string) (*suirpcv2.Object, error)
- func (c *PTBClient) ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor []byte) ([]*suirpcv2.Object, error)
- func (c *PTBClient) SendTransaction(ctx context.Context, execRequest *suirpcv2.ExecuteTransactionRequest) (*suirpcv2.ExecuteTransactionResponse, error)
- func (c *PTBClient) SetCachedValue(key string, value any)
- func (c *PTBClient) SetCachedValues(keyValues map[string]any)
- func (c *PTBClient) SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte) (*suirpcv2.ExecuteTransactionResponse, error)
- func (c *PTBClient) SimulatePTB(ctx context.Context, bcsBytes []byte) ([]any, error)
- func (c *PTBClient) TransformTransactionArg(ctx context.Context, tx *transaction.Transaction, arg any, argType string, ...) (*transaction.Argument, error)
- func (c *PTBClient) VerifyGrpcServices(ctx context.Context) error
- func (c *PTBClient) WithRateLimit(ctx context.Context, methodName string, f func(ctx context.Context) error) error
- type PTBClientConfig
- type PaginatedEventsResponse
- type QuerySortOptions
- type SigFlag
- type SuiExecutionStatus
- type SuiPTBClient
- type SuiTransactionBlockResponse
- type TransactionBlockOptions
- type TransactionBlockRequest
- type TransactionRequestType
- type TransactionResult
- type TxnMetaData
Constants ¶
const ( HashingIntentScopeChildObjectID = 0xf0 SuiFrameworkAddress = "0x2" )
const ( Base10 int = 10 DefaultGasPrice uint64 = 10_000 DefaultGasBudget uint64 = 1_000_000_000 DefaultMinGasBudget uint64 = 1_000_000 DefaultCacheExpiration time.Duration = 120 * time.Minute DefaultCacheCleanupInterval time.Duration = 240 * time.Minute DefaultHTTPTimeout time.Duration = 30 * time.Second // DefaultReadOpTimeout caps a single read chain (transform + simulate). Prevents gRPC calls from // outliving the CCIP config poller's 30s deadline when the node is overloaded. DefaultReadOpTimeout time.Duration = 30 * time.Second // DefaultPackageIdCacheTTL caches resolved latest package IDs to avoid repeated heavy // GetFunction/GetPackage/ListOwnedObjects chains under bursty config polling. DefaultPackageIdCacheTTL time.Duration = 5 * time.Minute )
const ( DefaultGrpcMaxMsgSize = 20 * 1024 * 1024 // DefaultMaxGrpcConnections is the number of independent gRPC connections each client opens to the // node. Spreading RPCs round-robin across several connections multiplies the available concurrent // HTTP/2 streams so a single connection's stream limit does not throttle bursty reads. DefaultMaxGrpcConnections = 128 )
Variables ¶
var RateLimitWeights = map[string]int64{
"MoveCall": 0,
"SendTransaction": 0,
"ReadFunction": 0,
"SignAndSendTransaction": 0,
"QueryEvents": 0,
"QueryTransactions": 0,
"GetCoinsByAddress": 0,
"QueryCoinsByAddress": 0,
"EstimateGas": 0,
"GetTransactionStatus": 0,
"GetBlockById": 0,
"GetNormalizedModule": 0,
"GetSUIBalance": 0,
"GetCoinBalanceByAddress": 0,
"GetValuesFromPackageOwnedObjectField": 0,
"GetReferenceGasPrice": 0,
"FinishPTBAndSend": 0,
"ReadFilterOwnedObjectIds": 0,
"ReadOwnedObjects": 0,
"ReadObjectId": 0,
"GetLatestPackageId": 0,
"LoadModulePackageIds": 0,
"GetParentObjectID": 0,
"GetCCIPPackageID": 0,
"GetTokenPoolConfigByPackageAddress": 0,
"GetLatestEpoch": 0,
"GetTransactionsByCheckpoint": 0,
"GetLatestCheckpoint": 0,
"GetCheckpointData": 0,
"SimulatePTB": 0,
"GetCoinMetadata": 0,
}
Functions ¶
func DeriveObjectIDWithVectorU8Key ¶
DeriveObjectIDWithVectorU8Key constructs the BCS bytes for DerivedObjectKey<vector<u8>> TypeTag. keyBytes should be the raw vector<u8> value - this function will BCS-serialize it.
func GetAddressFromPublicKey ¶
func NewSuiGrpcClient ¶
func NewSuiGrpcClient(config GrpcClientConfig) *suigrpcconn.Connection
NewSuiGrpcClient creates an authenticated Sui gRPC connection.
func SerializeSuiSignature ¶
SerializeSuiSignature formats and serializes a signature for use with Sui transactions.
This function follows the Sui transaction signature format specification: 1. A one-byte flag indicating the signature scheme (0x00 for Ed25519) 2. The raw signature bytes 3. The public key bytes These components are concatenated and then base64 encoded to produce the final signature string that can be submitted to the Sui network.
Based on the implementation from block-vision's sui-go-sdk: https://github.com/block-vision/sui-go-sdk/blob/main/models/signature.go#L140
Parameters:
signature - The raw signature bytes from the ed25519 Sign operation pubKey - The public key corresponding to the private key that produced the signature
Returns:
A base64-encoded string containing the serialized signature ready for submission to Sui
Types ¶
type BindingsClient ¶
type BindingsClient interface {
ReadObjectId(ctx context.Context, objectId string) (*suirpcv2.Object, error)
QueryCoinsByAddress(ctx context.Context, address, coinType string) ([]*suirpcv2.Object, error)
GetReferenceGasPrice(ctx context.Context) (*big.Int, error)
SimulatePTB(ctx context.Context, bcsBytes []byte) ([]any, error)
SendTransaction(ctx context.Context, req *suirpcv2.ExecuteTransactionRequest) (*suirpcv2.ExecuteTransactionResponse, error)
GetTransactionStatus(ctx context.Context, digest string) (TransactionResult, error)
FinishPTBAndSend(ctx context.Context, signer *signer.Signer, tx *transaction.Transaction, requestType TransactionRequestType) (*suirpcv2.ExecuteTransactionResponse, error)
}
BindingsClient is the subset of SuiPTBClient used by the bindings module.
type CheckpointData ¶
type CheckpointData struct {
Checkpoint *suirpcv2.Checkpoint
Transactions []*suirpcv2.ExecutedTransaction
}
CheckpointData combines checkpoint metadata with its transactions.
type EventData ¶
type EventData struct {
Id struct {
TxDigest string `json:"txDigest"`
EventSeq string `json:"eventSeq"`
} `json:"id"`
PackageId string `json:"packageId"`
TransactionModule string `json:"transactionModule"`
Sender string `json:"sender"`
Type struct {
Address string `json:"address"`
Module string `json:"module"`
Name string `json:"name"`
} `json:"type"`
ParsedJson any `json:"parsedJson"`
Bcs string `json:"bcs"`
TimestampMs string `json:"timestampMs"`
}
type EventSelector ¶
type EventSelector = EventFilterByMoveEventModule
EventSelector is an alias for EventFilterByMoveEventModule
type FunctionReadResponse ¶
type FunctionReadResponse struct {
ReturnValues []any `json:"returnValues"`
}
type GrpcClientConfig ¶
GrpcClientConfig holds configuration for a Sui gRPC client connection.
func DefaultGrpcConfig ¶
func DefaultGrpcConfig(target, token string) GrpcClientConfig
DefaultGrpcConfig returns sensible defaults for a gRPC endpoint and auth token.
type MoveCallRequest ¶
type MoveCallRequest struct {
// the transaction signer's Sui address
Signer string `json:"signer"`
// the package containing the module and function
PackageObjectId string `json:"packageObjectId"`
// the specific module in the package containing the function
Module string `json:"module"`
// the function to be called
Function string `json:"function"`
// the type arguments to the function
TypeArguments []any `json:"typeArguments"`
// the arguments to the function
Arguments []any `json:"arguments"`
// gas object to be used in this transaction, node will pick one from the signer's possession if not provided
Gas uint64 `json:"gas"`
// the gas budget, the transaction will fail if the gas cost exceed the budget
GasBudget uint64 `json:"gasBudget"`
}
type ObjectMetadataCache ¶
type ObjectMetadataCache interface {
GetObjectMetadata(ctx context.Context, objectID string, loader func(context.Context) (*suirpcv2.Object, error)) (*suirpcv2.Object, error)
}
ObjectMetadataCache caches version-stable object reference metadata (owner/version/digest) to avoid redundant GetObject RPCs on the read hot path. It is satisfied by chainreader/reader.Cache and supplied via PTBClientConfig.ObjectCache.
type PTBClient ¶
type PTBClient struct {
// contains filtered or unexported fields
}
PTBClient implements SuiClient interface using the blockvision SDK. During the gRPC migration, JSON-RPC (client) and gRPC (grpcClient) coexist: migrated methods use gRPC service accessors; others continue via JSON-RPC.
func NewPTBClient ¶
func NewPTBClient(log logger.Logger, cfg PTBClientConfig) (*PTBClient, error)
func NewPTBClientFromConfig ¶
func NewPTBClientFromConfig(log logger.Logger, cfg PTBClientConfig) (*PTBClient, error)
NewPTBClientFromConfig creates a PTBClient from a full configuration.
func (*PTBClient) CreateTypeTag ¶
func (c *PTBClient) CreateTypeTag(typeStr string) (transaction.TypeTag, error)
Add helper method to create type tags
func (*PTBClient) EstimateGas ¶
func (c *PTBClient) EstimateGas(ctx context.Context, tx *transaction.Transaction) (uint64, error)
func (*PTBClient) FinishPTBAndSend ¶
func (c *PTBClient) FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, requestType TransactionRequestType) (*suirpcv2.ExecuteTransactionResponse, error)
FinishPTBAndSend finishes the PTB transaction and sends it to the network. IMPORTANT: This method is only used for testing purposes.
func (*PTBClient) GetBlockById ¶
func (c *PTBClient) GetBlockById(ctx context.Context, checkpointDigest string) (*suirpcv2.Checkpoint, error)
GetBlockById (i.e. get checkpoint by id) returns the checkpoint details given its ID
func (*PTBClient) GetCCIPPackageID ¶
GetCCIPPackageId gets the CCIP package ID from the offramp package ID. IMPORTANT: This function expects to call the original (un-upgraded / first version) offramp package ID.
func (*PTBClient) GetCachedValues ¶
func (*PTBClient) GetCheckpointData ¶
func (c *PTBClient) GetCheckpointData(ctx context.Context, checkpointSequenceNumber uint64) (*CheckpointData, error)
GetCheckpointData returns checkpoint metadata plus all transactions for a given sequence number.
func (*PTBClient) GetCoinBalanceByAddress ¶
func (*PTBClient) GetCoinMetadata ¶
func (*PTBClient) GetCoinsByAddress ¶
func (c *PTBClient) GetCoinsByAddress(ctx context.Context, address string) ([]*suirpcv2.Object, error)
GetCoinsByAddress returns all coin objects for a given address.
func (*PTBClient) GetEventsByCheckpoint ¶
func (c *PTBClient) GetEventsByCheckpoint(ctx context.Context, checkpointSequenceNumber uint64, eventTypes []string) ([]*suirpcv2.Event, error)
GetEventsByCheckpoint returns all the events for a given checkpoint sequence number. @param checkpointSequenceNumber - the checkpoint sequence number to get events for @param eventTypes - the types of events to get (must be fully qualified `packageId::moduleId::EventName`) @return the events and an error if any
func (*PTBClient) GetLatestCheckpoint ¶
GetLatestCheckpoint returns the latest checkpoint from the chain. Uses GetCheckpointRequest with empty CheckpointId which returns the latest.
func (*PTBClient) GetLatestEpoch ¶
func (*PTBClient) GetLatestPackageId ¶
func (*PTBClient) GetMoveModuleFunction ¶
func (*PTBClient) GetNormalizedModule ¶
func (*PTBClient) GetParentObjectID ¶
func (c *PTBClient) GetParentObjectID(ctx context.Context, packageID string, moduleID string, pointerObjectName string) (string, error)
GetParentObjectID gets the parent object ID from a pointer object's field. With derived objects, pointers now store a reference to the parent "Object" struct (e.g., OffRampObject, CCIPObject). e.g. OffRampStatePointer contains "off_ramp_object_id" field pointing to OffRampObject.
func (*PTBClient) GetReferenceGasPrice ¶
func (*PTBClient) GetSUIBalance ¶
func (*PTBClient) GetTransactionChangedObjects ¶
func (*PTBClient) GetTransactionPaymentCoinForAddress ¶
func (c *PTBClient) GetTransactionPaymentCoinForAddress(ctx context.Context, payer string) (models.SuiAddressBytes, uint64, models.ObjectDigestBytes, error)
func (*PTBClient) GetTransactionStatus ¶
func (*PTBClient) GetTransactionsByCheckpoint ¶
func (c *PTBClient) GetTransactionsByCheckpoint(ctx context.Context, checkpointSequenceNumber uint64) ([]*suirpcv2.ExecutedTransaction, error)
GetTransactionsByCheckpoint returns all the transactions for a given checkpoint sequence number.
func (*PTBClient) GetValuesFromPackageOwnedObjectField ¶
func (c *PTBClient) GetValuesFromPackageOwnedObjectField(ctx context.Context, packageID string, moduleID string, objectName string, fieldKeys []string) (map[string]string, error)
GetValueFromPackageOwnedObjectField gets the value of a field from a package owned object. This is used to get addresses stored within pointer objects on-chain. For example, the state object ID of a package is stored in the pointer object, so we need to get the value of the pointer object's field to get the state object ID.
func (*PTBClient) HashTxBytes ¶
HashTxBytes is a helper method to hash (Blake2) the transaction bytes before signing
func (*PTBClient) HealthCheckGrpc ¶
HealthCheckGrpc verifies gRPC connectivity by calling LedgerService.GetServiceInfo on a pooled connection.
func (*PTBClient) HydrateTransactionEvents ¶
func (c *PTBClient) HydrateTransactionEvents(ctx context.Context, tx *suirpcv2.ExecutedTransaction)
TODO: this should be the responsibility of the indexer, not the client HydrateTransactionEvents fetches full event payloads when a checkpoint transaction reports an events_digest but omits inline TransactionEvents.
func (*PTBClient) LoadModulePackageIds ¶
func (c *PTBClient) LoadModulePackageIds(ctx context.Context, packageId string, module string) ([]string, error)
LoadModulePackages returns the set of package IDs for a given module using its original package ID This method assumes that module names are unique across all packages
func (*PTBClient) MoveCall ¶
func (c *PTBClient) MoveCall(ctx context.Context, req MoveCallRequest) (TxnMetaData, error)
MoveCall is a method that's used primarily in tests for adhoc contract calls. It simply builds the transaction bytes and returns them.
func (*PTBClient) QueryCoinsByAddress ¶
func (c *PTBClient) QueryCoinsByAddress(ctx context.Context, address string, coinType string) ([]*suirpcv2.Object, error)
QueryCoinsByAddress is the same as GetCoinsByAddress, but it allows you to filter by coin type. The `coinType` parameter should be the full coin type, e.g. "0x2::coin::Coin<0x2::sui::SUI>".
func (*PTBClient) QueryEvents ¶
func (c *PTBClient) QueryEvents(ctx context.Context, filter EventFilterByMoveEventModule, limit *uint, cursor *EventId, sortOptions *QuerySortOptions) (*models.PaginatedEventsResponse, error)
func (*PTBClient) QueryTransactions ¶
func (c *PTBClient) QueryTransactions(ctx context.Context, fromAddress string, cursor *suirpcv2.Checkpoint, limit *uint64) ([]*suirpcv2.ExecutedTransaction, error)
QueryTransactions queries the transactions for a given address. @param fromAddress - the address to query transactions for @param cursor - a checkpoint ID to start from, if nil the latest checkpoint is used @param limit - the limit of transactions to return @return the transactions and an error if any
func (*PTBClient) ReadFilterOwnedObjectIds ¶
func (*PTBClient) ReadFunction ¶
func (*PTBClient) ReadObjectId ¶
func (*PTBClient) ReadOwnedObjects ¶
func (*PTBClient) SendTransaction ¶
func (c *PTBClient) SendTransaction(ctx context.Context, execRequest *suirpcv2.ExecuteTransactionRequest) (*suirpcv2.ExecuteTransactionResponse, error)
SendTransaction executes an already signed transaction, using the execution service, given the BCS bytes.
func (*PTBClient) SetCachedValue ¶
func (*PTBClient) SetCachedValues ¶
func (*PTBClient) SignAndSendTransaction ¶
func (*PTBClient) SimulatePTB ¶
SimulatePTB simulates a pre-built PTB and returns JSON-decoded Move return values.
func (*PTBClient) TransformTransactionArg ¶
func (c *PTBClient) TransformTransactionArg( ctx context.Context, tx *transaction.Transaction, arg any, argType string, mutable bool, ) (*transaction.Argument, error)
func (*PTBClient) VerifyGrpcServices ¶
VerifyGrpcServices initializes all gRPC service stubs to verify connectivity.
type PTBClientConfig ¶
type PTBClientConfig struct {
GrpcTarget string
GrpcToken string
MaxRetries *int
TransactionTimeout time.Duration
KeystoreService loop.Keystore
MaxConcurrentRequests int64
// MaxGrpcConnections is the size of the round-robin gRPC connection pool. Zero means use
// DefaultMaxGrpcConnections.
MaxGrpcConnections int
// ObjectCache, when set, caches version-stable object reference metadata to avoid redundant GetObject
// RPCs on the read hot path. Nil disables object-metadata caching.
ObjectCache ObjectMetadataCache
DefaultRequestType TransactionRequestType
}
PTBClientConfig configures a PTBClient with gRPC endpoints.
type PaginatedEventsResponse ¶
type QuerySortOptions ¶
type QuerySortOptions struct {
Descending bool `json:"descending"`
}
type SuiExecutionStatus ¶
type SuiPTBClient ¶
type SuiPTBClient interface {
MoveCall(ctx context.Context, req MoveCallRequest) (TxnMetaData, error)
SendTransaction(ctx context.Context, execRequest *suirpcv2.ExecuteTransactionRequest) (*suirpcv2.ExecuteTransactionResponse, error)
ReadOwnedObjects(ctx context.Context, ownerAddress string, cursor []byte) ([]*suirpcv2.Object, error)
ReadFilterOwnedObjectIds(ctx context.Context, ownerAddress string, structType string, cursor []byte) ([]*suirpcv2.Object, error)
ReadObjectId(ctx context.Context, objectId string) (*suirpcv2.Object, error)
ReadFunction(ctx context.Context, packageId string, module string, function string, args []any, argTypes []string, typeArgs []string) ([]any, error)
SimulatePTB(ctx context.Context, bcsBytes []byte) ([]any, error)
SignAndSendTransaction(ctx context.Context, txBytesRaw string, signerPublicKey []byte) (*suirpcv2.ExecuteTransactionResponse, error)
QueryEvents(ctx context.Context, filter EventFilterByMoveEventModule, limit *uint, cursor *EventId, sortOptions *QuerySortOptions) (*models.PaginatedEventsResponse, error)
QueryTransactions(ctx context.Context, fromAddress string, cursor *suirpcv2.Checkpoint, limit *uint64) ([]*suirpcv2.ExecutedTransaction, error)
GetTransactionStatus(ctx context.Context, digest string) (TransactionResult, error)
GetCoinsByAddress(ctx context.Context, address string) ([]*suirpcv2.Object, error)
QueryCoinsByAddress(ctx context.Context, address string, coinType string) ([]*suirpcv2.Object, error)
EstimateGas(ctx context.Context, tx *transaction.Transaction) (uint64, error)
GetReferenceGasPrice(ctx context.Context) (*big.Int, error)
FinishPTBAndSend(ctx context.Context, txnSigner *signer.Signer, tx *transaction.Transaction, requestType TransactionRequestType) (*suirpcv2.ExecuteTransactionResponse, error)
GetBlockById(ctx context.Context, checkpointDigest string) (*suirpcv2.Checkpoint, error)
GetLatestEpoch(ctx context.Context) (*suirpcv2.Epoch, error)
GetLatestCheckpoint(ctx context.Context) (*suirpcv2.Checkpoint, error)
GetCheckpointData(ctx context.Context, checkpointSequenceNumber uint64) (*CheckpointData, error)
GetNormalizedModule(ctx context.Context, packageId string, moduleId string) (models.GetNormalizedMoveModuleResponse, error)
GetMoveModuleFunction(ctx context.Context, packageId string, moduleId string, functionName string) (*suirpcv2.FunctionDescriptor, error)
GetSUIBalance(ctx context.Context, address string) (*suirpcv2.Balance, error)
LoadModulePackageIds(ctx context.Context, packageId string, module string) ([]string, error)
GetLatestPackageId(ctx context.Context, packageId string, module string) (string, error)
GetCoinMetadata(ctx context.Context, coinType string) (models.CoinMetadataResponse, error)
GetCache() *cache.Cache
GetCachedValue(key string) (any, bool)
SetCachedValue(key string, value any)
GetCachedValues(keys []string) (map[string]any, bool)
SetCachedValues(keyValues map[string]any)
HashTxBytes(txBytes []byte) []byte
GetCCIPPackageID(ctx context.Context, offRampPackageID string) (string, error)
GetValuesFromPackageOwnedObjectField(ctx context.Context, packageID string, moduleID string, objectName string, fieldKeys []string) (map[string]string, error)
GetParentObjectID(ctx context.Context, packageID string, moduleID string, pointerObjectName string) (string, error)
}
type SuiTransactionBlockResponse ¶
type SuiTransactionBlockResponse struct {
TxDigest string `json:"txDigest"`
Status SuiExecutionStatus `json:"status"`
Effects models.SuiEffects `json:"effects"`
Events []models.SuiEventResponse `json:"events,omitempty"`
Timestamp uint64 `json:"timestamp"`
Height uint64 `json:"height"`
ObjectChanges []models.ObjectChange `json:"objectChanges,omitempty"`
}
type TransactionBlockOptions ¶
type TransactionBlockOptions struct {
ShowInput bool `json:"showInput,omitempty"`
ShowRawInput bool `json:"showRawInput,omitempty"`
ShowEffects bool `json:"showEffects,omitempty"`
ShowEvents bool `json:"showEvents,omitempty"`
ShowObjectChanges bool `json:"showObjectChanges,omitempty"`
ShowBalanceChanges bool `json:"showBalanceChanges,omitempty"`
}
type TransactionBlockRequest ¶
type TransactionBlockRequest struct {
// BCS serialized transaction data bytes without its type tag, as base-64 encoded string.
TxBytes string `json:"txBytes"`
// A list of signatures (`flag || signature || pubkey` bytes, as base-64 encoded string).
// Signature is committed to the intent message of the transaction data, as base-64 encoded string.
Signatures []string `json:"signature"`
// Options for specifying the content to be returned
Options TransactionBlockOptions `json:"options"`
// The request type, derived from `SuiTransactionBlockResponseOptions` if None.
// The optional enumeration values are: `WaitForEffectsCert`, or `WaitForLocalExecution`
RequestType string `json:"requestType"`
}
TransactionBlockRequest represents the request the SuiExecuteTransactionBlock endpoint. https://docs.sui.io/sui-api-ref#sui_executetransactionblock
type TransactionRequestType ¶
type TransactionRequestType string
TransactionRequestType defines the possible request types for transaction execution
const ( WaitForEffectsCert TransactionRequestType = "WaitForEffectsCert" WaitForLocalExecution TransactionRequestType = "WaitForLocalExecution" )
type TransactionResult ¶
type TxnMetaData ¶
type TxnMetaData struct {
TxBytes string `json:"txBytes"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |