resources

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Airdrop

type Airdrop struct {
	Key
	Attributes AirdropAttributes `json:"attributes"`
}

type AirdropAttributes

type AirdropAttributes struct {
	// Destination address for the airdrop
	Address string `json:"address"`
	// Amount of airdropped coins
	Amount string `json:"amount"`
	// RFC3339 UTC timestamp of the airdrop creation
	CreatedAt time.Time `json:"created_at"`
	// User nullifier
	Nullifier string `json:"nullifier"`
	// Status of the airdrop transaction
	Status string `json:"status"`
	// Hash of the airdrop transaction
	TxHash *string `json:"tx_hash,omitempty"`
	// RFC3339 UTC timestamp of the airdrop successful tx
	UpdatedAt time.Time `json:"updated_at"`
}

type AirdropListResponse

type AirdropListResponse struct {
	Data     []Airdrop       `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*AirdropListResponse) GetMeta

func (r *AirdropListResponse) GetMeta(out interface{}) error

func (*AirdropListResponse) PutMeta

func (r *AirdropListResponse) PutMeta(v interface{}) (err error)

type AirdropParams

type AirdropParams struct {
	Key
	Attributes AirdropParamsAttributes `json:"attributes"`
}

type AirdropParamsAttributes

type AirdropParamsAttributes struct {
	// Event identifier that is generated during ZKP query creation
	EventId string `json:"event_id"`
	// Query selector that is used for proof generation
	QuerySelector string `json:"query_selector"`
	// Unix timestamp in seconds when airdrop event starts
	StartedAt int64 `json:"started_at"`
}

type AirdropParamsListResponse

type AirdropParamsListResponse struct {
	Data     []AirdropParams `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*AirdropParamsListResponse) GetMeta

func (r *AirdropParamsListResponse) GetMeta(out interface{}) error

func (*AirdropParamsListResponse) PutMeta

func (r *AirdropParamsListResponse) PutMeta(v interface{}) (err error)

type AirdropParamsResponse

type AirdropParamsResponse struct {
	Data     AirdropParams `json:"data"`
	Included Included      `json:"included"`
}

type AirdropResponse

type AirdropResponse struct {
	Data     Airdrop  `json:"data"`
	Included Included `json:"included"`
}

type BuildPermitHash added in v0.2.0

type BuildPermitHash struct {
	Key
	Attributes BuildPermitHashAttributes `json:"attributes"`
}

type BuildPermitHashAttributes added in v0.2.0

type BuildPermitHashAttributes struct {
	// Transferred amount of tokens.
	Amount *big.Int `json:"amount"`
	// UNIX UTC timestamp in the future till which permit signature may be used.
	Deadline *big.Int `json:"deadline"`
	// EVM address FROM which tokens are transferred.
	Sender common.Address `json:"sender"`
}

type BuildPermitHashListRequest added in v0.2.0

type BuildPermitHashListRequest struct {
	Data     []BuildPermitHash `json:"data"`
	Included Included          `json:"included"`
	Links    *Links            `json:"links"`
	Meta     json.RawMessage   `json:"meta,omitempty"`
}

func (*BuildPermitHashListRequest) GetMeta added in v0.2.0

func (r *BuildPermitHashListRequest) GetMeta(out interface{}) error

func (*BuildPermitHashListRequest) PutMeta added in v0.2.0

func (r *BuildPermitHashListRequest) PutMeta(v interface{}) (err error)

type BuildPermitHashRequest added in v0.2.0

type BuildPermitHashRequest struct {
	Data     BuildPermitHash `json:"data"`
	Included Included        `json:"included"`
}

type CreateAirdrop

type CreateAirdrop struct {
	Key
	Attributes CreateAirdropAttributes `json:"attributes"`
}

type CreateAirdropAttributes

type CreateAirdropAttributes struct {
	// Destination address for the airdrop
	Address string `json:"address"`
	// ZK-proof of the passport data
	ZkProof types.ZKProof `json:"zk_proof"`
}

type CreateAirdropListRequest

