pyth

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertPythPrice

func ConvertPythPrice(rawPrice string, exponent int) (sdkmath.Int, error)

ConvertPythPrice converts the raw price using the exponent and returns a scaled osmomath.BigInt

func CreateUpdatePriceFeedsMsg

func CreateUpdatePriceFeedsMsg(contractAddress string, senderAddress string, base64Data string, funds sdk.Coins) (*wasmdtypes.MsgExecuteContract, error)

CreateUpdatePriceFeedsMsg constructs and returns the MsgExecuteContract to execute the "updatePriceFeeds" method on the contract

Types

type APIResponse

type APIResponse struct {
	Binary BinaryData `json:"binary"`
}

APIResponse represents the structure of the JSON response from the API.

type Binary

type Binary struct {
	Encoding string   `json:"encoding"` // Encoding type (e.g., "hex", "base64")
	Data     []string `json:"data"`     // Raw binary data (as hex/base64)
}

type BinaryData

type BinaryData struct {
	Encoding string   `json:"encoding"`
	Data     []string `json:"data"`
}

BinaryData represents the "binary" field of the API response.

type Metadata

type Metadata struct {
	Slot               int64 `json:"slot"`
	ProofAvailableTime int64 `json:"proof_available_time"`
	PrevPublishTime    int64 `json:"prev_publish_time"`
}

type Parsed

type Parsed struct {
	ID       string   `json:"id"`
	Price    Price    `json:"price"`
	EmaPrice Price    `json:"ema_price"`
	Metadata Metadata `json:"metadata"`
}

type Price

type Price struct {
	Price       string `json:"price"`
	Confidence  string `json:"conf"`
	Exponent    int    `json:"expo"`
	PublishTime int64  `json:"publish_time"`
}

type PriceResponse

type PriceResponse struct {
	Binary Binary   `json:"binary"`
	Parsed []Parsed `json:"parsed"`
}

type QueryClient

type QueryClient interface {
	LatestPrice(ctx context.Context, id string) (*PriceResponse, error)
	QueryGetUpdatedFee(ctx context.Context, qc wasmdtypes.QueryClient, contractAddress string, hexData string) (sdk.Coins, error)
}

PythClient is the client API for Pyth service

func NewQueryClient

func NewQueryClient(client *http.Client) QueryClient

NewQueryClient creates a new Pyth Query Client

type UpdatePriceFeeds

type UpdatePriceFeeds struct {
	Data []string `json:"data"`
}

UpdatePriceFeeds feeds holds the payload for the update_price_feeds endpoint

type UpdatePriceFeedsMsg

type UpdatePriceFeedsMsg struct {
	UpdatePriceFeeds UpdatePriceFeeds `json:"update_price_feeds"`
}

UpdatePriceFeedsMsg is the wrapper for UpdatePriceFeeds

Jump to

Keyboard shortcuts

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