Documentation ¶
Index ¶
- Constants
- Variables
- func InitCosmosKeyring(cosmosKeyringDir string, cosmosKeyringAppName string, ...) (cosmtypes.AccAddress, keyring.Keyring, error)
- func KeyringForPrivKey(name string, privKey cryptotypes.PrivKey) (keyring.Keyring, error)
- func NewClientContext(chainId, fromSpec string, kb keyring.Keyring) (client.Context, error)
- func NewTxConfig(signModes []signingtypes.SignMode) client.TxConfig
- func NewTxFactory(clientCtx client.Context) tx.Factory
- type ChainClient
- type DerivativeOrderData
- type EncodingConfig
- type ExchangeAuthz
- type OrderCancelData
- type OrderHashes
- type OrderbookType
- type SpotOrderData
Constants ¶
View Source
const ( SpotOrderbook = "injective.exchange.v1beta1.EventOrderbookUpdate.spot_orderbooks" DerivativeOrderbook = "injective.exchange.v1beta1.EventOrderbookUpdate.derivative_orderbooks" )
Variables ¶
View Source
var ( ErrTimedOut = errors.New("tx timed out") ErrQueueClosed = errors.New("queue is closed") ErrEnqueueTimeout = errors.New("enqueue timeout") ErrReadOnly = errors.New("client is in read-only mode") )
View Source
var ( CreateSpotLimitOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CreateSpotLimitOrderAuthz{})) CreateSpotMarketOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CreateSpotMarketOrderAuthz{})) BatchCreateSpotLimitOrdersAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.BatchCreateSpotLimitOrdersAuthz{})) CancelSpotOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CancelSpotOrderAuthz{})) BatchCancelSpotOrdersAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.BatchCancelSpotOrdersAuthz{})) CreateDerivativeLimitOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CreateDerivativeLimitOrderAuthz{})) CreateDerivativeMarketOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CreateDerivativeMarketOrderAuthz{})) BatchCreateDerivativeLimitOrdersAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.BatchCreateDerivativeLimitOrdersAuthz{})) CancelDerivativeOrderAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.CancelDerivativeOrderAuthz{})) BatchCancelDerivativeOrdersAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.BatchCancelDerivativeOrdersAuthz{})) BatchUpdateOrdersAuthz = ExchangeAuthz("/" + proto.MessageName(&exchangetypes.BatchUpdateOrdersAuthz{})) )
View Source
var AuctionSubaccountID = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111")
Functions ¶
func InitCosmosKeyring ¶
func KeyringForPrivKey ¶
KeyringForPrivKey creates a temporary in-mem keyring for a PrivKey. Allows to init Context when the key has been provided in plaintext and parsed.
func NewClientContext ¶
NewClientContext creates a new Cosmos Client context, where chainID corresponds to Cosmos chain ID, fromSpec is either name of the key, or bech32-address of the Cosmos account. Keyring is required to contain the specified key.
func NewTxConfig ¶
func NewTxConfig(signModes []signingtypes.SignMode) client.TxConfig
NewTxConfig initializes new Cosmos TxConfig with certain signModes enabled.
Types ¶
type ChainClient ¶
type ChainClient interface { CanSignTransactions() bool FromAddress() sdk.AccAddress QueryClient() *grpc.ClientConn ClientContext() client.Context // return account number and sequence without increasing sequence GetAccNonce() (accNum uint64, accSeq uint64) SimulateMsg(clientCtx client.Context, msgs ...sdk.Msg) (*txtypes.SimulateResponse, error) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxResponse, error) // Build signed tx with given accNum and accSeq, useful for offline siging // If simulate is set to false, initialGas will be used BuildSignedTx(clientCtx client.Context, accNum, accSeq, initialGas uint64, msg ...sdk.Msg) ([]byte, error) SyncBroadcastSignedTx(tyBytes []byte) (*txtypes.BroadcastTxResponse, error) AsyncBroadcastSignedTx(txBytes []byte) (*txtypes.BroadcastTxResponse, error) QueueBroadcastMsg(msgs ...sdk.Msg) error GetBankBalances(ctx context.Context, address string) (*banktypes.QueryAllBalancesResponse, error) GetBankBalance(ctx context.Context, address string, denom string) (*banktypes.QueryBalanceResponse, error) GetAuthzGrants(ctx context.Context, req authztypes.QueryGrantsRequest) (*authztypes.QueryGrantsResponse, error) GetAccount(ctx context.Context, address string) (*authtypes.QueryAccountResponse, error) BuildGenericAuthz(granter string, grantee string, msgtype string, expireIn time.Time) *authztypes.MsgGrant BuildExchangeAuthz(granter string, grantee string, authzType ExchangeAuthz, subaccountId string, markets []string, expireIn time.Time) *authztypes.MsgGrant BuildExchangeBatchUpdateOrdersAuthz( granter string, grantee string, subaccountId string, spotMarkets []string, derivativeMarkets []string, expireIn time.Time, ) *authztypes.MsgGrant DefaultSubaccount(acc cosmtypes.AccAddress) eth.Hash Subaccount(account cosmtypes.AccAddress, index int) eth.Hash GetSubAccountNonce(ctx context.Context, subaccountId eth.Hash) (*exchangetypes.QuerySubaccountTradeNonceResponse, error) GetFeeDiscountInfo(ctx context.Context, account string) (*exchangetypes.QueryFeeDiscountAccountInfoResponse, error) UpdateSubaccountNonceFromChain() error SynchronizeSubaccountNonce(subaccountId eth.Hash) error ComputeOrderHashes(spotOrders []exchangetypes.SpotOrder, derivativeOrders []exchangetypes.DerivativeOrder, subaccountId eth.Hash) (OrderHashes, error) SpotOrder(defaultSubaccountID eth.Hash, network common.Network, d *SpotOrderData) *exchangetypes.SpotOrder DerivativeOrder(defaultSubaccountID eth.Hash, network common.Network, d *DerivativeOrderData) *exchangetypes.DerivativeOrder OrderCancel(defaultSubaccountID eth.Hash, d *OrderCancelData) *exchangetypes.OrderData SmartContractState( ctx context.Context, contractAddress string, queryData []byte, ) (*wasmtypes.QuerySmartContractStateResponse, error) RawContractState( ctx context.Context, contractAddress string, queryData []byte, ) (*wasmtypes.QueryRawContractStateResponse, error) GetGasFee() (string, error) StreamEventOrderFail(sender string, failEventCh chan map[string]uint) StreamEventOrderFailWithWebsocket(sender string, websocket *rpchttp.HTTP, failEventCh chan map[string]uint) StreamOrderbookUpdateEvents(orderbookType OrderbookType, marketIds []string, orderbookCh chan exchangetypes.Orderbook) StreamOrderbookUpdateEventsWithWebsocket(orderbookType OrderbookType, marketIds []string, websocket *rpchttp.HTTP, orderbookCh chan exchangetypes.Orderbook) ChainStream(ctx context.Context, req chainstreamtypes.StreamRequest) (chainstreamtypes.Stream_StreamClient, error) SpotMarket(ctx context.Context, req exchangetypes.QuerySpotMarketRequest) (*exchangetypes.QuerySpotMarketResponse, error) SubaccountDeposits(ctx context.Context, req exchangetypes.QuerySubaccountDepositsRequest) (*exchangetypes.QuerySubaccountDepositsResponse, error) // get tx from chain node GetTx(ctx context.Context, txHash string) (*txtypes.GetTxResponse, error) Close() }
func NewChainClient
deprecated
func NewChainClient( ctx client.Context, network common.Network, options ...common.ClientOption, ) (ChainClient, error)
Deprecated: Use NewChainClientWithMarketsAssistant instead.
func NewChainClientWithMarketsAssistant ¶
func NewChainClientWithMarketsAssistant( ctx client.Context, network common.Network, marketsAssistant core.MarketsAssistant, options ...common.ClientOption, ) (ChainClient, error)
type DerivativeOrderData ¶ added in v1.34.0
type EncodingConfig ¶
type ExchangeAuthz ¶ added in v1.38.1
type ExchangeAuthz string
type OrderCancelData ¶ added in v1.34.0
type OrderHashes ¶ added in v1.38.0
type OrderbookType ¶ added in v1.43.1
type OrderbookType string
Click to show internal directories.
Click to hide internal directories.