type CreateAirdropListRequest struct {
	Data     []CreateAirdrop `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*CreateAirdropListRequest) GetMeta

func (r *CreateAirdropListRequest) GetMeta(out interface{}) error

func (*CreateAirdropListRequest) PutMeta

func (r *CreateAirdropListRequest) PutMeta(v interface{}) (err error)

type CreateAirdropRequest

type CreateAirdropRequest struct {
	Data     CreateAirdrop `json:"data"`
	Included Included      `json:"included"`
}

type Details

type Details json.RawMessage

func (Details) MarshalJSON

func (d Details) MarshalJSON() ([]byte, error)

MarshalJSON - casts Details to []byte

func (*Details) Scan

func (r *Details) Scan(src interface{}) error

Scan - implements db driver method for auto unmarshal

func (Details) String

func (d Details) String() string

func (*Details) UnmarshalJSON

func (d *Details) UnmarshalJSON(data []byte) error

UnmarshalJSON - casts data to Details

func (Details) Value

func (r Details) Value() (driver.Value, error)

Value - implements db driver method for auto marshal

type Estimate added in v0.2.0

type Estimate struct {
	Key
	Attributes EstimateAttributes `json:"attributes"`
}

type EstimateAttributes added in v0.2.0

type EstimateAttributes struct {
	// Amount of tokens that will be transferred to the destination.
	Amount int64 `json:"amount"`
	// Amount of tokens that will be drawn ass fee expenses.
	Fee int64 `json:"fee"`
}

type EstimateListResponse added in v0.2.0

type EstimateListResponse struct {
	Data     []Estimate      `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*EstimateListResponse) GetMeta added in v0.2.0

func (r *EstimateListResponse) GetMeta(out interface{}) error

func (*EstimateListResponse) PutMeta added in v0.2.0

func (r *EstimateListResponse) PutMeta(v interface{}) (err error)

type EstimateResponse added in v0.2.0

type EstimateResponse struct {
	Data     Estimate `json:"data"`
	Included Included `json:"included"`
}

type Flag

type Flag struct {
	Name  string `json:"name"`
	Value int32  `json:"value"`
}

type Flagger

type Flagger interface {
	IsFlag() bool
}

type Flags

type Flags struct {
	Mask   int32  `json:"mask"`
	Values []Flag `json:"flags"`
}

func FlagsFromMask

func FlagsFromMask(mask int32, allFlags map[int32]string) Flags

type Included

type Included struct {
	// contains filtered or unexported fields
}

Included - an array of Resource objects that are related to the primary data and/or each other (“included resources”).

func (*Included) Add

func (c *Included) Add(includes ...Resource)

Add - adds new include into collection. If one already present - skips it

func (Included) MarshalJSON

func (c Included) MarshalJSON() ([]byte, error)

MarshalJSON - marshals include collection as array of json objects

func (*Included) MustAirdrop

func (c *Included) MustAirdrop(key Key) *Airdrop

MustAirdrop - returns Airdrop from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustAirdropParams

func (c *Included) MustAirdropParams(key Key) *AirdropParams

MustAirdropParams - returns AirdropParams from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustBuildPermitHash added in v0.2.0

func (c *Included) MustBuildPermitHash(key Key) *BuildPermitHash

MustBuildPermitHash - returns BuildPermitHash from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustCreateAirdrop

func (c *Included) MustCreateAirdrop(key Key) *CreateAirdrop

MustCreateAirdrop - returns CreateAirdrop from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustEstimate added in v0.2.0

func (c *Included) MustEstimate(key Key) *Estimate

MustEstimate - returns Estimate from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustPermitHash added in v0.2.0

func (c *Included) MustPermitHash(key Key) *PermitHash

MustPermitHash - returns PermitHash from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustTransferErc20Token added in v0.2.0

func (c *Included) MustTransferErc20Token(key Key) *TransferErc20Token

MustTransferErc20Token - returns TransferErc20Token from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) MustTx added in v0.2.0

func (c *Included) MustTx(key Key) *Tx

MustTx - returns Tx from include collection. if entry with specified key does not exist - returns nil if entry with specified key exists but type or ID mismatches - panics

func (*Included) UnmarshalJSON

func (c *Included) UnmarshalJSON(data []byte) error

UmarshalJSON - unmarshal array of json objects into include collection

type Key

type Key struct {
	ID   string       `json:"id"`
	Type ResourceType `json:"type"`
}

func NewKeyInt64

func NewKeyInt64(id int64, resourceType ResourceType) Key

func (Key) AsRelation

func (r Key) AsRelation() *Relation

func (*Key) GetKey

func (r *Key) GetKey() Key

func (Key) GetKeyP

func (r Key) GetKeyP() *Key
type Links struct {
	First string `json:"first,omitempty"`
	Last  string `json:"last,omitempty"`
	Next  string `json:"next,omitempty"`
	Prev  string `json:"prev,omitempty"`
	Self  string `json:"self,omitempty"`
}

type PermitHash added in v0.2.0

