dexietypes

package
v0.0.0-...-613d1fa Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToUint8

func BoolToUint8(b bool) uint8

func EventLogsFromCommonType

func EventLogsFromCommonType(eventLogs []ethtypes.Log) js.Value

func EventLogsToCommonType

func EventLogsToCommonType(eventLogs js.Value) []ethtypes.Log

func MetadataToCommonType

func MetadataToCommonType(metadata *Metadata) *types.Metadata

func MiniHeaderFromCommonType

func MiniHeaderFromCommonType(miniHeader *types.MiniHeader) js.Value

func MiniHeaderToCommonType

func MiniHeaderToCommonType(miniHeader js.Value) *types.MiniHeader

func MiniHeadersFromCommonType

func MiniHeadersFromCommonType(miniHeaders []*types.MiniHeader) js.Value

func MiniHeadersToCommonType

func MiniHeadersToCommonType(miniHeaders js.Value) []*types.MiniHeader

func OrderToCommonType

func OrderToCommonType(order *Order) *types.OrderWithMetadata

func OrdersToCommonType

func OrdersToCommonType(orders []*Order) []*types.OrderWithMetadata

func ParsedAssetDataFromCommonType

func ParsedAssetDataFromCommonType(parsedAssetData []*types.SingleAssetData) string

func ParsedAssetDataToCommonType

func ParsedAssetDataToCommonType(parsedAssetData string) []*types.SingleAssetData

func SingleAssetDataToCommonType

func SingleAssetDataToCommonType(singleAssetData *SingleAssetData) *types.SingleAssetData

Types

type BigInt

type BigInt struct {
	*big.Int
}

BigInt is a wrapper around *big.Int that implements the json.Marshaler and json.Unmarshaler interfaces in a way that is compatible with Dexie.js but *does not* pad with zeroes and *does not* retain sort order.

func BigIntFromInt64

func BigIntFromInt64(v int64) *BigInt

func BigIntFromString

func BigIntFromString(v string) (*BigInt, error)

func NewBigInt

func NewBigInt(v *big.Int) *BigInt

func (*BigInt) MarshalJSON

func (i *BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) UnmarshalJSON

func (i *BigInt) UnmarshalJSON(data []byte) error

type Metadata

type Metadata struct {
	EthereumChainID                   int       `json:"ethereumChainID"`
	EthRPCRequestsSentInCurrentUTCDay int       `json:"ethRPCRequestsSentInCurrentUTCDay"`
	StartOfCurrentUTCDay              time.Time `json:"startOfCurrentUTCDay"`
}

func MetadataFromCommonType

func MetadataFromCommonType(metadata *types.Metadata) *Metadata

type Order

type Order struct {
	Hash                     common.Hash    `json:"hash"`
	ChainID                  *SortedBigInt  `json:"chainID"`
	ExchangeAddress          common.Address `json:"exchangeAddress"`
	MakerAddress             common.Address `json:"makerAddress"`
	MakerAssetData           []byte         `json:"makerAssetData"`
	MakerFeeAssetData        []byte         `json:"makerFeeAssetData"`
	MakerAssetAmount         *SortedBigInt  `json:"makerAssetAmount"`
	MakerFee                 *SortedBigInt  `json:"makerFee"`
	TakerAddress             common.Address `json:"takerAddress"`
	TakerAssetData           []byte         `json:"takerAssetData"`
	TakerFeeAssetData        []byte         `json:"takerFeeAssetData"`
	TakerAssetAmount         *SortedBigInt  `json:"takerAssetAmount"`
	TakerFee                 *SortedBigInt  `json:"takerFee"`
	SenderAddress            common.Address `json:"senderAddress"`
	FeeRecipientAddress      common.Address `json:"feeRecipientAddress"`
	ExpirationTimeSeconds    *SortedBigInt  `json:"expirationTimeSeconds"`
	Salt                     *SortedBigInt  `json:"salt"`
	Signature                []byte         `json:"signature"`
	LastUpdated              time.Time      `json:"lastUpdated"`
	FillableTakerAssetAmount *SortedBigInt  `json:"fillableTakerAssetAmount"`
	IsRemoved                uint8          `json:"isRemoved"`
	IsPinned                 uint8          `json:"isPinned"`
	IsNotPinned              uint8          `json:"isNotPinned"` // Used in a compound index in queries related to max expiration time.
	ParsedMakerAssetData     string         `json:"parsedMakerAssetData"`
	ParsedMakerFeeAssetData  string         `json:"parsedMakerFeeAssetData"`
	LastValidatedBlockNumber *SortedBigInt  `json:"lastValidatedBlockNumber"`
	LastValidatedBlockHash   common.Hash    `json:"lastValidatedBlockHash"`
}

Order is the SQL database representation a 0x order along with some relevant metadata.

func OrderFromCommonType

func OrderFromCommonType(order *types.OrderWithMetadata) *Order

func OrdersFromCommonType

func OrdersFromCommonType(orders []*types.OrderWithMetadata) []*Order

type ParsedAssetData

type ParsedAssetData []*SingleAssetData

ParsedAssetData is a wrapper around []*SingleAssetData that implements the sql.Valuer and sql.Scanner interfaces.

type SingleAssetData

type SingleAssetData struct {
	Address common.Address `json:"address"`
	TokenID *BigInt        `json:"tokenID"`
}

func SingleAssetDataFromCommonType

func SingleAssetDataFromCommonType(singleAssetData *types.SingleAssetData) *SingleAssetData

type SortedBigInt

type SortedBigInt struct {
	*big.Int
}

SortedBigInt is a wrapper around *big.Int that implements the json.Marshaler and json.Unmarshaler interfaces in a way that is compatible with Dexie.js and retains sort order by padding with zeroes.

func NewSortedBigInt

func NewSortedBigInt(v *big.Int) *SortedBigInt

func SortedBigIntFromInt64

func SortedBigIntFromInt64(v int64) *SortedBigInt

func SortedBigIntFromString

func SortedBigIntFromString(v string) (*SortedBigInt, error)

func (*SortedBigInt) FixedLengthString

func (i *SortedBigInt) FixedLengthString() string

func (*SortedBigInt) MarshalJSON

func (i *SortedBigInt) MarshalJSON() ([]byte, error)

func (*SortedBigInt) UnmarshalJSON

func (i *SortedBigInt) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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