Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) BroadcastTx(tx stypes.TxOutItem, txBytes []byte) (string, error)
- func (c *Client) ConfirmationCountReady(txIn stypes.TxIn) bool
- func (c *Client) GetAccount(pkey common.PubKey, height *big.Int) (common.Account, error)
- func (c *Client) GetAccountByAddress(address string, height *big.Int) (common.Account, error)
- func (c *Client) GetAddress(poolPubKey common.PubKey) string
- func (c *Client) GetBlockScannerHeight() (int64, error)
- func (c *Client) GetChain() common.Chain
- func (c *Client) GetConfig() config.BifrostChainConfiguration
- func (c *Client) GetConfirmationCount(txIn stypes.TxIn) int64
- func (c *Client) GetHeight() (int64, error)
- func (c *Client) GetLatestTxForVault(vault string) (string, string, error)
- func (c *Client) IsBlockScannerHealthy() bool
- func (c *Client) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)
- func (c *Client) ReportSolvency(blockHeight int64) error
- func (c *Client) RollbackBlockScanner() error
- func (c *Client) ShouldReportSolvency(height int64) bool
- func (c *Client) SignTx(tx stypes.TxOutItem, thorchainHeight int64) (signedTx, checkpoint []byte, _ *stypes.TxInItem, err error)
- func (c *Client) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, ...)
- func (c *Client) Stop()
- type LedgerResponseWithTxHashes
- type SolvencyReporter
- type XrpAssetMapping
- type XrpBlockScanner
- type XrpMetaDataStore
- type XrpMetadata
Constants ¶
const ( // FeeUpdatePeriodBlocks is the block interval at which we report fee changes. FeeUpdatePeriodBlocks = 20 // FeeCacheTransactions is the number of transactions over which we compute an average // (mean) fee price to use for outbound transactions. Note that only transactions // using the chain fee asset will be considered. FeeCacheTransactions = 200 )
Variables ¶
var ( ErrInvalidScanStorage = errors.New("scan storage is empty or nil") ErrInvalidMetrics = errors.New("metrics is empty or nil") ErrEmptyTx = errors.New("empty tx") )
var XrpAssetMappings = []XrpAssetMapping{ { XrpKind: txtypes.XRP, XrpCurrency: "", XrpIssuer: "", XrpDecimals: 6, THORChainAsset: common.XRPAsset, }, }
XrpAssetMappings maps an xrp denom to a THORChain symbol and provides the asset decimals CHANGEME: define assets that should be observed by THORChain here. This also acts a whitelist.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a structure to sign and broadcast tx to XRP chain used by signer mostly
func NewClient ¶
func NewClient( thorKeys *thorclient.Keys, cfg config.BifrostChainConfiguration, server *tssp.TssServer, thorchainBridge thorclient.ThorchainBridge, m *metrics.Metrics, ) (*Client, error)
NewClient creates a new instance of an XRP-based chain client
func (*Client) BroadcastTx ¶
BroadcastTx is to broadcast the tx to cosmos chain
func (*Client) ConfirmationCountReady ¶
ConfirmationCountReady xrp chain has almost instant finality, so doesn't need to wait for confirmation
func (*Client) GetAccount ¶
func (*Client) GetAccountByAddress ¶
func (*Client) GetAddress ¶
GetAddress return current signer address, it will be bech32 encoded address
func (*Client) GetBlockScannerHeight ¶
GetBlockScannerHeight returns blockscanner height
func (*Client) GetConfig ¶
func (c *Client) GetConfig() config.BifrostChainConfiguration
GetConfig return the configuration used by Xrp chain client
func (*Client) GetConfirmationCount ¶
GetConfirmationCount determine how many confirmations are required NOTE: Xrp chains are instant finality, so confirmations are not needed. If the transaction was successful, we know it is included in a block and thus immutable.
func (*Client) GetLatestTxForVault ¶
func (*Client) IsBlockScannerHealthy ¶
func (*Client) OnObservedTxIn ¶
OnObservedTxIn update the signer cache (in case we haven't already)
func (*Client) ReportSolvency ¶
func (*Client) RollbackBlockScanner ¶ added in v3.6.1
RollbackBlockScanner rolls back the block scanner to the last observed block
func (*Client) ShouldReportSolvency ¶
func (*Client) SignTx ¶
func (c *Client) SignTx(tx stypes.TxOutItem, thorchainHeight int64) (signedTx, checkpoint []byte, _ *stypes.TxInItem, err error)
SignTx sign the the given TxArrayItem
type LedgerResponseWithTxHashes ¶
type LedgerResponseWithTxHashes struct { Ledger struct { Transactions []string `json:"transactions,omitempty"` } `json:"ledger"` LedgerHash string `json:"ledger_hash"` LedgerIndex xrplcommon.LedgerIndex `json:"ledger_index"` Validated bool `json:"validated,omitempty"` }
The expected response from the ledger method.
type SolvencyReporter ¶
SolvencyReporter is to report solvency info to THORNode
type XrpAssetMapping ¶
type XrpAssetMapping struct { XrpKind txtypes.CurrencyKind XrpCurrency string XrpIssuer string XrpDecimals int64 THORChainAsset common.Asset }
func GetAssetByThorchainAsset ¶
func GetAssetByThorchainAsset(asset common.Asset) (XrpAssetMapping, bool)
func GetAssetByXrpCurrency ¶
func GetAssetByXrpCurrency(coin txtypes.CurrencyAmount) (XrpAssetMapping, bool)
type XrpBlockScanner ¶
type XrpBlockScanner struct {
// contains filtered or unexported fields
}
XrpBlockScanner is to scan the blocks
func NewXrpBlockScanner ¶
func NewXrpBlockScanner(rpcHost string, cfg config.BifrostBlockScannerConfiguration, scanStorage blockscanner.ScannerStorage, bridge thorclient.ThorchainBridge, m *metrics.Metrics, solvencyReporter SolvencyReporter, ) (*XrpBlockScanner, error)
NewXrpBlockScanner create a new instance of BlockScan
func (*XrpBlockScanner) FetchMemPool ¶
func (c *XrpBlockScanner) FetchMemPool(height int64) (types.TxIn, error)
FetchMemPool returns nothing since we are only concerned about finalized transactions in Xrp
func (*XrpBlockScanner) FetchTxs ¶
func (c *XrpBlockScanner) FetchTxs(height, chainHeight int64) (types.TxIn, error)
func (*XrpBlockScanner) GetHeight ¶
func (c *XrpBlockScanner) GetHeight() (int64, error)
GetHeight returns the index of the most recently validated ledger.
func (*XrpBlockScanner) GetNetworkFee ¶
func (c *XrpBlockScanner) GetNetworkFee() (transactionSize, transactionFeeRate uint64)
GetNetworkFee returns current chain network fee according to Bifrost.
type XrpMetaDataStore ¶
type XrpMetaDataStore struct {
// contains filtered or unexported fields
}
func NewXrpMetaDataStore ¶
func NewXrpMetaDataStore() *XrpMetaDataStore
func (*XrpMetaDataStore) Get ¶
func (b *XrpMetaDataStore) Get(pk common.PubKey) XrpMetadata
func (*XrpMetaDataStore) SeqInc ¶
func (b *XrpMetaDataStore) SeqInc(pk common.PubKey)
func (*XrpMetaDataStore) Set ¶
func (b *XrpMetaDataStore) Set(pk common.PubKey, meta XrpMetadata)