type PermitHash struct {
	Key
	Attributes PermitHashAttributes `json:"attributes"`
}

type PermitHashAttributes added in v0.2.0

type PermitHashAttributes struct {
	// Permit message hash built by ERC-2612 standard that has to be signed by token owner.
	Hash string `json:"hash"`
}

type PermitHashListResponse added in v0.2.0

type PermitHashListResponse struct {
	Data     []PermitHash    `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*PermitHashListResponse) GetMeta added in v0.2.0

func (r *PermitHashListResponse) GetMeta(out interface{}) error

func (*PermitHashListResponse) PutMeta added in v0.2.0

func (r *PermitHashListResponse) PutMeta(v interface{}) (err error)

type PermitHashResponse added in v0.2.0

type PermitHashResponse struct {
	Data     PermitHash `json:"data"`
	Included Included   `json:"included"`
}

type Relation

type Relation struct {
	Data  *Key   `json:"data,omitempty"`
	Links *Links `json:"links,omitempty"`
}

type RelationCollection

type RelationCollection struct {
	Data  []Key  `json:"data"`
	Links *Links `json:"links,omitempty"`
}

func (RelationCollection) MarshalJSON

func (r RelationCollection) MarshalJSON() ([]byte, error)

type Resource

type Resource interface {
	//GetKey - returns key of the Resource
	GetKey() Key
}

type ResourceType

type ResourceType string
const (
	AIRDROP        ResourceType = "airdrop"
	CREATE_AIRDROP ResourceType = "create_airdrop"
	TRANSFER_ERC20 ResourceType = "transfer_erc20"
)

List of ResourceType

type TransferErc20Token added in v0.2.0

type TransferErc20Token struct {
	Key
	Attributes TransferErc20TokenAttributes `json:"attributes"`
}

type TransferErc20TokenAttributes added in v0.2.0

type TransferErc20TokenAttributes struct {
	// Transferred amount of tokens.
	Amount *big.Int `json:"amount"`
	// UNIX UTC timestamp in the future till which permit signature may be used.
	Deadline *big.Int `json:"deadline"`
	// Hex encoded permit the x coordinate of R value of the signature.
	R string `json:"r"`
	// EVM address TO which tokens are transferred.
	Receiver common.Address `json:"receiver"`
	// Hex encoded permit the x coordinate of S value of the signature.
	S string `json:"s"`
	// EVM address FROM which tokens are transferred.
	Sender common.Address `json:"sender"`
	// The parity of the y coordinate of R.
	V uint8 `json:"v"`
}

type TransferErc20TokenListRequest added in v0.2.0

type TransferErc20TokenListRequest struct {
	Data     []TransferErc20Token `json:"data"`
	Included Included             `json:"included"`
	Links    *Links               `json:"links"`
	Meta     json.RawMessage      `json:"meta,omitempty"`
}

func (*TransferErc20TokenListRequest) GetMeta added in v0.2.0

func (r *TransferErc20TokenListRequest) GetMeta(out interface{}) error

func (*TransferErc20TokenListRequest) PutMeta added in v0.2.0

func (r *TransferErc20TokenListRequest) PutMeta(v interface{}) (err error)

type TransferErc20TokenRequest added in v0.2.0

type TransferErc20TokenRequest struct {
	Data     TransferErc20Token `json:"data"`
	Included Included           `json:"included"`
}

type Tx added in v0.2.0

type Tx struct {
	Key
	Attributes TxAttributes `json:"attributes"`
}

type TxAttributes added in v0.2.0

type TxAttributes struct {
	// Amount of tokens that was transferred to the destination.
	Amount int64 `json:"amount"`
	// Amount of tokens that was drawn ass fee expenses.
	Fee int64 `json:"fee"`
	// Transfer transaction hash.
	Hash string `json:"hash"`
}

type TxListResponse added in v0.2.0

type TxListResponse struct {
	Data     []Tx            `json:"data"`
	Included Included        `json:"included"`
	Links    *Links          `json:"links"`
	Meta     json.RawMessage `json:"meta,omitempty"`
}

func (*TxListResponse) GetMeta added in v0.2.0

func (r *TxListResponse) GetMeta(out interface{}) error

func (*TxListResponse) PutMeta added in v0.2.0

func (r *TxListResponse) PutMeta(v interface{}) (err error)

type TxResponse added in v0.2.0

type TxResponse struct {
	Data     Tx       `json:"data"`
	Included Included `json:"included"`
}

Jump to

Keyboard shortcuts

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