models

package
v0.0.0-...-9dc1272 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DROPS_IN_XRP = 1000000
View Source
const GENESIS_LEDGER uint32 = 0

XRPL Genesis ledger is 32570 - https://xrpscan.com/ledger/32570

View Source
const LEDGER_STREAM_TYPE string = "ledgerClosed"

LedgerStream type is constant 'ledgerClosed' - https://xrpl.org/subscribe.html#ledger-stream

View Source
const XRP = "XRP"

Variables

A slice of all known Amount-like fields in XRPL transaction.

A slice of all known Date fields in XRPL transaction

View Source
var HexFields = []HexField{
	Domain,
	Data,
	URI,
	Provider,
	AssetClass,
}

Slice of all known hex fields in XRPL transaction

Functions

This section is empty.

Types

type AmountField

type AmountField int8

Amount-like fields

const (
	Amount AmountField = iota
	DeliverMax
	DeliveredAmount
	Delivered_Amount
	DeliverMin
	SendMax
	LimitAmount
	TakerGets
	TakerPays
	Currency_
	NFTokenBrokerFee
	Amount2
	Asset
	Asset2
	BidMin
	BidMax
	EPrice
	LPTokenIn
	LPTokenOut
)

func (AmountField) String

func (af AmountField) String() string

Converts AmountField to its string representation

type AuthAccount

type AuthAccount struct {
	Account string `json:"Account,omitempty"`
}

type AuthAccounts

type AuthAccounts struct {
	AuthAccount AuthAccount `json:"AuthAccount,omitempty"`
}

type Currency

type Currency struct {
	Currency string `json:"currency,omitempty"`
	Issuer   string `json:"issuer,omitempty"`
	Value    int64  `json:"value,omitempty"`
	Native   bool   `json:"native,omitempty"`
}

type DateField

type DateField int8

Fields with Date

const (
	Date DateField = iota
	Expiration
	CancelAfter
	FinishAfter
	LastUpdateTime
)

func (DateField) String

func (df DateField) String() string

Convert Date field to its string representation as present in tx object

type HexField

type HexField int8

Fields with hex encoded data

const (
	Domain HexField = iota
	Data
	URI
	Provider
	AssetClass
)

func (HexField) String

func (hf HexField) String() string

Convert HexField to its string representation

type Ledger

type Ledger struct {
	Hash                string               `json:"hash,omitempty"`
	LedgerHash          string               `json:"ledger_hash,omitempty"`
	CloseTimeHuman      string               `json:"close_time_human,omitempty"`
	TransactionHash     string               `json:"transaction_hash,omitempty"`
	AccountHash         string               `json:"account_hash,omitempty"`
	ParentHash          string               `json:"parent_hash,omitempty"`
	Transactions        []models.Transaction `json:"transactions,omitempty"`
	Total_Coins         int64                `json:"totalCoins,omitempty"`
	TotalCoins          int64                `json:"total_coins,omitempty"`
	CloseFlags          uint32               `json:"close_flags,omitempty"`
	ParentCloseTime     uint32               `json:"parent_close_time,omitempty"`
	CloseTimeResolution uint32               `json:"close_time_resolution,omitempty"`
	SeqNum              uint32               `json:"seq_num,omitempty"`
	LedgerIndex         uint32               `json:"ledger_index,omitempty"`
	CloseTime           uint32               `json:"close_time,omitempty"`
	Closed              bool                 `json:"closed,omitempty"`
	Accepted            bool                 `json:"accepted,omitempty"`
}

Ledger struct represents output of 'ledger' websocket command Ref: https://xrpl.org/ledger.html#response-format

type LedgerStream

type LedgerStream struct {
	Type             string `json:"type,omitempty"`
	LedgerHash       string `json:"ledger_hash,omitempty"`
	ValidatedLedgers string `json:"validated_ledgers,omitempty"`
	FeeBase          uint64 `json:"fee_base,omitempty"`
	FeeRef           uint64 `json:"fee_ref,omitempty"`
	ReserveBase      uint64 `json:"reserve_base,omitempty"`
	ReserveInc       uint64 `json:"reserve_inc,omitempty"`
	LedgerIndex      uint32 `json:"ledger_index,omitempty"`
	LedgerTime       uint32 `json:"ledger_time,omitempty"`
	TxnCount         uint32 `json:"txn_count,omitempty"`
}

LedgerStream struct represents ledger object emitted by ledger stream Ref: https://xrpl.org/subscribe.html#ledger-stream

