Documentation
¶
Index ¶
- Constants
- func ProcessSwapEvent(events []abcitypes.Event, expectedSender, denom string) (string, error)
- type AxelarTransfer
- type BalancesRequest
- type BalancesResponse
- type ChainRequest
- type ChainResponse
- type Client
- type CosmosMessage
- type CosmosTx
- type DenomDetail
- type ERC20Approval
- type EVMTx
- type Error
- type GenericTransfer
- type IBCTransfer
- type MsgsRequest
- type MsgsResponse
- type PacketTxs
- type PricePoint
- type RouteRequest
- type RouteResponse
- type SendTokenTxs
- type SmartSwapOptions
- type StatusResponse
- type StatusTrackingTx
- type SubmitRequest
- type SubmitResponse
- type TrackRequest
- type TrackResponse
- type TransactionState
- type Transfer
- type TransferAssetRelease
- type TransferSequence
- type Tx
- type TxHash
Constants ¶
const (
// MaxPositionAmount6dp represents maximum allowed position value in USDC (10M)
MaxPositionAmount6dp = 10_000_000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AxelarTransfer ¶
type AxelarTransfer struct {
FromChainID string `json:"from_chain_id"`
ToChainID string `json:"to_chain_id"`
Type string `json:"type"`
State string `json:"state"`
Txs SendTokenTxs `json:"txs"`
AxelarScanLink string `json:"axelar_scan_link"`
}
AxelarTransfer represents an Axelar transfer.
type BalancesRequest ¶
type BalancesRequest struct {
Chains map[string]ChainRequest `json:"chains"`
}
BalancesRequest represents a request for balances.
type BalancesResponse ¶
type BalancesResponse struct {
Chains map[string]ChainResponse `json:"chains"`
}
BalancesResponse represents the response for a balance request.
type ChainRequest ¶
ChainRequest represents a single chain's balance request.
type ChainResponse ¶
type ChainResponse struct {
Address string `json:"address"`
Denoms map[string]DenomDetail `json:"denoms"`
}
ChainResponse represents a single chain's balance response.
type Client ¶
type Client interface {
Balance(ctx context.Context, request *BalancesRequest) (*BalancesResponse, error)
Route(ctx context.Context, sourceAssetDenom, sourceAssetChainID, destAssetDenom, destAssetChainID string, amountIn *big.Int) (*RouteResponse, error)
SwapRoute(ctx context.Context, tokenIn, tokenOut, chainID string, amountIn *big.Int) (*RouteResponse, error)
FindOptimalSwapRoute(
ctx context.Context, logger *zap.Logger, tokenIn, tokenOut, chainID string, amountIn *big.Int, maxPriceImpact float64,
) (*big.Int, *RouteResponse, error)
Msgs(ctx context.Context, route RouteResponse, addressList []string, slippage string) ([]Tx, error)
SubmitTx(ctx context.Context, tx []byte, chainID string) (TxHash, error)
TrackTx(ctx context.Context, txHash, chainID string) (TxHash, error)
Status(ctx context.Context, tx TxHash, chainID string) (*StatusResponse, error)
}
SkipGoClient defines the interface for SkipGo operations.
type CosmosMessage ¶
CosmosMessage represents a Cosmos SDK message.
type CosmosTx ¶
type CosmosTx struct {
ChainID string `json:"chain_id"`
Path []string `json:"path"`
SignerAddress string `json:"signer_address"`
Msgs []CosmosMessage `json:"msgs"`
}
CosmosTx represents a Cosmos SDK transaction.
type DenomDetail ¶
type DenomDetail struct {
Amount string `json:"amount"`
Decimals uint8 `json:"decimals"`
FormattedAmount string `json:"formatted_amount"`
Price string `json:"price"`
ValueUSD string `json:"value_usd"`
}
DenomDetail provides details about a specific denomination.
type ERC20Approval ¶
type ERC20Approval struct {
TokenContract string `json:"token_contract"`
Spender string `json:"spender"`
Amount string `json:"amount"`
}
ERC20Approval represents an ERC20 token approval.
type EVMTx ¶
type EVMTx struct {
ChainID string `json:"chain_id"`
To string `json:"to"`
Value string `json:"value"`
Data string `json:"data"`
SignerAddress string `json:"signer_address"`
RequiredERC20Approvals []ERC20Approval `json:"required_erc20_approvals"`
}
EVMTx represents an Ethereum transaction.
type Error ¶
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
Details any `json:"details"`
}
SkipGoError represents an error response from SkipGo.
type GenericTransfer ¶
type GenericTransfer struct {
ToChain string `json:"to_chain"`
FromChain string `json:"from_chain"`
State string `json:"state"`
SendTx StatusTrackingTx `json:"send_tx"`
ReceiveTx StatusTrackingTx `json:"receive_tx"`
}
GenericTransfer represents a generic transfer.
type IBCTransfer ¶
type IBCTransfer struct {
FromChainID string `json:"from_chain_id"`
ToChainID string `json:"to_chain_id"`
State string `json:"state"`
PacketTxs PacketTxs `json:"packet_txs"`
}
IBCTransfer represents an IBC transfer.
type MsgsRequest ¶
type MsgsRequest struct {
SourceAssetDenom string `json:"source_asset_denom"`
SourceAssetChainID string `json:"source_asset_chain_id"`
DestAssetDenom string `json:"dest_asset_denom"`
DestAssetChainID string `json:"dest_asset_chain_id"`
AmountIn string `json:"amount_in"`
AmountOut string `json:"amount_out"`
SlippageTolerancePercent string `json:"slippage_tolerance_percent"`
AddressList []string `json:"address_list"`
Operations []any `json:"operations"`
}
MsgsRequest represents a request to fetch messages for a transaction.
type MsgsResponse ¶
type MsgsResponse struct {
Txs []Tx `json:"txs"`
}
MsgsResponse represents the response from a Msgs request.
type PacketTxs ¶
type PacketTxs struct {
SendTx *StatusTrackingTx `json:"send_tx"`
ReceiveTx *StatusTrackingTx `json:"receive_tx"`
AcknowledgeTx *StatusTrackingTx `json:"acknowledge_tx"`
TimeoutTx *StatusTrackingTx `json:"timeout_tx,omitempty"`
Error *string `json:"error,omitempty"`
}
PacketTxs represents the transactions involved in a packet.
type PricePoint ¶
type PricePoint struct {
Amount *big.Int
ExecutionPrice *big.Float
PriceImpact *big.Float
Route *RouteResponse
}
PricePoint represents a point on the price curve
type RouteRequest ¶
type RouteRequest struct {
SourceAssetDenom string `json:"source_asset_denom"`
SourceAssetChainID string `json:"source_asset_chain_id"`
DestAssetDenom string `json:"dest_asset_denom"`
DestAssetChainID string `json:"dest_asset_chain_id"`
AmountIn string `json:"amount_in"`
AllowMultiTx bool `json:"allow_multi_tx"`
Bridges []string `json:"bridges"`
AllowUnsafe bool `json:"allow_unsafe"`
SmartSwapOptions SmartSwapOptions `json:"smart_swap_options"`
}
RouteResponse represents the the request for a route.
type RouteResponse ¶
type RouteResponse struct {
AmountIn string `json:"amount_in"`
AmountOut string `json:"amount_out"`
SourceAssetDenom string `json:"source_asset_denom"`
SourceAssetChainID string `json:"source_asset_chain_id"`
DestAssetDenom string `json:"dest_asset_denom"`
DestAssetChainID string `json:"dest_asset_chain_id"`
Operations []any `json:"operations"`
ChainIDs []string `json:"chain_ids"`
RequiredChainAddresses []string `json:"required_chain_addresses"`
DoesSwap bool `json:"does_swap"`
EstimatedAmountOut string `json:"estimated_amount_out"`
TxsRequired int `json:"txs_required"`
USDAmountIn string `json:"usd_amount_in"`
USDAmountOut string `json:"usd_amount_out"`
SwapPriceImpactPercent string `json:"swap_price_impact_percent"`
}
RouteResponse represents the response from a route request.
type SendTokenTxs ¶
type SendTokenTxs struct {
SendTx *StatusTrackingTx `json:"send_tx"`
ConfirmTx *StatusTrackingTx `json:"confirm_tx,omitempty"`
ExecuteTx *StatusTrackingTx `json:"execute_tx"`
Error *string `json:"error,omitempty"`
}
SendTokenTxs represents the token transactions in an Axelar transfer.
type SmartSwapOptions ¶
type StatusResponse ¶
type StatusResponse struct {
Transfers []Transfer `json:"transfers"`
}
StatusResponse represents the status of a transaction.
type StatusTrackingTx ¶
type StatusTrackingTx struct {
ChainID string `json:"chain_id"`
ExplorerLink string `json:"explorer_link"`
TxHash string `json:"tx_hash"`
}
StatusTrackingTx represents a transaction being tracked.
type SubmitRequest ¶
SubmitRequest represents a request to submit a transaction.
type SubmitResponse ¶
type SubmitResponse struct {
TxHash string `json:"tx_hash"`
}
SubmitResponse represents the response after submitting a transaction.
type TrackRequest ¶
TrackRequest represents a request to track a transaction.
type TrackResponse ¶
type TrackResponse struct {
TxHash string `json:"tx_hash"`
}
TrackResponse represents the response after tracking a transaction.
type TransactionState ¶
type TransactionState string
TransactionState represents the state of a transaction.
const ( StateSubmitted TransactionState = "STATE_SUBMITTED" StatePending TransactionState = "STATE_PENDING" StateCompletedSuccess TransactionState = "STATE_COMPLETED_SUCCESS" StateCompletedError TransactionState = "STATE_COMPLETED_ERROR" StateAbandoned TransactionState = "STATE_ABANDONED" StatePendingError TransactionState = "STATE_PENDING_ERROR" )
func (TransactionState) IsCompleted ¶
func (s TransactionState) IsCompleted() bool
IsCompleted checks if the transaction is completed.
func (TransactionState) IsCompletedError ¶
func (s TransactionState) IsCompletedError() bool
IsCompletedError checks if the transaction completed with an error.
type Transfer ¶
type Transfer struct {
State TransactionState `json:"state"`
TransferSequence []TransferSequence `json:"transfer_sequence"`
NextBlockingTransfer *TransferSequence `json:"next_blocking_transfer,omitempty"`
TransferAssetRelease TransferAssetRelease `json:"transfer_asset_release,omitempty"`
Error *string `json:"error,omitempty"`
}
Transfer represents a single transfer within a transaction.
type TransferAssetRelease ¶
type TransferAssetRelease struct {
ChainID string `json:"chain_id"`
Denom string `json:"denom"`
Released bool `json:"released"`
}
TransferAssetRelease represents the release of transfer assets.
type TransferSequence ¶
type TransferSequence struct {
IBCTransfer *IBCTransfer `json:"ibc_transfer,omitempty"`
AxelarTransfer *AxelarTransfer `json:"axelar_transfer,omitempty"`
CCTPTransfer *GenericTransfer `json:"cctp_transfer,omitempty"`
HyperlaneTransfer *GenericTransfer `json:"hyperlane_transfer,omitempty"`
OpinitTransfer *GenericTransfer `json:"opinit_transfer,omitempty"`
}
TransferSequence represents the sequence of transfers.