types

package
v0.0.0-...-95d8435 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeMove              = EventType("MoveEvent")
	EventTypePublish           = EventType("Publish")
	EventTypeCoinBalanceChange = EventType("CoinBalanceChange")
	EventTypeTransferObject    = EventType("TransferObject")
	EventTypeNewObject         = EventType("NewObject")
	EventTypeDeleteObject      = EventType("DeleteObject")
	EventTypeMutateObject      = EventType("MutateObject")
)
View Source
const (
	CoinBalanceChangeGas     CoinBalanceChangeType = "Gas"
	CoinBalanceChangePay                           = "Pay"
	CoinBalanceChangeReceive                       = "Receive"
)
View Source
const (
	AddressLength = 20
)

Variables

This section is empty.

Functions

func FromHex

func FromHex(s string) []byte

FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".

func Hex2Bytes

func Hex2Bytes(str string) []byte

Hex2Bytes returns the bytes represented by the hexadecimal string str.

func OwnerToString

func OwnerToString(o *ObjectOwner) string

Types

type Address

type Address [AddressLength]byte

func BytesToAddress

func BytesToAddress(b []byte) Address

BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.

func HexToAddress

func HexToAddress(s string) Address

HexToAddress returns Address with byte values of s. If s is larger than len(h), s will be cropped from the left.

func (Address) Hex

func (a Address) Hex() string

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

func (*Address) Scan

func (a *Address) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes sets the address to the value of b. If b is larger than len(a), b will be cropped from the left.

func (Address) String

func (a Address) String() string

String implements fmt.Stringer.

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) error

func (Address) Value

func (a Address) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type Checkpoint

type Checkpoint struct {
	CheckpointSequenceNumber uint64 `json:"checkpoint_sequence_number"`
}

Checkpoint New checkpoint

type CoinBalanceChange

type CoinBalanceChange struct {
	PackageId         string       `json:"packageId"`
	TransactionModule string       `json:"transactionModule"`
	Sender            string       `json:"sender"`
	ChangeType        string       `json:"changeType"`
	Owner             *ObjectOwner `json:"owner"`
	CoinType          string       `json:"coinType"`
	CoinObjectId      string       `json:"coinObjectId"`
	Version           int64        `json:"version"`
	Amount            int64        `json:"amount"`
}

CoinBalanceChange Coin balance changing event

type CoinBalanceChangeType

type CoinBalanceChangeType string

type DeleteObject

type DeleteObject struct {
	PackageID         string `json:"packageId"`
	TransactionModule string `json:"transactionModule"`
	Sender            string `json:"sender"`
	ObjectID          string `json:"objectId"`
	Version           int64  `json:"version"`
}

DeleteObject Delete object

type Digest

type Digest []byte

type EpochChange

type EpochChange struct {
	EpochId uint64 `json:"epoch_id"`
}

EpochChange Epoch change

type Event

type Event json.RawMessage

type EventID

type EventID struct {
	TxDigest string `json:"txDigest"`
	EventSeq int64  `json:"eventSeq"`
}

type EventPage

type EventPage struct {
	Data       []json.RawMessage `json:"data"`
	NextCursor EventID           `json:"nextCursor"`
}

type EventQuery

type EventQuery struct {
	// Return all events.
	All *string `json:"All"`
	// Return events emitted by the given transaction.
	Transaction *Digest `json:"Transaction"`
	// Return events emitted in a specified Move module
	MoveModule *MoveModule `json:"MoveModule"`
	// Return events with the given move event struct name
	MoveEvent *string `json:"MoveEvent"` // e.g. `0x2::devnet_nft::MintNFTEvent`
	// MoveEvent/Publish/CoinBalanceChange/EpochChange/Checkpoint
	// TransferObject/MutateObject/DeleteObject/NewObject
	EventType *string `json:"EventType"`
	// Query by sender address.
	Sender *Address `json:"Sender"`
	// Query by recipient address
	Recipient *ObjectOwnerInternal `json:"Recipient"`
	// Return events associated with the given object
	Object *ObjectId `json:"Object"`
	// Return events emitted in [start_time, end_time] interval
	TimeRange *TimeRange `json:"TimeRange"`
}

func (EventQuery) MarshalJSON

func (q EventQuery) MarshalJSON() ([]byte, error)