func (*LedgerStream) FetchTransactions

func (ledger *LedgerStream) FetchTransactions() (xrpl.BaseResponse, error)

Fetches all transaction for a specific ledger from XRPL server

func (*LedgerStream) Validate

func (ledger *LedgerStream) Validate() error

type Memo

type Memo struct {
	MemoData   string `json:"MemoData,omitempty"`
	MemoFormat string `json:"MemoFormat,omitempty"`
	MemoType   string `json:"MemoType,omitempty"`
}

type Memos

type Memos struct {
	Memo Memo `json:"Memo,omitempty"`
}

type Meta

type Meta struct {
	TransactionResult string   `json:"TransactionResult,omitempty"`
	DeliveredAmount   Currency `json:"DeliveredAmount,omitempty"`
	Delivered_Amount  Currency `json:"delivered_amount,omitempty"`
	TransactionIndex  uint32   `json:"TransactionIndex,omitempty"`
}

type Path

type Path struct {
	Account  string `json:"account,omitempty"`
	Currency string `json:"currency,omitempty"`
	Issuer   string `json:"issuer,omitempty"`
}

type PriceData

type PriceData struct {
	BaseAsset  string `json:"BaseAsset,omitempty"`
	QuoteAsset string `json:"QuoteAsset,omitempty"`
	AssetPrice uint64 `json:"AssetPrice,omitempty"`
	Scale      uint8  `json:"Scale,omitempty"`
}

type Signer

type Signer struct {
	Account       string `json:"Account,omitempty"`
	TxnSignature  string `json:"TxnSignature,omitempty"`
	SigningPubKey string `json:"SigningPubKey,omitempty"`
}

type SignerEntry

type SignerEntry struct {
	Account       string `json:"Account,omitempty"`
	WalletLocator string `json:"WalletLocator,omitempty"`
	SignerWeight  uint16 `json:"SignerWeight,omitempty"`
}

type Stream

type Stream int8
const (
	StreamLedger Stream = iota
	StreamTransaction
	StreamValidation
	StreamManifest
	StreamPeerStatus
	StreamConsensus
	StreamPathFind
	StreamServer
	StreamResponse
)

func (Stream) String

func (s Stream) String() string

type Transaction

