Documentation ¶
Index ¶
- Variables
- func Ptr[T any](v T) *T
- func StringOrNil[T fmt.Stringer](v *T) *string
- func TryAsJSON(v interface{}) json.RawMessage
- type BigInt
- func (b BigInt) MarshalBinary() ([]byte, error)
- func (b BigInt) MarshalJSON() ([]byte, error)
- func (b BigInt) MarshalText() ([]byte, error)
- func (b BigInt) NumericValue() (pgtype.Numeric, error)
- func (b BigInt) Plus(other BigInt) BigInt
- func (b *BigInt) ScanNumeric(n pgtype.Numeric) error
- func (b BigInt) String() string
- func (b BigInt) Times(other BigInt) BigInt
- func (b *BigInt) UnmarshalBinary(data []byte) error
- func (b *BigInt) UnmarshalJSON(text []byte) error
- func (b *BigInt) UnmarshalText(text []byte) error
- type CallFormat
- type ChainName
- type ContextKey
- type Layer
- type Runtime
- type TokenType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNetworkUnknown is returned if a chain context does not correspond // to a known network identifier. ErrNetworkUnknown = errors.New("network unknown") // ErrRuntimeUnknown is returned if a chain context does not correspond // to a known runtime identifier. ErrRuntimeUnknown = errors.New("runtime unknown") )
Functions ¶
func StringOrNil ¶ added in v0.2.9
func TryAsJSON ¶
func TryAsJSON(v interface{}) json.RawMessage
Returns `v` as a JSON string. If `v` cannot be marshaled, returns the string "null" instead.
Types ¶
type BigInt ¶
Arbitrary-precision integer. Wrapper around big.Int to allow for custom JSON marshaling.
func BigIntFromQuantity ¶
func NumericToBigInt ¶
NumericToBigInt converts a pgtype.Numeric to a BigInt similar to the private method found at https://github.com/jackc/pgtype/blob/master/numeric.go#L398
func (BigInt) MarshalBinary ¶ added in v0.2.3
Used by the `cbor` library.
func (BigInt) MarshalJSON ¶
func (BigInt) MarshalText ¶
func (BigInt) NumericValue ¶
Implement NumericValuer interface for BigInt.
func (*BigInt) ScanNumeric ¶
Implement NumericDecoder interface for BigInt.
func (*BigInt) UnmarshalBinary ¶ added in v0.2.3
func (*BigInt) UnmarshalJSON ¶
func (*BigInt) UnmarshalText ¶
type CallFormat ¶
type CallFormat string
type ChainName ¶
type ChainName string
ChainName is a name given to a sequence of networks. Used to index config.DefaultChains and sdkConfig.DefaultNetworks.All.
type ContextKey ¶
type ContextKey string
Key used to set values in a web request context. API uses this to set values, backend uses this to retrieve values.
const ( // RuntimeContextKey is used to set the relevant runtime name // in a request context. RuntimeContextKey ContextKey = "runtime" // RequestIDContextKey is used to set a request id for tracing // in a request context. RequestIDContextKey ContextKey = "request_id" )
type Layer ¶ added in v0.1.13
type Layer string
Layer is an identifier for either Consensus or a network runtime.
type TokenType ¶ added in v0.1.17
type TokenType int
TokenType is a small-ish number that we use to identify what type of token each row of the tokens table is. Values aren't consecutive like in an enum. Prefer to use the number of the ERC if applicable and available, e.g. 20 for ERC-20. "Historical reasons" style note: this has grown to include non-EVM token types as well.
const ( TokenTypeNative TokenType = -1 // A placeholder type to represent the runtime's native token. No contract should be assigned this type. TokenTypeUnsupported TokenType = 0 // A smart contract for which we're confident it's not a supported token kind. TokenTypeERC20 TokenType = 20 TokenTypeERC721 TokenType = 721 )