Documentation
¶
Index ¶
- Variables
- func ClaimableBalanceIdFromRevocation(liquidityPoolId xdr.PoolId, asset xdr.Asset, ...) (xdr.ClaimableBalanceId, error)
- func VerifyEvents(ledger xdr.LedgerCloseMeta, passphrase string, readFromUnifiedEvents bool) error
- type Burn
- type Clawback
- func (*Clawback) Descriptor() ([]byte, []int)deprecated
- func (x *Clawback) GetAmount() string
- func (x *Clawback) GetAsset() *asset.Asset
- func (x *Clawback) GetFrom() string
- func (*Clawback) ProtoMessage()
- func (x *Clawback) ProtoReflect() protoreflect.Message
- func (x *Clawback) Reset()
- func (x *Clawback) String() string
- type ErrNotSep41TokenEvent
- type EventError
- type EventMeta
- func (*EventMeta) Descriptor() ([]byte, []int)deprecated
- func (x *EventMeta) GetClosedAt() *timestamppb.Timestamp
- func (x *EventMeta) GetContractAddress() string
- func (x *EventMeta) GetLedgerSequence() uint32
- func (x *EventMeta) GetOperationIndex() uint32
- func (x *EventMeta) GetToMuxedInfo() *MuxedInfo
- func (x *EventMeta) GetTransactionIndex() uint32
- func (x *EventMeta) GetTxHash() string
- func (*EventMeta) ProtoMessage()
- func (x *EventMeta) ProtoReflect() protoreflect.Message
- func (x *EventMeta) Reset()
- func (x *EventMeta) String() string
- type EventsProcessor
- func (p *EventsProcessor) EventsFromLedger(lcm xdr.LedgerCloseMeta) ([]*TokenTransferEvent, error)
- func (p *EventsProcessor) EventsFromOperation(tx ingest.LedgerTransaction, opIndex uint32, op xdr.Operation, ...) ([]*TokenTransferEvent, error)
- func (p *EventsProcessor) EventsFromTransaction(tx ingest.LedgerTransaction) (TransactionEvents, error)
- type EventsProcessorOption
- type Fee
- type InvalidFeeEvent
- type Mint
- type MuxedInfo
- func (*MuxedInfo) Descriptor() ([]byte, []int)deprecated
- func (x *MuxedInfo) GetContent() isMuxedInfo_Content
- func (x *MuxedInfo) GetHash() []byte
- func (x *MuxedInfo) GetId() uint64
- func (x *MuxedInfo) GetText() string
- func (*MuxedInfo) ProtoMessage()
- func (x *MuxedInfo) ProtoReflect() protoreflect.Message
- func (x *MuxedInfo) Reset()
- func (x *MuxedInfo) String() string
- type MuxedInfo_Hash
- type MuxedInfo_Id
- type MuxedInfo_Text
- type TokenTransferEvent
- func NewBurnEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
- func NewClawbackEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
- func NewFeeEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
- func NewMintEvent(meta *EventMeta, to string, amount string, token *assetProto.Asset) *TokenTransferEvent
- func NewTransferEvent(meta *EventMeta, from, to string, amount string, token *assetProto.Asset) *TokenTransferEvent
- func (*TokenTransferEvent) Descriptor() ([]byte, []int)deprecated
- func (event *TokenTransferEvent) GetAmount() string
- func (event *TokenTransferEvent) GetAsset() *assetProto.Asset
- func (x *TokenTransferEvent) GetBurn() *Burn
- func (x *TokenTransferEvent) GetClawback() *Clawback
- func (x *TokenTransferEvent) GetEvent() isTokenTransferEvent_Event
- func (event *TokenTransferEvent) GetEventType() string
- func (x *TokenTransferEvent) GetFee() *Fee
- func (x *TokenTransferEvent) GetMeta() *EventMeta
- func (x *TokenTransferEvent) GetMint() *Mint
- func (x *TokenTransferEvent) GetTransfer() *Transfer
- func (*TokenTransferEvent) ProtoMessage()
- func (x *TokenTransferEvent) ProtoReflect() protoreflect.Message
- func (x *TokenTransferEvent) Reset()
- func (event *TokenTransferEvent) SetAsset(asset xdr.Asset)
- func (x *TokenTransferEvent) String() string
- type TokenTransferEvent_Burn
- type TokenTransferEvent_Clawback
- type TokenTransferEvent_Fee
- type TokenTransferEvent_Mint
- type TokenTransferEvent_Transfer
- type TransactionEvents
- type Transfer
- func (*Transfer) Descriptor() ([]byte, []int)deprecated
- func (x *Transfer) GetAmount() string
- func (x *Transfer) GetAsset() *asset.Asset
- func (x *Transfer) GetFrom() string
- func (x *Transfer) GetTo() string
- func (*Transfer) ProtoMessage()
- func (x *Transfer) ProtoReflect() protoreflect.Message
- func (x *Transfer) Reset()
- func (x *Transfer) String() string
Constants ¶
This section is empty.
Variables ¶
var ( TransferEvent = "transfer" MintEvent = "mint" BurnEvent = "burn" ClawbackEvent = "clawback" FeeEvent = "fee" )
var ( ErrNoLiquidityPoolEntryFound = errors.New("no liquidity pool entry found in operation changes") ErrNoClaimableBalanceEntryFound = errors.New("no claimable balance entry found in operation changes") )
var File_processors_token_transfer_token_transfer_event_proto protoreflect.FileDescriptor
Functions ¶
func ClaimableBalanceIdFromRevocation ¶
func ClaimableBalanceIdFromRevocation(liquidityPoolId xdr.PoolId, asset xdr.Asset, accountSequence xdr.SequenceNumber, accountId xdr.AccountId, opIndex uint32) (xdr.ClaimableBalanceId, error)
Helper function to convert LiquidityPoolId to generate ClaimableBalanceIds in a deterministic way as per https://github.com/stellar/stellar-protocol/blob/master/core/cap-0038.md#settrustlineflagsop-and-allowtrustop Whenever a trustline is revoked for an asset for an account, via setTrustlineFalgs or allowTrust operations, if that account has deposited into a Liquidity Pool, then, claimable balances are created for those assets from the LP
The generated ClaimableBalanceId is derived from: - Liquidity Pool Id from which the pool shares are withdrawn - The asset for which CB is created - the accountSequence number of the transaction account - The transaction accountId - The operationIndex of the setTrustlineFlags or allowTrust operation within the transaction
func VerifyEvents ¶
func VerifyEvents(ledger xdr.LedgerCloseMeta, passphrase string, readFromUnifiedEvents bool) error
Types ¶
type Burn ¶
type Burn struct {
From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
Asset *asset.Asset `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset,omitempty"` // Asset can be native or issued. For custom tokens, it will be absent
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
// contains filtered or unexported fields
}
func (*Burn) Descriptor
deprecated
func (*Burn) ProtoMessage ¶
func (*Burn) ProtoMessage()
func (*Burn) ProtoReflect ¶
func (x *Burn) ProtoReflect() protoreflect.Message
type Clawback ¶
type Clawback struct {
From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
Asset *asset.Asset `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset,omitempty"` // Asset can be native or issued. For custom tokens, it will be absent
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
// contains filtered or unexported fields
}
func (*Clawback) Descriptor
deprecated
func (*Clawback) ProtoMessage ¶
func (*Clawback) ProtoMessage()
func (*Clawback) ProtoReflect ¶
func (x *Clawback) ProtoReflect() protoreflect.Message
type ErrNotSep41TokenEvent ¶
type ErrNotSep41TokenEvent struct {
Message string
}
func (ErrNotSep41TokenEvent) Error ¶
func (e ErrNotSep41TokenEvent) Error() string
type EventError ¶
type EventError struct {
Message string
}
func NewEventError ¶
func NewEventError(message string) *EventError
func (*EventError) Error ¶
func (e *EventError) Error() string
type EventMeta ¶
type EventMeta struct {
LedgerSequence uint32 `protobuf:"varint,1,opt,name=ledger_sequence,json=ledgerSequence,proto3" json:"ledger_sequence,omitempty"`
ClosedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=closed_at,json=closedAt,proto3" json:"closed_at,omitempty"`
TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
// Index of transaction within this ledger. This is 1-indexed as per SEP-35
TransactionIndex uint32 `protobuf:"varint,4,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"`
// Index of operation within the transaction, if it is not a fee event. This is 1-indexed as per SEP-35
OperationIndex *uint32 `protobuf:"varint,5,opt,name=operation_index,json=operationIndex,proto3,oneof" json:"operation_index,omitempty"`
// For a classic operation, this contract_address is the ContractID as derived from asset
// For a smart contract event, this contractId is the id of the contract emiting the core event
ContractAddress string `protobuf:"bytes,6,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`
// The to_muxed_info follows the spec outlined in section in CAP-67 - https://github.com/stellar/stellar-protocol/blob/master/core/cap-0067.md#multiplexing-support
ToMuxedInfo *MuxedInfo `protobuf:"bytes,7,opt,name=to_muxed_info,json=toMuxedInfo,proto3" json:"to_muxed_info,omitempty"`
// contains filtered or unexported fields
}
EventMeta message
func NewEventMetaFromTx ¶
func NewEventMetaFromTx(tx ingest.LedgerTransaction, operationIndex *uint32, contractAddress string) *EventMeta
func (*EventMeta) Descriptor
deprecated
func (*EventMeta) GetClosedAt ¶
func (x *EventMeta) GetClosedAt() *timestamppb.Timestamp
func (*EventMeta) GetContractAddress ¶
func (*EventMeta) GetLedgerSequence ¶
func (*EventMeta) GetOperationIndex ¶
func (*EventMeta) GetToMuxedInfo ¶
func (*EventMeta) GetTransactionIndex ¶
func (*EventMeta) ProtoMessage ¶
func (*EventMeta) ProtoMessage()
func (*EventMeta) ProtoReflect ¶
func (x *EventMeta) ProtoReflect() protoreflect.Message
type EventsProcessor ¶
type EventsProcessor struct {
// contains filtered or unexported fields
}
func NewEventsProcessor ¶
func NewEventsProcessor(networkPassphrase string, options ...EventsProcessorOption) *EventsProcessor
func NewEventsProcessorForUnifiedEvents ¶
func NewEventsProcessorForUnifiedEvents(passphrase string) *EventsProcessor
Use this constructor if you know that the ledgers you pass to EventsFromLedger() have unified events
func (*EventsProcessor) EventsFromLedger ¶
func (p *EventsProcessor) EventsFromLedger(lcm xdr.LedgerCloseMeta) ([]*TokenTransferEvent, error)
EventsFromLedger processes token transfer events for all transactions in a given ledger. This function operates at the ledger level, iterating over all transactions in the ledger. it calls EventsFromTransaction to process token transfer events from each transaction within the ledger.
func (*EventsProcessor) EventsFromOperation ¶
func (p *EventsProcessor) EventsFromOperation(tx ingest.LedgerTransaction, opIndex uint32, op xdr.Operation, opResult xdr.OperationResult) ([]*TokenTransferEvent, error)
EventsFromOperation processes token transfer events for a given operation within a transaction. It operates at the operation level, analyzing the operation type and generating corresponding token transfer events. If the operation is successful, it processes the event based on the operation type (e.g., payment, account creation, etc.). It handles various operation types like payments, account merges, trust line modifications, and more. There is a separate private function to derive events for each classic operation. It is implicitly assumed that the operation is successful, and thus will contribute towards generating events. which is why we don't check for the success code in the OperationResult
func (*EventsProcessor) EventsFromTransaction ¶
func (p *EventsProcessor) EventsFromTransaction(tx ingest.LedgerTransaction) (TransactionEvents, error)
EventsFromTransaction processes token transfer events for all operations within a given transaction.
First, it generates a FeeEvent for the transaction If the transaction was successful, it processes all operations in the transaction by calling EventsFromOperation for each operation in the transaction.
If the transaction is unsuccessful, it only generates events for transaction fees.
type EventsProcessorOption ¶
type EventsProcessorOption func(*EventsProcessor)
func WithUnifiedEventsStreamEnabled ¶
func WithUnifiedEventsStreamEnabled() EventsProcessorOption
type Fee ¶
type Fee struct {
From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
Asset *asset.Asset `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset,omitempty"` // Asset can be native or issued. For custom tokens, it will be absent
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
// contains filtered or unexported fields
}
func (*Fee) Descriptor
deprecated
func (*Fee) ProtoMessage ¶
func (*Fee) ProtoMessage()
func (*Fee) ProtoReflect ¶
func (x *Fee) ProtoReflect() protoreflect.Message
type InvalidFeeEvent ¶
type InvalidFeeEvent struct {
Message string
}
func (InvalidFeeEvent) Error ¶
func (e InvalidFeeEvent) Error() string
type Mint ¶
type Mint struct {
To string `protobuf:"bytes,1,opt,name=to,proto3" json:"to,omitempty"`
Asset *asset.Asset `protobuf:"bytes,2,opt,name=asset,proto3" json:"asset,omitempty"` // Asset can be native or issued. For custom tokens, it will be absent
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
// contains filtered or unexported fields
}
func (*Mint) Descriptor
deprecated
func (*Mint) ProtoMessage ¶
func (*Mint) ProtoMessage()
func (*Mint) ProtoReflect ¶
func (x *Mint) ProtoReflect() protoreflect.Message
type MuxedInfo ¶
type MuxedInfo struct {
// Types that are valid to be assigned to Content:
//
// *MuxedInfo_Text
// *MuxedInfo_Id
// *MuxedInfo_Hash
Content isMuxedInfo_Content `protobuf_oneof:"content"`
// contains filtered or unexported fields
}
func NewMuxedInfoFromId ¶
func NewMuxedInfoFromMemo ¶
func NewMuxedInfoFromText ¶
func (*MuxedInfo) Descriptor
deprecated
func (*MuxedInfo) GetContent ¶
func (x *MuxedInfo) GetContent() isMuxedInfo_Content
func (*MuxedInfo) ProtoMessage ¶
func (*MuxedInfo) ProtoMessage()
func (*MuxedInfo) ProtoReflect ¶
func (x *MuxedInfo) ProtoReflect() protoreflect.Message
type MuxedInfo_Hash ¶
type MuxedInfo_Hash struct {
Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3,oneof"`
}
type MuxedInfo_Id ¶
type MuxedInfo_Id struct {
Id uint64 `protobuf:"varint,2,opt,name=id,proto3,oneof"`
}
type MuxedInfo_Text ¶
type MuxedInfo_Text struct {
Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"`
}
type TokenTransferEvent ¶
type TokenTransferEvent struct {
Meta *EventMeta `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"`
// Types that are valid to be assigned to Event:
//
// *TokenTransferEvent_Transfer
// *TokenTransferEvent_Mint
// *TokenTransferEvent_Burn
// *TokenTransferEvent_Clawback
// *TokenTransferEvent_Fee
Event isTokenTransferEvent_Event `protobuf_oneof:"event"`
// contains filtered or unexported fields
}
func NewBurnEvent ¶
func NewBurnEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
func NewClawbackEvent ¶
func NewClawbackEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
func NewFeeEvent ¶
func NewFeeEvent(meta *EventMeta, from string, amount string, token *assetProto.Asset) *TokenTransferEvent
func NewMintEvent ¶
func NewMintEvent(meta *EventMeta, to string, amount string, token *assetProto.Asset) *TokenTransferEvent
func NewTransferEvent ¶
func NewTransferEvent(meta *EventMeta, from, to string, amount string, token *assetProto.Asset) *TokenTransferEvent
func (*TokenTransferEvent) Descriptor
deprecated
func (*TokenTransferEvent) Descriptor() ([]byte, []int)
Deprecated: Use TokenTransferEvent.ProtoReflect.Descriptor instead.
func (*TokenTransferEvent) GetAmount ¶
func (event *TokenTransferEvent) GetAmount() string
func (*TokenTransferEvent) GetAsset ¶
func (event *TokenTransferEvent) GetAsset() *assetProto.Asset
func (*TokenTransferEvent) GetBurn ¶
func (x *TokenTransferEvent) GetBurn() *Burn
func (*TokenTransferEvent) GetClawback ¶
func (x *TokenTransferEvent) GetClawback() *Clawback
func (*TokenTransferEvent) GetEvent ¶
func (x *TokenTransferEvent) GetEvent() isTokenTransferEvent_Event
func (*TokenTransferEvent) GetEventType ¶
func (event *TokenTransferEvent) GetEventType() string
func (*TokenTransferEvent) GetFee ¶
func (x *TokenTransferEvent) GetFee() *Fee
func (*TokenTransferEvent) GetMeta ¶
func (x *TokenTransferEvent) GetMeta() *EventMeta
func (*TokenTransferEvent) GetMint ¶
func (x *TokenTransferEvent) GetMint() *Mint
func (*TokenTransferEvent) GetTransfer ¶
func (x *TokenTransferEvent) GetTransfer() *Transfer
func (*TokenTransferEvent) ProtoMessage ¶
func (*TokenTransferEvent) ProtoMessage()
func (*TokenTransferEvent) ProtoReflect ¶
func (x *TokenTransferEvent) ProtoReflect() protoreflect.Message
func (*TokenTransferEvent) Reset ¶
func (x *TokenTransferEvent) Reset()
func (*TokenTransferEvent) SetAsset ¶
func (event *TokenTransferEvent) SetAsset(asset xdr.Asset)
func (*TokenTransferEvent) String ¶
func (x *TokenTransferEvent) String() string
type TokenTransferEvent_Burn ¶
type TokenTransferEvent_Burn struct {
Burn *Burn `protobuf:"bytes,4,opt,name=burn,proto3,oneof"`
}
type TokenTransferEvent_Clawback ¶
type TokenTransferEvent_Clawback struct {
Clawback *Clawback `protobuf:"bytes,5,opt,name=clawback,proto3,oneof"`
}
type TokenTransferEvent_Fee ¶
type TokenTransferEvent_Fee struct {
Fee *Fee `protobuf:"bytes,6,opt,name=fee,proto3,oneof"`
}
type TokenTransferEvent_Mint ¶
type TokenTransferEvent_Mint struct {
Mint *Mint `protobuf:"bytes,3,opt,name=mint,proto3,oneof"`
}
type TokenTransferEvent_Transfer ¶
type TokenTransferEvent_Transfer struct {
Transfer *Transfer `protobuf:"bytes,2,opt,name=transfer,proto3,oneof"`
}
type TransactionEvents ¶
type TransactionEvents struct {
FeeEvents []*TokenTransferEvent
OperationEvents []*TokenTransferEvent
}
type Transfer ¶
type Transfer struct {
From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
Asset *asset.Asset `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"` // Asset can be native or issued. For custom tokens, it will be absent
Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"`
// contains filtered or unexported fields
}
func (*Transfer) Descriptor
deprecated
func (*Transfer) ProtoMessage ¶
func (*Transfer) ProtoMessage()
func (*Transfer) ProtoReflect ¶
func (x *Transfer) ProtoReflect() protoreflect.Message