Documentation
¶
Index ¶
- Variables
- type Asset
- type Chain
- type Error
- type ErrorCode
- type StreamParams
- func (*StreamParams) Descriptor() ([]byte, []int)deprecated
- func (x *StreamParams) GetInterval() string
- func (x *StreamParams) GetQuantity() string
- func (*StreamParams) ProtoMessage()
- func (x *StreamParams) ProtoReflect() protoreflect.Message
- func (x *StreamParams) Reset()
- func (x *StreamParams) String() string
- type SwapInput
- func (*SwapInput) Descriptor() ([]byte, []int)deprecated
- func (x *SwapInput) GetAffiliateFeeAddress() string
- func (x *SwapInput) GetAffiliateFeeRateBp() string
- func (x *SwapInput) GetExpirationTime() uint64
- func (x *SwapInput) GetExtraMemo() string
- func (x *SwapInput) GetFromAddress() string
- func (x *SwapInput) GetFromAmount() string
- func (x *SwapInput) GetFromAsset() *Asset
- func (x *SwapInput) GetRouterAddress() string
- func (x *SwapInput) GetStreamParams() *StreamParams
- func (x *SwapInput) GetToAddress() string
- func (x *SwapInput) GetToAmountLimit() string
- func (x *SwapInput) GetToAsset() *Asset
- func (x *SwapInput) GetVaultAddress() string
- func (*SwapInput) ProtoMessage()
- func (x *SwapInput) ProtoReflect() protoreflect.Message
- func (x *SwapInput) Reset()
- func (x *SwapInput) String() string
- type SwapOutput
- func (*SwapOutput) Descriptor() ([]byte, []int)deprecated
- func (x *SwapOutput) GetBinance() *binance.SigningInput
- func (x *SwapOutput) GetBitcoin() *bitcoin.SigningInput
- func (x *SwapOutput) GetCosmos() *cosmos.SigningInput
- func (x *SwapOutput) GetError() *Error
- func (x *SwapOutput) GetEthereum() *ethereum.SigningInput
- func (x *SwapOutput) GetFromChain() Chain
- func (x *SwapOutput) GetSigningInputOneof() isSwapOutput_SigningInputOneof
- func (x *SwapOutput) GetToChain() Chain
- func (*SwapOutput) ProtoMessage()
- func (x *SwapOutput) ProtoReflect() protoreflect.Message
- func (x *SwapOutput) Reset()
- func (x *SwapOutput) String() string
- type SwapOutput_Binance
- type SwapOutput_Bitcoin
- type SwapOutput_Cosmos
- type SwapOutput_Ethereum
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Chain_name = map[int32]string{ 0: "THOR", 1: "BTC", 2: "ETH", 3: "BNB", 4: "DOGE", 5: "BCH", 6: "LTC", 7: "ATOM", 8: "AVAX", 9: "BSC", } Chain_value = map[string]int32{ "THOR": 0, "BTC": 1, "ETH": 2, "BNB": 3, "DOGE": 4, "BCH": 5, "LTC": 6, "ATOM": 7, "AVAX": 8, "BSC": 9, } )
Enum value maps for Chain.
View Source
var ( ErrorCode_name = map[int32]string{ 0: "OK", 1: "Error_general", 2: "Error_Input_proto_deserialization", 13: "Error_Unsupported_from_chain", 14: "Error_Unsupported_to_chain", 15: "Error_Invalid_from_address", 16: "Error_Invalid_to_address", 21: "Error_Invalid_vault_address", 22: "Error_Invalid_router_address", } ErrorCode_value = map[string]int32{ "OK": 0, "Error_general": 1, "Error_Input_proto_deserialization": 2, "Error_Unsupported_from_chain": 13, "Error_Unsupported_to_chain": 14, "Error_Invalid_from_address": 15, "Error_Invalid_to_address": 16, "Error_Invalid_vault_address": 21, "Error_Invalid_router_address": 22, } )
Enum value maps for ErrorCode.
View Source
var File_THORChainSwap_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
// Chain ID
Chain Chain `protobuf:"varint,1,opt,name=chain,proto3,enum=TW.THORChainSwap.Proto.Chain" json:"chain,omitempty"`
// Symbol
Symbol string `protobuf:"bytes,2,opt,name=symbol,proto3" json:"symbol,omitempty"`
// The ID of the token (blockchain-specific format)
TokenId string `protobuf:"bytes,3,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty"`
// contains filtered or unexported fields
}
Represents an asset. Examples: BNB.BNB, RUNE.RUNE, BNB.RUNE-67C
func (*Asset) Descriptor
deprecated
func (*Asset) GetTokenId ¶
func (*Asset) ProtoMessage ¶
func (*Asset) ProtoMessage()
func (*Asset) ProtoReflect ¶
func (x *Asset) ProtoReflect() protoreflect.Message
type Chain ¶
type Chain int32
Supported blockchains
func (Chain) Descriptor ¶
func (Chain) Descriptor() protoreflect.EnumDescriptor
func (Chain) EnumDescriptor
deprecated
func (Chain) Number ¶
func (x Chain) Number() protoreflect.EnumNumber
func (Chain) Type ¶
func (Chain) Type() protoreflect.EnumType
type Error ¶
type Error struct {
// code of the error
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=TW.THORChainSwap.Proto.ErrorCode" json:"code,omitempty"`
// optional error message
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
// contains filtered or unexported fields
}
An error code + a free text
func (*Error) Descriptor
deprecated
func (*Error) GetMessage ¶
func (*Error) ProtoMessage ¶
func (*Error) ProtoMessage()
func (*Error) ProtoReflect ¶
func (x *Error) ProtoReflect() protoreflect.Message
type ErrorCode ¶
type ErrorCode int32
Predefined error codes
const ( // OK ErrorCode_OK ErrorCode = 0 ErrorCode_Error_general ErrorCode = 1 ErrorCode_Error_Input_proto_deserialization ErrorCode = 2 ErrorCode_Error_Unsupported_from_chain ErrorCode = 13 ErrorCode_Error_Unsupported_to_chain ErrorCode = 14 ErrorCode_Error_Invalid_from_address ErrorCode = 15 ErrorCode_Error_Invalid_to_address ErrorCode = 16 ErrorCode_Error_Invalid_vault_address ErrorCode = 21 ErrorCode_Error_Invalid_router_address ErrorCode = 22 )
func (ErrorCode) Descriptor ¶
func (ErrorCode) Descriptor() protoreflect.EnumDescriptor
func (ErrorCode) EnumDescriptor
deprecated
func (ErrorCode) Number ¶
func (x ErrorCode) Number() protoreflect.EnumNumber
func (ErrorCode) Type ¶
func (ErrorCode) Type() protoreflect.EnumType
type StreamParams ¶
type StreamParams struct {
// Optional Swap Interval ncy in blocks.
// The default is 1 - time-optimised means getting the trade done quickly, regardless of the cost.
Interval string `protobuf:"bytes,1,opt,name=interval,proto3" json:"interval,omitempty"`
// Optional Swap Quantity. Swap interval times every Interval blocks.
// The default is 0 - network will determine the number of swaps.
Quantity string `protobuf:"bytes,2,opt,name=quantity,proto3" json:"quantity,omitempty"`
// contains filtered or unexported fields
}
func (*StreamParams) Descriptor
deprecated
func (*StreamParams) Descriptor() ([]byte, []int)
Deprecated: Use StreamParams.ProtoReflect.Descriptor instead.
func (*StreamParams) GetInterval ¶
func (x *StreamParams) GetInterval() string
func (*StreamParams) GetQuantity ¶
func (x *StreamParams) GetQuantity() string
func (*StreamParams) ProtoMessage ¶
func (*StreamParams) ProtoMessage()
func (*StreamParams) ProtoReflect ¶
func (x *StreamParams) ProtoReflect() protoreflect.Message
func (*StreamParams) Reset ¶
func (x *StreamParams) Reset()
func (*StreamParams) String ¶
func (x *StreamParams) String() string
type SwapInput ¶
type SwapInput struct {
// Source chain
FromAsset *Asset `protobuf:"bytes,1,opt,name=from_asset,json=fromAsset,proto3" json:"from_asset,omitempty"`
// Source address, on source chain
FromAddress string `protobuf:"bytes,2,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"`
// Destination chain+asset, on destination chain
ToAsset *Asset `protobuf:"bytes,3,opt,name=to_asset,json=toAsset,proto3" json:"to_asset,omitempty"`
// Destination address, on destination chain
ToAddress string `protobuf:"bytes,4,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty"`
// ThorChainSwap vault, on the source chain. Should be queried afresh, as it may change
VaultAddress string `protobuf:"bytes,5,opt,name=vault_address,json=vaultAddress,proto3" json:"vault_address,omitempty"`
// ThorChain router, only in case of Ethereum source network
RouterAddress string `protobuf:"bytes,6,opt,name=router_address,json=routerAddress,proto3" json:"router_address,omitempty"`
// The source amount, integer as string, in the smallest native unit of the chain
FromAmount string `protobuf:"bytes,7,opt,name=from_amount,json=fromAmount,proto3" json:"from_amount,omitempty"`
// Optional minimum accepted destination amount. Actual destination amount will depend on current rates, limit amount can be used to prevent using very unfavorable rates.
// The default is 0 - no price limit.
ToAmountLimit string `protobuf:"bytes,8,opt,name=to_amount_limit,json=toAmountLimit,proto3" json:"to_amount_limit,omitempty"`
// Optional affiliate fee destination address. A Rune address.
AffiliateFeeAddress string `protobuf:"bytes,9,opt,name=affiliate_fee_address,json=affiliateFeeAddress,proto3" json:"affiliate_fee_address,omitempty"`
// Optional affiliate fee, percentage base points, e.g. 100 means 1%, 0 - 1000, as string. Empty means to ignore it.
AffiliateFeeRateBp string `protobuf:"bytes,10,opt,name=affiliate_fee_rate_bp,json=affiliateFeeRateBp,proto3" json:"affiliate_fee_rate_bp,omitempty"`
// Optional extra custom memo, reserved for later use.
ExtraMemo string `protobuf:"bytes,11,opt,name=extra_memo,json=extraMemo,proto3" json:"extra_memo,omitempty"`
// Optional expirationTime, will be now() + 15 min if not set
ExpirationTime uint64 `protobuf:"varint,12,opt,name=expiration_time,json=expirationTime,proto3" json:"expiration_time,omitempty"`
// Optional streaming parameters. Use Streaming Swaps and Swap Optimisation strategy if set.
// https://docs.thorchain.org/thorchain-finance/continuous-liquidity-pools#streaming-swaps-and-swap-optimisation
StreamParams *StreamParams `protobuf:"bytes,13,opt,name=stream_params,json=streamParams,proto3" json:"stream_params,omitempty"`
// contains filtered or unexported fields
}
Input for a swap between source and destination chains; for creating a TX on the source chain.
func (*SwapInput) Descriptor
deprecated
func (*SwapInput) GetAffiliateFeeAddress ¶
func (*SwapInput) GetAffiliateFeeRateBp ¶
func (*SwapInput) GetExpirationTime ¶
func (*SwapInput) GetExtraMemo ¶
func (*SwapInput) GetFromAddress ¶
func (*SwapInput) GetFromAmount ¶
func (*SwapInput) GetFromAsset ¶
func (*SwapInput) GetRouterAddress ¶
func (*SwapInput) GetStreamParams ¶
func (x *SwapInput) GetStreamParams() *StreamParams
func (*SwapInput) GetToAddress ¶
func (*SwapInput) GetToAmountLimit ¶
func (*SwapInput) GetToAsset ¶
func (*SwapInput) GetVaultAddress ¶
func (*SwapInput) ProtoMessage ¶
func (*SwapInput) ProtoMessage()
func (*SwapInput) ProtoReflect ¶
func (x *SwapInput) ProtoReflect() protoreflect.Message
type SwapOutput ¶
type SwapOutput struct {
// Source chain
FromChain Chain `protobuf:"varint,1,opt,name=from_chain,json=fromChain,proto3,enum=TW.THORChainSwap.Proto.Chain" json:"from_chain,omitempty"`
// Destination chain
ToChain Chain `protobuf:"varint,2,opt,name=to_chain,json=toChain,proto3,enum=TW.THORChainSwap.Proto.Chain" json:"to_chain,omitempty"`
// Error code, filled in case of error, OK/empty on success
Error *Error `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
// Prepared unsigned transaction input, on the source chain, to THOR. Some fields must be completed, and it has to be signed.
//
// Types that are valid to be assigned to SigningInputOneof:
//
// *SwapOutput_Bitcoin
// *SwapOutput_Ethereum
// *SwapOutput_Binance
// *SwapOutput_Cosmos
SigningInputOneof isSwapOutput_SigningInputOneof `protobuf_oneof:"signing_input_oneof"`
// contains filtered or unexported fields
}
Result of the swap, a SigningInput struct for the specific chain
func (*SwapOutput) Descriptor
deprecated
func (*SwapOutput) Descriptor() ([]byte, []int)
Deprecated: Use SwapOutput.ProtoReflect.Descriptor instead.
func (*SwapOutput) GetBinance ¶
func (x *SwapOutput) GetBinance() *binance.SigningInput
func (*SwapOutput) GetBitcoin ¶
func (x *SwapOutput) GetBitcoin() *bitcoin.SigningInput
func (*SwapOutput) GetCosmos ¶
func (x *SwapOutput) GetCosmos() *cosmos.SigningInput
func (*SwapOutput) GetError ¶
func (x *SwapOutput) GetError() *Error
func (*SwapOutput) GetEthereum ¶
func (x *SwapOutput) GetEthereum() *ethereum.SigningInput
func (*SwapOutput) GetFromChain ¶
func (x *SwapOutput) GetFromChain() Chain
func (*SwapOutput) GetSigningInputOneof ¶
func (x *SwapOutput) GetSigningInputOneof() isSwapOutput_SigningInputOneof
func (*SwapOutput) GetToChain ¶
func (x *SwapOutput) GetToChain() Chain
func (*SwapOutput) ProtoMessage ¶
func (*SwapOutput) ProtoMessage()
func (*SwapOutput) ProtoReflect ¶
func (x *SwapOutput) ProtoReflect() protoreflect.Message
func (*SwapOutput) Reset ¶
func (x *SwapOutput) Reset()
func (*SwapOutput) String ¶
func (x *SwapOutput) String() string
type SwapOutput_Binance ¶
type SwapOutput_Binance struct {
Binance *binance.SigningInput `protobuf:"bytes,6,opt,name=binance,proto3,oneof"`
}
type SwapOutput_Bitcoin ¶
type SwapOutput_Bitcoin struct {
Bitcoin *bitcoin.SigningInput `protobuf:"bytes,4,opt,name=bitcoin,proto3,oneof"`
}
type SwapOutput_Cosmos ¶
type SwapOutput_Cosmos struct {
Cosmos *cosmos.SigningInput `protobuf:"bytes,7,opt,name=cosmos,proto3,oneof"`
}
type SwapOutput_Ethereum ¶
type SwapOutput_Ethereum struct {
Ethereum *ethereum.SigningInput `protobuf:"bytes,5,opt,name=ethereum,proto3,oneof"`
}
Click to show internal directories.
Click to hide internal directories.