Documentation
¶
Index ¶
Constants ¶
const ERC165GasLimit uint64 = 30_000
const MaxMetadataBytes = 10 * 1024 * 1024
const NativeRuntimeTokenAddress = "oasis1runt1menat1vet0ken0000000000000000000000"
A fake address that is used to represent the native runtime token in contexts that are primarily intended for tracking EVM tokens (= contract-based tokens).
Variables ¶
var ( // https://github.com/oasisprotocol/oasis-web3-gateway/blob/v3.0.0/rpc/eth/api.go#L403-L408 DefaultGasPrice = []byte{1} DefaultGasLimit uint64 = 30_000_000 DefaultCaller = ethCommon.Address{1}.Bytes() DefaultValue = []byte{0} )
var ( InvalidInterfaceID = []byte{0xff, 0xff, 0xff, 0xff} ERC165InterfaceID = InterfaceID(evmabi.ERC165) ERC721InterfaceID = InterfaceID(evmabi.ERC721) ERC721TokenReceiverInterfaceID = InterfaceID(evmabi.ERC721TokenReceiver) ERC721MetadataInterfaceID = InterfaceID(evmabi.ERC721Metadata) ERC721EnumerableInterfaceID = InterfaceID(evmabi.ERC721Enumerable) )
Functions ¶
func InterfaceID ¶
Types ¶
type ERC721AssetMetadata ¶ added in v0.1.16
type ERC721AssetMetadata struct {
// Name identifies the asset which this NFT represents
Name *string `json:"name"`
// Description describes the asset which this NFT represents
Description *string `json:"description"`
// Image is A URI pointing to a resource with mime type image/*
// representing the asset which this NFT represents. (Additional
// non-descriptive text from ERC-721 omitted.)
Image *string `json:"image"`
}
ERC721AssetMetadata is asset metadata https://eips.ethereum.org/EIPS/eip-721
type EVMContractData ¶
type EVMDeterministicError ¶
type EVMDeterministicError struct {
// contains filtered or unexported fields
}
func (EVMDeterministicError) Is ¶
func (err EVMDeterministicError) Is(target error) bool
type EVMEncryptedData ¶
type EVMEncryptedData struct {
Format common.CallFormat
PublicKey []byte
DataNonce []byte
DataData []byte
ResultNonce []byte
ResultData []byte
// Unlike `ResultData` and `DataData`, this field is not encrypted data. Rather,
// it is extracted during encrypted tx parsing and processed in extract.go.
// If non-null, the tx is an older Sapphire tx and it failed, and `ResultNonce`
// and `ResultData` will be empty.
FailedCallResult *sdkTypes.FailedCallResult
}
func EVMMaybeUnmarshalEncryptedData ¶
func EVMMaybeUnmarshalEncryptedData(data []byte, result *[]byte) (*EVMEncryptedData, error)
type EVMNFTData ¶ added in v0.1.16
type EVMNFTData struct {
MetadataURI *string
MetadataAccessed *time.Time
Metadata *string
Name *string
Description *string
Image *string
}
func EVMDownloadNewNFT ¶ added in v0.1.16
type EVMPossibleToken ¶
type EVMPossibleToken struct {
// True if a mutable property of the token (e.g. total_supply) has changed and this
// module wants to indicate that the contract should be queried to get the new value
// of the mutable property (or ideally just verify it if we'll also dead-reckon it).
Mutated bool
TotalSupplyChange big.Int
NumTransfersChange uint64
}
A contract that "looks like" a token contract, e.g. because it emitted a Transfer event.
type EVMTokenBalanceData ¶
type EVMTokenBalanceData struct {
// Balance... if you're here to ask about why there's a "balance" struct
// with a Balance field, it's because the struct is really a little
// document that the EVMDownloadTokenBalance function can optionally give
// you about an account. (And we didn't name the struct "account" because
// the only thing inside it is the balance.) We let that function return a
// *EVMTokenBalanceData so that it can return nil if it can determine that
// the contract is not supported. Plus, Go's idea of an arbitrary size
// integer is *big.Int, and we don't want anyone fainting if they see a
// ** in the codebase.
Balance *big.Int
}
func EVMDownloadTokenBalance ¶
func EVMDownloadTokenBalance(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte, accountEthAddr []byte, tokenType common.TokenType) (*EVMTokenBalanceData, error)
EVMDownloadTokenBalance tries to download the balance of a given account for a given token. If it transiently fails to download the balance, it returns with a non-nil error. If it deterministically cannot download the balance, it returns nil with nil error as well. Note that this latter case is not considered an error!
type EVMTokenData ¶
type EVMTokenData struct {
Type common.TokenType
Name string
Symbol string
Decimals uint8
*EVMTokenMutableData
}
func EVMDownloadNewToken ¶
func EVMDownloadNewToken(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte) (*EVMTokenData, error)
EVMDownloadNewToken tries to download the data of a given token. If it transiently fails to download the data, it returns with a non-nil error. If it deterministically cannot download the data, it returns a struct with the `Type` field set to `TokenTypeUnsupported`.
type EVMTokenMutableData ¶
func EVMDownloadMutatedToken ¶
func EVMDownloadMutatedToken(ctx context.Context, logger *log.Logger, source nodeapi.RuntimeApiLite, round uint64, tokenEthAddr []byte, tokenType common.TokenType) (*EVMTokenMutableData, error)
EVMDownloadMutatedToken tries to download the mutable data of a given token. If it transiently fails to download the data, it returns with a non-nil error. If it deterministically cannot download the data, it returns nil with nil error as well. Note that this latter case is not considered an error!