type Transaction struct {
	// Transaction response fields - https://xrpl.org/tx.html#response-format
	CTID        string `json:"ctid,omitempty"`
	Date        uint32 `json:"date,omitempty"`
	Hash        string `json:"hash,omitempty"`
	LedgerIndex uint32 `json:"ledger_index,omitempty"`
	InLedger    uint32 `json:"inLedger,omitempty"`
	Validated   bool   `json:"validated,omitempty"`

	// Common fields - https://xrpl.org/transaction-common-fields.html
	Account            string   `json:"Account,omitempty"`
	TransactionType    string   `json:"TransactionType,omitempty"`
	Fee                uint64   `json:"Fee,omitempty"`
	Sequence           uint32   `json:"Sequence,omitempty"`
	AccountTxnID       string   `json:"AccountTxnID,omitempty"`
	PreviousTxnID      string   `json:"PreviousTxnID,omitempty"`
	Flags              uint32   `json:"Flags,omitempty"`
	LastLedgerSequence uint32   `json:"LastLedgerSequence,omitempty"`
	Memos              []Memos  `json:"Memos,omitempty"`
	NetworkID          uint32   `json:"NetworkID,omitempty"`
	Signers            []Signer `json:"Signers,omitempty"`
	SourceTag          uint32   `json:"SourceTag,omitempty"`
	SigningPubKey      string   `json:"SigningPubKey,omitempty"`
	TicketSequence     uint32   `json:"TicketSequence,omitempty"`
	TxnSignature       string   `json:"TxnSignature,omitempty"`

	// Metadata fields - https://xrpl.org/transaction-metadata.html
	Meta     Meta `json:"meta,omitempty"`
	MetaData Meta `json:"metaData,omitempty"`

	// AccountSet fields - https://xrpl.org/accountset.html#accountset-fields
	ClearFlag     uint32 `json:"ClearFlag,omitempty"`
	Domain        string `json:"Domain,omitempty"`
	EmailHash     string `json:"EmailHash,omitempty"`
	MessageKey    string `json:"MessageKey,omitempty"`
	NFTokenMinter string `json:"NFTokenMinter,omitempty"`
	SetFlag       uint32 `json:"SetFlag,omitempty"`
	TransferRate  uint32 `json:"TransferRate,omitempty"`
	TickSize      uint8  `json:"TickSize,omitempty"`
	WalletLocator string `json:"WalletLocator,omitempty"`
	WalletSize    uint32 `json:"WalletSize,omitempty"`

	// AMMBid fields - https://xrpl.org/docs/references/protocol/transactions/types/ammbid/
	Asset        Currency       `json:"Asset,omitempty"`
	Asset2       Currency       `json:"Asset2,omitempty"`
	BidMin       Currency       `json:"BidMin,omitempty"`
	BidMax       Currency       `json:"BidMax,omitempty"`
	AuthAccounts []AuthAccounts `json:"AuthAccounts,omitempty"`

	// AMMCreate fields - https://xrpl.org/docs/references/protocol/transactions/types/ammcreate/
	// Shared fields:
	// Amount Currency
	Amount2    Currency `json:"Amount2,omitempty"`
	TradingFee uint16   `json:"TradingFee,omitempty"`

	// AMMDeposit fields - https://xrpl.org/docs/references/protocol/transactions/types/ammdeposit/
	// Shared fields
	// Asset      Currency
	// Asset2     Currency
	// Amount     Currency
	// Amount2    Currency
	EPrice     Currency `json:"EPrice,omitempty"`
	LPTokenOut Currency `json:"LPTokenOut,omitempty"`

	// AMMWithdraw fields - https://xrpl.org/docs/references/protocol/transactions/types/ammwithdraw/
	// Shared fields
	// Asset     Currency
	// Asset2    Currency
	// Amount    Currency
	// Amount2   Currency
	// EPrice    Currency
	LPTokenIn Currency `json:"LPTokenIn,omitempty"`

	// CheckCash fields - https://xrpl.org/checkcash.html#checkcash-fields
	// Shared fields:
	// Amount     Currency
	// DeliverMin Currency
	CheckID string `json:"CheckID,omitempty"`

	// DepositPreauth fields - https://xrpl.org/depositpreauth.html#depositpreauth-fields
	Authorize   string `json:"Authorize,omitempty"`
	Unauthorize string `json:"Unauthorize,omitempty"`

	// DIDSet fields - https://xrpl.org/docs/references/protocol/transactions/types/didset/
	// Shared fields
	// URI         string
	Data        string `json:"Data,omitempty"`
	DIDDocument string `json:"DIDDocument,omitempty"`

	// EnableAmendment fields - https://xrpl.org/enableamendment.html#enableamendment-fields
	// Shared fields:
	// LedgerSequence uint32
	Amendment string `json:"Amendment,omitempty"`

	// EscrowCreate fields - https://xrpl.org/escrowcreate.html#escrowcreate-fields
	// Shared fields:
	// Amount Currency
	// Destination    string
	// DestinationTag uint32
	CancelAfter uint32 `json:"CancelAfter,omitempty"`
	FinishAfter uint32 `json:"FinishAfter,omitempty"`
	Condition   string `json:"Condition,omitempty"`

	// EscrowFinish fields - https://xrpl.org/escrowfinish.html#escrowfinish-fields
	// Shared fields:
	// Condition string
	// Owner     string
	// OfferSequence uint32
	Fulfillment string `json:"Fulfillment,omitempty"`

	// NFTokenAcceptOffer fields - https://xrpl.org/nftokenacceptoffer.html#nftokenacceptoffer-fields
	NFTokenSellOffer string   `json:"NFTokenSellOffer,omitempty"`
	NFTokenBuyOffer  string   `json:"NFTokenBuyOffer,omitempty"`
	NFTokenBrokerFee Currency `json:"NFTokenBrokerFee,omitempty"`

	// NFTokenCancelOffer fields - https://xrpl.org/nftokencanceloffer.html#nftokencanceloffer-fields
	NFTokenOffers []string `json:"NFTokenOffers,omitempty"`

	// NFTokenMint fields - https://xrpl.org/nftokenmint.html#nftokenmint-fields
	NFTokenTaxon uint32 `json:"NFTokenTaxon,omitempty"`
	Issuer       string `json:"Issuer,omitempty"`
	TransferFee  uint16 `json:"TransferFee,omitempty"`
	URI          string `json:"URI,omitempty"`

	// OfferCreate fields - https://xrpl.org/offercreate.html#offercreate-fields
	// Shared fields:
	// Expiration    uint32
	// OfferSequence uint32
	TakerGets Currency `json:"TakerGets,omitempty"`
	TakerPays Currency `json:"TakerPays,omitempty"`

	// OracleDelete fields - https://xrpl.org/docs/references/protocol/transactions/types/oracledelete
	// Shared fields:
	// Account string
	OracleDocumentID uint32 `json:"OracleDocumentID,omitempty"`

	// OracleSet fields - https://xrpl.org/docs/references/protocol/transactions/types/oracleset
	// Shared fields:
	// Account          string
	// OracleDocumentID uint32
	// URI              string
	Provider        string      `json:"Provider,omitempty"`
	LastUpdateTime  uint32      `json:"LastUpdateTime,omitempty"`
	AssetClass      string      `json:"AssetClass,omitempty"`
	PriceDataSeries []PriceData `json:"PriceDataSeries,omitempty"`

	// Payment fields - https://xrpl.org/payment.html#payment-fields
	Amount         Currency `json:"Amount,omitempty"`
	Destination    string   `json:"Destination,omitempty"`
	DestinationTag uint32   `json:"DestinationTag,omitempty"`
	InvoiceID      string   `json:"InvoiceID,omitempty"`
	Paths          []Path   `json:"Paths,omitempty"`
	SendMax        Currency `json:"SendMax,omitempty"`
	DeliverMin     Currency `json:"DeliverMin,omitempty"`
	DeliverMax     Currency `json:"DeliverMax,omitempty"`

	// PaymentChannelClaim fields - https://xrpl.org/paymentchannelclaim.html#paymentchannelclaim-fields
	// Shared fields:
	// Amount    string
	// PublicKey string
	Channel   string `json:"Channel,omitempty"`
	Balance   string `json:"Balance,omitempty"`
	Signature string `json:"Signature,omitempty"`

	// PaymentChannelCreate fields - https://xrpl.org/paymentchannelcreate.html#paymentchannelcreate-fields
	// Shared fields:
	// Amount         string
	// Destination    string
	// CancelAfter    uint32
	// DestinationTag uint32
	SettleDelay uint32 `json:"SettleDelay,omitempty"`
	PublicKey   string `json:"PublicKey,omitempty"`

	// SetFee fields - https://xrpl.org/setfee.html#setfee-fields
	// Shared fields:
	// LedgerSequence        uint32
	BaseFee               uint64 `json:"BaseFee,omitempty"`
	ReferenceFeeUnits     uint32 `json:"ReferenceFeeUnits,omitempty"`
	ReserveBase           uint32 `json:"ReserveBase,omitempty"`
	ReserveIncrement      uint32 `json:"ReserveIncrement,omitempty"`
	BaseFeeDrops          string `json:"BaseFeeDrops,omitempty"`
	ReserveBaseDrops      string `json:"ReserveBaseDrops,omitempty"`
	ReserveIncrementDrops string `json:"ReserveIncrementDrops,omitempty"`

	// SetRegularKey fields - https://xrpl.org/setregularkey.html#setregularkey-fields
	RegularKey string `json:"RegularKey,omitempty"`

	// SignerListSet fields - https://xrpl.org/signerlistset.html#signerlistset-fields
	SignerQuorum  uint32        `json:"SignerQuorum,omitempty"`
	SignerEntries []SignerEntry `json:"SignerEntries,omitempty"`

	// TicketCreate fields - https://xrpl.org/ticketcreate.html#ticketcreate-fields
	TicketCount uint32 `json:"TicketCount,omitempty"`

	// TrustSet fields - https://xrpl.org/trustset.html#trustset-fields
	LimitAmount Currency `json:"LimitAmount,omitempty"`
	QualityIn   uint32   `json:"QualityIn,omitempty"`
	QualityOut  uint32   `json:"QualityOut,omitempty"`

	// UNLModify fields - https://xrpl.org/unlmodify.html#unlmodify-fields
	// Shared fields:
	// LedgerSequence uint32
	UNLModifyDisabling uint8  `json:"UNLModifyDisabling,omitempty"`
	UNLModifyValidator string `json:"UNLModifyValidator,omitempty"`

	// Xahau Burn2Mint fields
	OperationLimit string `json:"OperationLimit,omitempty"`

	// Shared fields
	Owner          string `json:"Owner,omitempty"`
	LedgerSequence uint32 `json:"LedgerSequence,omitempty"`
	NFTokenID      string `json:"NFTokenID,omitempty"`
	Expiration     uint32 `json:"Expiration,omitempty"`
	OfferSequence  uint32 `json:"OfferSequence,omitempty"`
}

Jump to

Keyboard shortcuts

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