type EventResult

type EventResult struct {
	Timestamp uint64                     `json:"timestamp"`
	TxDigest  string                     `json:"txDigest"`
	Id        EventID                    `json:"id"`
	Event     map[string]json.RawMessage `json:"event"`
}

type EventType

type EventType string

func EventFromSui

func EventFromSui(e string) EventType

func (EventType) Description

func (e EventType) Description() string

func (EventType) Emoji

func (e EventType) Emoji() string

type MoveEvent

type MoveEvent struct {
	PackageId         string          `json:"packageId"`
	TransactionModule string          `json:"transactionModule"`
	Sender            string          `json:"sender"`
	Type              string          `json:"type"`
	Fields            json.RawMessage `json:"fields"`
	Bcs               string          `json:"bcs"`
}

MoveEvent is a move event. Transaction level event Move-specific event

type MoveModule

type MoveModule struct {
	Package ObjectId `json:"package"`
	Module  string   `json:"module"`
}

type MutateObject

type MutateObject struct {
	PackageID         string `json:"packageId"`
	TransactionModule string `json:"transactionModule"`
	Sender            string `json:"sender"`
	ObjectType        string `json:"objectType"`
	ObjectID          string `json:"objectId"`
	Version           int64  `json:"version"`
}

MutateObject Object level event Object mutated.

type NewObject

type NewObject struct {
	PackageID         string       `json:"packageId"`
	TransactionModule string       `json:"transactionModule"`
	Sender            string       `json:"sender"`
	Recipient         *ObjectOwner `json:"recipient"`
	ObjectType        string       `json:"objectType"`
	ObjectID          string       `json:"objectId"`
	Version           int64        `json:"version"`
}

NewObject object creation

type ObjectId

type ObjectId []byte

type ObjectOwner

type ObjectOwner struct {
	*ObjectOwnerInternal
	// contains filtered or unexported fields
}

func (*ObjectOwner) MarshalJSON

func (o *ObjectOwner) MarshalJSON() ([]byte, error)

func (*ObjectOwner) Scan

func (o *ObjectOwner) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*ObjectOwner) UnmarshalJSON

func (o *ObjectOwner) UnmarshalJSON(data []byte) error

func (ObjectOwner) Value

func (o ObjectOwner) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type ObjectOwnerInternal

type ObjectOwnerInternal struct {
	AddressOwner *Address `json:"AddressOwner,omitempty"`
	ObjectOwner  *Address `json:"ObjectOwner,omitempty"`
	SingleOwner  *Address `json:"SingleOwner,omitempty"`
	Shared       *struct {
		InitialSharedVersion uint64 `json:"initial_shared_version"`
	} `json:"Shared,omitempty"`
}

type Publish

type Publish struct {
	Sender    string `json:"sender"`
	PackageID string `json:"packageId"`
	Version   int64  `json:"version"`
	Digest    string `json:"digest"`
}

Publish Module published

type StructTag

type StructTag struct {
	Address    string `json:"address"`
	Module     string `json:"module"`
	Name       string `json:"name"`
	TypeParams string `json:"type_params"`
}

type SubscribeEventQuery

type SubscribeEventQuery struct {
	//Package        *string
	//Module         *string
	//MoveEventType  *string
	//MoveEventField interface{}
	//SenderAddress  *string
	EventType EventType
}

type Subscription

type Subscription struct {
	Subscription SubscriptionID  `json:"subscription"`
	Result       json.RawMessage `json:"result"`
}

type SubscriptionID

type SubscriptionID uint64

type TimeRange

type TimeRange struct {
	StartTime uint64 `json:"startTime"` // left endpoint of time interval, milliseconds since epoch, inclusive
	EndTime   uint64 `json:"endTime"`   // right endpoint of time interval, milliseconds since epoch, exclusive
}

type TransferObject

type TransferObject struct {
	PackageID         string       `json:"packageId"`
	TransactionModule string       `json:"transactionModule"`
	Sender            string       `json:"sender"`
	Recipient         *ObjectOwner `json:"recipient"`
	ObjectType        string       `json:"objectType"`
	ObjectID          string       `json:"objectId"`
	Version           int64        `json:"version"`
}

TransferObject Object level event Transfer objects to new address / wrap in another object

Jump to

Keyboard shortcuts

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