From 3736b386c2d2b7015a740cf99354920eaa048858 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:15:03 -0300 Subject: [PATCH 01/13] (feat) Added configuration for pre-commit. Solved all issues found by pre-commit stepts, including golangci-lint --- .pre-commit-config.yaml | 19 + LICENSE.md | 2 +- NOTICE.md | 2 +- README.md | 2 +- chain/auction/types/auction.pb.go | 7 +- chain/auction/types/genesis.pb.go | 5 +- chain/auction/types/query.pb.go | 7 +- chain/auction/types/tx.pb.go | 7 +- chain/crypto/ethsecp256k1/keys.pb.go | 5 +- chain/exchange/types/authz.pb.go | 5 +- chain/exchange/types/events.pb.go | 7 +- chain/exchange/types/exchange.pb.go | 7 +- chain/exchange/types/genesis.pb.go | 7 +- chain/exchange/types/proposal.pb.go | 7 +- chain/exchange/types/query.pb.go | 7 +- chain/exchange/types/tx.pb.go | 7 +- chain/exchange/types/wasm_maker_contract.go | 4 +- chain/insurance/types/genesis.pb.go | 5 +- chain/insurance/types/insurance.pb.go | 9 +- chain/insurance/types/query.pb.go | 7 +- chain/insurance/types/tx.pb.go | 7 +- chain/ocr/types/genesis.pb.go | 7 +- chain/ocr/types/ocr.pb.go | 9 +- chain/ocr/types/query.pb.go | 7 +- chain/ocr/types/tx.pb.go | 7 +- chain/oracle/types/events.pb.go | 7 +- chain/oracle/types/genesis.pb.go | 5 +- chain/oracle/types/oracle.pb.go | 7 +- chain/oracle/types/proposal.pb.go | 7 +- chain/oracle/types/query.pb.go | 7 +- chain/oracle/types/tx.pb.go | 7 +- chain/peggy/types/attestation.pb.go | 7 +- chain/peggy/types/batch.pb.go | 3 +- chain/peggy/types/ethereum_signer.pb.go | 3 +- chain/peggy/types/events.pb.go | 7 +- chain/peggy/types/genesis.pb.go | 7 +- chain/peggy/types/msgs.pb.go | 7 +- chain/peggy/types/params.pb.go | 7 +- chain/peggy/types/pool.pb.go | 7 +- chain/peggy/types/proposal.pb.go | 7 +- chain/peggy/types/query.pb.go | 7 +- chain/peggy/types/types.pb.go | 7 +- chain/stream/types/query.pb.go | 7 +- .../types/authorityMetadata.pb.go | 7 +- chain/tokenfactory/types/events.pb.go | 7 +- chain/tokenfactory/types/genesis.pb.go | 5 +- chain/tokenfactory/types/params.pb.go | 7 +- chain/tokenfactory/types/query.pb.go | 7 +- chain/tokenfactory/types/tx.pb.go | 7 +- chain/types/account.pb.go | 7 +- chain/types/tx_ext.pb.go | 5 +- chain/types/tx_response.pb.go | 3 +- chain/wasmx/types/events.pb.go | 5 +- chain/wasmx/types/genesis.pb.go | 5 +- chain/wasmx/types/proposal.pb.go | 7 +- chain/wasmx/types/query.pb.go | 7 +- chain/wasmx/types/tx.pb.go | 7 +- chain/wasmx/types/wasmx.pb.go | 5 +- client/chain/chain.go | 66 ++- client/chain/chain_test.go | 5 +- client/common/embeded.go | 6 +- client/common/network.go | 5 +- client/common/network_test.go | 3 +- client/common/util.go | 8 +- client/exchange/exchange.go | 500 +++++++++--------- client/explorer/explorer.go | 142 +++-- client/metadata/assets/devnet-1.ini | 1 - client/metadata/fetch_metadata.go | 19 +- ethereum/util/amounts.go | 6 +- examples/chain/0_LocalOrderHash/example.go | 3 +- .../example.go | 3 +- .../example.go | 3 +- .../example.go | 3 +- .../13_MsgIncreasePositionMargin/example.go | 3 +- .../chain/17_MsgBatchUpdateOrders/example.go | 3 +- examples/chain/19_MsgGrant/example.go | 3 +- examples/chain/1_MsgSend/example.go | 3 +- examples/chain/28_BankBalances/example.go | 1 + examples/chain/2_MsgDeposit/example.go | 3 +- examples/chain/33_GetBlock/example.go | 1 + examples/chain/37_DecodeTx/37_decode_tx.go | 1 + .../3_MsgCreateSpotLimitOrder/example.go | 3 +- examples/chain/40_ChainStream/example.go | 1 + .../example.go | 3 +- .../4_MsgCreateSpotMarketOrder/example.go | 3 +- .../chain/5_MsgCancelSpotOrder/example.go | 3 +- .../example.go | 3 +- .../example.go | 3 +- .../8_MsgCancelDerivativeOrder/example.go | 3 +- .../9_MsgBatchCancelSpotOrders/example.go | 3 +- .../accounts/5_SubaccountHistory/example.go | 2 +- .../6_SubaccountOrderSummary/example.go | 2 +- .../accounts/7_OrderStates/example.go | 2 +- .../exchange/accounts/9_Rewards/example.go | 2 +- .../derivatives/10_StreamPositions/example.go | 2 +- .../derivatives/11_StreamOrders/example.go | 2 +- .../exchange/derivatives/12_Trades/example.go | 2 +- .../derivatives/13_StreamTrades/example.go | 2 +- .../14_SubaccountOrdersList/example.go | 2 +- .../15_SubaccountTradesList/example.go | 2 +- .../derivatives/16_FundingPayments/example.go | 2 +- .../derivatives/17_FundingRates/example.go | 2 +- .../18_HistoricalOrders/example.go | 2 +- .../19_StreamHistoricalOrders/example.go | 2 +- .../20_LiquidablePositions/example.go | 2 +- .../derivatives/21_TradesV2/example.go | 2 +- .../derivatives/22_StreamTradesV2/example.go | 2 +- .../exchange/derivatives/2_Markets/example.go | 2 +- .../derivatives/8_Positions/example.go | 2 +- .../exchange/derivatives/9_Orders/example.go | 2 +- .../insurance/1_InsuranceFunds/example.go | 3 +- .../insurance/2_Redemptions/example.go | 3 +- examples/exchange/meta/1_Ping/example.go | 2 +- examples/exchange/meta/2_Version/example.go | 2 +- examples/exchange/meta/3_Info/example.go | 2 +- .../meta/4_StreamKeepAlive/example.go | 2 +- examples/exchange/oracle/2_Price/example.go | 1 + .../example.go | 1 + .../exchange/spot/10_StreamTrades/example.go | 2 +- .../spot/11_SubaccountOrdersList/example.go | 2 +- .../spot/12_SubaccountTradesList/example.go | 2 +- .../spot/14_HistoricalOrders/example.go | 2 +- .../spot/15_StreamHistoricalOrders/example.go | 2 +- examples/exchange/spot/16_TradesV2/example.go | 2 +- .../spot/17_StreamTradesV2/example.go | 2 +- examples/exchange/spot/2_Markets/example.go | 2 +- examples/exchange/spot/5_Orders/example.go | 4 +- examples/exchange/spot/6_Trades/example.go | 2 +- .../exchange/spot/9_StreamOrders/example.go | 2 +- examples/explorer/10_IBCTransfers/example.go | 2 +- examples/explorer/11_GetWasmCodes/example.go | 2 +- .../explorer/12_GetWasmCodeById/example.go | 2 +- .../explorer/13_GetWasmContracts/example.go | 2 +- .../14_GetWasmContractByAddress/example.go | 2 +- .../explorer/15_GetCW20Balance/example.go | 2 +- examples/explorer/2_AccountTxs/example.go | 2 +- examples/explorer/5_TxsRequest/example.go | 2 +- examples/explorer/8_PeggyDeposits/example.go | 2 +- .../explorer/9_PeggyWithdrawals/example.go | 2 +- go.mod | 2 +- 140 files changed, 698 insertions(+), 592 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7c8d4cf5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +exclude: | + (?x)^( + proto/.*| + exchange/.* + )$ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: end-of-file-fixer + - id: check-yaml + - repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.0 + hooks: + - id: go-fmt + - id: go-imports + - id: golangci-lint diff --git a/LICENSE.md b/LICENSE.md index fd30af8c..1d5c5b7c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -200,4 +200,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/NOTICE.md b/NOTICE.md index 68e8c372..9e73b26c 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -5,4 +5,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
-http://www.apache.org/licenses/ +http://www.apache.org/licenses/ diff --git a/README.md b/README.md index b5f92d4d..32653a09 100644 --- a/README.md +++ b/README.md @@ -65,4 +65,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
-http://www.apache.org/licenses/ +http://www.apache.org/licenses/ diff --git a/chain/auction/types/auction.pb.go b/chain/auction/types/auction.pb.go index d0d2e780..0d7b6220 100644 --- a/chain/auction/types/auction.pb.go +++ b/chain/auction/types/auction.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/genesis.pb.go b/chain/auction/types/genesis.pb.go index d1452e2a..c7c3ab27 100644 --- a/chain/auction/types/genesis.pb.go +++ b/chain/auction/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/query.pb.go b/chain/auction/types/query.pb.go index ec9d8b68..bde86cb4 100644 --- a/chain/auction/types/query.pb.go +++ b/chain/auction/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/tx.pb.go b/chain/auction/types/tx.pb.go index 57d3be57..b592915e 100644 --- a/chain/auction/types/tx.pb.go +++ b/chain/auction/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/crypto/ethsecp256k1/keys.pb.go b/chain/crypto/ethsecp256k1/keys.pb.go index c445cb5b..1f19c66a 100644 --- a/chain/crypto/ethsecp256k1/keys.pb.go +++ b/chain/crypto/ethsecp256k1/keys.pb.go @@ -5,11 +5,12 @@ package ethsecp256k1 import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/authz.pb.go b/chain/exchange/types/authz.pb.go index e97e8a78..7989416a 100644 --- a/chain/exchange/types/authz.pb.go +++ b/chain/exchange/types/authz.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/events.pb.go b/chain/exchange/types/events.pb.go index fde0ea75..0b05ad3a 100644 --- a/chain/exchange/types/events.pb.go +++ b/chain/exchange/types/events.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/exchange.pb.go b/chain/exchange/types/exchange.pb.go index d462df25..1db8e74d 100644 --- a/chain/exchange/types/exchange.pb.go +++ b/chain/exchange/types/exchange.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types1 "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/genesis.pb.go b/chain/exchange/types/genesis.pb.go index 92998d1d..d83d83f7 100644 --- a/chain/exchange/types/genesis.pb.go +++ b/chain/exchange/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/proposal.pb.go b/chain/exchange/types/proposal.pb.go index 6f3eee76..8ec78f6e 100644 --- a/chain/exchange/types/proposal.pb.go +++ b/chain/exchange/types/proposal.pb.go @@ -5,6 +5,10 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types" @@ -13,9 +17,6 @@ import ( types1 "github.com/cosmos/cosmos-sdk/x/distribution/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/query.pb.go b/chain/exchange/types/query.pb.go index b4111c76..d95ca74e 100644 --- a/chain/exchange/types/query.pb.go +++ b/chain/exchange/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/tx.pb.go b/chain/exchange/types/tx.pb.go index 682a9a23..b36abb8e 100644 --- a/chain/exchange/types/tx.pb.go +++ b/chain/exchange/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types1 "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -18,9 +22,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/wasm_maker_contract.go b/chain/exchange/types/wasm_maker_contract.go index ca0a9227..8b75eb9f 100644 --- a/chain/exchange/types/wasm_maker_contract.go +++ b/chain/exchange/types/wasm_maker_contract.go @@ -1,7 +1,7 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/math" ) type MintToUser struct { @@ -13,7 +13,7 @@ type MintToUserMsg struct { MintToUser MintToUser `json:"mint_to_user"` } -func NewMintToUserMsg(subaccountIDSender string, amount sdk.Int) MintToUserMsg { +func NewMintToUserMsg(subaccountIDSender string, amount math.Int) MintToUserMsg { return MintToUserMsg{ MintToUser: MintToUser{ SubaccountIDSender: subaccountIDSender, diff --git a/chain/insurance/types/genesis.pb.go b/chain/insurance/types/genesis.pb.go index 2bd30a00..09aa4be5 100644 --- a/chain/insurance/types/genesis.pb.go +++ b/chain/insurance/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/insurance.pb.go b/chain/insurance/types/insurance.pb.go index ba256531..bf9d978e 100644 --- a/chain/insurance/types/insurance.pb.go +++ b/chain/insurance/types/insurance.pb.go @@ -5,6 +5,11 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" @@ -13,10 +18,6 @@ import ( github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/query.pb.go b/chain/insurance/types/query.pb.go index 4b79acab..37fdf2bd 100644 --- a/chain/insurance/types/query.pb.go +++ b/chain/insurance/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/tx.pb.go b/chain/insurance/types/tx.pb.go index 846919ee..1113a9f8 100644 --- a/chain/insurance/types/tx.pb.go +++ b/chain/insurance/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/types" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/genesis.pb.go b/chain/ocr/types/genesis.pb.go index 210d8023..68aee64a 100644 --- a/chain/ocr/types/genesis.pb.go +++ b/chain/ocr/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/ocr.pb.go b/chain/ocr/types/ocr.pb.go index d80ac284..4c0279d4 100644 --- a/chain/ocr/types/ocr.pb.go +++ b/chain/ocr/types/ocr.pb.go @@ -5,6 +5,11 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -12,10 +17,6 @@ import ( proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/query.pb.go b/chain/ocr/types/query.pb.go index 5320b68e..3000c85e 100644 --- a/chain/ocr/types/query.pb.go +++ b/chain/ocr/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/tx.pb.go b/chain/ocr/types/tx.pb.go index 76af8a8c..b1574018 100644 --- a/chain/ocr/types/tx.pb.go +++ b/chain/ocr/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/events.pb.go b/chain/oracle/types/events.pb.go index d8b8118e..4f5e3139 100644 --- a/chain/oracle/types/events.pb.go +++ b/chain/oracle/types/events.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/genesis.pb.go b/chain/oracle/types/genesis.pb.go index 04cb607c..df592e98 100644 --- a/chain/oracle/types/genesis.pb.go +++ b/chain/oracle/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/oracle.pb.go b/chain/oracle/types/oracle.pb.go index 156c1208..65482710 100644 --- a/chain/oracle/types/oracle.pb.go +++ b/chain/oracle/types/oracle.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" golang_proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/proposal.pb.go b/chain/oracle/types/proposal.pb.go index 2606c3f3..ae4c5169 100644 --- a/chain/oracle/types/proposal.pb.go +++ b/chain/oracle/types/proposal.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/query.pb.go b/chain/oracle/types/query.pb.go index d82bee6f..4581b81c 100644 --- a/chain/oracle/types/query.pb.go +++ b/chain/oracle/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/tx.pb.go b/chain/oracle/types/tx.pb.go index c993e9d9..165fcf35 100644 --- a/chain/oracle/types/tx.pb.go +++ b/chain/oracle/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/attestation.pb.go b/chain/peggy/types/attestation.pb.go index 0d591bd2..3ea675f8 100644 --- a/chain/peggy/types/attestation.pb.go +++ b/chain/peggy/types/attestation.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/batch.pb.go b/chain/peggy/types/batch.pb.go index 083ea8c7..65fac894 100644 --- a/chain/peggy/types/batch.pb.go +++ b/chain/peggy/types/batch.pb.go @@ -5,10 +5,11 @@ package types import ( fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/ethereum_signer.pb.go b/chain/peggy/types/ethereum_signer.pb.go index d52e1b45..08af7a8a 100644 --- a/chain/peggy/types/ethereum_signer.pb.go +++ b/chain/peggy/types/ethereum_signer.pb.go @@ -5,9 +5,10 @@ package types import ( fmt "fmt" + math "math" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/events.pb.go b/chain/peggy/types/events.pb.go index 13168705..571bb00b 100644 --- a/chain/peggy/types/events.pb.go +++ b/chain/peggy/types/events.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/genesis.pb.go b/chain/peggy/types/genesis.pb.go index 197630ab..e4baffbc 100644 --- a/chain/peggy/types/genesis.pb.go +++ b/chain/peggy/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/msgs.pb.go b/chain/peggy/types/msgs.pb.go index 6bf0619c..7797fcfe 100644 --- a/chain/peggy/types/msgs.pb.go +++ b/chain/peggy/types/msgs.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -18,9 +22,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/params.pb.go b/chain/peggy/types/params.pb.go index f7932952..7afc74dd 100644 --- a/chain/peggy/types/params.pb.go +++ b/chain/peggy/types/params.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/pool.pb.go b/chain/peggy/types/pool.pb.go index a7eabb67..68e76b1a 100644 --- a/chain/peggy/types/pool.pb.go +++ b/chain/peggy/types/pool.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/proposal.pb.go b/chain/peggy/types/proposal.pb.go index dd9ece2a..242fd142 100644 --- a/chain/peggy/types/proposal.pb.go +++ b/chain/peggy/types/proposal.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/query.pb.go b/chain/peggy/types/query.pb.go index 56cc080b..daac4c68 100644 --- a/chain/peggy/types/query.pb.go +++ b/chain/peggy/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -13,9 +17,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/types.pb.go b/chain/peggy/types/types.pb.go index 66673a3c..29281874 100644 --- a/chain/peggy/types/types.pb.go +++ b/chain/peggy/types/types.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/stream/types/query.pb.go b/chain/stream/types/query.pb.go index 1e7e3f0c..fcbb41c6 100644 --- a/chain/stream/types/query.pb.go +++ b/chain/stream/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/exchange/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/authorityMetadata.pb.go b/chain/tokenfactory/types/authorityMetadata.pb.go index 51337590..8ee31dd6 100644 --- a/chain/tokenfactory/types/authorityMetadata.pb.go +++ b/chain/tokenfactory/types/authorityMetadata.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/events.pb.go b/chain/tokenfactory/types/events.pb.go index 96598dc0..17d0804f 100644 --- a/chain/tokenfactory/types/events.pb.go +++ b/chain/tokenfactory/types/events.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/genesis.pb.go b/chain/tokenfactory/types/genesis.pb.go index 85a59947..9f623873 100644 --- a/chain/tokenfactory/types/genesis.pb.go +++ b/chain/tokenfactory/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/params.pb.go b/chain/tokenfactory/types/params.pb.go index 9d705d9c..089844bc 100644 --- a/chain/tokenfactory/types/params.pb.go +++ b/chain/tokenfactory/types/params.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/query.pb.go b/chain/tokenfactory/types/query.pb.go index 9d7f5742..f8afd710 100644 --- a/chain/tokenfactory/types/query.pb.go +++ b/chain/tokenfactory/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/tx.pb.go b/chain/tokenfactory/types/tx.pb.go index 214084f8..33e4eb33 100644 --- a/chain/tokenfactory/types/tx.pb.go +++ b/chain/tokenfactory/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/account.pb.go b/chain/types/account.pb.go index cb352b87..59afd490 100644 --- a/chain/types/account.pb.go +++ b/chain/types/account.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/tx_ext.pb.go b/chain/types/tx_ext.pb.go index 3b5e02ae..5f48212a 100644 --- a/chain/types/tx_ext.pb.go +++ b/chain/types/tx_ext.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/tx_response.pb.go b/chain/types/tx_response.pb.go index e4d2327b..de584707 100644 --- a/chain/types/tx_response.pb.go +++ b/chain/types/tx_response.pb.go @@ -5,10 +5,11 @@ package types import ( fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/events.pb.go b/chain/wasmx/types/events.pb.go index 9f3f7471..a211e66a 100644 --- a/chain/wasmx/types/events.pb.go +++ b/chain/wasmx/types/events.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/genesis.pb.go b/chain/wasmx/types/genesis.pb.go index fe9147ae..c9405de5 100644 --- a/chain/wasmx/types/genesis.pb.go +++ b/chain/wasmx/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/proposal.pb.go b/chain/wasmx/types/proposal.pb.go index 128ae2cc..4e85c1c3 100644 --- a/chain/wasmx/types/proposal.pb.go +++ b/chain/wasmx/types/proposal.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/CosmWasm/wasmd/x/wasm/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/query.pb.go b/chain/wasmx/types/query.pb.go index a94efce7..1b1f4cdb 100644 --- a/chain/wasmx/types/query.pb.go +++ b/chain/wasmx/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -13,9 +17,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/tx.pb.go b/chain/wasmx/types/tx.pb.go index 02545b39..908d6219 100644 --- a/chain/wasmx/types/tx.pb.go +++ b/chain/wasmx/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/wasmx.pb.go b/chain/wasmx/types/wasmx.pb.go index 053a0a76..e3e8dee8 100644 --- a/chain/wasmx/types/wasmx.pb.go +++ b/chain/wasmx/types/wasmx.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/client/chain/chain.go b/client/chain/chain.go index e9474631..dbcff32c 100644 --- a/client/chain/chain.go +++ b/client/chain/chain.go @@ -15,6 +15,8 @@ import ( "sync/atomic" "time" + "google.golang.org/grpc/credentials/insecure" + sdkmath "cosmossdk.io/math" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" log "github.com/InjectiveLabs/suplog" @@ -151,10 +153,9 @@ type chainClient struct { chainStreamConn *grpc.ClientConn txFactory tx.Factory - fromAddress sdk.AccAddress - doneC chan bool - msgC chan sdk.Msg - syncMux *sync.Mutex + doneC chan bool + msgC chan sdk.Msg + syncMux *sync.Mutex cancelCtx context.Context cancelFn func() @@ -218,7 +219,7 @@ func NewChainClient( if opts.TLSCert != nil { conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) stickySessionEnabled = false } if err != nil { @@ -230,7 +231,7 @@ func NewChainClient( if opts.TLSCert != nil { chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err = errors.Wrapf(err, "failed to connect to the chain stream gRPC: %s", network.ChainStreamGrpcEndpoint) @@ -379,7 +380,10 @@ func (c *chainClient) getAccSeq() uint64 { func (c *chainClient) requestCookie() metadata.MD { var header metadata.MD - c.txClient.GetTx(context.Background(), &txtypes.GetTxRequest{}, grpc.Header(&header)) + _, err := c.txClient.GetTx(context.Background(), &txtypes.GetTxRequest{}, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -461,16 +465,18 @@ func (c *chainClient) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRes c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) res, err := c.broadcastTx(c.ctx, c.txFactory, true, msgs...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, true, msgs...) } if err != nil { @@ -480,8 +486,6 @@ func (c *chainClient) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRes } } - c.accSeq++ - return res, nil } @@ -525,15 +529,17 @@ func (c *chainClient) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRe c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) res, err := c.broadcastTx(c.ctx, c.txFactory, false, msgs...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, false, msgs...) } if err != nil { @@ -543,8 +549,6 @@ func (c *chainClient) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRe } } - c.accSeq++ - return res, nil } @@ -781,16 +785,18 @@ func (c *chainClient) runBatchBroadcast() { submitBatch := func(toSubmit []sdk.Msg) { c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("broadcastTx with nonce", c.accSeq) + log.Debugln("broadcastTx with nonce", sequence) res, err := c.broadcastTx(c.ctx, c.txFactory, true, toSubmit...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, true, toSubmit...) } if err != nil { @@ -807,8 +813,6 @@ func (c *chainClient) runBatchBroadcast() { log.WithField("txHash", res.TxResponse.TxHash).Debugln("msg batch broadcasted successfully at height", res.TxResponse.Height) } - c.accSeq++ - log.Debugln("nonce incremented to", c.accSeq) log.Debugln("gas wanted: ", c.gasWanted) } @@ -955,7 +959,7 @@ func (c *chainClient) DerivativeOrder(defaultSubaccountID eth.Hash, network comm margin := cosmtypes.MustNewDecFromStr(fmt.Sprint(d.Quantity)).Mul(d.Price).Quo(d.Leverage) - if d.IsReduceOnly == true { + if d.IsReduceOnly { margin = cosmtypes.MustNewDecFromStr("0") } @@ -1183,7 +1187,12 @@ func (c *chainClient) StreamEventOrderFail(sender string, failEventCh chan map[s panic(err) } } - defer cometbftClient.Stop() + defer func() { + err := cometbftClient.Stop() + if err != nil { + panic(err) + } + }() c.StreamEventOrderFailWithWebsocket(sender, cometbftClient, failEventCh) } @@ -1237,7 +1246,12 @@ func (c *chainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, m panic(err) } } - defer cometbftClient.Stop() + defer func() { + err := cometbftClient.Stop() + if err != nil { + panic(err) + } + }() c.StreamOrderbookUpdateEventsWithWebsocket(orderbookType, marketIds, cometbftClient, orderbookCh) diff --git a/client/chain/chain_test.go b/client/chain/chain_test.go index 0ec9bde8..ed55ed2a 100644 --- a/client/chain/chain_test.go +++ b/client/chain/chain_test.go @@ -1,14 +1,15 @@ package chain import ( + "os" + "testing" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" rpchttp "github.com/cometbft/cometbft/rpc/client/http" "github.com/cosmos/cosmos-sdk/crypto/keyring" cosmtypes "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" - "os" - "testing" ) func accountForTests() (cosmtypes.AccAddress, keyring.Keyring, error) { diff --git a/client/common/embeded.go b/client/common/embeded.go index b22554cf..d1c7d7e6 100644 --- a/client/common/embeded.go +++ b/client/common/embeded.go @@ -1,4 +1,6 @@ package common -import _ "github.com/InjectiveLabs/sdk-go/client/cert" -import _ "github.com/InjectiveLabs/sdk-go/client/metadata/assets" +import ( + _ "github.com/InjectiveLabs/sdk-go/client/cert" + _ "github.com/InjectiveLabs/sdk-go/client/metadata/assets" +) diff --git a/client/common/network.go b/client/common/network.go index 7095823b..42ba48f9 100644 --- a/client/common/network.go +++ b/client/common/network.go @@ -4,7 +4,6 @@ import ( "context" "crypto/tls" "fmt" - "google.golang.org/grpc/metadata" "net" "net/http" "path" @@ -12,6 +11,8 @@ import ( "strings" "time" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/credentials" ) @@ -74,7 +75,7 @@ func (assistant *ExpiringCookieAssistant) checkCookieExpiration() { expirationTime, err := time.Parse(assistant.timeLayout, cookie.Value) if err == nil { - timestampDiff := expirationTime.Sub(time.Now()) + timestampDiff := time.Until(expirationTime) if timestampDiff < SessionRenewalOffset { assistant.cookie = "" } diff --git a/client/common/network_test.go b/client/common/network_test.go index cf63efcd..235c580e 100644 --- a/client/common/network_test.go +++ b/client/common/network_test.go @@ -2,9 +2,10 @@ package common import ( "fmt" - "google.golang.org/grpc/metadata" "testing" "time" + + "google.golang.org/grpc/metadata" ) func TestMainnetKubernetesLoadBalancedCookieAssistant(t *testing.T) { diff --git a/client/common/util.go b/client/common/util.go index 6f6af8ee..f7e0c9bc 100644 --- a/client/common/util.go +++ b/client/common/util.go @@ -5,7 +5,7 @@ import ( "crypto/x509" "encoding/hex" "fmt" - "io/ioutil" + "os" "strings" chaintypes "github.com/InjectiveLabs/sdk-go/chain/types" @@ -13,9 +13,7 @@ import ( ) func HexToBytes(str string) ([]byte, error) { - if strings.HasPrefix(str, "0x") { - str = str[2:] - } + str = strings.TrimPrefix(str, "0x") data, err := hex.DecodeString(str) if err != nil { @@ -31,7 +29,7 @@ func LoadTlsCert(path string, serverName string) credentials.TransportCredential } // build cert obj - rootCert, err := ioutil.ReadFile(path) + rootCert, err := os.ReadFile(path) if err != nil { fmt.Println(err, "cannot load tls cert from path") return nil diff --git a/client/exchange/exchange.go b/client/exchange/exchange.go index 59552049..e331d947 100644 --- a/client/exchange/exchange.go +++ b/client/exchange/exchange.go @@ -3,6 +3,10 @@ package exchange import ( "context" "fmt" + "time" + + "google.golang.org/grpc/credentials/insecure" + "github.com/InjectiveLabs/sdk-go/client/common" accountPB "github.com/InjectiveLabs/sdk-go/exchange/accounts_rpc/pb" auctionPB "github.com/InjectiveLabs/sdk-go/exchange/auction_rpc/pb" @@ -22,74 +26,74 @@ import ( type ExchangeClient interface { QueryClient() *grpc.ClientConn - GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error) - GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error) - GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error) + GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error) + GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error) + GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error) // StreamDerivativeOrderbook deprecated API - StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) - StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error) + StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) + StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (*derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) - GetDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersRequest) (derivativeExchangePB.OrdersResponse, error) - GetDerivativeMarkets(ctx context.Context, req derivativeExchangePB.MarketsRequest) (derivativeExchangePB.MarketsResponse, error) - GetDerivativePositions(ctx context.Context, req derivativeExchangePB.PositionsRequest) (derivativeExchangePB.PositionsResponse, error) - GetDerivativePositionsV2(ctx context.Context, req derivativeExchangePB.PositionsV2Request) (derivativeExchangePB.PositionsV2Response, error) - GetDerivativeLiquidablePositions(ctx context.Context, req derivativeExchangePB.LiquidablePositionsRequest) (derivativeExchangePB.LiquidablePositionsResponse, error) - StreamDerivativePositions(ctx context.Context, req derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) - StreamDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) - GetDerivativeTrades(ctx context.Context, req derivativeExchangePB.TradesRequest) (derivativeExchangePB.TradesResponse, error) - GetDerivativeTradesV2(ctx context.Context, req derivativeExchangePB.TradesV2Request) (derivativeExchangePB.TradesV2Response, error) - StreamDerivativeTrades(ctx context.Context, req derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) - StreamDerivativeV2Trades(ctx context.Context, req derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) - GetSubaccountDerivativeOrdersList(ctx context.Context, req derivativeExchangePB.SubaccountOrdersListRequest) (derivativeExchangePB.SubaccountOrdersListResponse, error) - GetSubaccountDerivativeTradesList(ctx context.Context, req derivativeExchangePB.SubaccountTradesListRequest) (derivativeExchangePB.SubaccountTradesListResponse, error) - GetHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersHistoryRequest) (derivativeExchangePB.OrdersHistoryResponse, error) - StreamHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) - GetDerivativeFundingPayments(ctx context.Context, req derivativeExchangePB.FundingPaymentsRequest) (derivativeExchangePB.FundingPaymentsResponse, error) - GetDerivativeFundingRates(ctx context.Context, req derivativeExchangePB.FundingRatesRequest) (derivativeExchangePB.FundingRatesResponse, error) - GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error) - GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error) + GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error) + GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error) + GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error) + GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error) + GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error) + StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) + StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) + GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error) + GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error) + StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) + StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) + GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error) + GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error) + GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error) + StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) + GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error) + GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error) + GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error) + GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error) - GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) - GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error) + GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error) + GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error) StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error) - GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error) - GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) + GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error) + GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error) StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error) - GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error) - GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error) - GetSubaccountOrderSummary(ctx context.Context, req accountPB.SubaccountOrderSummaryRequest) (accountPB.SubaccountOrderSummaryResponse, error) - GetOrderStates(ctx context.Context, req accountPB.OrderStatesRequest) (accountPB.OrderStatesResponse, error) - GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error) - GetRewards(ctx context.Context, req accountPB.RewardsRequest) (accountPB.RewardsResponse, error) - GetSpotOrders(ctx context.Context, req spotExchangePB.OrdersRequest) (spotExchangePB.OrdersResponse, error) - GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error) - GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error) + GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error) + GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error) + GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error) + GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error) + GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error) + GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error) + GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error) + GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error) + GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error) // StreamSpotOrderbook deprecated API StreamSpotOrderbookV2(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookV2Client, error) StreamSpotOrderbookUpdate(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error) - GetSpotMarkets(ctx context.Context, req spotExchangePB.MarketsRequest) (spotExchangePB.MarketsResponse, error) - GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error) + GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error) + GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) - StreamSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) - GetSpotTrades(ctx context.Context, req spotExchangePB.TradesRequest) (spotExchangePB.TradesResponse, error) - GetSpotTradesV2(ctx context.Context, req spotExchangePB.TradesV2Request) (spotExchangePB.TradesV2Response, error) - StreamSpotTrades(ctx context.Context, req spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) - StreamSpotTradesV2(ctx context.Context, req spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) - GetSubaccountSpotOrdersList(ctx context.Context, req spotExchangePB.SubaccountOrdersListRequest) (spotExchangePB.SubaccountOrdersListResponse, error) - GetSubaccountSpotTradesList(ctx context.Context, req spotExchangePB.SubaccountTradesListRequest) (spotExchangePB.SubaccountTradesListResponse, error) - GetHistoricalSpotOrders(ctx context.Context, req spotExchangePB.OrdersHistoryRequest) (spotExchangePB.OrdersHistoryResponse, error) - StreamHistoricalSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) - GetInsuranceFunds(ctx context.Context, req insurancePB.FundsRequest) (insurancePB.FundsResponse, error) - GetRedemptions(ctx context.Context, req insurancePB.RedemptionsRequest) (insurancePB.RedemptionsResponse, error) - - GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error) - GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioBalancesResponse, error) + StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) + GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error) + GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error) + StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) + StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) + GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error) + GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error) + GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error) + StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) + GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error) + GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error) + + GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error) + GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error) - StreamKeepalive(ctx context.Context) (metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) - GetInfo(ctx context.Context, req metaPB.InfoRequest) (metaPB.InfoResponse, error) - GetVersion(ctx context.Context, req metaPB.VersionRequest) (metaPB.VersionResponse, error) - Ping(ctx context.Context, req metaPB.PingRequest) (metaPB.PingResponse, error) + StreamKeepalive(ctx context.Context) (*metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) + GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error) + GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error) + Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error) Close() } @@ -113,7 +117,7 @@ func NewExchangeClient(network common.Network, options ...common.ClientOption) ( conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err := errors.Wrapf(err, "failed to connect to the gRPC: %s", network.ExchangeGrpcEndpoint) @@ -150,9 +154,6 @@ type exchangeClient struct { network common.Network conn *grpc.ClientConn logger log.Logger - client *grpc.ClientConn - - sessionCookie string metaClient metaPB.InjectiveMetaRPCClient explorerClient explorerPB.InjectiveExplorerRPCClient @@ -163,14 +164,15 @@ type exchangeClient struct { spotExchangeClient spotExchangePB.InjectiveSpotExchangeRPCClient derivativeExchangeClient derivativeExchangePB.InjectiveDerivativeExchangeRPCClient portfolioExchangeClient portfolioExchangePB.InjectivePortfolioRPCClient - - closed int64 } func (c *exchangeClient) requestCookie() metadata.MD { var header metadata.MD - req := metaPB.InfoRequest{} - c.metaClient.Info(context.Background(), &req, grpc.Header(&header)) + req := metaPB.InfoRequest{Timestamp: time.Now().UnixMilli()} + _, err := c.metaClient.Info(context.Background(), &req, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -186,52 +188,52 @@ func (c *exchangeClient) QueryClient() *grpc.ClientConn { // Derivatives RPC -func (c *exchangeClient) GetDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersRequest) (derivativeExchangePB.OrdersResponse, error) { +func (c *exchangeClient) GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Orders(ctx, &req) + res, err := c.derivativeExchangeClient.Orders(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrdersResponse{}, err + return &derivativeExchangePB.OrdersResponse{}, err } - return *res, nil + return res, nil } // Deprecated: Use GetDerivativePositionsV2 instead. -func (c *exchangeClient) GetDerivativePositions(ctx context.Context, req derivativeExchangePB.PositionsRequest) (derivativeExchangePB.PositionsResponse, error) { +func (c *exchangeClient) GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Positions(ctx, &req) + res, err := c.derivativeExchangeClient.Positions(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.PositionsResponse{}, err + return &derivativeExchangePB.PositionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativePositionsV2(ctx context.Context, req derivativeExchangePB.PositionsV2Request) (derivativeExchangePB.PositionsV2Response, error) { +func (c *exchangeClient) GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.PositionsV2(ctx, &req) + res, err := c.derivativeExchangeClient.PositionsV2(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.PositionsV2Response{}, err + return &derivativeExchangePB.PositionsV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req derivativeExchangePB.LiquidablePositionsRequest) (derivativeExchangePB.LiquidablePositionsResponse, error) { +func (c *exchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.LiquidablePositions(ctx, &req) + res, err := c.derivativeExchangeClient.LiquidablePositions(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.LiquidablePositionsResponse{}, err + return &derivativeExchangePB.LiquidablePositionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error) { +func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error) { req := derivativeExchangePB.OrderbookV2Request{ MarketId: marketId, } @@ -240,13 +242,13 @@ func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId res, err := c.derivativeExchangeClient.OrderbookV2(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrderbookV2Response{}, err + return &derivativeExchangePB.OrderbookV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error) { +func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error) { req := derivativeExchangePB.OrderbooksV2Request{ MarketIds: marketIds, } @@ -255,13 +257,13 @@ func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketId res, err := c.derivativeExchangeClient.OrderbooksV2(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrderbooksV2Response{}, err + return &derivativeExchangePB.OrderbooksV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) { +func (c *exchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) { req := derivativeExchangePB.StreamOrderbookV2Request{ MarketIds: marketIds, } @@ -273,10 +275,10 @@ func (c *exchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, market return nil, err } - return stream, nil + return &stream, nil } -func (c *exchangeClient) StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error) { +func (c *exchangeClient) StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (*derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error) { req := derivativeExchangePB.StreamOrderbookUpdateRequest{ MarketIds: marketIds, } @@ -288,21 +290,21 @@ func (c *exchangeClient) StreamDerivativeOrderbookUpdate(ctx context.Context, ma return nil, err } - return stream, nil + return &stream, nil } -func (c *exchangeClient) GetDerivativeMarkets(ctx context.Context, req derivativeExchangePB.MarketsRequest) (derivativeExchangePB.MarketsResponse, error) { +func (c *exchangeClient) GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Markets(ctx, &req) + res, err := c.derivativeExchangeClient.Markets(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.MarketsResponse{}, err + return &derivativeExchangePB.MarketsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error) { +func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error) { req := derivativeExchangePB.MarketRequest{ MarketId: marketId, } @@ -311,10 +313,10 @@ func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId strin res, err := c.derivativeExchangeClient.Market(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.MarketResponse{}, err + return &derivativeExchangePB.MarketResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) { @@ -332,9 +334,9 @@ func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds [ return stream, nil } -func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { +func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamPositions(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamPositions(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -343,9 +345,9 @@ func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req deri return stream, nil } -func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { +func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamOrders(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamOrders(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -354,31 +356,31 @@ func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req derivat return stream, nil } -func (c *exchangeClient) GetDerivativeTrades(ctx context.Context, req derivativeExchangePB.TradesRequest) (derivativeExchangePB.TradesResponse, error) { +func (c *exchangeClient) GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Trades(ctx, &req) + res, err := c.derivativeExchangeClient.Trades(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.TradesResponse{}, err + return &derivativeExchangePB.TradesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeTradesV2(ctx context.Context, req derivativeExchangePB.TradesV2Request) (derivativeExchangePB.TradesV2Response, error) { +func (c *exchangeClient) GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.TradesV2(ctx, &req) + res, err := c.derivativeExchangeClient.TradesV2(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.TradesV2Response{}, err + return &derivativeExchangePB.TradesV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { +func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamTrades(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamTrades(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -387,9 +389,9 @@ func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req derivat return stream, nil } -func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { +func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamTradesV2(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamTradesV2(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -398,41 +400,41 @@ func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req deriv return stream, nil } -func (c *exchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req derivativeExchangePB.SubaccountOrdersListRequest) (derivativeExchangePB.SubaccountOrdersListResponse, error) { +func (c *exchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.SubaccountOrdersList(ctx, &req) + res, err := c.derivativeExchangeClient.SubaccountOrdersList(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.SubaccountOrdersListResponse{}, err + return &derivativeExchangePB.SubaccountOrdersListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req derivativeExchangePB.SubaccountTradesListRequest) (derivativeExchangePB.SubaccountTradesListResponse, error) { +func (c *exchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.SubaccountTradesList(ctx, &req) + res, err := c.derivativeExchangeClient.SubaccountTradesList(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.SubaccountTradesListResponse{}, err + return &derivativeExchangePB.SubaccountTradesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersHistoryRequest) (derivativeExchangePB.OrdersHistoryResponse, error) { +func (c *exchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.OrdersHistory(ctx, &req) + res, err := c.derivativeExchangeClient.OrdersHistory(ctx, req) if err != nil { - return derivativeExchangePB.OrdersHistoryResponse{}, err + return &derivativeExchangePB.OrdersHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { +func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamOrdersHistory(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamOrdersHistory(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -441,31 +443,31 @@ func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, r return stream, nil } -func (c *exchangeClient) GetDerivativeFundingPayments(ctx context.Context, req derivativeExchangePB.FundingPaymentsRequest) (derivativeExchangePB.FundingPaymentsResponse, error) { +func (c *exchangeClient) GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.FundingPayments(ctx, &req) + res, err := c.derivativeExchangeClient.FundingPayments(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.FundingPaymentsResponse{}, err + return &derivativeExchangePB.FundingPaymentsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeFundingRates(ctx context.Context, req derivativeExchangePB.FundingRatesRequest) (derivativeExchangePB.FundingRatesResponse, error) { +func (c *exchangeClient) GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.FundingRates(ctx, &req) + res, err := c.derivativeExchangeClient.FundingRates(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.FundingRatesResponse{}, err + return &derivativeExchangePB.FundingRatesResponse{}, err } - return *res, nil + return res, nil } // Oracle RPC -func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error) { +func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error) { req := oraclePB.PriceRequest{ BaseSymbol: baseSymbol, QuoteSymbol: quoteSymbol, @@ -477,23 +479,23 @@ func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteS res, err := c.oracleClient.Price(ctx, &req) if err != nil { fmt.Println(err) - return oraclePB.PriceResponse{}, err + return &oraclePB.PriceResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error) { +func (c *exchangeClient) GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error) { req := oraclePB.OracleListRequest{} ctx = c.getCookie(ctx) res, err := c.oracleClient.OracleList(ctx, &req) if err != nil { fmt.Println(err) - return oraclePB.OracleListResponse{}, err + return &oraclePB.OracleListResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error) { @@ -515,7 +517,7 @@ func (c *exchangeClient) StreamPrices(ctx context.Context, baseSymbol string, qu // Auction RPC -func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) { +func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error) { req := auctionPB.AuctionEndpointRequest{ Round: round, } @@ -524,23 +526,23 @@ func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB res, err := c.auctionClient.AuctionEndpoint(ctx, &req) if err != nil { fmt.Println(err) - return auctionPB.AuctionEndpointResponse{}, err + return &auctionPB.AuctionEndpointResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error) { +func (c *exchangeClient) GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error) { req := auctionPB.AuctionsRequest{} ctx = c.getCookie(ctx) res, err := c.auctionClient.Auctions(ctx, &req) if err != nil { fmt.Println(err) - return auctionPB.AuctionsResponse{}, err + return &auctionPB.AuctionsResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error) { @@ -558,7 +560,7 @@ func (c *exchangeClient) StreamBids(ctx context.Context) (auctionPB.InjectiveAuc // Accounts RPC -func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error) { +func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error) { req := accountPB.SubaccountsListRequest{ AccountAddress: accountAddress, } @@ -567,13 +569,13 @@ func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress res, err := c.accountClient.SubaccountsList(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountsListResponse{}, err + return &accountPB.SubaccountsListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) { +func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error) { req := accountPB.SubaccountBalanceEndpointRequest{ SubaccountId: subaccountId, Denom: denom, @@ -583,10 +585,10 @@ func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId res, err := c.accountClient.SubaccountBalanceEndpoint(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountBalanceEndpointResponse{}, err + return &accountPB.SubaccountBalanceEndpointResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error) { @@ -604,7 +606,7 @@ func (c *exchangeClient) StreamSubaccountBalance(ctx context.Context, subaccount return stream, nil } -func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error) { +func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error) { req := accountPB.SubaccountBalancesListRequest{ SubaccountId: subaccountId, } @@ -613,46 +615,46 @@ func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccou res, err := c.accountClient.SubaccountBalancesList(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountBalancesListResponse{}, err + return &accountPB.SubaccountBalancesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error) { +func (c *exchangeClient) GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.SubaccountHistory(ctx, &req) + res, err := c.accountClient.SubaccountHistory(ctx, req) if err != nil { fmt.Println(err) - return accountPB.SubaccountHistoryResponse{}, err + return &accountPB.SubaccountHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountOrderSummary(ctx context.Context, req accountPB.SubaccountOrderSummaryRequest) (accountPB.SubaccountOrderSummaryResponse, error) { +func (c *exchangeClient) GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.SubaccountOrderSummary(ctx, &req) + res, err := c.accountClient.SubaccountOrderSummary(ctx, req) if err != nil { fmt.Println(err) - return accountPB.SubaccountOrderSummaryResponse{}, err + return &accountPB.SubaccountOrderSummaryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetOrderStates(ctx context.Context, req accountPB.OrderStatesRequest) (accountPB.OrderStatesResponse, error) { +func (c *exchangeClient) GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.OrderStates(ctx, &req) + res, err := c.accountClient.OrderStates(ctx, req) if err != nil { fmt.Println(err) - return accountPB.OrderStatesResponse{}, err + return &accountPB.OrderStatesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error) { +func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error) { req := accountPB.PortfolioRequest{ AccountAddress: accountAddress, } @@ -661,37 +663,37 @@ func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string res, err := c.accountClient.Portfolio(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.PortfolioResponse{}, err + return &accountPB.PortfolioResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetRewards(ctx context.Context, req accountPB.RewardsRequest) (accountPB.RewardsResponse, error) { +func (c *exchangeClient) GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.Rewards(ctx, &req) + res, err := c.accountClient.Rewards(ctx, req) if err != nil { fmt.Println(err) - return accountPB.RewardsResponse{}, err + return &accountPB.RewardsResponse{}, err } - return *res, nil + return res, nil } // Spot RPC -func (c *exchangeClient) GetSpotOrders(ctx context.Context, req spotExchangePB.OrdersRequest) (spotExchangePB.OrdersResponse, error) { +func (c *exchangeClient) GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Orders(ctx, &req) + res, err := c.spotExchangeClient.Orders(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.OrdersResponse{}, err + return &spotExchangePB.OrdersResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error) { +func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error) { req := spotExchangePB.OrderbookV2Request{ MarketId: marketId, } @@ -700,13 +702,13 @@ func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string res, err := c.spotExchangeClient.OrderbookV2(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.OrderbookV2Response{}, err + return &spotExchangePB.OrderbookV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error) { +func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error) { req := spotExchangePB.OrderbooksV2Request{ MarketIds: marketIds, } @@ -715,10 +717,10 @@ func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []st res, err := c.spotExchangeClient.OrderbooksV2(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.OrderbooksV2Response{}, err + return &spotExchangePB.OrderbooksV2Response{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSpotOrderbookUpdate(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error) { @@ -751,18 +753,18 @@ func (c *exchangeClient) StreamSpotOrderbookV2(ctx context.Context, marketIds [] return stream, nil } -func (c *exchangeClient) GetSpotMarkets(ctx context.Context, req spotExchangePB.MarketsRequest) (spotExchangePB.MarketsResponse, error) { +func (c *exchangeClient) GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Markets(ctx, &req) + res, err := c.spotExchangeClient.Markets(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.MarketsResponse{}, err + return &spotExchangePB.MarketsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error) { +func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error) { req := spotExchangePB.MarketRequest{ MarketId: marketId, } @@ -771,10 +773,10 @@ func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (sp res, err := c.spotExchangeClient.Market(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.MarketResponse{}, err + return &spotExchangePB.MarketResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) { @@ -792,9 +794,9 @@ func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIds []strin return stream, nil } -func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { +func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamOrders(ctx, &req) + stream, err := c.spotExchangeClient.StreamOrders(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -803,31 +805,31 @@ func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req spotExchangeP return stream, nil } -func (c *exchangeClient) GetSpotTrades(ctx context.Context, req spotExchangePB.TradesRequest) (spotExchangePB.TradesResponse, error) { +func (c *exchangeClient) GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Trades(ctx, &req) + res, err := c.spotExchangeClient.Trades(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.TradesResponse{}, err + return &spotExchangePB.TradesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotTradesV2(ctx context.Context, req spotExchangePB.TradesV2Request) (spotExchangePB.TradesV2Response, error) { +func (c *exchangeClient) GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.TradesV2(ctx, &req) + res, err := c.spotExchangeClient.TradesV2(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.TradesV2Response{}, err + return &spotExchangePB.TradesV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { +func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamTrades(ctx, &req) + stream, err := c.spotExchangeClient.StreamTrades(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -836,9 +838,9 @@ func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req spotExchangeP return stream, nil } -func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { +func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamTradesV2(ctx, &req) + stream, err := c.spotExchangeClient.StreamTradesV2(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -847,41 +849,41 @@ func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req spotExchang return stream, nil } -func (c *exchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req spotExchangePB.SubaccountOrdersListRequest) (spotExchangePB.SubaccountOrdersListResponse, error) { +func (c *exchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.SubaccountOrdersList(ctx, &req) + res, err := c.spotExchangeClient.SubaccountOrdersList(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.SubaccountOrdersListResponse{}, err + return &spotExchangePB.SubaccountOrdersListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req spotExchangePB.SubaccountTradesListRequest) (spotExchangePB.SubaccountTradesListResponse, error) { +func (c *exchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.SubaccountTradesList(ctx, &req) + res, err := c.spotExchangeClient.SubaccountTradesList(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.SubaccountTradesListResponse{}, err + return &spotExchangePB.SubaccountTradesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetHistoricalSpotOrders(ctx context.Context, req spotExchangePB.OrdersHistoryRequest) (spotExchangePB.OrdersHistoryResponse, error) { +func (c *exchangeClient) GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.OrdersHistory(ctx, &req) + res, err := c.spotExchangeClient.OrdersHistory(ctx, req) if err != nil { - return spotExchangePB.OrdersHistoryResponse{}, err + return &spotExchangePB.OrdersHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { +func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamOrdersHistory(ctx, &req) + stream, err := c.spotExchangeClient.StreamOrdersHistory(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -890,62 +892,62 @@ func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req spo return stream, nil } -func (c *exchangeClient) GetInsuranceFunds(ctx context.Context, req insurancePB.FundsRequest) (insurancePB.FundsResponse, error) { +func (c *exchangeClient) GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.insuranceClient.Funds(ctx, &req) + res, err := c.insuranceClient.Funds(ctx, req) if err != nil { fmt.Println(err) - return insurancePB.FundsResponse{}, err + return &insurancePB.FundsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetRedemptions(ctx context.Context, req insurancePB.RedemptionsRequest) (insurancePB.RedemptionsResponse, error) { +func (c *exchangeClient) GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.insuranceClient.Redemptions(ctx, &req) + res, err := c.insuranceClient.Redemptions(ctx, req) if err != nil { fmt.Println(err) - return insurancePB.RedemptionsResponse{}, err + return &insurancePB.RedemptionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) Ping(ctx context.Context, req metaPB.PingRequest) (metaPB.PingResponse, error) { +func (c *exchangeClient) Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Ping(ctx, &req) + res, err := c.metaClient.Ping(ctx, req) if err != nil { fmt.Println(err) - return metaPB.PingResponse{}, err + return &metaPB.PingResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetVersion(ctx context.Context, req metaPB.VersionRequest) (metaPB.VersionResponse, error) { +func (c *exchangeClient) GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Version(ctx, &req) + res, err := c.metaClient.Version(ctx, req) if err != nil { fmt.Println(err) - return metaPB.VersionResponse{}, err + return &metaPB.VersionResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetInfo(ctx context.Context, req metaPB.InfoRequest) (metaPB.InfoResponse, error) { +func (c *exchangeClient) GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Info(ctx, &req) + res, err := c.metaClient.Info(ctx, req) if err != nil { fmt.Println(err) - return metaPB.InfoResponse{}, err + return &metaPB.InfoResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamKeepalive(ctx context.Context) (metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) { +func (c *exchangeClient) StreamKeepalive(ctx context.Context) (*metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) { req := metaPB.StreamKeepaliveRequest{} ctx = c.getCookie(ctx) @@ -955,34 +957,34 @@ func (c *exchangeClient) StreamKeepalive(ctx context.Context) (metaPB.InjectiveM return nil, err } - return stream, nil + return &stream, nil } // Deprecated: Use GetAccountPortfolioBalances instead. -func (c *exchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error) { +func (c *exchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error) { ctx = c.getCookie(ctx) res, err := c.portfolioExchangeClient.AccountPortfolio(ctx, &portfolioExchangePB.AccountPortfolioRequest{ AccountAddress: accountAddress, }) if err != nil { fmt.Println(err) - return portfolioExchangePB.AccountPortfolioResponse{}, err + return &portfolioExchangePB.AccountPortfolioResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioBalancesResponse, error) { +func (c *exchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error) { ctx = c.getCookie(ctx) res, err := c.portfolioExchangeClient.AccountPortfolioBalances(ctx, &portfolioExchangePB.AccountPortfolioBalancesRequest{ AccountAddress: accountAddress, }) if err != nil { fmt.Println(err) - return portfolioExchangePB.AccountPortfolioBalancesResponse{}, err + return &portfolioExchangePB.AccountPortfolioBalancesResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error) { diff --git a/client/explorer/explorer.go b/client/explorer/explorer.go index e5fcef53..00c76fc6 100644 --- a/client/explorer/explorer.go +++ b/client/explorer/explorer.go @@ -3,6 +3,9 @@ package exchange import ( "context" "fmt" + + "google.golang.org/grpc/credentials/insecure" + "github.com/InjectiveLabs/sdk-go/client/common" explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb" "google.golang.org/grpc/metadata" @@ -14,21 +17,21 @@ import ( type ExplorerClient interface { QueryClient() *grpc.ClientConn - GetTxByTxHash(ctx context.Context, hash string) (explorerPB.GetTxByTxHashResponse, error) - GetTxs(ctx context.Context, req explorerPB.GetTxsRequest) (explorerPB.GetTxsResponse, error) - GetBlock(ctx context.Context, blockHeight string) (explorerPB.GetBlockResponse, error) - GetBlocks(ctx context.Context) (explorerPB.GetBlocksResponse, error) - GetAccountTxs(ctx context.Context, req explorerPB.GetAccountTxsRequest) (explorerPB.GetAccountTxsResponse, error) - GetPeggyDeposits(ctx context.Context, req explorerPB.GetPeggyDepositTxsRequest) (explorerPB.GetPeggyDepositTxsResponse, error) - GetPeggyWithdrawals(ctx context.Context, req explorerPB.GetPeggyWithdrawalTxsRequest) (explorerPB.GetPeggyWithdrawalTxsResponse, error) - GetIBCTransfers(ctx context.Context, req explorerPB.GetIBCTransferTxsRequest) (explorerPB.GetIBCTransferTxsResponse, error) + GetTxByTxHash(ctx context.Context, hash string) (*explorerPB.GetTxByTxHashResponse, error) + GetTxs(ctx context.Context, req *explorerPB.GetTxsRequest) (*explorerPB.GetTxsResponse, error) + GetBlock(ctx context.Context, blockHeight string) (*explorerPB.GetBlockResponse, error) + GetBlocks(ctx context.Context) (*explorerPB.GetBlocksResponse, error) + GetAccountTxs(ctx context.Context, req *explorerPB.GetAccountTxsRequest) (*explorerPB.GetAccountTxsResponse, error) + GetPeggyDeposits(ctx context.Context, req *explorerPB.GetPeggyDepositTxsRequest) (*explorerPB.GetPeggyDepositTxsResponse, error) + GetPeggyWithdrawals(ctx context.Context, req *explorerPB.GetPeggyWithdrawalTxsRequest) (*explorerPB.GetPeggyWithdrawalTxsResponse, error) + GetIBCTransfers(ctx context.Context, req *explorerPB.GetIBCTransferTxsRequest) (*explorerPB.GetIBCTransferTxsResponse, error) StreamTxs(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamTxsClient, error) StreamBlocks(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamBlocksClient, error) - GetWasmCodes(ctx context.Context, req explorerPB.GetWasmCodesRequest) (explorerPB.GetWasmCodesResponse, error) - GetWasmCodeByID(ctx context.Context, req explorerPB.GetWasmCodeByIDRequest) (explorerPB.GetWasmCodeByIDResponse, error) - GetWasmContracts(ctx context.Context, req explorerPB.GetWasmContractsRequest) (explorerPB.GetWasmContractsResponse, error) - GetWasmContractByAddress(ctx context.Context, req explorerPB.GetWasmContractByAddressRequest) (explorerPB.GetWasmContractByAddressResponse, error) - GetCW20Balance(ctx context.Context, req explorerPB.GetCw20BalanceRequest) (explorerPB.GetCw20BalanceResponse, error) + GetWasmCodes(ctx context.Context, req *explorerPB.GetWasmCodesRequest) (*explorerPB.GetWasmCodesResponse, error) + GetWasmCodeByID(ctx context.Context, req *explorerPB.GetWasmCodeByIDRequest) (*explorerPB.GetWasmCodeByIDResponse, error) + GetWasmContracts(ctx context.Context, req *explorerPB.GetWasmContractsRequest) (*explorerPB.GetWasmContractsResponse, error) + GetWasmContractByAddress(ctx context.Context, req *explorerPB.GetWasmContractByAddressRequest) (*explorerPB.GetWasmContractByAddressResponse, error) + GetCW20Balance(ctx context.Context, req *explorerPB.GetCw20BalanceRequest) (*explorerPB.GetCw20BalanceResponse, error) Close() } @@ -51,7 +54,7 @@ func NewExplorerClient(network common.Network, options ...common.ClientOption) ( if opts.TLSCert != nil { conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err := errors.Wrapf(err, "failed to connect to the gRPC: %s", network.ExplorerGrpcEndpoint) @@ -80,14 +83,16 @@ type explorerClient struct { conn *grpc.ClientConn logger log.Logger - sessionCookie string explorerClient explorerPB.InjectiveExplorerRPCClient } func (c *explorerClient) requestCookie() metadata.MD { var header metadata.MD req := explorerPB.GetTxsRequest{} - c.explorerClient.GetTxs(context.Background(), &req, grpc.Header(&header)) + _, err := c.explorerClient.GetTxs(context.Background(), &req, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -97,18 +102,11 @@ func (c *explorerClient) getCookie(ctx context.Context) context.Context { return metadata.AppendToOutgoingContext(ctx, "cookie", cookie) } -func (c *explorerClient) setCookie(metadata metadata.MD) { - md := metadata.Get("set-cookie") - if len(md) > 0 { - c.sessionCookie = md[0] - } -} - func (c *explorerClient) QueryClient() *grpc.ClientConn { return c.conn } -func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (explorerPB.GetTxByTxHashResponse, error) { +func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (*explorerPB.GetTxByTxHashResponse, error) { req := explorerPB.GetTxByTxHashRequest{ Hash: hash, } @@ -117,37 +115,37 @@ func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (explor res, err := c.explorerClient.GetTxByTxHash(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetTxByTxHashResponse{}, err + return &explorerPB.GetTxByTxHashResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetAccountTxs(ctx context.Context, req explorerPB.GetAccountTxsRequest) (explorerPB.GetAccountTxsResponse, error) { +func (c *explorerClient) GetAccountTxs(ctx context.Context, req *explorerPB.GetAccountTxsRequest) (*explorerPB.GetAccountTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetAccountTxs(ctx, &req) + res, err := c.explorerClient.GetAccountTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetAccountTxsResponse{}, err + return &explorerPB.GetAccountTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetBlocks(ctx context.Context) (explorerPB.GetBlocksResponse, error) { +func (c *explorerClient) GetBlocks(ctx context.Context) (*explorerPB.GetBlocksResponse, error) { req := explorerPB.GetBlocksRequest{} ctx = c.getCookie(ctx) res, err := c.explorerClient.GetBlocks(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetBlocksResponse{}, err + return &explorerPB.GetBlocksResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (explorerPB.GetBlockResponse, error) { +func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (*explorerPB.GetBlockResponse, error) { req := explorerPB.GetBlockRequest{ Id: blockHeight, } @@ -156,54 +154,54 @@ func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (expl res, err := c.explorerClient.GetBlock(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetBlockResponse{}, err + return &explorerPB.GetBlockResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetTxs(ctx context.Context, req explorerPB.GetTxsRequest) (explorerPB.GetTxsResponse, error) { +func (c *explorerClient) GetTxs(ctx context.Context, req *explorerPB.GetTxsRequest) (*explorerPB.GetTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetTxs(ctx, &req) + res, err := c.explorerClient.GetTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetTxsResponse{}, err + return &explorerPB.GetTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetPeggyDeposits(ctx context.Context, req explorerPB.GetPeggyDepositTxsRequest) (explorerPB.GetPeggyDepositTxsResponse, error) { +func (c *explorerClient) GetPeggyDeposits(ctx context.Context, req *explorerPB.GetPeggyDepositTxsRequest) (*explorerPB.GetPeggyDepositTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetPeggyDepositTxs(ctx, &req) + res, err := c.explorerClient.GetPeggyDepositTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetPeggyDepositTxsResponse{}, err + return &explorerPB.GetPeggyDepositTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetPeggyWithdrawals(ctx context.Context, req explorerPB.GetPeggyWithdrawalTxsRequest) (explorerPB.GetPeggyWithdrawalTxsResponse, error) { +func (c *explorerClient) GetPeggyWithdrawals(ctx context.Context, req *explorerPB.GetPeggyWithdrawalTxsRequest) (*explorerPB.GetPeggyWithdrawalTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetPeggyWithdrawalTxs(ctx, &req) + res, err := c.explorerClient.GetPeggyWithdrawalTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetPeggyWithdrawalTxsResponse{}, err + return &explorerPB.GetPeggyWithdrawalTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetIBCTransfers(ctx context.Context, req explorerPB.GetIBCTransferTxsRequest) (explorerPB.GetIBCTransferTxsResponse, error) { +func (c *explorerClient) GetIBCTransfers(ctx context.Context, req *explorerPB.GetIBCTransferTxsRequest) (*explorerPB.GetIBCTransferTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetIBCTransferTxs(ctx, &req) + res, err := c.explorerClient.GetIBCTransferTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetIBCTransferTxsResponse{}, err + return &explorerPB.GetIBCTransferTxsResponse{}, err } - return *res, nil + return res, nil } func (c *explorerClient) StreamTxs(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamTxsClient, error) { @@ -232,59 +230,59 @@ func (c *explorerClient) StreamBlocks(ctx context.Context) (explorerPB.Injective return stream, nil } -func (c *explorerClient) GetWasmCodes(ctx context.Context, req explorerPB.GetWasmCodesRequest) (explorerPB.GetWasmCodesResponse, error) { +func (c *explorerClient) GetWasmCodes(ctx context.Context, req *explorerPB.GetWasmCodesRequest) (*explorerPB.GetWasmCodesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmCodes(ctx, &req) + res, err := c.explorerClient.GetWasmCodes(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmCodesResponse{}, err + return &explorerPB.GetWasmCodesResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmCodeByID(ctx context.Context, req explorerPB.GetWasmCodeByIDRequest) (explorerPB.GetWasmCodeByIDResponse, error) { +func (c *explorerClient) GetWasmCodeByID(ctx context.Context, req *explorerPB.GetWasmCodeByIDRequest) (*explorerPB.GetWasmCodeByIDResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmCodeByID(ctx, &req) + res, err := c.explorerClient.GetWasmCodeByID(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmCodeByIDResponse{}, err + return &explorerPB.GetWasmCodeByIDResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmContracts(ctx context.Context, req explorerPB.GetWasmContractsRequest) (explorerPB.GetWasmContractsResponse, error) { +func (c *explorerClient) GetWasmContracts(ctx context.Context, req *explorerPB.GetWasmContractsRequest) (*explorerPB.GetWasmContractsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmContracts(ctx, &req) + res, err := c.explorerClient.GetWasmContracts(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmContractsResponse{}, err + return &explorerPB.GetWasmContractsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmContractByAddress(ctx context.Context, req explorerPB.GetWasmContractByAddressRequest) (explorerPB.GetWasmContractByAddressResponse, error) { +func (c *explorerClient) GetWasmContractByAddress(ctx context.Context, req *explorerPB.GetWasmContractByAddressRequest) (*explorerPB.GetWasmContractByAddressResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmContractByAddress(ctx, &req) + res, err := c.explorerClient.GetWasmContractByAddress(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmContractByAddressResponse{}, err + return &explorerPB.GetWasmContractByAddressResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetCW20Balance(ctx context.Context, req explorerPB.GetCw20BalanceRequest) (explorerPB.GetCw20BalanceResponse, error) { +func (c *explorerClient) GetCW20Balance(ctx context.Context, req *explorerPB.GetCw20BalanceRequest) (*explorerPB.GetCw20BalanceResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetCw20Balance(ctx, &req) + res, err := c.explorerClient.GetCw20Balance(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetCw20BalanceResponse{}, err + return &explorerPB.GetCw20BalanceResponse{}, err } - return *res, nil + return res, nil } func (c *explorerClient) Close() { diff --git a/client/metadata/assets/devnet-1.ini b/client/metadata/assets/devnet-1.ini index ea7462f8..5d4c12cb 100644 --- a/client/metadata/assets/devnet-1.ini +++ b/client/metadata/assets/devnet-1.ini @@ -255,4 +255,3 @@ decimals = 18 [USDC] peggy_denom = peggy0xdAC17F958D2ee523a2206206994597C13D831ec7 decimals = 6 - diff --git a/client/metadata/fetch_metadata.go b/client/metadata/fetch_metadata.go index 4e9d02bb..cb4f08b0 100644 --- a/client/metadata/fetch_metadata.go +++ b/client/metadata/fetch_metadata.go @@ -3,25 +3,18 @@ package main import ( "context" "fmt" + "os" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" - "os" //derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" - spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" "math" "strconv" -) -func find(slice []string, val string) bool { - for _, item := range slice { - if item == val { - return true - } - } - return false -} + spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" +) var metadataTemplate = `[%s] description = '%s %s %s' @@ -50,7 +43,7 @@ func FetchDenom(network common.Network) { // fetch spot markets spotMarketsReq := spotExchangePB.MarketsRequest{MarketStatus: "active"} ctx := context.Background() - spotRes, err := exchangeClient.GetSpotMarkets(ctx, spotMarketsReq) + spotRes, err := exchangeClient.GetSpotMarkets(ctx, &spotMarketsReq) if err != nil { panic(err) } @@ -90,7 +83,7 @@ func FetchDenom(network common.Network) { //fetch derivative markets derivativeMarketsReq := derivativeExchangePB.MarketsRequest{MarketStatus: "active"} - derivativeRes, err := exchangeClient.GetDerivativeMarkets(ctx, derivativeMarketsReq) + derivativeRes, err := exchangeClient.GetDerivativeMarkets(ctx, &derivativeMarketsReq) if err != nil { panic(err) } diff --git a/ethereum/util/amounts.go b/ethereum/util/amounts.go index b195b404..1435beaa 100644 --- a/ethereum/util/amounts.go +++ b/ethereum/util/amounts.go @@ -27,11 +27,11 @@ func (w *Wei) Scan(v interface{}) error { return nil } var source string - switch v.(type) { + switch value := v.(type) { case string: - source = v.(string) + source = value case []byte: - source = string(v.([]byte)) + source = string(value) default: return fmt.Errorf("incompatible type for decimal.Decimal: %T", v) } diff --git a/examples/chain/0_LocalOrderHash/example.go b/examples/chain/0_LocalOrderHash/example.go index aee0e24d..3d875458 100644 --- a/examples/chain/0_LocalOrderHash/example.go +++ b/examples/chain/0_LocalOrderHash/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" "github.com/InjectiveLabs/sdk-go/client" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go b/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go index 0f422a64..f5c395c6 100644 --- a/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go +++ b/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" diff --git a/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go b/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go index 21782db9..0b6d7882 100644 --- a/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go +++ b/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go b/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go index 6275ec78..bdab45c9 100644 --- a/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go +++ b/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/13_MsgIncreasePositionMargin/example.go b/examples/chain/13_MsgIncreasePositionMargin/example.go index 9f7be080..3fa058aa 100644 --- a/examples/chain/13_MsgIncreasePositionMargin/example.go +++ b/examples/chain/13_MsgIncreasePositionMargin/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" diff --git a/examples/chain/17_MsgBatchUpdateOrders/example.go b/examples/chain/17_MsgBatchUpdateOrders/example.go index b2b73123..92dd3c8b 100644 --- a/examples/chain/17_MsgBatchUpdateOrders/example.go +++ b/examples/chain/17_MsgBatchUpdateOrders/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/19_MsgGrant/example.go b/examples/chain/19_MsgGrant/example.go index b5c3f96f..618f8a85 100644 --- a/examples/chain/19_MsgGrant/example.go +++ b/examples/chain/19_MsgGrant/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/1_MsgSend/example.go b/examples/chain/1_MsgSend/example.go index eee926cb..c28ec491 100644 --- a/examples/chain/1_MsgSend/example.go +++ b/examples/chain/1_MsgSend/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/28_BankBalances/example.go b/examples/chain/28_BankBalances/example.go index 48975525..70547abd 100644 --- a/examples/chain/28_BankBalances/example.go +++ b/examples/chain/28_BankBalances/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/2_MsgDeposit/example.go b/examples/chain/2_MsgDeposit/example.go index 7b823b79..538f004e 100644 --- a/examples/chain/2_MsgDeposit/example.go +++ b/examples/chain/2_MsgDeposit/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" sdktypes "github.com/cosmos/cosmos-sdk/types" diff --git a/examples/chain/33_GetBlock/example.go b/examples/chain/33_GetBlock/example.go index a0e70672..35e195dd 100644 --- a/examples/chain/33_GetBlock/example.go +++ b/examples/chain/33_GetBlock/example.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" tmclient "github.com/InjectiveLabs/sdk-go/client/tm" ) diff --git a/examples/chain/37_DecodeTx/37_decode_tx.go b/examples/chain/37_DecodeTx/37_decode_tx.go index b444eb18..f72f564c 100644 --- a/examples/chain/37_DecodeTx/37_decode_tx.go +++ b/examples/chain/37_DecodeTx/37_decode_tx.go @@ -3,6 +3,7 @@ package main import ( "encoding/base64" "fmt" + cosmostxpb "github.com/cosmos/cosmos-sdk/types/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) diff --git a/examples/chain/3_MsgCreateSpotLimitOrder/example.go b/examples/chain/3_MsgCreateSpotLimitOrder/example.go index dd3bd3f0..3873604c 100644 --- a/examples/chain/3_MsgCreateSpotLimitOrder/example.go +++ b/examples/chain/3_MsgCreateSpotLimitOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/40_ChainStream/example.go b/examples/chain/40_ChainStream/example.go index 21935caf..c0413d92 100644 --- a/examples/chain/40_ChainStream/example.go +++ b/examples/chain/40_ChainStream/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + chainStreamModule "github.com/InjectiveLabs/sdk-go/chain/stream/types" "github.com/InjectiveLabs/sdk-go/client" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/41_BroadcastMsgWithoutSimulation/example.go b/examples/chain/41_BroadcastMsgWithoutSimulation/example.go index 0ac4e18e..ff1031e7 100644 --- a/examples/chain/41_BroadcastMsgWithoutSimulation/example.go +++ b/examples/chain/41_BroadcastMsgWithoutSimulation/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" + "os" + "github.com/InjectiveLabs/sdk-go/client/common" "github.com/google/uuid" "github.com/shopspring/decimal" - "os" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/4_MsgCreateSpotMarketOrder/example.go b/examples/chain/4_MsgCreateSpotMarketOrder/example.go index 9fbb8fa9..7136a747 100644 --- a/examples/chain/4_MsgCreateSpotMarketOrder/example.go +++ b/examples/chain/4_MsgCreateSpotMarketOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/5_MsgCancelSpotOrder/example.go b/examples/chain/5_MsgCancelSpotOrder/example.go index 6ed6b5c2..7d8165ce 100644 --- a/examples/chain/5_MsgCancelSpotOrder/example.go +++ b/examples/chain/5_MsgCancelSpotOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" diff --git a/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go b/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go index 3ef69f5d..b69518fb 100644 --- a/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go +++ b/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go b/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go index 6bd93c67..3d5201e9 100644 --- a/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go +++ b/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/google/uuid" "os" "time" + "github.com/google/uuid" + "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/8_MsgCancelDerivativeOrder/example.go b/examples/chain/8_MsgCancelDerivativeOrder/example.go index 7e7cc342..8624ad0c 100644 --- a/examples/chain/8_MsgCancelDerivativeOrder/example.go +++ b/examples/chain/8_MsgCancelDerivativeOrder/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" diff --git a/examples/chain/9_MsgBatchCancelSpotOrders/example.go b/examples/chain/9_MsgBatchCancelSpotOrders/example.go index 485f3357..3b62bb4e 100644 --- a/examples/chain/9_MsgBatchCancelSpotOrders/example.go +++ b/examples/chain/9_MsgBatchCancelSpotOrders/example.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/InjectiveLabs/sdk-go/client" "os" "time" + "github.com/InjectiveLabs/sdk-go/client" + "github.com/InjectiveLabs/sdk-go/client/common" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" diff --git a/examples/exchange/accounts/5_SubaccountHistory/example.go b/examples/exchange/accounts/5_SubaccountHistory/example.go index b8b54798..8dc67c4a 100644 --- a/examples/exchange/accounts/5_SubaccountHistory/example.go +++ b/examples/exchange/accounts/5_SubaccountHistory/example.go @@ -32,7 +32,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountHistory(ctx, req) + res, err := exchangeClient.GetSubaccountHistory(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/6_SubaccountOrderSummary/example.go b/examples/exchange/accounts/6_SubaccountOrderSummary/example.go index 01176ee3..bc8da227 100644 --- a/examples/exchange/accounts/6_SubaccountOrderSummary/example.go +++ b/examples/exchange/accounts/6_SubaccountOrderSummary/example.go @@ -27,7 +27,7 @@ func main() { OrderDirection: orderDirection, } - res, err := exchangeClient.GetSubaccountOrderSummary(ctx, req) + res, err := exchangeClient.GetSubaccountOrderSummary(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/7_OrderStates/example.go b/examples/exchange/accounts/7_OrderStates/example.go index 1db56f65..f6b849da 100644 --- a/examples/exchange/accounts/7_OrderStates/example.go +++ b/examples/exchange/accounts/7_OrderStates/example.go @@ -26,7 +26,7 @@ func main() { DerivativeOrderHashes: derivativeOrderHashes, } - res, err := exchangeClient.GetOrderStates(ctx, req) + res, err := exchangeClient.GetOrderStates(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/9_Rewards/example.go b/examples/exchange/accounts/9_Rewards/example.go index af024703..3cdc0330 100644 --- a/examples/exchange/accounts/9_Rewards/example.go +++ b/examples/exchange/accounts/9_Rewards/example.go @@ -26,7 +26,7 @@ func main() { AccountAddress: accountAddress, } - res, err := exchangeClient.GetRewards(ctx, req) + res, err := exchangeClient.GetRewards(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/derivatives/10_StreamPositions/example.go b/examples/exchange/derivatives/10_StreamPositions/example.go index 23f38139..af23ee70 100644 --- a/examples/exchange/derivatives/10_StreamPositions/example.go +++ b/examples/exchange/derivatives/10_StreamPositions/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativePositions(ctx, req) + stream, err := exchangeClient.StreamDerivativePositions(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/11_StreamOrders/example.go b/examples/exchange/derivatives/11_StreamOrders/example.go index 393bc86b..245d6f69 100644 --- a/examples/exchange/derivatives/11_StreamOrders/example.go +++ b/examples/exchange/derivatives/11_StreamOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, OrderSide: orderSide, } - stream, err := exchangeClient.StreamDerivativeOrders(ctx, req) + stream, err := exchangeClient.StreamDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/12_Trades/example.go b/examples/exchange/derivatives/12_Trades/example.go index 7b87b301..afa45715 100644 --- a/examples/exchange/derivatives/12_Trades/example.go +++ b/examples/exchange/derivatives/12_Trades/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeTrades(ctx, req) + res, err := exchangeClient.GetDerivativeTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/13_StreamTrades/example.go b/examples/exchange/derivatives/13_StreamTrades/example.go index a94c49f7..02239ad5 100644 --- a/examples/exchange/derivatives/13_StreamTrades/example.go +++ b/examples/exchange/derivatives/13_StreamTrades/example.go @@ -26,7 +26,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativeTrades(ctx, req) + stream, err := exchangeClient.StreamDerivativeTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/14_SubaccountOrdersList/example.go b/examples/exchange/derivatives/14_SubaccountOrdersList/example.go index c8cd6db6..0177193e 100644 --- a/examples/exchange/derivatives/14_SubaccountOrdersList/example.go +++ b/examples/exchange/derivatives/14_SubaccountOrdersList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountDerivativeOrdersList(ctx, req) + res, err := exchangeClient.GetSubaccountDerivativeOrdersList(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/15_SubaccountTradesList/example.go b/examples/exchange/derivatives/15_SubaccountTradesList/example.go index 2b8a1d04..2bf30a1e 100644 --- a/examples/exchange/derivatives/15_SubaccountTradesList/example.go +++ b/examples/exchange/derivatives/15_SubaccountTradesList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountDerivativeTradesList(ctx, req) + res, err := exchangeClient.GetSubaccountDerivativeTradesList(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/16_FundingPayments/example.go b/examples/exchange/derivatives/16_FundingPayments/example.go index d1d960e0..8aa286c9 100644 --- a/examples/exchange/derivatives/16_FundingPayments/example.go +++ b/examples/exchange/derivatives/16_FundingPayments/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeFundingPayments(ctx, req) + res, err := exchangeClient.GetDerivativeFundingPayments(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/17_FundingRates/example.go b/examples/exchange/derivatives/17_FundingRates/example.go index 53c799af..0512f91a 100644 --- a/examples/exchange/derivatives/17_FundingRates/example.go +++ b/examples/exchange/derivatives/17_FundingRates/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, } - res, err := exchangeClient.GetDerivativeFundingRates(ctx, req) + res, err := exchangeClient.GetDerivativeFundingRates(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/18_HistoricalOrders/example.go b/examples/exchange/derivatives/18_HistoricalOrders/example.go index 2b39b069..718b6c00 100644 --- a/examples/exchange/derivatives/18_HistoricalOrders/example.go +++ b/examples/exchange/derivatives/18_HistoricalOrders/example.go @@ -32,7 +32,7 @@ func main() { IsConditional: isConditional, } - res, err := exchangeClient.GetHistoricalDerivativeOrders(ctx, req) + res, err := exchangeClient.GetHistoricalDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go b/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go index e3260f6c..3c49b01d 100644 --- a/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go +++ b/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, Direction: direction, } - stream, err := exchangeClient.StreamHistoricalDerivativeOrders(ctx, req) + stream, err := exchangeClient.StreamHistoricalDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/20_LiquidablePositions/example.go b/examples/exchange/derivatives/20_LiquidablePositions/example.go index 0759019a..3b28112d 100644 --- a/examples/exchange/derivatives/20_LiquidablePositions/example.go +++ b/examples/exchange/derivatives/20_LiquidablePositions/example.go @@ -28,7 +28,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativeLiquidablePositions(ctx, req) + res, err := exchangeClient.GetDerivativeLiquidablePositions(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/21_TradesV2/example.go b/examples/exchange/derivatives/21_TradesV2/example.go index eff34442..50be9292 100644 --- a/examples/exchange/derivatives/21_TradesV2/example.go +++ b/examples/exchange/derivatives/21_TradesV2/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeTradesV2(ctx, req) + res, err := exchangeClient.GetDerivativeTradesV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/22_StreamTradesV2/example.go b/examples/exchange/derivatives/22_StreamTradesV2/example.go index e771be2f..3d78df5d 100644 --- a/examples/exchange/derivatives/22_StreamTradesV2/example.go +++ b/examples/exchange/derivatives/22_StreamTradesV2/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativeV2Trades(ctx, req) + stream, err := exchangeClient.StreamDerivativeV2Trades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/2_Markets/example.go b/examples/exchange/derivatives/2_Markets/example.go index c4654980..97618d7a 100644 --- a/examples/exchange/derivatives/2_Markets/example.go +++ b/examples/exchange/derivatives/2_Markets/example.go @@ -27,7 +27,7 @@ func main() { QuoteDenom: quoteDenom, } - res, err := exchangeClient.GetDerivativeMarkets(ctx, req) + res, err := exchangeClient.GetDerivativeMarkets(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/8_Positions/example.go b/examples/exchange/derivatives/8_Positions/example.go index b3ec5878..3b11e289 100644 --- a/examples/exchange/derivatives/8_Positions/example.go +++ b/examples/exchange/derivatives/8_Positions/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativePositionsV2(ctx, req) + res, err := exchangeClient.GetDerivativePositionsV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/9_Orders/example.go b/examples/exchange/derivatives/9_Orders/example.go index 30d07946..824ebd28 100644 --- a/examples/exchange/derivatives/9_Orders/example.go +++ b/examples/exchange/derivatives/9_Orders/example.go @@ -29,7 +29,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativeOrders(ctx, req) + res, err := exchangeClient.GetDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/insurance/1_InsuranceFunds/example.go b/examples/exchange/insurance/1_InsuranceFunds/example.go index 83fde460..ec55943b 100644 --- a/examples/exchange/insurance/1_InsuranceFunds/example.go +++ b/examples/exchange/insurance/1_InsuranceFunds/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" insurancePB "github.com/InjectiveLabs/sdk-go/exchange/insurance_rpc/pb" @@ -21,7 +22,7 @@ func main() { req := insurancePB.FundsRequest{} - res, err := exchangeClient.GetInsuranceFunds(ctx, req) + res, err := exchangeClient.GetInsuranceFunds(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/insurance/2_Redemptions/example.go b/examples/exchange/insurance/2_Redemptions/example.go index 4f36e7d3..d9de971a 100644 --- a/examples/exchange/insurance/2_Redemptions/example.go +++ b/examples/exchange/insurance/2_Redemptions/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" insurancePB "github.com/InjectiveLabs/sdk-go/exchange/insurance_rpc/pb" @@ -21,7 +22,7 @@ func main() { req := insurancePB.RedemptionsRequest{} - res, err := exchangeClient.GetRedemptions(ctx, req) + res, err := exchangeClient.GetRedemptions(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/1_Ping/example.go b/examples/exchange/meta/1_Ping/example.go index cc0ff1ab..342cd9b7 100644 --- a/examples/exchange/meta/1_Ping/example.go +++ b/examples/exchange/meta/1_Ping/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.PingRequest{} - res, err := exchangeClient.Ping(ctx, req) + res, err := exchangeClient.Ping(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/2_Version/example.go b/examples/exchange/meta/2_Version/example.go index 7f83badf..cc29a71e 100644 --- a/examples/exchange/meta/2_Version/example.go +++ b/examples/exchange/meta/2_Version/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.VersionRequest{} - res, err := exchangeClient.GetVersion(ctx, req) + res, err := exchangeClient.GetVersion(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/3_Info/example.go b/examples/exchange/meta/3_Info/example.go index edda9480..535c170d 100644 --- a/examples/exchange/meta/3_Info/example.go +++ b/examples/exchange/meta/3_Info/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.InfoRequest{} - res, err := exchangeClient.GetInfo(ctx, req) + res, err := exchangeClient.GetInfo(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/4_StreamKeepAlive/example.go b/examples/exchange/meta/4_StreamKeepAlive/example.go index 6731ed39..64c4c958 100644 --- a/examples/exchange/meta/4_StreamKeepAlive/example.go +++ b/examples/exchange/meta/4_StreamKeepAlive/example.go @@ -29,7 +29,7 @@ func main() { case <-ctx.Done(): return default: - res, err := stream.Recv() + res, err := (*stream).Recv() if err != nil { fmt.Println(err) return diff --git a/examples/exchange/oracle/2_Price/example.go b/examples/exchange/oracle/2_Price/example.go index 80acbf9e..bc1be02b 100644 --- a/examples/exchange/oracle/2_Price/example.go +++ b/examples/exchange/oracle/2_Price/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" ) diff --git a/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go b/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go index 66763a29..4b6d9434 100644 --- a/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go +++ b/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/exchange/spot/10_StreamTrades/example.go b/examples/exchange/spot/10_StreamTrades/example.go index c61e0cf5..91eeb7ae 100644 --- a/examples/exchange/spot/10_StreamTrades/example.go +++ b/examples/exchange/spot/10_StreamTrades/example.go @@ -26,7 +26,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamSpotTrades(ctx, req) + stream, err := exchangeClient.StreamSpotTrades(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/11_SubaccountOrdersList/example.go b/examples/exchange/spot/11_SubaccountOrdersList/example.go index 33c924ce..ea10cf9b 100644 --- a/examples/exchange/spot/11_SubaccountOrdersList/example.go +++ b/examples/exchange/spot/11_SubaccountOrdersList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountSpotOrdersList(ctx, req) + res, err := exchangeClient.GetSubaccountSpotOrdersList(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/12_SubaccountTradesList/example.go b/examples/exchange/spot/12_SubaccountTradesList/example.go index 5ce30b0e..3c13bc97 100644 --- a/examples/exchange/spot/12_SubaccountTradesList/example.go +++ b/examples/exchange/spot/12_SubaccountTradesList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountSpotTradesList(ctx, req) + res, err := exchangeClient.GetSubaccountSpotTradesList(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/14_HistoricalOrders/example.go b/examples/exchange/spot/14_HistoricalOrders/example.go index 027855c3..288781b3 100644 --- a/examples/exchange/spot/14_HistoricalOrders/example.go +++ b/examples/exchange/spot/14_HistoricalOrders/example.go @@ -32,7 +32,7 @@ func main() { OrderTypes: orderTypes, } - res, err := exchangeClient.GetHistoricalSpotOrders(ctx, req) + res, err := exchangeClient.GetHistoricalSpotOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/15_StreamHistoricalOrders/example.go b/examples/exchange/spot/15_StreamHistoricalOrders/example.go index 0cfcf4c8..45c59723 100644 --- a/examples/exchange/spot/15_StreamHistoricalOrders/example.go +++ b/examples/exchange/spot/15_StreamHistoricalOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, Direction: direction, } - stream, err := exchangeClient.StreamHistoricalSpotOrders(ctx, req) + stream, err := exchangeClient.StreamHistoricalSpotOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/16_TradesV2/example.go b/examples/exchange/spot/16_TradesV2/example.go index c4bf53cc..851dee00 100644 --- a/examples/exchange/spot/16_TradesV2/example.go +++ b/examples/exchange/spot/16_TradesV2/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetSpotTradesV2(ctx, req) + res, err := exchangeClient.GetSpotTradesV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/17_StreamTradesV2/example.go b/examples/exchange/spot/17_StreamTradesV2/example.go index 02a086a3..d81e88ec 100644 --- a/examples/exchange/spot/17_StreamTradesV2/example.go +++ b/examples/exchange/spot/17_StreamTradesV2/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamSpotTradesV2(ctx, req) + stream, err := exchangeClient.StreamSpotTradesV2(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/2_Markets/example.go b/examples/exchange/spot/2_Markets/example.go index dbfb3e45..928cca41 100644 --- a/examples/exchange/spot/2_Markets/example.go +++ b/examples/exchange/spot/2_Markets/example.go @@ -27,7 +27,7 @@ func main() { QuoteDenom: quoteDenom, } - res, err := exchangeClient.GetSpotMarkets(ctx, req) + res, err := exchangeClient.GetSpotMarkets(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/5_Orders/example.go b/examples/exchange/spot/5_Orders/example.go index 4aca678d..20ca209f 100644 --- a/examples/exchange/spot/5_Orders/example.go +++ b/examples/exchange/spot/5_Orders/example.go @@ -12,7 +12,7 @@ import ( func main() { //network := common.LoadNetwork("mainnet", "k8s") - network := common.LoadNetwork("testnet", "lb") + network := common.LoadNetwork("mainnet", "lb") exchangeClient, err := exchangeclient.NewExchangeClient(network) if err != nil { fmt.Println(err) @@ -29,7 +29,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSpotOrders(ctx, req) + res, err := exchangeClient.GetSpotOrders(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/6_Trades/example.go b/examples/exchange/spot/6_Trades/example.go index 655146d2..9fce3efc 100644 --- a/examples/exchange/spot/6_Trades/example.go +++ b/examples/exchange/spot/6_Trades/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetSpotTrades(ctx, req) + res, err := exchangeClient.GetSpotTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/9_StreamOrders/example.go b/examples/exchange/spot/9_StreamOrders/example.go index 1f83acf8..65ff75b1 100644 --- a/examples/exchange/spot/9_StreamOrders/example.go +++ b/examples/exchange/spot/9_StreamOrders/example.go @@ -28,7 +28,7 @@ func main() { SubaccountId: subaccountId, OrderSide: orderSide, } - stream, err := exchangeClient.StreamSpotOrders(ctx, req) + stream, err := exchangeClient.StreamSpotOrders(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/10_IBCTransfers/example.go b/examples/explorer/10_IBCTransfers/example.go index d17ad7ff..ad3a08dc 100644 --- a/examples/explorer/10_IBCTransfers/example.go +++ b/examples/explorer/10_IBCTransfers/example.go @@ -25,7 +25,7 @@ func main() { Receiver: receiver, } - res, err := explorerClient.GetIBCTransfers(ctx, req) + res, err := explorerClient.GetIBCTransfers(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/11_GetWasmCodes/example.go b/examples/explorer/11_GetWasmCodes/example.go index b2e47810..ea298b34 100644 --- a/examples/explorer/11_GetWasmCodes/example.go +++ b/examples/explorer/11_GetWasmCodes/example.go @@ -24,7 +24,7 @@ func main() { Limit: 10, } - res, err := explorerClient.GetWasmCodes(ctx, req) + res, err := explorerClient.GetWasmCodes(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/12_GetWasmCodeById/example.go b/examples/explorer/12_GetWasmCodeById/example.go index 26a92ba3..b8b932fa 100644 --- a/examples/explorer/12_GetWasmCodeById/example.go +++ b/examples/explorer/12_GetWasmCodeById/example.go @@ -24,7 +24,7 @@ func main() { CodeId: 10, } - res, err := explorerClient.GetWasmCodeByID(ctx, req) + res, err := explorerClient.GetWasmCodeByID(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/13_GetWasmContracts/example.go b/examples/explorer/13_GetWasmContracts/example.go index d4153e2f..33f7df07 100644 --- a/examples/explorer/13_GetWasmContracts/example.go +++ b/examples/explorer/13_GetWasmContracts/example.go @@ -22,7 +22,7 @@ func main() { req := explorerPB.GetWasmContractsRequest{} - res, err := explorerClient.GetWasmContracts(ctx, req) + res, err := explorerClient.GetWasmContracts(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/14_GetWasmContractByAddress/example.go b/examples/explorer/14_GetWasmContractByAddress/example.go index 5c142671..d3a880c2 100644 --- a/examples/explorer/14_GetWasmContractByAddress/example.go +++ b/examples/explorer/14_GetWasmContractByAddress/example.go @@ -23,7 +23,7 @@ func main() { req := explorerPB.GetWasmContractByAddressRequest{ ContractAddress: "inj1ru9nhdjtjtz8u8wrwxmcl9zsns4fh2838yr5ga", } - res, err := explorerClient.GetWasmContractByAddress(ctx, req) + res, err := explorerClient.GetWasmContractByAddress(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/15_GetCW20Balance/example.go b/examples/explorer/15_GetCW20Balance/example.go index 6a82495e..da38564d 100644 --- a/examples/explorer/15_GetCW20Balance/example.go +++ b/examples/explorer/15_GetCW20Balance/example.go @@ -23,7 +23,7 @@ func main() { req := explorerPB.GetCw20BalanceRequest{ Address: "inj1dc6rrxhfjaxexzdcrec5w3ryl4jn6x5t7t9j3z", } - res, err := explorerClient.GetCW20Balance(ctx, req) + res, err := explorerClient.GetCW20Balance(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/2_AccountTxs/example.go b/examples/explorer/2_AccountTxs/example.go index 8bce4684..3bbb56dc 100644 --- a/examples/explorer/2_AccountTxs/example.go +++ b/examples/explorer/2_AccountTxs/example.go @@ -27,7 +27,7 @@ func main() { } ctx := context.Background() - res, err := explorerClient.GetAccountTxs(ctx, req) + res, err := explorerClient.GetAccountTxs(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/5_TxsRequest/example.go b/examples/explorer/5_TxsRequest/example.go index 8ebbe1a2..dd57bfe8 100644 --- a/examples/explorer/5_TxsRequest/example.go +++ b/examples/explorer/5_TxsRequest/example.go @@ -26,7 +26,7 @@ func main() { Before: before, } - res, err := explorerClient.GetTxs(ctx, req) + res, err := explorerClient.GetTxs(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/8_PeggyDeposits/example.go b/examples/explorer/8_PeggyDeposits/example.go index 9cd17c67..bd00e9e1 100644 --- a/examples/explorer/8_PeggyDeposits/example.go +++ b/examples/explorer/8_PeggyDeposits/example.go @@ -26,7 +26,7 @@ func main() { Receiver: receiver, } - res, err := explorerClient.GetPeggyDeposits(ctx, req) + res, err := explorerClient.GetPeggyDeposits(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/9_PeggyWithdrawals/example.go b/examples/explorer/9_PeggyWithdrawals/example.go index f7d221d4..d6284f5a 100644 --- a/examples/explorer/9_PeggyWithdrawals/example.go +++ b/examples/explorer/9_PeggyWithdrawals/example.go @@ -25,7 +25,7 @@ func main() { Sender: sender, } - res, err := explorerClient.GetPeggyWithdrawals(ctx, req) + res, err := explorerClient.GetPeggyWithdrawals(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/go.mod b/go.mod index 3bf80764..6ca3a336 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.0.1 github.com/ethereum/go-ethereum v1.11.5 + github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.4.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/olekukonko/tablewriter v0.0.5 @@ -85,7 +86,6 @@ require ( github.com/gofrs/uuid v4.3.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.1.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect From 4eb212d9051a7581c37c36f61541cb98bb156917 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:35:35 -0300 Subject: [PATCH 02/13] (feat) Added GitHub workflow to run pre-commit for PRs and when pushing to master and dev --- .github/workflows/pre-commit.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..7b4efc6e --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit +on: + pull_request: + push: + branches: [master, dev] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: actions/setup-go@v3 + - run: go install golang.org/x/tools/cmd/goimports@latest + - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 + - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV + - uses: pre-commit/action@v2.0.2 From e8126fe0be5a921db376bc02d3e8b3974879397e Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:48:55 -0300 Subject: [PATCH 03/13] (fix) Fix pre-commit configuration --- .github/workflows/pre-commit.yml | 2 +- .pre-commit-config.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7b4efc6e..ba4a3f6b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 - run: go install golang.org/x/tools/cmd/goimports@latest - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c8d4cf5..f35e0ca6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,4 @@ repos: - id: go-fmt - id: go-imports - id: golangci-lint + args: [--timeout=15m] From 8443d0b9e4bcd0ba991e572ca27839a573034ec0 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 18:21:57 -0300 Subject: [PATCH 04/13] (fix) Fix pre-commit configuration --- .github/workflows/pre-commit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ba4a3f6b..e822c838 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -8,10 +8,12 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - uses: actions/setup-python@v4 - uses: actions/setup-go@v5 + with: + go-version: 1.19 - run: go install golang.org/x/tools/cmd/goimports@latest - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV + - uses: actions/checkout@v3 - uses: pre-commit/action@v2.0.2 From bce2da2c8b7d3add32b33796ac747d54fe33775d Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 22 Dec 2023 00:23:35 -0300 Subject: [PATCH 05/13] (feat) Added GitHub workflow to run tests and calculate coverage --- .github/workflows/run-tests.yml | 20 ++++++++++++++++++++ .gitignore | 1 + Makefile | 7 ++++++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..c95973fc --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,20 @@ +name: run-tests +on: + pull_request: + push: + branches: [ master, dev ] + +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + - uses: actions/setup-go@v5 + with: + go-version: 1.19 + - name: Run test and calculate coverage + run: make coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index 23bbb47f..8f38a601 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .idea/ .chain_cookie .exchange_cookie +coverage.out diff --git a/Makefile b/Makefile index a0ceca7c..627437a9 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ copy-exchange-client: cp -r ../injective-indexer/api/gen/grpc/injective_derivative_exchange_rpc/pb exchange/derivative_exchange_rpc/pb cp -r ../injective-indexer/api/gen/grpc/injective_portfolio_rpc/pb exchange/portfolio_rpc/pb -.PHONY: copy-exchange-client +.PHONY: copy-exchange-client tests coverage copy-chain-types: cp ../injective-core/injective-chain/types/*.go chain/types @@ -53,3 +53,8 @@ copy-chain-types: echo "👉 Replace injective-core/injective-chain/modules with sdk-go/chain" echo "👉 Replace injective-core/injective-chain/types with sdk-go/chain/types" echo "👉 Replace injective-core/injective-chain/crypto with sdk-go/chain/crypto" + +tests: + go test -race ./client/... ./ethereum/... +coverage: + go test -race -coverprofile=coverage.out -covermode=atomic ./client/... ./ethereum/... From 4170d7f6a0e46ae8ebb3f4ebbee2af5108e44c46 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 22 Dec 2023 00:36:35 -0300 Subject: [PATCH 06/13] (feat) Added Codecov badge in README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 32653a09..1ab21609 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Injective Protocol Golang SDK 🌟 +[![codecov](https://codecov.io/gh/InjectiveLabs/sdk-go/graph/badge.svg?token=XDGZV265EE)](https://codecov.io/gh/InjectiveLabs/sdk-go) + --- ## 📚 Getting Started From a170f1f201accdacca465481a68514491b7c4b9d Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:15:03 -0300 Subject: [PATCH 07/13] (feat) Added configuration for pre-commit. Solved all issues found by pre-commit stepts, including golangci-lint --- .gitignore | 1 + .pre-commit-config.yaml | 19 + LICENSE.md | 2 +- NOTICE.md | 2 +- README.md | 2 +- chain/auction/types/auction.pb.go | 7 +- chain/auction/types/genesis.pb.go | 5 +- chain/auction/types/query.pb.go | 7 +- chain/auction/types/tx.pb.go | 7 +- chain/crypto/ethsecp256k1/keys.pb.go | 5 +- chain/exchange/types/authz.pb.go | 5 +- chain/exchange/types/events.pb.go | 7 +- chain/exchange/types/exchange.pb.go | 7 +- chain/exchange/types/genesis.pb.go | 7 +- chain/exchange/types/proposal.pb.go | 7 +- chain/exchange/types/query.pb.go | 7 +- chain/exchange/types/tx.pb.go | 7 +- chain/exchange/types/wasm_maker_contract.go | 4 +- chain/insurance/types/genesis.pb.go | 5 +- chain/insurance/types/insurance.pb.go | 9 +- chain/insurance/types/query.pb.go | 7 +- chain/insurance/types/tx.pb.go | 7 +- chain/ocr/types/genesis.pb.go | 7 +- chain/ocr/types/ocr.pb.go | 9 +- chain/ocr/types/query.pb.go | 7 +- chain/ocr/types/tx.pb.go | 7 +- chain/oracle/types/events.pb.go | 7 +- chain/oracle/types/genesis.pb.go | 5 +- chain/oracle/types/oracle.pb.go | 7 +- chain/oracle/types/proposal.pb.go | 7 +- chain/oracle/types/query.pb.go | 7 +- chain/oracle/types/tx.pb.go | 7 +- chain/peggy/types/attestation.pb.go | 7 +- chain/peggy/types/batch.pb.go | 3 +- chain/peggy/types/ethereum_signer.pb.go | 3 +- chain/peggy/types/events.pb.go | 7 +- chain/peggy/types/genesis.pb.go | 7 +- chain/peggy/types/msgs.pb.go | 7 +- chain/peggy/types/params.pb.go | 7 +- chain/peggy/types/pool.pb.go | 7 +- chain/peggy/types/proposal.pb.go | 7 +- chain/peggy/types/query.pb.go | 7 +- chain/peggy/types/types.pb.go | 7 +- chain/stream/types/query.pb.go | 7 +- .../types/authorityMetadata.pb.go | 7 +- chain/tokenfactory/types/events.pb.go | 7 +- chain/tokenfactory/types/genesis.pb.go | 5 +- chain/tokenfactory/types/params.pb.go | 7 +- chain/tokenfactory/types/query.pb.go | 7 +- chain/tokenfactory/types/tx.pb.go | 7 +- chain/types/account.pb.go | 7 +- chain/types/tx_ext.pb.go | 5 +- chain/types/tx_response.pb.go | 3 +- chain/wasmx/types/events.pb.go | 5 +- chain/wasmx/types/genesis.pb.go | 5 +- chain/wasmx/types/proposal.pb.go | 7 +- chain/wasmx/types/query.pb.go | 7 +- chain/wasmx/types/tx.pb.go | 7 +- chain/wasmx/types/wasmx.pb.go | 5 +- client/chain/chain.go | 67 ++- client/chain/chain_test.go | 5 +- client/common/embeded.go | 6 +- client/common/network.go | 12 +- client/common/network_test.go | 3 +- client/common/util.go | 8 +- client/core/market_test.go | 3 +- client/core/markets_assistant.go | 23 +- client/core/markets_assistant_test.go | 15 +- client/core/markets_assistant_test_support.go | 215 ++++---- client/core/token_test.go | 3 +- client/exchange/exchange.go | 482 +++++++++--------- client/explorer/explorer.go | 142 +++--- client/metadata/assets/devnet-1.ini | 1 - client/metadata/fetch_metadata.go | 19 +- ethereum/util/amounts.go | 6 +- examples/chain/0_LocalOrderHash/example.go | 5 +- .../example.go | 5 +- .../example.go | 5 +- .../example.go | 5 +- .../13_MsgIncreasePositionMargin/example.go | 5 +- examples/chain/15_MsgWithdraw/example.go | 5 +- .../chain/16_MsgSubaccountTransfer/example.go | 5 +- .../chain/17_MsgBatchUpdateOrders/example.go | 5 +- examples/chain/18_MsgBid/example.go | 5 +- examples/chain/19_MsgGrant/example.go | 5 +- examples/chain/1_MsgSend/example.go | 5 +- examples/chain/20_MsgExec/example.go | 5 +- examples/chain/21_MsgRevoke/example.go | 5 +- examples/chain/22_MsgSendToEth/example.go | 5 +- .../23_MsgRelayPriceFeedPrice/example.go | 5 +- examples/chain/24_MsgRegisterAsDMM/example.go | 5 +- examples/chain/25_MsgDelegate/example.go | 5 +- .../26_MsgWithdrawDelegatorReward/example.go | 5 +- examples/chain/27_QueryAuthzGrants/example.go | 1 + examples/chain/28_BankBalances/example.go | 1 + examples/chain/29_BankBalance/example.go | 1 + examples/chain/2_MsgDeposit/example.go | 5 +- .../chain/30_MsgExternalTransfer/example.go | 5 +- examples/chain/31_MsgMultiSend/example.go | 5 +- examples/chain/33_GetBlock/example.go | 1 + examples/chain/34_OfflineSigning/example.go | 5 +- .../chain/35_StreamEventOrderFail/example.go | 1 + .../36_StreamEventOrderbookUpdate/example.go | 1 + examples/chain/37_DecodeTx/37_decode_tx.go | 1 + examples/chain/38_MsgLiquidate/example.go | 5 +- examples/chain/39_GetTx/example.go | 5 +- .../3_MsgCreateSpotLimitOrder/example.go | 5 +- examples/chain/40_ChainStream/example.go | 1 + .../example.go | 3 +- .../4_MsgCreateSpotMarketOrder/example.go | 5 +- .../chain/5_MsgCancelSpotOrder/example.go | 5 +- .../example.go | 5 +- .../example.go | 5 +- .../8_MsgCancelDerivativeOrder/example.go | 5 +- .../9_MsgBatchCancelSpotOrders/example.go | 5 +- .../accounts/5_SubaccountHistory/example.go | 2 +- .../6_SubaccountOrderSummary/example.go | 2 +- .../accounts/7_OrderStates/example.go | 2 +- .../exchange/accounts/9_Rewards/example.go | 2 +- .../derivatives/10_StreamPositions/example.go | 2 +- .../derivatives/11_StreamOrders/example.go | 2 +- .../exchange/derivatives/12_Trades/example.go | 2 +- .../derivatives/13_StreamTrades/example.go | 2 +- .../14_SubaccountOrdersList/example.go | 2 +- .../15_SubaccountTradesList/example.go | 2 +- .../derivatives/16_FundingPayments/example.go | 2 +- .../derivatives/17_FundingRates/example.go | 2 +- .../18_HistoricalOrders/example.go | 2 +- .../19_StreamHistoricalOrders/example.go | 2 +- .../20_LiquidablePositions/example.go | 2 +- .../derivatives/21_TradesV2/example.go | 2 +- .../derivatives/22_StreamTradesV2/example.go | 2 +- .../exchange/derivatives/2_Markets/example.go | 2 +- .../derivatives/8_Positions/example.go | 2 +- .../exchange/derivatives/9_Orders/example.go | 2 +- .../insurance/1_InsuranceFunds/example.go | 3 +- .../insurance/2_Redemptions/example.go | 3 +- examples/exchange/meta/1_Ping/example.go | 2 +- examples/exchange/meta/2_Version/example.go | 2 +- examples/exchange/meta/3_Info/example.go | 2 +- .../meta/4_StreamKeepAlive/example.go | 2 +- examples/exchange/oracle/2_Price/example.go | 1 + .../example.go | 1 + .../exchange/spot/10_StreamTrades/example.go | 2 +- .../spot/11_SubaccountOrdersList/example.go | 2 +- .../spot/12_SubaccountTradesList/example.go | 2 +- .../spot/14_HistoricalOrders/example.go | 2 +- .../spot/15_StreamHistoricalOrders/example.go | 2 +- examples/exchange/spot/16_TradesV2/example.go | 2 +- .../spot/17_StreamTradesV2/example.go | 2 +- examples/exchange/spot/2_Markets/example.go | 2 +- examples/exchange/spot/5_Orders/example.go | 4 +- examples/exchange/spot/6_Trades/example.go | 2 +- .../exchange/spot/9_StreamOrders/example.go | 2 +- examples/explorer/10_IBCTransfers/example.go | 2 +- examples/explorer/11_GetWasmCodes/example.go | 2 +- .../explorer/12_GetWasmCodeById/example.go | 2 +- .../explorer/13_GetWasmContracts/example.go | 2 +- .../14_GetWasmContractByAddress/example.go | 2 +- .../explorer/15_GetCW20Balance/example.go | 2 +- examples/explorer/2_AccountTxs/example.go | 2 +- examples/explorer/5_TxsRequest/example.go | 2 +- examples/explorer/8_PeggyDeposits/example.go | 2 +- .../explorer/9_PeggyWithdrawals/example.go | 2 +- go.mod | 6 +- 165 files changed, 894 insertions(+), 761 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index 23bbb47f..8f38a601 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .idea/ .chain_cookie .exchange_cookie +coverage.out diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7c8d4cf5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +exclude: | + (?x)^( + proto/.*| + exchange/.* + )$ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: end-of-file-fixer + - id: check-yaml + - repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.0 + hooks: + - id: go-fmt + - id: go-imports + - id: golangci-lint diff --git a/LICENSE.md b/LICENSE.md index fd30af8c..1d5c5b7c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -200,4 +200,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/NOTICE.md b/NOTICE.md index 68e8c372..9e73b26c 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -5,4 +5,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
-http://www.apache.org/licenses/ +http://www.apache.org/licenses/ diff --git a/README.md b/README.md index b5f92d4d..32653a09 100644 --- a/README.md +++ b/README.md @@ -65,4 +65,4 @@ Copyright © 2020 - 2022 Injective Labs Inc. (https://injectivelabs.org/) Originally released by Injective Labs Inc. under:
Apache License
Version 2.0, January 2004
-http://www.apache.org/licenses/ +http://www.apache.org/licenses/ diff --git a/chain/auction/types/auction.pb.go b/chain/auction/types/auction.pb.go index d0d2e780..0d7b6220 100644 --- a/chain/auction/types/auction.pb.go +++ b/chain/auction/types/auction.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/genesis.pb.go b/chain/auction/types/genesis.pb.go index d1452e2a..c7c3ab27 100644 --- a/chain/auction/types/genesis.pb.go +++ b/chain/auction/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/query.pb.go b/chain/auction/types/query.pb.go index ec9d8b68..bde86cb4 100644 --- a/chain/auction/types/query.pb.go +++ b/chain/auction/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/auction/types/tx.pb.go b/chain/auction/types/tx.pb.go index 57d3be57..b592915e 100644 --- a/chain/auction/types/tx.pb.go +++ b/chain/auction/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/crypto/ethsecp256k1/keys.pb.go b/chain/crypto/ethsecp256k1/keys.pb.go index c445cb5b..1f19c66a 100644 --- a/chain/crypto/ethsecp256k1/keys.pb.go +++ b/chain/crypto/ethsecp256k1/keys.pb.go @@ -5,11 +5,12 @@ package ethsecp256k1 import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/authz.pb.go b/chain/exchange/types/authz.pb.go index e97e8a78..7989416a 100644 --- a/chain/exchange/types/authz.pb.go +++ b/chain/exchange/types/authz.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/events.pb.go b/chain/exchange/types/events.pb.go index fde0ea75..0b05ad3a 100644 --- a/chain/exchange/types/events.pb.go +++ b/chain/exchange/types/events.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/exchange.pb.go b/chain/exchange/types/exchange.pb.go index d462df25..1db8e74d 100644 --- a/chain/exchange/types/exchange.pb.go +++ b/chain/exchange/types/exchange.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types1 "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/genesis.pb.go b/chain/exchange/types/genesis.pb.go index 92998d1d..d83d83f7 100644 --- a/chain/exchange/types/genesis.pb.go +++ b/chain/exchange/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/proposal.pb.go b/chain/exchange/types/proposal.pb.go index 6f3eee76..8ec78f6e 100644 --- a/chain/exchange/types/proposal.pb.go +++ b/chain/exchange/types/proposal.pb.go @@ -5,6 +5,10 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types" @@ -13,9 +17,6 @@ import ( types1 "github.com/cosmos/cosmos-sdk/x/distribution/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/query.pb.go b/chain/exchange/types/query.pb.go index b4111c76..d95ca74e 100644 --- a/chain/exchange/types/query.pb.go +++ b/chain/exchange/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/tx.pb.go b/chain/exchange/types/tx.pb.go index 682a9a23..b36abb8e 100644 --- a/chain/exchange/types/tx.pb.go +++ b/chain/exchange/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types1 "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -18,9 +22,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/exchange/types/wasm_maker_contract.go b/chain/exchange/types/wasm_maker_contract.go index ca0a9227..8b75eb9f 100644 --- a/chain/exchange/types/wasm_maker_contract.go +++ b/chain/exchange/types/wasm_maker_contract.go @@ -1,7 +1,7 @@ package types import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/math" ) type MintToUser struct { @@ -13,7 +13,7 @@ type MintToUserMsg struct { MintToUser MintToUser `json:"mint_to_user"` } -func NewMintToUserMsg(subaccountIDSender string, amount sdk.Int) MintToUserMsg { +func NewMintToUserMsg(subaccountIDSender string, amount math.Int) MintToUserMsg { return MintToUserMsg{ MintToUser: MintToUser{ SubaccountIDSender: subaccountIDSender, diff --git a/chain/insurance/types/genesis.pb.go b/chain/insurance/types/genesis.pb.go index 2bd30a00..09aa4be5 100644 --- a/chain/insurance/types/genesis.pb.go +++ b/chain/insurance/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/insurance.pb.go b/chain/insurance/types/insurance.pb.go index ba256531..bf9d978e 100644 --- a/chain/insurance/types/insurance.pb.go +++ b/chain/insurance/types/insurance.pb.go @@ -5,6 +5,11 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" @@ -13,10 +18,6 @@ import ( github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/durationpb" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/query.pb.go b/chain/insurance/types/query.pb.go index 4b79acab..37fdf2bd 100644 --- a/chain/insurance/types/query.pb.go +++ b/chain/insurance/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/insurance/types/tx.pb.go b/chain/insurance/types/tx.pb.go index 846919ee..1113a9f8 100644 --- a/chain/insurance/types/tx.pb.go +++ b/chain/insurance/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/oracle/types" _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/types" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/genesis.pb.go b/chain/ocr/types/genesis.pb.go index 210d8023..68aee64a 100644 --- a/chain/ocr/types/genesis.pb.go +++ b/chain/ocr/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/ocr.pb.go b/chain/ocr/types/ocr.pb.go index d80ac284..4c0279d4 100644 --- a/chain/ocr/types/ocr.pb.go +++ b/chain/ocr/types/ocr.pb.go @@ -5,6 +5,11 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + time "time" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -12,10 +17,6 @@ import ( proto "github.com/cosmos/gogoproto/proto" github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/timestamppb" - io "io" - math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/query.pb.go b/chain/ocr/types/query.pb.go index 5320b68e..3000c85e 100644 --- a/chain/ocr/types/query.pb.go +++ b/chain/ocr/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/ocr/types/tx.pb.go b/chain/ocr/types/tx.pb.go index 76af8a8c..b1574018 100644 --- a/chain/ocr/types/tx.pb.go +++ b/chain/ocr/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/events.pb.go b/chain/oracle/types/events.pb.go index d8b8118e..4f5e3139 100644 --- a/chain/oracle/types/events.pb.go +++ b/chain/oracle/types/events.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-sdk/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/genesis.pb.go b/chain/oracle/types/genesis.pb.go index 04cb607c..df592e98 100644 --- a/chain/oracle/types/genesis.pb.go +++ b/chain/oracle/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/oracle.pb.go b/chain/oracle/types/oracle.pb.go index 156c1208..65482710 100644 --- a/chain/oracle/types/oracle.pb.go +++ b/chain/oracle/types/oracle.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" golang_proto "github.com/golang/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/proposal.pb.go b/chain/oracle/types/proposal.pb.go index 2606c3f3..ae4c5169 100644 --- a/chain/oracle/types/proposal.pb.go +++ b/chain/oracle/types/proposal.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/query.pb.go b/chain/oracle/types/query.pb.go index d82bee6f..4581b81c 100644 --- a/chain/oracle/types/query.pb.go +++ b/chain/oracle/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/oracle/types/tx.pb.go b/chain/oracle/types/tx.pb.go index c993e9d9..165fcf35 100644 --- a/chain/oracle/types/tx.pb.go +++ b/chain/oracle/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/attestation.pb.go b/chain/peggy/types/attestation.pb.go index 0d591bd2..3ea675f8 100644 --- a/chain/peggy/types/attestation.pb.go +++ b/chain/peggy/types/attestation.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/batch.pb.go b/chain/peggy/types/batch.pb.go index 083ea8c7..65fac894 100644 --- a/chain/peggy/types/batch.pb.go +++ b/chain/peggy/types/batch.pb.go @@ -5,10 +5,11 @@ package types import ( fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/ethereum_signer.pb.go b/chain/peggy/types/ethereum_signer.pb.go index d52e1b45..08af7a8a 100644 --- a/chain/peggy/types/ethereum_signer.pb.go +++ b/chain/peggy/types/ethereum_signer.pb.go @@ -5,9 +5,10 @@ package types import ( fmt "fmt" + math "math" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - math "math" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/events.pb.go b/chain/peggy/types/events.pb.go index 13168705..571bb00b 100644 --- a/chain/peggy/types/events.pb.go +++ b/chain/peggy/types/events.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/genesis.pb.go b/chain/peggy/types/genesis.pb.go index 197630ab..e4baffbc 100644 --- a/chain/peggy/types/genesis.pb.go +++ b/chain/peggy/types/genesis.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/msgs.pb.go b/chain/peggy/types/msgs.pb.go index 6bf0619c..7797fcfe 100644 --- a/chain/peggy/types/msgs.pb.go +++ b/chain/peggy/types/msgs.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types1 "github.com/cosmos/cosmos-sdk/codec/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" @@ -18,9 +22,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/params.pb.go b/chain/peggy/types/params.pb.go index f7932952..7afc74dd 100644 --- a/chain/peggy/types/params.pb.go +++ b/chain/peggy/types/params.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/pool.pb.go b/chain/peggy/types/pool.pb.go index a7eabb67..68e76b1a 100644 --- a/chain/peggy/types/pool.pb.go +++ b/chain/peggy/types/pool.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/proposal.pb.go b/chain/peggy/types/proposal.pb.go index dd9ece2a..242fd142 100644 --- a/chain/peggy/types/proposal.pb.go +++ b/chain/peggy/types/proposal.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/query.pb.go b/chain/peggy/types/query.pb.go index 56cc080b..daac4c68 100644 --- a/chain/peggy/types/query.pb.go +++ b/chain/peggy/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -13,9 +17,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/peggy/types/types.pb.go b/chain/peggy/types/types.pb.go index 66673a3c..29281874 100644 --- a/chain/peggy/types/types.pb.go +++ b/chain/peggy/types/types.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/stream/types/query.pb.go b/chain/stream/types/query.pb.go index 1e7e3f0c..fcbb41c6 100644 --- a/chain/stream/types/query.pb.go +++ b/chain/stream/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/InjectiveLabs/sdk-go/chain/exchange/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/types" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/authorityMetadata.pb.go b/chain/tokenfactory/types/authorityMetadata.pb.go index 51337590..8ee31dd6 100644 --- a/chain/tokenfactory/types/authorityMetadata.pb.go +++ b/chain/tokenfactory/types/authorityMetadata.pb.go @@ -5,12 +5,13 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/events.pb.go b/chain/tokenfactory/types/events.pb.go index 96598dc0..17d0804f 100644 --- a/chain/tokenfactory/types/events.pb.go +++ b/chain/tokenfactory/types/events.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/genesis.pb.go b/chain/tokenfactory/types/genesis.pb.go index 85a59947..9f623873 100644 --- a/chain/tokenfactory/types/genesis.pb.go +++ b/chain/tokenfactory/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/params.pb.go b/chain/tokenfactory/types/params.pb.go index 9d705d9c..089844bc 100644 --- a/chain/tokenfactory/types/params.pb.go +++ b/chain/tokenfactory/types/params.pb.go @@ -5,14 +5,15 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/query.pb.go b/chain/tokenfactory/types/query.pb.go index 9d7f5742..f8afd710 100644 --- a/chain/tokenfactory/types/query.pb.go +++ b/chain/tokenfactory/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -14,9 +18,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/tokenfactory/types/tx.pb.go b/chain/tokenfactory/types/tx.pb.go index 214084f8..33e4eb33 100644 --- a/chain/tokenfactory/types/tx.pb.go +++ b/chain/tokenfactory/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -16,9 +20,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/account.pb.go b/chain/types/account.pb.go index cb352b87..59afd490 100644 --- a/chain/types/account.pb.go +++ b/chain/types/account.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/x/auth/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/tx_ext.pb.go b/chain/types/tx_ext.pb.go index 3b5e02ae..5f48212a 100644 --- a/chain/types/tx_ext.pb.go +++ b/chain/types/tx_ext.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/types/tx_response.pb.go b/chain/types/tx_response.pb.go index e4d2327b..de584707 100644 --- a/chain/types/tx_response.pb.go +++ b/chain/types/tx_response.pb.go @@ -5,10 +5,11 @@ package types import ( fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/events.pb.go b/chain/wasmx/types/events.pb.go index 9f3f7471..a211e66a 100644 --- a/chain/wasmx/types/events.pb.go +++ b/chain/wasmx/types/events.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/genesis.pb.go b/chain/wasmx/types/genesis.pb.go index fe9147ae..c9405de5 100644 --- a/chain/wasmx/types/genesis.pb.go +++ b/chain/wasmx/types/genesis.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/proposal.pb.go b/chain/wasmx/types/proposal.pb.go index 128ae2cc..4e85c1c3 100644 --- a/chain/wasmx/types/proposal.pb.go +++ b/chain/wasmx/types/proposal.pb.go @@ -5,13 +5,14 @@ package types import ( fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + types "github.com/CosmWasm/wasmd/x/wasm/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/query.pb.go b/chain/wasmx/types/query.pb.go index a94efce7..1b1f4cdb 100644 --- a/chain/wasmx/types/query.pb.go +++ b/chain/wasmx/types/query.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -13,9 +17,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/tx.pb.go b/chain/wasmx/types/tx.pb.go index 02545b39..908d6219 100644 --- a/chain/wasmx/types/tx.pb.go +++ b/chain/wasmx/types/tx.pb.go @@ -6,6 +6,10 @@ package types import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,9 +19,6 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/chain/wasmx/types/wasmx.pb.go b/chain/wasmx/types/wasmx.pb.go index 053a0a76..e3e8dee8 100644 --- a/chain/wasmx/types/wasmx.pb.go +++ b/chain/wasmx/types/wasmx.pb.go @@ -5,11 +5,12 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/client/chain/chain.go b/client/chain/chain.go index f2dc9514..8b9b0720 100644 --- a/client/chain/chain.go +++ b/client/chain/chain.go @@ -6,7 +6,6 @@ import ( "encoding/hex" "encoding/json" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" "math" "os" "strconv" @@ -15,6 +14,10 @@ import ( "sync/atomic" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + + "google.golang.org/grpc/credentials/insecure" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" log "github.com/InjectiveLabs/suplog" rpchttp "github.com/cometbft/cometbft/rpc/client/http" @@ -151,10 +154,9 @@ type chainClient struct { chainStreamConn *grpc.ClientConn txFactory tx.Factory - fromAddress sdk.AccAddress - doneC chan bool - msgC chan sdk.Msg - syncMux *sync.Mutex + doneC chan bool + msgC chan sdk.Msg + syncMux *sync.Mutex cancelCtx context.Context cancelFn func() @@ -231,7 +233,7 @@ func NewChainClientWithMarketsAssistant( if opts.TLSCert != nil { conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ChainGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) stickySessionEnabled = false } if err != nil { @@ -243,7 +245,7 @@ func NewChainClientWithMarketsAssistant( if opts.TLSCert != nil { chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + chainStreamConn, err = grpc.Dial(network.ChainStreamGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err = errors.Wrapf(err, "failed to connect to the chain stream gRPC: %s", network.ChainStreamGrpcEndpoint) @@ -393,7 +395,10 @@ func (c *chainClient) getAccSeq() uint64 { func (c *chainClient) requestCookie() metadata.MD { var header metadata.MD - c.txClient.GetTx(context.Background(), &txtypes.GetTxRequest{}, grpc.Header(&header)) + _, err := c.txClient.GetTx(context.Background(), &txtypes.GetTxRequest{}, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -475,16 +480,18 @@ func (c *chainClient) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRes c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) res, err := c.broadcastTx(c.ctx, c.txFactory, true, msgs...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, true, msgs...) } if err != nil { @@ -494,8 +501,6 @@ func (c *chainClient) SyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRes } } - c.accSeq++ - return res, nil } @@ -539,15 +544,17 @@ func (c *chainClient) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRe c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) res, err := c.broadcastTx(c.ctx, c.txFactory, false, msgs...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, false, msgs...) } if err != nil { @@ -557,8 +564,6 @@ func (c *chainClient) AsyncBroadcastMsg(msgs ...sdk.Msg) (*txtypes.BroadcastTxRe } } - c.accSeq++ - return res, nil } @@ -795,16 +800,18 @@ func (c *chainClient) runBatchBroadcast() { submitBatch := func(toSubmit []sdk.Msg) { c.syncMux.Lock() defer c.syncMux.Unlock() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("broadcastTx with nonce", c.accSeq) + log.Debugln("broadcastTx with nonce", sequence) res, err := c.broadcastTx(c.ctx, c.txFactory, true, toSubmit...) if err != nil { if strings.Contains(err.Error(), "account sequence mismatch") { c.syncNonce() - c.txFactory = c.txFactory.WithSequence(c.accSeq) + sequence := c.getAccSeq() + c.txFactory = c.txFactory.WithSequence(sequence) c.txFactory = c.txFactory.WithAccountNumber(c.accNum) - log.Debugln("retrying broadcastTx with nonce", c.accSeq) + log.Debugln("retrying broadcastTx with nonce", sequence) res, err = c.broadcastTx(c.ctx, c.txFactory, true, toSubmit...) } if err != nil { @@ -821,8 +828,6 @@ func (c *chainClient) runBatchBroadcast() { log.WithField("txHash", res.TxResponse.TxHash).Debugln("msg batch broadcasted successfully at height", res.TxResponse.Height) } - c.accSeq++ - log.Debugln("nonce incremented to", c.accSeq) log.Debugln("gas wanted: ", c.gasWanted) } @@ -1149,7 +1154,12 @@ func (c *chainClient) StreamEventOrderFail(sender string, failEventCh chan map[s panic(err) } } - defer cometbftClient.Stop() + defer func() { + err := cometbftClient.Stop() + if err != nil { + panic(err) + } + }() c.StreamEventOrderFailWithWebsocket(sender, cometbftClient, failEventCh) } @@ -1203,7 +1213,12 @@ func (c *chainClient) StreamOrderbookUpdateEvents(orderbookType OrderbookType, m panic(err) } } - defer cometbftClient.Stop() + defer func() { + err := cometbftClient.Stop() + if err != nil { + panic(err) + } + }() c.StreamOrderbookUpdateEventsWithWebsocket(orderbookType, marketIds, cometbftClient, orderbookCh) diff --git a/client/chain/chain_test.go b/client/chain/chain_test.go index 4dc3741f..f286819b 100644 --- a/client/chain/chain_test.go +++ b/client/chain/chain_test.go @@ -2,6 +2,9 @@ package chain import ( "context" + "os" + "testing" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/InjectiveLabs/sdk-go/client/core" @@ -10,8 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" cosmtypes "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" - "os" - "testing" ) func accountForTests() (cosmtypes.AccAddress, keyring.Keyring, error) { diff --git a/client/common/embeded.go b/client/common/embeded.go index b22554cf..d1c7d7e6 100644 --- a/client/common/embeded.go +++ b/client/common/embeded.go @@ -1,4 +1,6 @@ package common -import _ "github.com/InjectiveLabs/sdk-go/client/cert" -import _ "github.com/InjectiveLabs/sdk-go/client/metadata/assets" +import ( + _ "github.com/InjectiveLabs/sdk-go/client/cert" + _ "github.com/InjectiveLabs/sdk-go/client/metadata/assets" +) diff --git a/client/common/network.go b/client/common/network.go index 7095823b..ec50a01b 100644 --- a/client/common/network.go +++ b/client/common/network.go @@ -4,14 +4,13 @@ import ( "context" "crypto/tls" "fmt" - "google.golang.org/grpc/metadata" "net" "net/http" - "path" - "runtime" "strings" "time" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/credentials" ) @@ -74,7 +73,7 @@ func (assistant *ExpiringCookieAssistant) checkCookieExpiration() { expirationTime, err := time.Parse(assistant.timeLayout, cookie.Value) if err == nil { - timestampDiff := expirationTime.Sub(time.Now()) + timestampDiff := time.Until(expirationTime) if timestampDiff < SessionRenewalOffset { assistant.cookie = "" } @@ -175,11 +174,6 @@ func (network *Network) ExplorerMetadata(provider MetadataProvider) (string, err return network.explorerCookieAssistant.Metadata(provider) } -func getFileAbsPath(relativePath string) string { - _, filename, _, _ := runtime.Caller(0) - return path.Join(path.Dir(filename), relativePath) -} - func LoadNetwork(name string, node string) Network { switch name { diff --git a/client/common/network_test.go b/client/common/network_test.go index cf63efcd..235c580e 100644 --- a/client/common/network_test.go +++ b/client/common/network_test.go @@ -2,9 +2,10 @@ package common import ( "fmt" - "google.golang.org/grpc/metadata" "testing" "time" + + "google.golang.org/grpc/metadata" ) func TestMainnetKubernetesLoadBalancedCookieAssistant(t *testing.T) { diff --git a/client/common/util.go b/client/common/util.go index 6f6af8ee..f7e0c9bc 100644 --- a/client/common/util.go +++ b/client/common/util.go @@ -5,7 +5,7 @@ import ( "crypto/x509" "encoding/hex" "fmt" - "io/ioutil" + "os" "strings" chaintypes "github.com/InjectiveLabs/sdk-go/chain/types" @@ -13,9 +13,7 @@ import ( ) func HexToBytes(str string) ([]byte, error) { - if strings.HasPrefix(str, "0x") { - str = str[2:] - } + str = strings.TrimPrefix(str, "0x") data, err := hex.DecodeString(str) if err != nil { @@ -31,7 +29,7 @@ func LoadTlsCert(path string, serverName string) credentials.TransportCredential } // build cert obj - rootCert, err := ioutil.ReadFile(path) + rootCert, err := os.ReadFile(path) if err != nil { fmt.Println(err, "cannot load tls cert from path") return nil diff --git a/client/core/market_test.go b/client/core/market_test.go index 0c56fe31..3ee77ea8 100644 --- a/client/core/market_test.go +++ b/client/core/market_test.go @@ -1,10 +1,11 @@ package core import ( + "testing" + "github.com/cosmos/cosmos-sdk/types" "github.com/huandu/go-assert" "github.com/shopspring/decimal" - "testing" ) func createINJUSDTSpotMarket() SpotMarket { diff --git a/client/core/markets_assistant.go b/client/core/markets_assistant.go index a046904f..5f6de9b6 100644 --- a/client/core/markets_assistant.go +++ b/client/core/markets_assistant.go @@ -3,15 +3,16 @@ package core import ( "context" "fmt" + "path" + "runtime" + "strings" + "github.com/InjectiveLabs/sdk-go/client/exchange" - injective_derivative_exchange_rpcpb "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" - injective_spot_exchange_rpcpb "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" + derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" + spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" "github.com/shopspring/decimal" "golang.org/x/exp/maps" "gopkg.in/ini.v1" - "path" - "runtime" - "strings" ) type MarketsAssistant struct { @@ -130,10 +131,10 @@ func NewMarketsAssistant(networkName string) (MarketsAssistant, error) { func NewMarketsAssistantUsingExchangeClient(ctx context.Context, exchangeClient exchange.ExchangeClient) (MarketsAssistant, error) { assistant := newMarketsAssistant() - spotMarketsRequest := injective_spot_exchange_rpcpb.MarketsRequest{ + spotMarketsRequest := spotExchangePB.MarketsRequest{ MarketStatus: "active", } - spotMarkets, err := exchangeClient.GetSpotMarkets(ctx, spotMarketsRequest) + spotMarkets, err := exchangeClient.GetSpotMarkets(ctx, &spotMarketsRequest) if err != nil { return assistant, err @@ -176,10 +177,10 @@ func NewMarketsAssistantUsingExchangeClient(ctx context.Context, exchangeClient } } - derivativeMarketsRequest := injective_derivative_exchange_rpcpb.MarketsRequest{ + derivativeMarketsRequest := derivativeExchangePB.MarketsRequest{ MarketStatus: "active", } - derivativeMarkets, err := exchangeClient.GetDerivativeMarkets(ctx, derivativeMarketsRequest) + derivativeMarkets, err := exchangeClient.GetDerivativeMarkets(ctx, &derivativeMarketsRequest) if err != nil { return assistant, err @@ -244,7 +245,7 @@ func uniqueSymbol(symbol string, denom string, tokenMetaSymbol string, tokenMeta return uniqueSymbol } -func spotTokenRepresentation(symbol string, tokenMeta *injective_spot_exchange_rpcpb.TokenMeta, denom string, assistant *MarketsAssistant) Token { +func spotTokenRepresentation(symbol string, tokenMeta *spotExchangePB.TokenMeta, denom string, assistant *MarketsAssistant) Token { _, isPresent := assistant.tokensByDenom[denom] if !isPresent { @@ -267,7 +268,7 @@ func spotTokenRepresentation(symbol string, tokenMeta *injective_spot_exchange_r return assistant.tokensByDenom[denom] } -func derivativeTokenRepresentation(symbol string, tokenMeta *injective_derivative_exchange_rpcpb.TokenMeta, denom string, assistant *MarketsAssistant) Token { +func derivativeTokenRepresentation(symbol string, tokenMeta *derivativeExchangePB.TokenMeta, denom string, assistant *MarketsAssistant) Token { _, isPresent := assistant.tokensByDenom[denom] if !isPresent { diff --git a/client/core/markets_assistant_test.go b/client/core/markets_assistant_test.go index adb28638..b727c559 100644 --- a/client/core/markets_assistant_test.go +++ b/client/core/markets_assistant_test.go @@ -2,11 +2,12 @@ package core import ( "context" + "strings" + "testing" + derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" "github.com/stretchr/testify/assert" - "strings" - "testing" ) func TestMarketAssistantCreationUsingMarketsFromExchange(t *testing.T) { @@ -17,14 +18,14 @@ func TestMarketAssistantCreationUsingMarketsFromExchange(t *testing.T) { apeUsdtSpotMarketInfo := createAPEUSDTSpotMarketInfo() btcUsdtDerivativeMarketInfo := createBTCUSDTDerivativeMarketInfo() - spotMarketInfos = append(spotMarketInfos, &injUsdtSpotMarketInfo) - spotMarketInfos = append(spotMarketInfos, &apeUsdtSpotMarketInfo) - derivativeMarketInfos = append(derivativeMarketInfos, &btcUsdtDerivativeMarketInfo) + spotMarketInfos = append(spotMarketInfos, injUsdtSpotMarketInfo) + spotMarketInfos = append(spotMarketInfos, apeUsdtSpotMarketInfo) + derivativeMarketInfos = append(derivativeMarketInfos, btcUsdtDerivativeMarketInfo) - mockExchange.SpotMarketsResponses = append(mockExchange.SpotMarketsResponses, spotExchangePB.MarketsResponse{ + mockExchange.SpotMarketsResponses = append(mockExchange.SpotMarketsResponses, &spotExchangePB.MarketsResponse{ Markets: spotMarketInfos, }) - mockExchange.DerivativeMarketsResponses = append(mockExchange.DerivativeMarketsResponses, derivativeExchangePB.MarketsResponse{ + mockExchange.DerivativeMarketsResponses = append(mockExchange.DerivativeMarketsResponses, &derivativeExchangePB.MarketsResponse{ Markets: derivativeMarketInfos, }) diff --git a/client/core/markets_assistant_test_support.go b/client/core/markets_assistant_test_support.go index a369d7eb..9febc8df 100644 --- a/client/core/markets_assistant_test_support.go +++ b/client/core/markets_assistant_test_support.go @@ -2,6 +2,7 @@ package core import ( "context" + accountPB "github.com/InjectiveLabs/sdk-go/exchange/accounts_rpc/pb" auctionPB "github.com/InjectiveLabs/sdk-go/exchange/auction_rpc/pb" derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" @@ -58,7 +59,7 @@ func createUSDTPerpTokenMeta() derivativeExchangePB.TokenMeta { } } -func createINJUSDTSpotMarketInfo() spotExchangePB.SpotMarketInfo { +func createINJUSDTSpotMarketInfo() *spotExchangePB.SpotMarketInfo { injTokenMeta := createINJTokenMeta() usdtTokenMeta := createUSDTTokenMeta() marketInfo := spotExchangePB.SpotMarketInfo{ @@ -76,10 +77,10 @@ func createINJUSDTSpotMarketInfo() spotExchangePB.SpotMarketInfo { MinQuantityTickSize: "1000000000000000", } - return marketInfo + return &marketInfo } -func createAPEUSDTSpotMarketInfo() spotExchangePB.SpotMarketInfo { +func createAPEUSDTSpotMarketInfo() *spotExchangePB.SpotMarketInfo { apeTokenMeta := createAPETokenMeta() usdtTokenMeta := createUSDTTokenMeta() marketInfo := spotExchangePB.SpotMarketInfo{ @@ -97,10 +98,10 @@ func createAPEUSDTSpotMarketInfo() spotExchangePB.SpotMarketInfo { MinQuantityTickSize: "1000000000000000", } - return marketInfo + return &marketInfo } -func createBTCUSDTDerivativeMarketInfo() derivativeExchangePB.DerivativeMarketInfo { +func createBTCUSDTDerivativeMarketInfo() *derivativeExchangePB.DerivativeMarketInfo { usdtPerpTokenMeta := createUSDTPerpTokenMeta() perpetualMarketInfo := derivativeExchangePB.PerpetualMarketInfo{ @@ -138,12 +139,12 @@ func createBTCUSDTDerivativeMarketInfo() derivativeExchangePB.DerivativeMarketIn PerpetualMarketFunding: &perpetualmarketFunding, } - return marketInfo + return &marketInfo } type MockExchangeClient struct { - SpotMarketsResponses []spotExchangePB.MarketsResponse - DerivativeMarketsResponses []derivativeExchangePB.MarketsResponse + SpotMarketsResponses []*spotExchangePB.MarketsResponse + DerivativeMarketsResponses []*derivativeExchangePB.MarketsResponse } func (e *MockExchangeClient) QueryClient() *grpc.ClientConn { @@ -151,16 +152,16 @@ func (e *MockExchangeClient) QueryClient() *grpc.ClientConn { return &dummyConnection } -func (e *MockExchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error) { - return derivativeExchangePB.MarketResponse{}, nil +func (e *MockExchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error) { + return &derivativeExchangePB.MarketResponse{}, nil } -func (e *MockExchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error) { - return derivativeExchangePB.OrderbookV2Response{}, nil +func (e *MockExchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error) { + return &derivativeExchangePB.OrderbookV2Response{}, nil } -func (e *MockExchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error) { - return derivativeExchangePB.OrderbooksV2Response{}, nil +func (e *MockExchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error) { + return &derivativeExchangePB.OrderbooksV2Response{}, nil } func (e *MockExchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) { @@ -175,151 +176,155 @@ func (e *MockExchangeClient) StreamDerivativeMarket(ctx context.Context, marketI return nil, nil } -func (e *MockExchangeClient) GetDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersRequest) (derivativeExchangePB.OrdersResponse, error) { - return derivativeExchangePB.OrdersResponse{}, nil +func (e *MockExchangeClient) GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error) { + return &derivativeExchangePB.OrdersResponse{}, nil } -func (e *MockExchangeClient) GetDerivativeMarkets(ctx context.Context, req derivativeExchangePB.MarketsRequest) (derivativeExchangePB.MarketsResponse, error) { - var response derivativeExchangePB.MarketsResponse +func (e *MockExchangeClient) GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error) { + var response *derivativeExchangePB.MarketsResponse var localError error if len(e.DerivativeMarketsResponses) > 0 { response = e.DerivativeMarketsResponses[0] e.DerivativeMarketsResponses = e.DerivativeMarketsResponses[1:] localError = nil } else { - response = derivativeExchangePB.MarketsResponse{} + response = &derivativeExchangePB.MarketsResponse{} localError = errors.New("There are no responses configured") } return response, localError } -func (e *MockExchangeClient) GetDerivativePositions(ctx context.Context, req derivativeExchangePB.PositionsRequest) (derivativeExchangePB.PositionsResponse, error) { - return derivativeExchangePB.PositionsResponse{}, nil +func (e *MockExchangeClient) GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error) { + return &derivativeExchangePB.PositionsResponse{}, nil +} + +func (e *MockExchangeClient) GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error) { + return &derivativeExchangePB.PositionsV2Response{}, nil } -func (e *MockExchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req derivativeExchangePB.LiquidablePositionsRequest) (derivativeExchangePB.LiquidablePositionsResponse, error) { - return derivativeExchangePB.LiquidablePositionsResponse{}, nil +func (e *MockExchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error) { + return &derivativeExchangePB.LiquidablePositionsResponse{}, nil } -func (e *MockExchangeClient) StreamDerivativePositions(ctx context.Context, req derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { +func (e *MockExchangeClient) StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { return nil, nil } -func (e *MockExchangeClient) StreamDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { +func (e *MockExchangeClient) StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { return nil, nil } -func (e *MockExchangeClient) GetDerivativeTrades(ctx context.Context, req derivativeExchangePB.TradesRequest) (derivativeExchangePB.TradesResponse, error) { - return derivativeExchangePB.TradesResponse{}, nil +func (e *MockExchangeClient) GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error) { + return &derivativeExchangePB.TradesResponse{}, nil } -func (e *MockExchangeClient) GetDerivativeTradesV2(ctx context.Context, req derivativeExchangePB.TradesV2Request) (derivativeExchangePB.TradesV2Response, error) { - return derivativeExchangePB.TradesV2Response{}, nil +func (e *MockExchangeClient) GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error) { + return &derivativeExchangePB.TradesV2Response{}, nil } -func (e *MockExchangeClient) StreamDerivativeTrades(ctx context.Context, req derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { +func (e *MockExchangeClient) StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { return nil, nil } -func (e *MockExchangeClient) StreamDerivativeV2Trades(ctx context.Context, req derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { +func (e *MockExchangeClient) StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { return nil, nil } -func (e *MockExchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req derivativeExchangePB.SubaccountOrdersListRequest) (derivativeExchangePB.SubaccountOrdersListResponse, error) { - return derivativeExchangePB.SubaccountOrdersListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error) { + return &derivativeExchangePB.SubaccountOrdersListResponse{}, nil } -func (e *MockExchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req derivativeExchangePB.SubaccountTradesListRequest) (derivativeExchangePB.SubaccountTradesListResponse, error) { - return derivativeExchangePB.SubaccountTradesListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error) { + return &derivativeExchangePB.SubaccountTradesListResponse{}, nil } -func (e *MockExchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersHistoryRequest) (derivativeExchangePB.OrdersHistoryResponse, error) { - return derivativeExchangePB.OrdersHistoryResponse{}, nil +func (e *MockExchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error) { + return &derivativeExchangePB.OrdersHistoryResponse{}, nil } -func (e *MockExchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { +func (e *MockExchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { return nil, nil } -func (e *MockExchangeClient) GetDerivativeFundingPayments(ctx context.Context, req derivativeExchangePB.FundingPaymentsRequest) (derivativeExchangePB.FundingPaymentsResponse, error) { - return derivativeExchangePB.FundingPaymentsResponse{}, nil +func (e *MockExchangeClient) GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error) { + return &derivativeExchangePB.FundingPaymentsResponse{}, nil } -func (e *MockExchangeClient) GetDerivativeFundingRates(ctx context.Context, req derivativeExchangePB.FundingRatesRequest) (derivativeExchangePB.FundingRatesResponse, error) { - return derivativeExchangePB.FundingRatesResponse{}, nil +func (e *MockExchangeClient) GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error) { + return &derivativeExchangePB.FundingRatesResponse{}, nil } -func (e *MockExchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error) { - return oraclePB.PriceResponse{}, nil +func (e *MockExchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error) { + return &oraclePB.PriceResponse{}, nil } -func (e *MockExchangeClient) GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error) { - return oraclePB.OracleListResponse{}, nil +func (e *MockExchangeClient) GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error) { + return &oraclePB.OracleListResponse{}, nil } func (e *MockExchangeClient) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error) { return nil, nil } -func (e *MockExchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) { - return auctionPB.AuctionEndpointResponse{}, nil +func (e *MockExchangeClient) GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error) { + return &auctionPB.AuctionEndpointResponse{}, nil } -func (e *MockExchangeClient) GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error) { - return auctionPB.AuctionsResponse{}, nil +func (e *MockExchangeClient) GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error) { + return &auctionPB.AuctionsResponse{}, nil } func (e *MockExchangeClient) StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error) { return nil, nil } -func (e *MockExchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error) { - return accountPB.SubaccountsListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error) { + return &accountPB.SubaccountsListResponse{}, nil } -func (e *MockExchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) { - return accountPB.SubaccountBalanceEndpointResponse{}, nil +func (e *MockExchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error) { + return &accountPB.SubaccountBalanceEndpointResponse{}, nil } func (e *MockExchangeClient) StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error) { return nil, nil } -func (e *MockExchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error) { - return accountPB.SubaccountBalancesListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error) { + return &accountPB.SubaccountBalancesListResponse{}, nil } -func (e *MockExchangeClient) GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error) { - return accountPB.SubaccountHistoryResponse{}, nil +func (e *MockExchangeClient) GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error) { + return &accountPB.SubaccountHistoryResponse{}, nil } -func (e *MockExchangeClient) GetSubaccountOrderSummary(ctx context.Context, req accountPB.SubaccountOrderSummaryRequest) (accountPB.SubaccountOrderSummaryResponse, error) { - return accountPB.SubaccountOrderSummaryResponse{}, nil +func (e *MockExchangeClient) GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error) { + return &accountPB.SubaccountOrderSummaryResponse{}, nil } -func (e *MockExchangeClient) GetOrderStates(ctx context.Context, req accountPB.OrderStatesRequest) (accountPB.OrderStatesResponse, error) { - return accountPB.OrderStatesResponse{}, nil +func (e *MockExchangeClient) GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error) { + return &accountPB.OrderStatesResponse{}, nil } -func (e *MockExchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error) { - return accountPB.PortfolioResponse{}, nil +func (e *MockExchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error) { + return &accountPB.PortfolioResponse{}, nil } -func (e *MockExchangeClient) GetRewards(ctx context.Context, req accountPB.RewardsRequest) (accountPB.RewardsResponse, error) { - return accountPB.RewardsResponse{}, nil +func (e *MockExchangeClient) GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error) { + return &accountPB.RewardsResponse{}, nil } -func (e *MockExchangeClient) GetSpotOrders(ctx context.Context, req spotExchangePB.OrdersRequest) (spotExchangePB.OrdersResponse, error) { - return spotExchangePB.OrdersResponse{}, nil +func (e *MockExchangeClient) GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error) { + return &spotExchangePB.OrdersResponse{}, nil } -func (e *MockExchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error) { - return spotExchangePB.OrderbookV2Response{}, nil +func (e *MockExchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error) { + return &spotExchangePB.OrderbookV2Response{}, nil } -func (e *MockExchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error) { - return spotExchangePB.OrderbooksV2Response{}, nil +func (e *MockExchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error) { + return &spotExchangePB.OrderbooksV2Response{}, nil } func (e *MockExchangeClient) StreamSpotOrderbookV2(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookV2Client, error) { @@ -330,75 +335,79 @@ func (e *MockExchangeClient) StreamSpotOrderbookUpdate(ctx context.Context, mark return nil, nil } -func (e *MockExchangeClient) GetSpotMarkets(ctx context.Context, req spotExchangePB.MarketsRequest) (spotExchangePB.MarketsResponse, error) { - var response spotExchangePB.MarketsResponse +func (e *MockExchangeClient) GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error) { + var response *spotExchangePB.MarketsResponse var localError error if len(e.SpotMarketsResponses) > 0 { response = e.SpotMarketsResponses[0] e.SpotMarketsResponses = e.SpotMarketsResponses[1:] localError = nil } else { - response = spotExchangePB.MarketsResponse{} + response = &spotExchangePB.MarketsResponse{} localError = errors.New("There are no responses configured") } return response, localError } -func (e *MockExchangeClient) GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error) { - return spotExchangePB.MarketResponse{}, nil +func (e *MockExchangeClient) GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error) { + return &spotExchangePB.MarketResponse{}, nil } func (e *MockExchangeClient) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) { return nil, nil } -func (e *MockExchangeClient) StreamSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { +func (e *MockExchangeClient) StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { return nil, nil } -func (e *MockExchangeClient) GetSpotTrades(ctx context.Context, req spotExchangePB.TradesRequest) (spotExchangePB.TradesResponse, error) { - return spotExchangePB.TradesResponse{}, nil +func (e *MockExchangeClient) GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error) { + return &spotExchangePB.TradesResponse{}, nil } -func (e *MockExchangeClient) GetSpotTradesV2(ctx context.Context, req spotExchangePB.TradesV2Request) (spotExchangePB.TradesV2Response, error) { - return spotExchangePB.TradesV2Response{}, nil +func (e *MockExchangeClient) GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error) { + return &spotExchangePB.TradesV2Response{}, nil } -func (e *MockExchangeClient) StreamSpotTrades(ctx context.Context, req spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { +func (e *MockExchangeClient) StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { return nil, nil } -func (e *MockExchangeClient) StreamSpotTradesV2(ctx context.Context, req spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { +func (e *MockExchangeClient) StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { return nil, nil } -func (e *MockExchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req spotExchangePB.SubaccountOrdersListRequest) (spotExchangePB.SubaccountOrdersListResponse, error) { - return spotExchangePB.SubaccountOrdersListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error) { + return &spotExchangePB.SubaccountOrdersListResponse{}, nil } -func (e *MockExchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req spotExchangePB.SubaccountTradesListRequest) (spotExchangePB.SubaccountTradesListResponse, error) { - return spotExchangePB.SubaccountTradesListResponse{}, nil +func (e *MockExchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error) { + return &spotExchangePB.SubaccountTradesListResponse{}, nil } -func (e *MockExchangeClient) GetHistoricalSpotOrders(ctx context.Context, req spotExchangePB.OrdersHistoryRequest) (spotExchangePB.OrdersHistoryResponse, error) { - return spotExchangePB.OrdersHistoryResponse{}, nil +func (e *MockExchangeClient) GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error) { + return &spotExchangePB.OrdersHistoryResponse{}, nil } -func (e *MockExchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { +func (e *MockExchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { return nil, nil } -func (e *MockExchangeClient) GetInsuranceFunds(ctx context.Context, req insurancePB.FundsRequest) (insurancePB.FundsResponse, error) { - return insurancePB.FundsResponse{}, nil +func (e *MockExchangeClient) GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error) { + return &insurancePB.FundsResponse{}, nil +} + +func (e *MockExchangeClient) GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error) { + return &insurancePB.RedemptionsResponse{}, nil } -func (e *MockExchangeClient) GetRedemptions(ctx context.Context, req insurancePB.RedemptionsRequest) (insurancePB.RedemptionsResponse, error) { - return insurancePB.RedemptionsResponse{}, nil +func (e *MockExchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error) { + return &portfolioExchangePB.AccountPortfolioResponse{}, nil } -func (e *MockExchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error) { - return portfolioExchangePB.AccountPortfolioResponse{}, nil +func (e *MockExchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error) { + return &portfolioExchangePB.AccountPortfolioBalancesResponse{}, nil } func (e *MockExchangeClient) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error) { @@ -409,16 +418,16 @@ func (e *MockExchangeClient) StreamKeepalive(ctx context.Context) (metaPB.Inject return nil, nil } -func (e *MockExchangeClient) GetInfo(ctx context.Context, req metaPB.InfoRequest) (metaPB.InfoResponse, error) { - return metaPB.InfoResponse{}, nil +func (e *MockExchangeClient) GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error) { + return &metaPB.InfoResponse{}, nil } -func (e *MockExchangeClient) GetVersion(ctx context.Context, req metaPB.VersionRequest) (metaPB.VersionResponse, error) { - return metaPB.VersionResponse{}, nil +func (e *MockExchangeClient) GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error) { + return &metaPB.VersionResponse{}, nil } -func (e *MockExchangeClient) Ping(ctx context.Context, req metaPB.PingRequest) (metaPB.PingResponse, error) { - return metaPB.PingResponse{}, nil +func (e *MockExchangeClient) Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error) { + return &metaPB.PingResponse{}, nil } func (e *MockExchangeClient) Close() { diff --git a/client/core/token_test.go b/client/core/token_test.go index 7ced75cd..ceb72366 100644 --- a/client/core/token_test.go +++ b/client/core/token_test.go @@ -1,9 +1,10 @@ package core import ( + "testing" + "github.com/huandu/go-assert" "github.com/shopspring/decimal" - "testing" ) func createINJToken() Token { diff --git a/client/exchange/exchange.go b/client/exchange/exchange.go index 59552049..17577000 100644 --- a/client/exchange/exchange.go +++ b/client/exchange/exchange.go @@ -3,6 +3,10 @@ package exchange import ( "context" "fmt" + "time" + + "google.golang.org/grpc/credentials/insecure" + "github.com/InjectiveLabs/sdk-go/client/common" accountPB "github.com/InjectiveLabs/sdk-go/exchange/accounts_rpc/pb" auctionPB "github.com/InjectiveLabs/sdk-go/exchange/auction_rpc/pb" @@ -22,74 +26,74 @@ import ( type ExchangeClient interface { QueryClient() *grpc.ClientConn - GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error) - GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error) - GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error) + GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error) + GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error) + GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error) // StreamDerivativeOrderbook deprecated API StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) - GetDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersRequest) (derivativeExchangePB.OrdersResponse, error) - GetDerivativeMarkets(ctx context.Context, req derivativeExchangePB.MarketsRequest) (derivativeExchangePB.MarketsResponse, error) - GetDerivativePositions(ctx context.Context, req derivativeExchangePB.PositionsRequest) (derivativeExchangePB.PositionsResponse, error) - GetDerivativePositionsV2(ctx context.Context, req derivativeExchangePB.PositionsV2Request) (derivativeExchangePB.PositionsV2Response, error) - GetDerivativeLiquidablePositions(ctx context.Context, req derivativeExchangePB.LiquidablePositionsRequest) (derivativeExchangePB.LiquidablePositionsResponse, error) - StreamDerivativePositions(ctx context.Context, req derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) - StreamDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) - GetDerivativeTrades(ctx context.Context, req derivativeExchangePB.TradesRequest) (derivativeExchangePB.TradesResponse, error) - GetDerivativeTradesV2(ctx context.Context, req derivativeExchangePB.TradesV2Request) (derivativeExchangePB.TradesV2Response, error) - StreamDerivativeTrades(ctx context.Context, req derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) - StreamDerivativeV2Trades(ctx context.Context, req derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) - GetSubaccountDerivativeOrdersList(ctx context.Context, req derivativeExchangePB.SubaccountOrdersListRequest) (derivativeExchangePB.SubaccountOrdersListResponse, error) - GetSubaccountDerivativeTradesList(ctx context.Context, req derivativeExchangePB.SubaccountTradesListRequest) (derivativeExchangePB.SubaccountTradesListResponse, error) - GetHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersHistoryRequest) (derivativeExchangePB.OrdersHistoryResponse, error) - StreamHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) - GetDerivativeFundingPayments(ctx context.Context, req derivativeExchangePB.FundingPaymentsRequest) (derivativeExchangePB.FundingPaymentsResponse, error) - GetDerivativeFundingRates(ctx context.Context, req derivativeExchangePB.FundingRatesRequest) (derivativeExchangePB.FundingRatesResponse, error) - GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error) - GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error) + GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error) + GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error) + GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error) + GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error) + GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error) + StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) + StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) + GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error) + GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error) + StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) + StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) + GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error) + GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error) + GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error) + StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) + GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error) + GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error) + GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error) + GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error) - GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) - GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error) + GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error) + GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error) StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error) - GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error) - GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) + GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error) + GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error) StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error) - GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error) - GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error) - GetSubaccountOrderSummary(ctx context.Context, req accountPB.SubaccountOrderSummaryRequest) (accountPB.SubaccountOrderSummaryResponse, error) - GetOrderStates(ctx context.Context, req accountPB.OrderStatesRequest) (accountPB.OrderStatesResponse, error) - GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error) - GetRewards(ctx context.Context, req accountPB.RewardsRequest) (accountPB.RewardsResponse, error) - GetSpotOrders(ctx context.Context, req spotExchangePB.OrdersRequest) (spotExchangePB.OrdersResponse, error) - GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error) - GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error) + GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error) + GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error) + GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error) + GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error) + GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error) + GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error) + GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error) + GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error) + GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error) // StreamSpotOrderbook deprecated API StreamSpotOrderbookV2(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookV2Client, error) StreamSpotOrderbookUpdate(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error) - GetSpotMarkets(ctx context.Context, req spotExchangePB.MarketsRequest) (spotExchangePB.MarketsResponse, error) - GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error) + GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error) + GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) - StreamSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) - GetSpotTrades(ctx context.Context, req spotExchangePB.TradesRequest) (spotExchangePB.TradesResponse, error) - GetSpotTradesV2(ctx context.Context, req spotExchangePB.TradesV2Request) (spotExchangePB.TradesV2Response, error) - StreamSpotTrades(ctx context.Context, req spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) - StreamSpotTradesV2(ctx context.Context, req spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) - GetSubaccountSpotOrdersList(ctx context.Context, req spotExchangePB.SubaccountOrdersListRequest) (spotExchangePB.SubaccountOrdersListResponse, error) - GetSubaccountSpotTradesList(ctx context.Context, req spotExchangePB.SubaccountTradesListRequest) (spotExchangePB.SubaccountTradesListResponse, error) - GetHistoricalSpotOrders(ctx context.Context, req spotExchangePB.OrdersHistoryRequest) (spotExchangePB.OrdersHistoryResponse, error) - StreamHistoricalSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) - GetInsuranceFunds(ctx context.Context, req insurancePB.FundsRequest) (insurancePB.FundsResponse, error) - GetRedemptions(ctx context.Context, req insurancePB.RedemptionsRequest) (insurancePB.RedemptionsResponse, error) - - GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error) - GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioBalancesResponse, error) + StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) + GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error) + GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error) + StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) + StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) + GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error) + GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error) + GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error) + StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) + GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error) + GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error) + + GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error) + GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error) StreamKeepalive(ctx context.Context) (metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) - GetInfo(ctx context.Context, req metaPB.InfoRequest) (metaPB.InfoResponse, error) - GetVersion(ctx context.Context, req metaPB.VersionRequest) (metaPB.VersionResponse, error) - Ping(ctx context.Context, req metaPB.PingRequest) (metaPB.PingResponse, error) + GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error) + GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error) + Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error) Close() } @@ -113,7 +117,7 @@ func NewExchangeClient(network common.Network, options ...common.ClientOption) ( conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ExchangeGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err := errors.Wrapf(err, "failed to connect to the gRPC: %s", network.ExchangeGrpcEndpoint) @@ -150,9 +154,6 @@ type exchangeClient struct { network common.Network conn *grpc.ClientConn logger log.Logger - client *grpc.ClientConn - - sessionCookie string metaClient metaPB.InjectiveMetaRPCClient explorerClient explorerPB.InjectiveExplorerRPCClient @@ -163,14 +164,15 @@ type exchangeClient struct { spotExchangeClient spotExchangePB.InjectiveSpotExchangeRPCClient derivativeExchangeClient derivativeExchangePB.InjectiveDerivativeExchangeRPCClient portfolioExchangeClient portfolioExchangePB.InjectivePortfolioRPCClient - - closed int64 } func (c *exchangeClient) requestCookie() metadata.MD { var header metadata.MD - req := metaPB.InfoRequest{} - c.metaClient.Info(context.Background(), &req, grpc.Header(&header)) + req := metaPB.InfoRequest{Timestamp: time.Now().UnixMilli()} + _, err := c.metaClient.Info(context.Background(), &req, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -186,52 +188,52 @@ func (c *exchangeClient) QueryClient() *grpc.ClientConn { // Derivatives RPC -func (c *exchangeClient) GetDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersRequest) (derivativeExchangePB.OrdersResponse, error) { +func (c *exchangeClient) GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Orders(ctx, &req) + res, err := c.derivativeExchangeClient.Orders(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrdersResponse{}, err + return &derivativeExchangePB.OrdersResponse{}, err } - return *res, nil + return res, nil } // Deprecated: Use GetDerivativePositionsV2 instead. -func (c *exchangeClient) GetDerivativePositions(ctx context.Context, req derivativeExchangePB.PositionsRequest) (derivativeExchangePB.PositionsResponse, error) { +func (c *exchangeClient) GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Positions(ctx, &req) + res, err := c.derivativeExchangeClient.Positions(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.PositionsResponse{}, err + return &derivativeExchangePB.PositionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativePositionsV2(ctx context.Context, req derivativeExchangePB.PositionsV2Request) (derivativeExchangePB.PositionsV2Response, error) { +func (c *exchangeClient) GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.PositionsV2(ctx, &req) + res, err := c.derivativeExchangeClient.PositionsV2(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.PositionsV2Response{}, err + return &derivativeExchangePB.PositionsV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req derivativeExchangePB.LiquidablePositionsRequest) (derivativeExchangePB.LiquidablePositionsResponse, error) { +func (c *exchangeClient) GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.LiquidablePositions(ctx, &req) + res, err := c.derivativeExchangeClient.LiquidablePositions(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.LiquidablePositionsResponse{}, err + return &derivativeExchangePB.LiquidablePositionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error) { +func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error) { req := derivativeExchangePB.OrderbookV2Request{ MarketId: marketId, } @@ -240,13 +242,13 @@ func (c *exchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId res, err := c.derivativeExchangeClient.OrderbookV2(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrderbookV2Response{}, err + return &derivativeExchangePB.OrderbookV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error) { +func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error) { req := derivativeExchangePB.OrderbooksV2Request{ MarketIds: marketIds, } @@ -255,10 +257,10 @@ func (c *exchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketId res, err := c.derivativeExchangeClient.OrderbooksV2(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.OrderbooksV2Response{}, err + return &derivativeExchangePB.OrderbooksV2Response{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error) { @@ -291,18 +293,18 @@ func (c *exchangeClient) StreamDerivativeOrderbookUpdate(ctx context.Context, ma return stream, nil } -func (c *exchangeClient) GetDerivativeMarkets(ctx context.Context, req derivativeExchangePB.MarketsRequest) (derivativeExchangePB.MarketsResponse, error) { +func (c *exchangeClient) GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Markets(ctx, &req) + res, err := c.derivativeExchangeClient.Markets(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.MarketsResponse{}, err + return &derivativeExchangePB.MarketsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error) { +func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error) { req := derivativeExchangePB.MarketRequest{ MarketId: marketId, } @@ -311,10 +313,10 @@ func (c *exchangeClient) GetDerivativeMarket(ctx context.Context, marketId strin res, err := c.derivativeExchangeClient.Market(ctx, &req) if err != nil { fmt.Println(err) - return derivativeExchangePB.MarketResponse{}, err + return &derivativeExchangePB.MarketResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error) { @@ -332,9 +334,9 @@ func (c *exchangeClient) StreamDerivativeMarket(ctx context.Context, marketIds [ return stream, nil } -func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { +func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamPositions(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamPositions(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -343,9 +345,9 @@ func (c *exchangeClient) StreamDerivativePositions(ctx context.Context, req deri return stream, nil } -func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { +func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamOrders(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamOrders(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -354,31 +356,31 @@ func (c *exchangeClient) StreamDerivativeOrders(ctx context.Context, req derivat return stream, nil } -func (c *exchangeClient) GetDerivativeTrades(ctx context.Context, req derivativeExchangePB.TradesRequest) (derivativeExchangePB.TradesResponse, error) { +func (c *exchangeClient) GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.Trades(ctx, &req) + res, err := c.derivativeExchangeClient.Trades(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.TradesResponse{}, err + return &derivativeExchangePB.TradesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeTradesV2(ctx context.Context, req derivativeExchangePB.TradesV2Request) (derivativeExchangePB.TradesV2Response, error) { +func (c *exchangeClient) GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.TradesV2(ctx, &req) + res, err := c.derivativeExchangeClient.TradesV2(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.TradesV2Response{}, err + return &derivativeExchangePB.TradesV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { +func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamTrades(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamTrades(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -387,9 +389,9 @@ func (c *exchangeClient) StreamDerivativeTrades(ctx context.Context, req derivat return stream, nil } -func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { +func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamTradesV2(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamTradesV2(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -398,41 +400,41 @@ func (c *exchangeClient) StreamDerivativeV2Trades(ctx context.Context, req deriv return stream, nil } -func (c *exchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req derivativeExchangePB.SubaccountOrdersListRequest) (derivativeExchangePB.SubaccountOrdersListResponse, error) { +func (c *exchangeClient) GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.SubaccountOrdersList(ctx, &req) + res, err := c.derivativeExchangeClient.SubaccountOrdersList(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.SubaccountOrdersListResponse{}, err + return &derivativeExchangePB.SubaccountOrdersListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req derivativeExchangePB.SubaccountTradesListRequest) (derivativeExchangePB.SubaccountTradesListResponse, error) { +func (c *exchangeClient) GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.SubaccountTradesList(ctx, &req) + res, err := c.derivativeExchangeClient.SubaccountTradesList(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.SubaccountTradesListResponse{}, err + return &derivativeExchangePB.SubaccountTradesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.OrdersHistoryRequest) (derivativeExchangePB.OrdersHistoryResponse, error) { +func (c *exchangeClient) GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.OrdersHistory(ctx, &req) + res, err := c.derivativeExchangeClient.OrdersHistory(ctx, req) if err != nil { - return derivativeExchangePB.OrdersHistoryResponse{}, err + return &derivativeExchangePB.OrdersHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { +func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error) { ctx = c.getCookie(ctx) - stream, err := c.derivativeExchangeClient.StreamOrdersHistory(ctx, &req) + stream, err := c.derivativeExchangeClient.StreamOrdersHistory(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -441,31 +443,31 @@ func (c *exchangeClient) StreamHistoricalDerivativeOrders(ctx context.Context, r return stream, nil } -func (c *exchangeClient) GetDerivativeFundingPayments(ctx context.Context, req derivativeExchangePB.FundingPaymentsRequest) (derivativeExchangePB.FundingPaymentsResponse, error) { +func (c *exchangeClient) GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.FundingPayments(ctx, &req) + res, err := c.derivativeExchangeClient.FundingPayments(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.FundingPaymentsResponse{}, err + return &derivativeExchangePB.FundingPaymentsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetDerivativeFundingRates(ctx context.Context, req derivativeExchangePB.FundingRatesRequest) (derivativeExchangePB.FundingRatesResponse, error) { +func (c *exchangeClient) GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.derivativeExchangeClient.FundingRates(ctx, &req) + res, err := c.derivativeExchangeClient.FundingRates(ctx, req) if err != nil { fmt.Println(err) - return derivativeExchangePB.FundingRatesResponse{}, err + return &derivativeExchangePB.FundingRatesResponse{}, err } - return *res, nil + return res, nil } // Oracle RPC -func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error) { +func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error) { req := oraclePB.PriceRequest{ BaseSymbol: baseSymbol, QuoteSymbol: quoteSymbol, @@ -477,23 +479,23 @@ func (c *exchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteS res, err := c.oracleClient.Price(ctx, &req) if err != nil { fmt.Println(err) - return oraclePB.PriceResponse{}, err + return &oraclePB.PriceResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetOracleList(ctx context.Context) (oraclePB.OracleListResponse, error) { +func (c *exchangeClient) GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error) { req := oraclePB.OracleListRequest{} ctx = c.getCookie(ctx) res, err := c.oracleClient.OracleList(ctx, &req) if err != nil { fmt.Println(err) - return oraclePB.OracleListResponse{}, err + return &oraclePB.OracleListResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error) { @@ -515,7 +517,7 @@ func (c *exchangeClient) StreamPrices(ctx context.Context, baseSymbol string, qu // Auction RPC -func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB.AuctionEndpointResponse, error) { +func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error) { req := auctionPB.AuctionEndpointRequest{ Round: round, } @@ -524,23 +526,23 @@ func (c *exchangeClient) GetAuction(ctx context.Context, round int64) (auctionPB res, err := c.auctionClient.AuctionEndpoint(ctx, &req) if err != nil { fmt.Println(err) - return auctionPB.AuctionEndpointResponse{}, err + return &auctionPB.AuctionEndpointResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetAuctions(ctx context.Context) (auctionPB.AuctionsResponse, error) { +func (c *exchangeClient) GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error) { req := auctionPB.AuctionsRequest{} ctx = c.getCookie(ctx) res, err := c.auctionClient.Auctions(ctx, &req) if err != nil { fmt.Println(err) - return auctionPB.AuctionsResponse{}, err + return &auctionPB.AuctionsResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error) { @@ -558,7 +560,7 @@ func (c *exchangeClient) StreamBids(ctx context.Context) (auctionPB.InjectiveAuc // Accounts RPC -func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error) { +func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error) { req := accountPB.SubaccountsListRequest{ AccountAddress: accountAddress, } @@ -567,13 +569,13 @@ func (c *exchangeClient) GetSubaccountsList(ctx context.Context, accountAddress res, err := c.accountClient.SubaccountsList(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountsListResponse{}, err + return &accountPB.SubaccountsListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error) { +func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error) { req := accountPB.SubaccountBalanceEndpointRequest{ SubaccountId: subaccountId, Denom: denom, @@ -583,10 +585,10 @@ func (c *exchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId res, err := c.accountClient.SubaccountBalanceEndpoint(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountBalanceEndpointResponse{}, err + return &accountPB.SubaccountBalanceEndpointResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error) { @@ -604,7 +606,7 @@ func (c *exchangeClient) StreamSubaccountBalance(ctx context.Context, subaccount return stream, nil } -func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error) { +func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error) { req := accountPB.SubaccountBalancesListRequest{ SubaccountId: subaccountId, } @@ -613,46 +615,46 @@ func (c *exchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccou res, err := c.accountClient.SubaccountBalancesList(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.SubaccountBalancesListResponse{}, err + return &accountPB.SubaccountBalancesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountHistory(ctx context.Context, req accountPB.SubaccountHistoryRequest) (accountPB.SubaccountHistoryResponse, error) { +func (c *exchangeClient) GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.SubaccountHistory(ctx, &req) + res, err := c.accountClient.SubaccountHistory(ctx, req) if err != nil { fmt.Println(err) - return accountPB.SubaccountHistoryResponse{}, err + return &accountPB.SubaccountHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountOrderSummary(ctx context.Context, req accountPB.SubaccountOrderSummaryRequest) (accountPB.SubaccountOrderSummaryResponse, error) { +func (c *exchangeClient) GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.SubaccountOrderSummary(ctx, &req) + res, err := c.accountClient.SubaccountOrderSummary(ctx, req) if err != nil { fmt.Println(err) - return accountPB.SubaccountOrderSummaryResponse{}, err + return &accountPB.SubaccountOrderSummaryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetOrderStates(ctx context.Context, req accountPB.OrderStatesRequest) (accountPB.OrderStatesResponse, error) { +func (c *exchangeClient) GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.OrderStates(ctx, &req) + res, err := c.accountClient.OrderStates(ctx, req) if err != nil { fmt.Println(err) - return accountPB.OrderStatesResponse{}, err + return &accountPB.OrderStatesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error) { +func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error) { req := accountPB.PortfolioRequest{ AccountAddress: accountAddress, } @@ -661,37 +663,37 @@ func (c *exchangeClient) GetPortfolio(ctx context.Context, accountAddress string res, err := c.accountClient.Portfolio(ctx, &req) if err != nil { fmt.Println(err) - return accountPB.PortfolioResponse{}, err + return &accountPB.PortfolioResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetRewards(ctx context.Context, req accountPB.RewardsRequest) (accountPB.RewardsResponse, error) { +func (c *exchangeClient) GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.accountClient.Rewards(ctx, &req) + res, err := c.accountClient.Rewards(ctx, req) if err != nil { fmt.Println(err) - return accountPB.RewardsResponse{}, err + return &accountPB.RewardsResponse{}, err } - return *res, nil + return res, nil } // Spot RPC -func (c *exchangeClient) GetSpotOrders(ctx context.Context, req spotExchangePB.OrdersRequest) (spotExchangePB.OrdersResponse, error) { +func (c *exchangeClient) GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Orders(ctx, &req) + res, err := c.spotExchangeClient.Orders(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.OrdersResponse{}, err + return &spotExchangePB.OrdersResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error) { +func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error) { req := spotExchangePB.OrderbookV2Request{ MarketId: marketId, } @@ -700,13 +702,13 @@ func (c *exchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string res, err := c.spotExchangeClient.OrderbookV2(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.OrderbookV2Response{}, err + return &spotExchangePB.OrderbookV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error) { +func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error) { req := spotExchangePB.OrderbooksV2Request{ MarketIds: marketIds, } @@ -715,10 +717,10 @@ func (c *exchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []st res, err := c.spotExchangeClient.OrderbooksV2(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.OrderbooksV2Response{}, err + return &spotExchangePB.OrderbooksV2Response{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSpotOrderbookUpdate(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error) { @@ -751,18 +753,18 @@ func (c *exchangeClient) StreamSpotOrderbookV2(ctx context.Context, marketIds [] return stream, nil } -func (c *exchangeClient) GetSpotMarkets(ctx context.Context, req spotExchangePB.MarketsRequest) (spotExchangePB.MarketsResponse, error) { +func (c *exchangeClient) GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Markets(ctx, &req) + res, err := c.spotExchangeClient.Markets(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.MarketsResponse{}, err + return &spotExchangePB.MarketsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error) { +func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error) { req := spotExchangePB.MarketRequest{ MarketId: marketId, } @@ -771,10 +773,10 @@ func (c *exchangeClient) GetSpotMarket(ctx context.Context, marketId string) (sp res, err := c.spotExchangeClient.Market(ctx, &req) if err != nil { fmt.Println(err) - return spotExchangePB.MarketResponse{}, err + return &spotExchangePB.MarketResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error) { @@ -792,9 +794,9 @@ func (c *exchangeClient) StreamSpotMarket(ctx context.Context, marketIds []strin return stream, nil } -func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { +func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamOrders(ctx, &req) + stream, err := c.spotExchangeClient.StreamOrders(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -803,31 +805,31 @@ func (c *exchangeClient) StreamSpotOrders(ctx context.Context, req spotExchangeP return stream, nil } -func (c *exchangeClient) GetSpotTrades(ctx context.Context, req spotExchangePB.TradesRequest) (spotExchangePB.TradesResponse, error) { +func (c *exchangeClient) GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.Trades(ctx, &req) + res, err := c.spotExchangeClient.Trades(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.TradesResponse{}, err + return &spotExchangePB.TradesResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSpotTradesV2(ctx context.Context, req spotExchangePB.TradesV2Request) (spotExchangePB.TradesV2Response, error) { +func (c *exchangeClient) GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.TradesV2(ctx, &req) + res, err := c.spotExchangeClient.TradesV2(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.TradesV2Response{}, err + return &spotExchangePB.TradesV2Response{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { +func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamTrades(ctx, &req) + stream, err := c.spotExchangeClient.StreamTrades(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -836,9 +838,9 @@ func (c *exchangeClient) StreamSpotTrades(ctx context.Context, req spotExchangeP return stream, nil } -func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { +func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamTradesV2(ctx, &req) + stream, err := c.spotExchangeClient.StreamTradesV2(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -847,41 +849,41 @@ func (c *exchangeClient) StreamSpotTradesV2(ctx context.Context, req spotExchang return stream, nil } -func (c *exchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req spotExchangePB.SubaccountOrdersListRequest) (spotExchangePB.SubaccountOrdersListResponse, error) { +func (c *exchangeClient) GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.SubaccountOrdersList(ctx, &req) + res, err := c.spotExchangeClient.SubaccountOrdersList(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.SubaccountOrdersListResponse{}, err + return &spotExchangePB.SubaccountOrdersListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req spotExchangePB.SubaccountTradesListRequest) (spotExchangePB.SubaccountTradesListResponse, error) { +func (c *exchangeClient) GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.SubaccountTradesList(ctx, &req) + res, err := c.spotExchangeClient.SubaccountTradesList(ctx, req) if err != nil { fmt.Println(err) - return spotExchangePB.SubaccountTradesListResponse{}, err + return &spotExchangePB.SubaccountTradesListResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetHistoricalSpotOrders(ctx context.Context, req spotExchangePB.OrdersHistoryRequest) (spotExchangePB.OrdersHistoryResponse, error) { +func (c *exchangeClient) GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error) { ctx = c.getCookie(ctx) - res, err := c.spotExchangeClient.OrdersHistory(ctx, &req) + res, err := c.spotExchangeClient.OrdersHistory(ctx, req) if err != nil { - return spotExchangePB.OrdersHistoryResponse{}, err + return &spotExchangePB.OrdersHistoryResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { +func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error) { ctx = c.getCookie(ctx) - stream, err := c.spotExchangeClient.StreamOrdersHistory(ctx, &req) + stream, err := c.spotExchangeClient.StreamOrdersHistory(ctx, req) if err != nil { fmt.Println(err) return nil, err @@ -890,59 +892,59 @@ func (c *exchangeClient) StreamHistoricalSpotOrders(ctx context.Context, req spo return stream, nil } -func (c *exchangeClient) GetInsuranceFunds(ctx context.Context, req insurancePB.FundsRequest) (insurancePB.FundsResponse, error) { +func (c *exchangeClient) GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.insuranceClient.Funds(ctx, &req) + res, err := c.insuranceClient.Funds(ctx, req) if err != nil { fmt.Println(err) - return insurancePB.FundsResponse{}, err + return &insurancePB.FundsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetRedemptions(ctx context.Context, req insurancePB.RedemptionsRequest) (insurancePB.RedemptionsResponse, error) { +func (c *exchangeClient) GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.insuranceClient.Redemptions(ctx, &req) + res, err := c.insuranceClient.Redemptions(ctx, req) if err != nil { fmt.Println(err) - return insurancePB.RedemptionsResponse{}, err + return &insurancePB.RedemptionsResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) Ping(ctx context.Context, req metaPB.PingRequest) (metaPB.PingResponse, error) { +func (c *exchangeClient) Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Ping(ctx, &req) + res, err := c.metaClient.Ping(ctx, req) if err != nil { fmt.Println(err) - return metaPB.PingResponse{}, err + return &metaPB.PingResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetVersion(ctx context.Context, req metaPB.VersionRequest) (metaPB.VersionResponse, error) { +func (c *exchangeClient) GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Version(ctx, &req) + res, err := c.metaClient.Version(ctx, req) if err != nil { fmt.Println(err) - return metaPB.VersionResponse{}, err + return &metaPB.VersionResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetInfo(ctx context.Context, req metaPB.InfoRequest) (metaPB.InfoResponse, error) { +func (c *exchangeClient) GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error) { ctx = c.getCookie(ctx) - res, err := c.metaClient.Info(ctx, &req) + res, err := c.metaClient.Info(ctx, req) if err != nil { fmt.Println(err) - return metaPB.InfoResponse{}, err + return &metaPB.InfoResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamKeepalive(ctx context.Context) (metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error) { @@ -959,30 +961,30 @@ func (c *exchangeClient) StreamKeepalive(ctx context.Context) (metaPB.InjectiveM } // Deprecated: Use GetAccountPortfolioBalances instead. -func (c *exchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error) { +func (c *exchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error) { ctx = c.getCookie(ctx) res, err := c.portfolioExchangeClient.AccountPortfolio(ctx, &portfolioExchangePB.AccountPortfolioRequest{ AccountAddress: accountAddress, }) if err != nil { fmt.Println(err) - return portfolioExchangePB.AccountPortfolioResponse{}, err + return &portfolioExchangePB.AccountPortfolioResponse{}, err } - return *res, nil + return res, nil } -func (c *exchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioBalancesResponse, error) { +func (c *exchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error) { ctx = c.getCookie(ctx) res, err := c.portfolioExchangeClient.AccountPortfolioBalances(ctx, &portfolioExchangePB.AccountPortfolioBalancesRequest{ AccountAddress: accountAddress, }) if err != nil { fmt.Println(err) - return portfolioExchangePB.AccountPortfolioBalancesResponse{}, err + return &portfolioExchangePB.AccountPortfolioBalancesResponse{}, err } - return *res, nil + return res, nil } func (c *exchangeClient) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error) { diff --git a/client/explorer/explorer.go b/client/explorer/explorer.go index e5fcef53..00c76fc6 100644 --- a/client/explorer/explorer.go +++ b/client/explorer/explorer.go @@ -3,6 +3,9 @@ package exchange import ( "context" "fmt" + + "google.golang.org/grpc/credentials/insecure" + "github.com/InjectiveLabs/sdk-go/client/common" explorerPB "github.com/InjectiveLabs/sdk-go/exchange/explorer_rpc/pb" "google.golang.org/grpc/metadata" @@ -14,21 +17,21 @@ import ( type ExplorerClient interface { QueryClient() *grpc.ClientConn - GetTxByTxHash(ctx context.Context, hash string) (explorerPB.GetTxByTxHashResponse, error) - GetTxs(ctx context.Context, req explorerPB.GetTxsRequest) (explorerPB.GetTxsResponse, error) - GetBlock(ctx context.Context, blockHeight string) (explorerPB.GetBlockResponse, error) - GetBlocks(ctx context.Context) (explorerPB.GetBlocksResponse, error) - GetAccountTxs(ctx context.Context, req explorerPB.GetAccountTxsRequest) (explorerPB.GetAccountTxsResponse, error) - GetPeggyDeposits(ctx context.Context, req explorerPB.GetPeggyDepositTxsRequest) (explorerPB.GetPeggyDepositTxsResponse, error) - GetPeggyWithdrawals(ctx context.Context, req explorerPB.GetPeggyWithdrawalTxsRequest) (explorerPB.GetPeggyWithdrawalTxsResponse, error) - GetIBCTransfers(ctx context.Context, req explorerPB.GetIBCTransferTxsRequest) (explorerPB.GetIBCTransferTxsResponse, error) + GetTxByTxHash(ctx context.Context, hash string) (*explorerPB.GetTxByTxHashResponse, error) + GetTxs(ctx context.Context, req *explorerPB.GetTxsRequest) (*explorerPB.GetTxsResponse, error) + GetBlock(ctx context.Context, blockHeight string) (*explorerPB.GetBlockResponse, error) + GetBlocks(ctx context.Context) (*explorerPB.GetBlocksResponse, error) + GetAccountTxs(ctx context.Context, req *explorerPB.GetAccountTxsRequest) (*explorerPB.GetAccountTxsResponse, error) + GetPeggyDeposits(ctx context.Context, req *explorerPB.GetPeggyDepositTxsRequest) (*explorerPB.GetPeggyDepositTxsResponse, error) + GetPeggyWithdrawals(ctx context.Context, req *explorerPB.GetPeggyWithdrawalTxsRequest) (*explorerPB.GetPeggyWithdrawalTxsResponse, error) + GetIBCTransfers(ctx context.Context, req *explorerPB.GetIBCTransferTxsRequest) (*explorerPB.GetIBCTransferTxsResponse, error) StreamTxs(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamTxsClient, error) StreamBlocks(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamBlocksClient, error) - GetWasmCodes(ctx context.Context, req explorerPB.GetWasmCodesRequest) (explorerPB.GetWasmCodesResponse, error) - GetWasmCodeByID(ctx context.Context, req explorerPB.GetWasmCodeByIDRequest) (explorerPB.GetWasmCodeByIDResponse, error) - GetWasmContracts(ctx context.Context, req explorerPB.GetWasmContractsRequest) (explorerPB.GetWasmContractsResponse, error) - GetWasmContractByAddress(ctx context.Context, req explorerPB.GetWasmContractByAddressRequest) (explorerPB.GetWasmContractByAddressResponse, error) - GetCW20Balance(ctx context.Context, req explorerPB.GetCw20BalanceRequest) (explorerPB.GetCw20BalanceResponse, error) + GetWasmCodes(ctx context.Context, req *explorerPB.GetWasmCodesRequest) (*explorerPB.GetWasmCodesResponse, error) + GetWasmCodeByID(ctx context.Context, req *explorerPB.GetWasmCodeByIDRequest) (*explorerPB.GetWasmCodeByIDResponse, error) + GetWasmContracts(ctx context.Context, req *explorerPB.GetWasmContractsRequest) (*explorerPB.GetWasmContractsResponse, error) + GetWasmContractByAddress(ctx context.Context, req *explorerPB.GetWasmContractByAddressRequest) (*explorerPB.GetWasmContractByAddressResponse, error) + GetCW20Balance(ctx context.Context, req *explorerPB.GetCw20BalanceRequest) (*explorerPB.GetCw20BalanceResponse, error) Close() } @@ -51,7 +54,7 @@ func NewExplorerClient(network common.Network, options ...common.ClientOption) ( if opts.TLSCert != nil { conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithTransportCredentials(opts.TLSCert), grpc.WithContextDialer(common.DialerFunc)) } else { - conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithInsecure(), grpc.WithContextDialer(common.DialerFunc)) + conn, err = grpc.Dial(network.ExplorerGrpcEndpoint, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(common.DialerFunc)) } if err != nil { err := errors.Wrapf(err, "failed to connect to the gRPC: %s", network.ExplorerGrpcEndpoint) @@ -80,14 +83,16 @@ type explorerClient struct { conn *grpc.ClientConn logger log.Logger - sessionCookie string explorerClient explorerPB.InjectiveExplorerRPCClient } func (c *explorerClient) requestCookie() metadata.MD { var header metadata.MD req := explorerPB.GetTxsRequest{} - c.explorerClient.GetTxs(context.Background(), &req, grpc.Header(&header)) + _, err := c.explorerClient.GetTxs(context.Background(), &req, grpc.Header(&header)) + if err != nil { + panic(err) + } return header } @@ -97,18 +102,11 @@ func (c *explorerClient) getCookie(ctx context.Context) context.Context { return metadata.AppendToOutgoingContext(ctx, "cookie", cookie) } -func (c *explorerClient) setCookie(metadata metadata.MD) { - md := metadata.Get("set-cookie") - if len(md) > 0 { - c.sessionCookie = md[0] - } -} - func (c *explorerClient) QueryClient() *grpc.ClientConn { return c.conn } -func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (explorerPB.GetTxByTxHashResponse, error) { +func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (*explorerPB.GetTxByTxHashResponse, error) { req := explorerPB.GetTxByTxHashRequest{ Hash: hash, } @@ -117,37 +115,37 @@ func (c *explorerClient) GetTxByTxHash(ctx context.Context, hash string) (explor res, err := c.explorerClient.GetTxByTxHash(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetTxByTxHashResponse{}, err + return &explorerPB.GetTxByTxHashResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetAccountTxs(ctx context.Context, req explorerPB.GetAccountTxsRequest) (explorerPB.GetAccountTxsResponse, error) { +func (c *explorerClient) GetAccountTxs(ctx context.Context, req *explorerPB.GetAccountTxsRequest) (*explorerPB.GetAccountTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetAccountTxs(ctx, &req) + res, err := c.explorerClient.GetAccountTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetAccountTxsResponse{}, err + return &explorerPB.GetAccountTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetBlocks(ctx context.Context) (explorerPB.GetBlocksResponse, error) { +func (c *explorerClient) GetBlocks(ctx context.Context) (*explorerPB.GetBlocksResponse, error) { req := explorerPB.GetBlocksRequest{} ctx = c.getCookie(ctx) res, err := c.explorerClient.GetBlocks(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetBlocksResponse{}, err + return &explorerPB.GetBlocksResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (explorerPB.GetBlockResponse, error) { +func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (*explorerPB.GetBlockResponse, error) { req := explorerPB.GetBlockRequest{ Id: blockHeight, } @@ -156,54 +154,54 @@ func (c *explorerClient) GetBlock(ctx context.Context, blockHeight string) (expl res, err := c.explorerClient.GetBlock(ctx, &req) if err != nil { fmt.Println(err) - return explorerPB.GetBlockResponse{}, err + return &explorerPB.GetBlockResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetTxs(ctx context.Context, req explorerPB.GetTxsRequest) (explorerPB.GetTxsResponse, error) { +func (c *explorerClient) GetTxs(ctx context.Context, req *explorerPB.GetTxsRequest) (*explorerPB.GetTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetTxs(ctx, &req) + res, err := c.explorerClient.GetTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetTxsResponse{}, err + return &explorerPB.GetTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetPeggyDeposits(ctx context.Context, req explorerPB.GetPeggyDepositTxsRequest) (explorerPB.GetPeggyDepositTxsResponse, error) { +func (c *explorerClient) GetPeggyDeposits(ctx context.Context, req *explorerPB.GetPeggyDepositTxsRequest) (*explorerPB.GetPeggyDepositTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetPeggyDepositTxs(ctx, &req) + res, err := c.explorerClient.GetPeggyDepositTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetPeggyDepositTxsResponse{}, err + return &explorerPB.GetPeggyDepositTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetPeggyWithdrawals(ctx context.Context, req explorerPB.GetPeggyWithdrawalTxsRequest) (explorerPB.GetPeggyWithdrawalTxsResponse, error) { +func (c *explorerClient) GetPeggyWithdrawals(ctx context.Context, req *explorerPB.GetPeggyWithdrawalTxsRequest) (*explorerPB.GetPeggyWithdrawalTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetPeggyWithdrawalTxs(ctx, &req) + res, err := c.explorerClient.GetPeggyWithdrawalTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetPeggyWithdrawalTxsResponse{}, err + return &explorerPB.GetPeggyWithdrawalTxsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetIBCTransfers(ctx context.Context, req explorerPB.GetIBCTransferTxsRequest) (explorerPB.GetIBCTransferTxsResponse, error) { +func (c *explorerClient) GetIBCTransfers(ctx context.Context, req *explorerPB.GetIBCTransferTxsRequest) (*explorerPB.GetIBCTransferTxsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetIBCTransferTxs(ctx, &req) + res, err := c.explorerClient.GetIBCTransferTxs(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetIBCTransferTxsResponse{}, err + return &explorerPB.GetIBCTransferTxsResponse{}, err } - return *res, nil + return res, nil } func (c *explorerClient) StreamTxs(ctx context.Context) (explorerPB.InjectiveExplorerRPC_StreamTxsClient, error) { @@ -232,59 +230,59 @@ func (c *explorerClient) StreamBlocks(ctx context.Context) (explorerPB.Injective return stream, nil } -func (c *explorerClient) GetWasmCodes(ctx context.Context, req explorerPB.GetWasmCodesRequest) (explorerPB.GetWasmCodesResponse, error) { +func (c *explorerClient) GetWasmCodes(ctx context.Context, req *explorerPB.GetWasmCodesRequest) (*explorerPB.GetWasmCodesResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmCodes(ctx, &req) + res, err := c.explorerClient.GetWasmCodes(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmCodesResponse{}, err + return &explorerPB.GetWasmCodesResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmCodeByID(ctx context.Context, req explorerPB.GetWasmCodeByIDRequest) (explorerPB.GetWasmCodeByIDResponse, error) { +func (c *explorerClient) GetWasmCodeByID(ctx context.Context, req *explorerPB.GetWasmCodeByIDRequest) (*explorerPB.GetWasmCodeByIDResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmCodeByID(ctx, &req) + res, err := c.explorerClient.GetWasmCodeByID(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmCodeByIDResponse{}, err + return &explorerPB.GetWasmCodeByIDResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmContracts(ctx context.Context, req explorerPB.GetWasmContractsRequest) (explorerPB.GetWasmContractsResponse, error) { +func (c *explorerClient) GetWasmContracts(ctx context.Context, req *explorerPB.GetWasmContractsRequest) (*explorerPB.GetWasmContractsResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmContracts(ctx, &req) + res, err := c.explorerClient.GetWasmContracts(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmContractsResponse{}, err + return &explorerPB.GetWasmContractsResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetWasmContractByAddress(ctx context.Context, req explorerPB.GetWasmContractByAddressRequest) (explorerPB.GetWasmContractByAddressResponse, error) { +func (c *explorerClient) GetWasmContractByAddress(ctx context.Context, req *explorerPB.GetWasmContractByAddressRequest) (*explorerPB.GetWasmContractByAddressResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetWasmContractByAddress(ctx, &req) + res, err := c.explorerClient.GetWasmContractByAddress(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetWasmContractByAddressResponse{}, err + return &explorerPB.GetWasmContractByAddressResponse{}, err } - return *res, nil + return res, nil } -func (c *explorerClient) GetCW20Balance(ctx context.Context, req explorerPB.GetCw20BalanceRequest) (explorerPB.GetCw20BalanceResponse, error) { +func (c *explorerClient) GetCW20Balance(ctx context.Context, req *explorerPB.GetCw20BalanceRequest) (*explorerPB.GetCw20BalanceResponse, error) { ctx = c.getCookie(ctx) - res, err := c.explorerClient.GetCw20Balance(ctx, &req) + res, err := c.explorerClient.GetCw20Balance(ctx, req) if err != nil { fmt.Println(err) - return explorerPB.GetCw20BalanceResponse{}, err + return &explorerPB.GetCw20BalanceResponse{}, err } - return *res, nil + return res, nil } func (c *explorerClient) Close() { diff --git a/client/metadata/assets/devnet-1.ini b/client/metadata/assets/devnet-1.ini index ea7462f8..5d4c12cb 100644 --- a/client/metadata/assets/devnet-1.ini +++ b/client/metadata/assets/devnet-1.ini @@ -255,4 +255,3 @@ decimals = 18 [USDC] peggy_denom = peggy0xdAC17F958D2ee523a2206206994597C13D831ec7 decimals = 6 - diff --git a/client/metadata/fetch_metadata.go b/client/metadata/fetch_metadata.go index 4e9d02bb..cb4f08b0 100644 --- a/client/metadata/fetch_metadata.go +++ b/client/metadata/fetch_metadata.go @@ -3,25 +3,18 @@ package main import ( "context" "fmt" + "os" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" - "os" //derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" - spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" "math" "strconv" -) -func find(slice []string, val string) bool { - for _, item := range slice { - if item == val { - return true - } - } - return false -} + spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" +) var metadataTemplate = `[%s] description = '%s %s %s' @@ -50,7 +43,7 @@ func FetchDenom(network common.Network) { // fetch spot markets spotMarketsReq := spotExchangePB.MarketsRequest{MarketStatus: "active"} ctx := context.Background() - spotRes, err := exchangeClient.GetSpotMarkets(ctx, spotMarketsReq) + spotRes, err := exchangeClient.GetSpotMarkets(ctx, &spotMarketsReq) if err != nil { panic(err) } @@ -90,7 +83,7 @@ func FetchDenom(network common.Network) { //fetch derivative markets derivativeMarketsReq := derivativeExchangePB.MarketsRequest{MarketStatus: "active"} - derivativeRes, err := exchangeClient.GetDerivativeMarkets(ctx, derivativeMarketsReq) + derivativeRes, err := exchangeClient.GetDerivativeMarkets(ctx, &derivativeMarketsReq) if err != nil { panic(err) } diff --git a/ethereum/util/amounts.go b/ethereum/util/amounts.go index b195b404..1435beaa 100644 --- a/ethereum/util/amounts.go +++ b/ethereum/util/amounts.go @@ -27,11 +27,11 @@ func (w *Wei) Scan(v interface{}) error { return nil } var source string - switch v.(type) { + switch value := v.(type) { case string: - source = v.(string) + source = value case []byte: - source = string(v.([]byte)) + source = string(value) default: return fmt.Errorf("incompatible type for decimal.Decimal: %T", v) } diff --git a/examples/chain/0_LocalOrderHash/example.go b/examples/chain/0_LocalOrderHash/example.go index d5b8efa0..2eb3e8f1 100644 --- a/examples/chain/0_LocalOrderHash/example.go +++ b/examples/chain/0_LocalOrderHash/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" "github.com/InjectiveLabs/sdk-go/client" diff --git a/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go b/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go index dafb9566..2b78c7df 100644 --- a/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go +++ b/examples/chain/10_MsgBatchCancelDerivativeOrders/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go b/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go index 1f329833..fd679dd3 100644 --- a/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go +++ b/examples/chain/11_MsgBatchCreateSpotLimitOrders/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go b/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go index 2843b8e7..4ddd83d3 100644 --- a/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go +++ b/examples/chain/12_MsgBatchCreateDerivativeLimitOrders/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/13_MsgIncreasePositionMargin/example.go b/examples/chain/13_MsgIncreasePositionMargin/example.go index 0d37a089..ce5742cd 100644 --- a/examples/chain/13_MsgIncreasePositionMargin/example.go +++ b/examples/chain/13_MsgIncreasePositionMargin/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/15_MsgWithdraw/example.go b/examples/chain/15_MsgWithdraw/example.go index ceaeb7f0..2f05671c 100644 --- a/examples/chain/15_MsgWithdraw/example.go +++ b/examples/chain/15_MsgWithdraw/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/16_MsgSubaccountTransfer/example.go b/examples/chain/16_MsgSubaccountTransfer/example.go index 70a5ee81..06bac9cf 100644 --- a/examples/chain/16_MsgSubaccountTransfer/example.go +++ b/examples/chain/16_MsgSubaccountTransfer/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/17_MsgBatchUpdateOrders/example.go b/examples/chain/17_MsgBatchUpdateOrders/example.go index 8c4e65e6..79c9db97 100644 --- a/examples/chain/17_MsgBatchUpdateOrders/example.go +++ b/examples/chain/17_MsgBatchUpdateOrders/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/18_MsgBid/example.go b/examples/chain/18_MsgBid/example.go index babe0f2c..74ac4de2 100644 --- a/examples/chain/18_MsgBid/example.go +++ b/examples/chain/18_MsgBid/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/19_MsgGrant/example.go b/examples/chain/19_MsgGrant/example.go index 1213cf4f..4fa1280b 100644 --- a/examples/chain/19_MsgGrant/example.go +++ b/examples/chain/19_MsgGrant/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/1_MsgSend/example.go b/examples/chain/1_MsgSend/example.go index 552e6dfa..c90c3c3b 100644 --- a/examples/chain/1_MsgSend/example.go +++ b/examples/chain/1_MsgSend/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/20_MsgExec/example.go b/examples/chain/20_MsgExec/example.go index aa3c0207..aef4f510 100644 --- a/examples/chain/20_MsgExec/example.go +++ b/examples/chain/20_MsgExec/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/21_MsgRevoke/example.go b/examples/chain/21_MsgRevoke/example.go index ca2877c8..80ecc157 100644 --- a/examples/chain/21_MsgRevoke/example.go +++ b/examples/chain/21_MsgRevoke/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/22_MsgSendToEth/example.go b/examples/chain/22_MsgSendToEth/example.go index 81102cdb..4c79655f 100644 --- a/examples/chain/22_MsgSendToEth/example.go +++ b/examples/chain/22_MsgSendToEth/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/23_MsgRelayPriceFeedPrice/example.go b/examples/chain/23_MsgRelayPriceFeedPrice/example.go index a4cd3b9f..860e57d6 100644 --- a/examples/chain/23_MsgRelayPriceFeedPrice/example.go +++ b/examples/chain/23_MsgRelayPriceFeedPrice/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/24_MsgRegisterAsDMM/example.go b/examples/chain/24_MsgRegisterAsDMM/example.go index 1f3dfb70..7c9ec9ea 100644 --- a/examples/chain/24_MsgRegisterAsDMM/example.go +++ b/examples/chain/24_MsgRegisterAsDMM/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/25_MsgDelegate/example.go b/examples/chain/25_MsgDelegate/example.go index 60bcaf8b..84c18a20 100644 --- a/examples/chain/25_MsgDelegate/example.go +++ b/examples/chain/25_MsgDelegate/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/26_MsgWithdrawDelegatorReward/example.go b/examples/chain/26_MsgWithdrawDelegatorReward/example.go index d64c9df9..b93178db 100644 --- a/examples/chain/26_MsgWithdrawDelegatorReward/example.go +++ b/examples/chain/26_MsgWithdrawDelegatorReward/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/27_QueryAuthzGrants/example.go b/examples/chain/27_QueryAuthzGrants/example.go index f0fc0eb1..25ade850 100644 --- a/examples/chain/27_QueryAuthzGrants/example.go +++ b/examples/chain/27_QueryAuthzGrants/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/chain/28_BankBalances/example.go b/examples/chain/28_BankBalances/example.go index afcaca63..fbcabcf0 100644 --- a/examples/chain/28_BankBalances/example.go +++ b/examples/chain/28_BankBalances/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/chain/29_BankBalance/example.go b/examples/chain/29_BankBalance/example.go index ba2a0d5b..1946c666 100644 --- a/examples/chain/29_BankBalance/example.go +++ b/examples/chain/29_BankBalance/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/chain/2_MsgDeposit/example.go b/examples/chain/2_MsgDeposit/example.go index c4276c5d..26bc69f2 100644 --- a/examples/chain/2_MsgDeposit/example.go +++ b/examples/chain/2_MsgDeposit/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/30_MsgExternalTransfer/example.go b/examples/chain/30_MsgExternalTransfer/example.go index 4e89b201..2ff30426 100644 --- a/examples/chain/30_MsgExternalTransfer/example.go +++ b/examples/chain/30_MsgExternalTransfer/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/31_MsgMultiSend/example.go b/examples/chain/31_MsgMultiSend/example.go index 32ceba2a..e40018cd 100644 --- a/examples/chain/31_MsgMultiSend/example.go +++ b/examples/chain/31_MsgMultiSend/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/33_GetBlock/example.go b/examples/chain/33_GetBlock/example.go index a0e70672..35e195dd 100644 --- a/examples/chain/33_GetBlock/example.go +++ b/examples/chain/33_GetBlock/example.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" tmclient "github.com/InjectiveLabs/sdk-go/client/tm" ) diff --git a/examples/chain/34_OfflineSigning/example.go b/examples/chain/34_OfflineSigning/example.go index 16afce57..6962e625 100644 --- a/examples/chain/34_OfflineSigning/example.go +++ b/examples/chain/34_OfflineSigning/example.go @@ -4,11 +4,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "io/ioutil" "os" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/35_StreamEventOrderFail/example.go b/examples/chain/35_StreamEventOrderFail/example.go index 93ec8115..4697f761 100644 --- a/examples/chain/35_StreamEventOrderFail/example.go +++ b/examples/chain/35_StreamEventOrderFail/example.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/chain/36_StreamEventOrderbookUpdate/example.go b/examples/chain/36_StreamEventOrderbookUpdate/example.go index a9b49ff1..c8394edc 100644 --- a/examples/chain/36_StreamEventOrderbookUpdate/example.go +++ b/examples/chain/36_StreamEventOrderbookUpdate/example.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/chain/37_DecodeTx/37_decode_tx.go b/examples/chain/37_DecodeTx/37_decode_tx.go index b444eb18..f72f564c 100644 --- a/examples/chain/37_DecodeTx/37_decode_tx.go +++ b/examples/chain/37_DecodeTx/37_decode_tx.go @@ -3,6 +3,7 @@ package main import ( "encoding/base64" "fmt" + cosmostxpb "github.com/cosmos/cosmos-sdk/types/tx" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) diff --git a/examples/chain/38_MsgLiquidate/example.go b/examples/chain/38_MsgLiquidate/example.go index 26fd4522..2ca94cf6 100644 --- a/examples/chain/38_MsgLiquidate/example.go +++ b/examples/chain/38_MsgLiquidate/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/39_GetTx/example.go b/examples/chain/39_GetTx/example.go index 2a24f986..aaadc907 100644 --- a/examples/chain/39_GetTx/example.go +++ b/examples/chain/39_GetTx/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" - "github.com/InjectiveLabs/sdk-go/client/core" - exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "os" "time" + "github.com/InjectiveLabs/sdk-go/client/core" + exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/3_MsgCreateSpotLimitOrder/example.go b/examples/chain/3_MsgCreateSpotLimitOrder/example.go index 820e5103..fcdc56ab 100644 --- a/examples/chain/3_MsgCreateSpotLimitOrder/example.go +++ b/examples/chain/3_MsgCreateSpotLimitOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/40_ChainStream/example.go b/examples/chain/40_ChainStream/example.go index ce2c8ae0..3d933761 100644 --- a/examples/chain/40_ChainStream/example.go +++ b/examples/chain/40_ChainStream/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + chainStreamModule "github.com/InjectiveLabs/sdk-go/chain/stream/types" "github.com/InjectiveLabs/sdk-go/client" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/41_BroadcastMsgWithoutSimulation/example.go b/examples/chain/41_BroadcastMsgWithoutSimulation/example.go index ffcc0d02..7f353b9a 100644 --- a/examples/chain/41_BroadcastMsgWithoutSimulation/example.go +++ b/examples/chain/41_BroadcastMsgWithoutSimulation/example.go @@ -3,13 +3,14 @@ package main import ( "context" "fmt" + "os" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" "github.com/shopspring/decimal" - "os" exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types" chainclient "github.com/InjectiveLabs/sdk-go/client/chain" diff --git a/examples/chain/4_MsgCreateSpotMarketOrder/example.go b/examples/chain/4_MsgCreateSpotMarketOrder/example.go index c20cff97..8f24974c 100644 --- a/examples/chain/4_MsgCreateSpotMarketOrder/example.go +++ b/examples/chain/4_MsgCreateSpotMarketOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/5_MsgCancelSpotOrder/example.go b/examples/chain/5_MsgCancelSpotOrder/example.go index ae5af8f1..cb073f02 100644 --- a/examples/chain/5_MsgCancelSpotOrder/example.go +++ b/examples/chain/5_MsgCancelSpotOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go b/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go index cdac3ee3..8ab859cd 100644 --- a/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go +++ b/examples/chain/6_MsgCreateDerivativeLimitOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go b/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go index 2cc304ae..66967194 100644 --- a/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go +++ b/examples/chain/7_MsgCreateDerivativeMarketOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" "github.com/google/uuid" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" "github.com/shopspring/decimal" diff --git a/examples/chain/8_MsgCancelDerivativeOrder/example.go b/examples/chain/8_MsgCancelDerivativeOrder/example.go index 30b80304..a50656ec 100644 --- a/examples/chain/8_MsgCancelDerivativeOrder/example.go +++ b/examples/chain/8_MsgCancelDerivativeOrder/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/chain/9_MsgBatchCancelSpotOrders/example.go b/examples/chain/9_MsgBatchCancelSpotOrders/example.go index 38a93510..b37f0988 100644 --- a/examples/chain/9_MsgBatchCancelSpotOrders/example.go +++ b/examples/chain/9_MsgBatchCancelSpotOrders/example.go @@ -3,11 +3,12 @@ package main import ( "context" "fmt" + "os" + "time" + "github.com/InjectiveLabs/sdk-go/client" "github.com/InjectiveLabs/sdk-go/client/core" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" - "os" - "time" "github.com/InjectiveLabs/sdk-go/client/common" diff --git a/examples/exchange/accounts/5_SubaccountHistory/example.go b/examples/exchange/accounts/5_SubaccountHistory/example.go index b8b54798..8dc67c4a 100644 --- a/examples/exchange/accounts/5_SubaccountHistory/example.go +++ b/examples/exchange/accounts/5_SubaccountHistory/example.go @@ -32,7 +32,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountHistory(ctx, req) + res, err := exchangeClient.GetSubaccountHistory(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/6_SubaccountOrderSummary/example.go b/examples/exchange/accounts/6_SubaccountOrderSummary/example.go index 01176ee3..bc8da227 100644 --- a/examples/exchange/accounts/6_SubaccountOrderSummary/example.go +++ b/examples/exchange/accounts/6_SubaccountOrderSummary/example.go @@ -27,7 +27,7 @@ func main() { OrderDirection: orderDirection, } - res, err := exchangeClient.GetSubaccountOrderSummary(ctx, req) + res, err := exchangeClient.GetSubaccountOrderSummary(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/7_OrderStates/example.go b/examples/exchange/accounts/7_OrderStates/example.go index 1db56f65..f6b849da 100644 --- a/examples/exchange/accounts/7_OrderStates/example.go +++ b/examples/exchange/accounts/7_OrderStates/example.go @@ -26,7 +26,7 @@ func main() { DerivativeOrderHashes: derivativeOrderHashes, } - res, err := exchangeClient.GetOrderStates(ctx, req) + res, err := exchangeClient.GetOrderStates(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/accounts/9_Rewards/example.go b/examples/exchange/accounts/9_Rewards/example.go index af024703..3cdc0330 100644 --- a/examples/exchange/accounts/9_Rewards/example.go +++ b/examples/exchange/accounts/9_Rewards/example.go @@ -26,7 +26,7 @@ func main() { AccountAddress: accountAddress, } - res, err := exchangeClient.GetRewards(ctx, req) + res, err := exchangeClient.GetRewards(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/derivatives/10_StreamPositions/example.go b/examples/exchange/derivatives/10_StreamPositions/example.go index 23f38139..af23ee70 100644 --- a/examples/exchange/derivatives/10_StreamPositions/example.go +++ b/examples/exchange/derivatives/10_StreamPositions/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativePositions(ctx, req) + stream, err := exchangeClient.StreamDerivativePositions(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/11_StreamOrders/example.go b/examples/exchange/derivatives/11_StreamOrders/example.go index 393bc86b..245d6f69 100644 --- a/examples/exchange/derivatives/11_StreamOrders/example.go +++ b/examples/exchange/derivatives/11_StreamOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, OrderSide: orderSide, } - stream, err := exchangeClient.StreamDerivativeOrders(ctx, req) + stream, err := exchangeClient.StreamDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/12_Trades/example.go b/examples/exchange/derivatives/12_Trades/example.go index 48377621..2a5712c8 100644 --- a/examples/exchange/derivatives/12_Trades/example.go +++ b/examples/exchange/derivatives/12_Trades/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeTrades(ctx, req) + res, err := exchangeClient.GetDerivativeTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/13_StreamTrades/example.go b/examples/exchange/derivatives/13_StreamTrades/example.go index a94c49f7..02239ad5 100644 --- a/examples/exchange/derivatives/13_StreamTrades/example.go +++ b/examples/exchange/derivatives/13_StreamTrades/example.go @@ -26,7 +26,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativeTrades(ctx, req) + stream, err := exchangeClient.StreamDerivativeTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/14_SubaccountOrdersList/example.go b/examples/exchange/derivatives/14_SubaccountOrdersList/example.go index c8cd6db6..0177193e 100644 --- a/examples/exchange/derivatives/14_SubaccountOrdersList/example.go +++ b/examples/exchange/derivatives/14_SubaccountOrdersList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountDerivativeOrdersList(ctx, req) + res, err := exchangeClient.GetSubaccountDerivativeOrdersList(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/15_SubaccountTradesList/example.go b/examples/exchange/derivatives/15_SubaccountTradesList/example.go index 2b8a1d04..2bf30a1e 100644 --- a/examples/exchange/derivatives/15_SubaccountTradesList/example.go +++ b/examples/exchange/derivatives/15_SubaccountTradesList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountDerivativeTradesList(ctx, req) + res, err := exchangeClient.GetSubaccountDerivativeTradesList(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/16_FundingPayments/example.go b/examples/exchange/derivatives/16_FundingPayments/example.go index d1d960e0..8aa286c9 100644 --- a/examples/exchange/derivatives/16_FundingPayments/example.go +++ b/examples/exchange/derivatives/16_FundingPayments/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeFundingPayments(ctx, req) + res, err := exchangeClient.GetDerivativeFundingPayments(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/17_FundingRates/example.go b/examples/exchange/derivatives/17_FundingRates/example.go index 53c799af..0512f91a 100644 --- a/examples/exchange/derivatives/17_FundingRates/example.go +++ b/examples/exchange/derivatives/17_FundingRates/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, } - res, err := exchangeClient.GetDerivativeFundingRates(ctx, req) + res, err := exchangeClient.GetDerivativeFundingRates(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/18_HistoricalOrders/example.go b/examples/exchange/derivatives/18_HistoricalOrders/example.go index 2b39b069..718b6c00 100644 --- a/examples/exchange/derivatives/18_HistoricalOrders/example.go +++ b/examples/exchange/derivatives/18_HistoricalOrders/example.go @@ -32,7 +32,7 @@ func main() { IsConditional: isConditional, } - res, err := exchangeClient.GetHistoricalDerivativeOrders(ctx, req) + res, err := exchangeClient.GetHistoricalDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go b/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go index e3260f6c..3c49b01d 100644 --- a/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go +++ b/examples/exchange/derivatives/19_StreamHistoricalOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, Direction: direction, } - stream, err := exchangeClient.StreamHistoricalDerivativeOrders(ctx, req) + stream, err := exchangeClient.StreamHistoricalDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/20_LiquidablePositions/example.go b/examples/exchange/derivatives/20_LiquidablePositions/example.go index 0759019a..3b28112d 100644 --- a/examples/exchange/derivatives/20_LiquidablePositions/example.go +++ b/examples/exchange/derivatives/20_LiquidablePositions/example.go @@ -28,7 +28,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativeLiquidablePositions(ctx, req) + res, err := exchangeClient.GetDerivativeLiquidablePositions(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/21_TradesV2/example.go b/examples/exchange/derivatives/21_TradesV2/example.go index 51ea10cb..1edf4d98 100644 --- a/examples/exchange/derivatives/21_TradesV2/example.go +++ b/examples/exchange/derivatives/21_TradesV2/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetDerivativeTradesV2(ctx, req) + res, err := exchangeClient.GetDerivativeTradesV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/22_StreamTradesV2/example.go b/examples/exchange/derivatives/22_StreamTradesV2/example.go index e771be2f..3d78df5d 100644 --- a/examples/exchange/derivatives/22_StreamTradesV2/example.go +++ b/examples/exchange/derivatives/22_StreamTradesV2/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamDerivativeV2Trades(ctx, req) + stream, err := exchangeClient.StreamDerivativeV2Trades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/2_Markets/example.go b/examples/exchange/derivatives/2_Markets/example.go index c4654980..97618d7a 100644 --- a/examples/exchange/derivatives/2_Markets/example.go +++ b/examples/exchange/derivatives/2_Markets/example.go @@ -27,7 +27,7 @@ func main() { QuoteDenom: quoteDenom, } - res, err := exchangeClient.GetDerivativeMarkets(ctx, req) + res, err := exchangeClient.GetDerivativeMarkets(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/8_Positions/example.go b/examples/exchange/derivatives/8_Positions/example.go index b3ec5878..3b11e289 100644 --- a/examples/exchange/derivatives/8_Positions/example.go +++ b/examples/exchange/derivatives/8_Positions/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativePositionsV2(ctx, req) + res, err := exchangeClient.GetDerivativePositionsV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/derivatives/9_Orders/example.go b/examples/exchange/derivatives/9_Orders/example.go index 30d07946..824ebd28 100644 --- a/examples/exchange/derivatives/9_Orders/example.go +++ b/examples/exchange/derivatives/9_Orders/example.go @@ -29,7 +29,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetDerivativeOrders(ctx, req) + res, err := exchangeClient.GetDerivativeOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/insurance/1_InsuranceFunds/example.go b/examples/exchange/insurance/1_InsuranceFunds/example.go index 1d1d00df..63abd806 100644 --- a/examples/exchange/insurance/1_InsuranceFunds/example.go +++ b/examples/exchange/insurance/1_InsuranceFunds/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" insurancePB "github.com/InjectiveLabs/sdk-go/exchange/insurance_rpc/pb" @@ -21,7 +22,7 @@ func main() { req := insurancePB.FundsRequest{} - res, err := exchangeClient.GetInsuranceFunds(ctx, req) + res, err := exchangeClient.GetInsuranceFunds(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/insurance/2_Redemptions/example.go b/examples/exchange/insurance/2_Redemptions/example.go index 1fbb965e..e109cc7d 100644 --- a/examples/exchange/insurance/2_Redemptions/example.go +++ b/examples/exchange/insurance/2_Redemptions/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" insurancePB "github.com/InjectiveLabs/sdk-go/exchange/insurance_rpc/pb" @@ -21,7 +22,7 @@ func main() { req := insurancePB.RedemptionsRequest{} - res, err := exchangeClient.GetRedemptions(ctx, req) + res, err := exchangeClient.GetRedemptions(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/1_Ping/example.go b/examples/exchange/meta/1_Ping/example.go index f6acbeaf..15172af0 100644 --- a/examples/exchange/meta/1_Ping/example.go +++ b/examples/exchange/meta/1_Ping/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.PingRequest{} - res, err := exchangeClient.Ping(ctx, req) + res, err := exchangeClient.Ping(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/2_Version/example.go b/examples/exchange/meta/2_Version/example.go index 688de7d5..f9f9ef15 100644 --- a/examples/exchange/meta/2_Version/example.go +++ b/examples/exchange/meta/2_Version/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.VersionRequest{} - res, err := exchangeClient.GetVersion(ctx, req) + res, err := exchangeClient.GetVersion(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/3_Info/example.go b/examples/exchange/meta/3_Info/example.go index f7ee0227..571c3b6c 100644 --- a/examples/exchange/meta/3_Info/example.go +++ b/examples/exchange/meta/3_Info/example.go @@ -22,7 +22,7 @@ func main() { req := metaPB.InfoRequest{} - res, err := exchangeClient.GetInfo(ctx, req) + res, err := exchangeClient.GetInfo(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/meta/4_StreamKeepAlive/example.go b/examples/exchange/meta/4_StreamKeepAlive/example.go index 47da7ea2..c76a8605 100644 --- a/examples/exchange/meta/4_StreamKeepAlive/example.go +++ b/examples/exchange/meta/4_StreamKeepAlive/example.go @@ -29,7 +29,7 @@ func main() { case <-ctx.Done(): return default: - res, err := stream.Recv() + res, err := (*stream).Recv() if err != nil { fmt.Println(err) return diff --git a/examples/exchange/oracle/2_Price/example.go b/examples/exchange/oracle/2_Price/example.go index 9207e299..fe8840b1 100644 --- a/examples/exchange/oracle/2_Price/example.go +++ b/examples/exchange/oracle/2_Price/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" ) diff --git a/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go b/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go index 570d0db9..4880fa69 100644 --- a/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go +++ b/examples/exchange/portfolio/2_StreamAccountPortfolioBankBalances/example.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/InjectiveLabs/sdk-go/client/common" exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" diff --git a/examples/exchange/spot/10_StreamTrades/example.go b/examples/exchange/spot/10_StreamTrades/example.go index a5040113..48d160c1 100644 --- a/examples/exchange/spot/10_StreamTrades/example.go +++ b/examples/exchange/spot/10_StreamTrades/example.go @@ -26,7 +26,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamSpotTrades(ctx, req) + stream, err := exchangeClient.StreamSpotTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/11_SubaccountOrdersList/example.go b/examples/exchange/spot/11_SubaccountOrdersList/example.go index 0b4fe839..6bb6d48b 100644 --- a/examples/exchange/spot/11_SubaccountOrdersList/example.go +++ b/examples/exchange/spot/11_SubaccountOrdersList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountSpotOrdersList(ctx, req) + res, err := exchangeClient.GetSubaccountSpotOrdersList(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/12_SubaccountTradesList/example.go b/examples/exchange/spot/12_SubaccountTradesList/example.go index 887ca1ae..401e981d 100644 --- a/examples/exchange/spot/12_SubaccountTradesList/example.go +++ b/examples/exchange/spot/12_SubaccountTradesList/example.go @@ -31,7 +31,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSubaccountSpotTradesList(ctx, req) + res, err := exchangeClient.GetSubaccountSpotTradesList(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/14_HistoricalOrders/example.go b/examples/exchange/spot/14_HistoricalOrders/example.go index 027855c3..288781b3 100644 --- a/examples/exchange/spot/14_HistoricalOrders/example.go +++ b/examples/exchange/spot/14_HistoricalOrders/example.go @@ -32,7 +32,7 @@ func main() { OrderTypes: orderTypes, } - res, err := exchangeClient.GetHistoricalSpotOrders(ctx, req) + res, err := exchangeClient.GetHistoricalSpotOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/15_StreamHistoricalOrders/example.go b/examples/exchange/spot/15_StreamHistoricalOrders/example.go index 0cfcf4c8..45c59723 100644 --- a/examples/exchange/spot/15_StreamHistoricalOrders/example.go +++ b/examples/exchange/spot/15_StreamHistoricalOrders/example.go @@ -27,7 +27,7 @@ func main() { SubaccountId: subaccountId, Direction: direction, } - stream, err := exchangeClient.StreamHistoricalSpotOrders(ctx, req) + stream, err := exchangeClient.StreamHistoricalSpotOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/16_TradesV2/example.go b/examples/exchange/spot/16_TradesV2/example.go index c4bf53cc..851dee00 100644 --- a/examples/exchange/spot/16_TradesV2/example.go +++ b/examples/exchange/spot/16_TradesV2/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetSpotTradesV2(ctx, req) + res, err := exchangeClient.GetSpotTradesV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/17_StreamTradesV2/example.go b/examples/exchange/spot/17_StreamTradesV2/example.go index 11855061..c5a5af87 100644 --- a/examples/exchange/spot/17_StreamTradesV2/example.go +++ b/examples/exchange/spot/17_StreamTradesV2/example.go @@ -25,7 +25,7 @@ func main() { MarketId: marketId, SubaccountId: subaccountId, } - stream, err := exchangeClient.StreamSpotTradesV2(ctx, req) + stream, err := exchangeClient.StreamSpotTradesV2(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/2_Markets/example.go b/examples/exchange/spot/2_Markets/example.go index 8c4dbf40..e11b3b6d 100644 --- a/examples/exchange/spot/2_Markets/example.go +++ b/examples/exchange/spot/2_Markets/example.go @@ -27,7 +27,7 @@ func main() { QuoteDenom: quoteDenom, } - res, err := exchangeClient.GetSpotMarkets(ctx, req) + res, err := exchangeClient.GetSpotMarkets(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/5_Orders/example.go b/examples/exchange/spot/5_Orders/example.go index 816bace4..4fe513c8 100644 --- a/examples/exchange/spot/5_Orders/example.go +++ b/examples/exchange/spot/5_Orders/example.go @@ -12,7 +12,7 @@ import ( func main() { //network := common.LoadNetwork("mainnet", "k8s") - network := common.LoadNetwork("testnet", "lb") + network := common.LoadNetwork("mainnet", "lb") exchangeClient, err := exchangeclient.NewExchangeClient(network) if err != nil { panic(err) @@ -29,7 +29,7 @@ func main() { Limit: limit, } - res, err := exchangeClient.GetSpotOrders(ctx, req) + res, err := exchangeClient.GetSpotOrders(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/exchange/spot/6_Trades/example.go b/examples/exchange/spot/6_Trades/example.go index 655146d2..9fce3efc 100644 --- a/examples/exchange/spot/6_Trades/example.go +++ b/examples/exchange/spot/6_Trades/example.go @@ -26,7 +26,7 @@ func main() { SubaccountId: subaccountId, } - res, err := exchangeClient.GetSpotTrades(ctx, req) + res, err := exchangeClient.GetSpotTrades(ctx, &req) if err != nil { panic(err) } diff --git a/examples/exchange/spot/9_StreamOrders/example.go b/examples/exchange/spot/9_StreamOrders/example.go index 5f73916e..cb4cfffb 100644 --- a/examples/exchange/spot/9_StreamOrders/example.go +++ b/examples/exchange/spot/9_StreamOrders/example.go @@ -28,7 +28,7 @@ func main() { SubaccountId: subaccountId, OrderSide: orderSide, } - stream, err := exchangeClient.StreamSpotOrders(ctx, req) + stream, err := exchangeClient.StreamSpotOrders(ctx, &req) if err != nil { panic(err) } diff --git a/examples/explorer/10_IBCTransfers/example.go b/examples/explorer/10_IBCTransfers/example.go index d17ad7ff..ad3a08dc 100644 --- a/examples/explorer/10_IBCTransfers/example.go +++ b/examples/explorer/10_IBCTransfers/example.go @@ -25,7 +25,7 @@ func main() { Receiver: receiver, } - res, err := explorerClient.GetIBCTransfers(ctx, req) + res, err := explorerClient.GetIBCTransfers(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/11_GetWasmCodes/example.go b/examples/explorer/11_GetWasmCodes/example.go index b2e47810..ea298b34 100644 --- a/examples/explorer/11_GetWasmCodes/example.go +++ b/examples/explorer/11_GetWasmCodes/example.go @@ -24,7 +24,7 @@ func main() { Limit: 10, } - res, err := explorerClient.GetWasmCodes(ctx, req) + res, err := explorerClient.GetWasmCodes(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/12_GetWasmCodeById/example.go b/examples/explorer/12_GetWasmCodeById/example.go index 26a92ba3..b8b932fa 100644 --- a/examples/explorer/12_GetWasmCodeById/example.go +++ b/examples/explorer/12_GetWasmCodeById/example.go @@ -24,7 +24,7 @@ func main() { CodeId: 10, } - res, err := explorerClient.GetWasmCodeByID(ctx, req) + res, err := explorerClient.GetWasmCodeByID(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/13_GetWasmContracts/example.go b/examples/explorer/13_GetWasmContracts/example.go index d4153e2f..33f7df07 100644 --- a/examples/explorer/13_GetWasmContracts/example.go +++ b/examples/explorer/13_GetWasmContracts/example.go @@ -22,7 +22,7 @@ func main() { req := explorerPB.GetWasmContractsRequest{} - res, err := explorerClient.GetWasmContracts(ctx, req) + res, err := explorerClient.GetWasmContracts(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/14_GetWasmContractByAddress/example.go b/examples/explorer/14_GetWasmContractByAddress/example.go index 5c142671..d3a880c2 100644 --- a/examples/explorer/14_GetWasmContractByAddress/example.go +++ b/examples/explorer/14_GetWasmContractByAddress/example.go @@ -23,7 +23,7 @@ func main() { req := explorerPB.GetWasmContractByAddressRequest{ ContractAddress: "inj1ru9nhdjtjtz8u8wrwxmcl9zsns4fh2838yr5ga", } - res, err := explorerClient.GetWasmContractByAddress(ctx, req) + res, err := explorerClient.GetWasmContractByAddress(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/15_GetCW20Balance/example.go b/examples/explorer/15_GetCW20Balance/example.go index 6a82495e..da38564d 100644 --- a/examples/explorer/15_GetCW20Balance/example.go +++ b/examples/explorer/15_GetCW20Balance/example.go @@ -23,7 +23,7 @@ func main() { req := explorerPB.GetCw20BalanceRequest{ Address: "inj1dc6rrxhfjaxexzdcrec5w3ryl4jn6x5t7t9j3z", } - res, err := explorerClient.GetCW20Balance(ctx, req) + res, err := explorerClient.GetCW20Balance(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/2_AccountTxs/example.go b/examples/explorer/2_AccountTxs/example.go index 8bce4684..3bbb56dc 100644 --- a/examples/explorer/2_AccountTxs/example.go +++ b/examples/explorer/2_AccountTxs/example.go @@ -27,7 +27,7 @@ func main() { } ctx := context.Background() - res, err := explorerClient.GetAccountTxs(ctx, req) + res, err := explorerClient.GetAccountTxs(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/5_TxsRequest/example.go b/examples/explorer/5_TxsRequest/example.go index 8ebbe1a2..dd57bfe8 100644 --- a/examples/explorer/5_TxsRequest/example.go +++ b/examples/explorer/5_TxsRequest/example.go @@ -26,7 +26,7 @@ func main() { Before: before, } - res, err := explorerClient.GetTxs(ctx, req) + res, err := explorerClient.GetTxs(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/8_PeggyDeposits/example.go b/examples/explorer/8_PeggyDeposits/example.go index 9cd17c67..bd00e9e1 100644 --- a/examples/explorer/8_PeggyDeposits/example.go +++ b/examples/explorer/8_PeggyDeposits/example.go @@ -26,7 +26,7 @@ func main() { Receiver: receiver, } - res, err := explorerClient.GetPeggyDeposits(ctx, req) + res, err := explorerClient.GetPeggyDeposits(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/examples/explorer/9_PeggyWithdrawals/example.go b/examples/explorer/9_PeggyWithdrawals/example.go index f7d221d4..d6284f5a 100644 --- a/examples/explorer/9_PeggyWithdrawals/example.go +++ b/examples/explorer/9_PeggyWithdrawals/example.go @@ -25,7 +25,7 @@ func main() { Sender: sender, } - res, err := explorerClient.GetPeggyWithdrawals(ctx, req) + res, err := explorerClient.GetPeggyWithdrawals(ctx, &req) if err != nil { fmt.Println(err) } diff --git a/go.mod b/go.mod index 6a8a21cd..3e0c72aa 100644 --- a/go.mod +++ b/go.mod @@ -16,14 +16,17 @@ require ( github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.0.1 github.com/ethereum/go-ethereum v1.11.5 + github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.4.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/huandu/go-assert v1.1.5 github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 github.com/shopspring/decimal v1.2.0 + github.com/stretchr/testify v1.8.4 github.com/tyler-smith/go-bip39 v1.1.0 golang.org/x/crypto v0.11.0 + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529 google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 @@ -86,7 +89,6 @@ require ( github.com/gofrs/uuid v4.3.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.1.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect @@ -139,7 +141,6 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.16.0 // indirect - github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -149,7 +150,6 @@ require ( github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect - golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.10.0 // indirect From 0afd940acf15eae4be6c25d9b17819d03fa3b74b Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:35:35 -0300 Subject: [PATCH 08/13] (feat) Added GitHub workflow to run pre-commit for PRs and when pushing to master and dev --- .github/workflows/pre-commit.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..7b4efc6e --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit +on: + pull_request: + push: + branches: [master, dev] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: actions/setup-go@v3 + - run: go install golang.org/x/tools/cmd/goimports@latest + - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 + - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV + - uses: pre-commit/action@v2.0.2 From af96e92369a7ea7e7fd601029632239957c2e782 Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 17:48:55 -0300 Subject: [PATCH 09/13] (fix) Fix pre-commit configuration --- .github/workflows/pre-commit.yml | 2 +- .pre-commit-config.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7b4efc6e..ba4a3f6b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v5 - run: go install golang.org/x/tools/cmd/goimports@latest - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c8d4cf5..f35e0ca6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,4 @@ repos: - id: go-fmt - id: go-imports - id: golangci-lint + args: [--timeout=15m] From 19442587295817e1eabb10543b98ada8bb04a25f Mon Sep 17 00:00:00 2001 From: abel Date: Thu, 21 Dec 2023 18:21:57 -0300 Subject: [PATCH 10/13] (fix) Fix pre-commit configuration --- .github/workflows/pre-commit.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index ba4a3f6b..e822c838 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -8,10 +8,12 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - uses: actions/setup-python@v4 - uses: actions/setup-go@v5 + with: + go-version: 1.19 - run: go install golang.org/x/tools/cmd/goimports@latest - run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s - -b $(go env GOPATH)/bin v1.49.0 - run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV + - uses: actions/checkout@v3 - uses: pre-commit/action@v2.0.2 From de6e2ac3f6d7973ac1ffb4355c3066cd39064558 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 22 Dec 2023 00:23:35 -0300 Subject: [PATCH 11/13] (feat) Added GitHub workflow to run tests and calculate coverage --- .github/workflows/run-tests.yml | 20 ++++++++++++++++++++ Makefile | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..c95973fc --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,20 @@ +name: run-tests +on: + pull_request: + push: + branches: [ master, dev ] + +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + - uses: actions/setup-go@v5 + with: + go-version: 1.19 + - name: Run test and calculate coverage + run: make coverage + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/Makefile b/Makefile index a0ceca7c..627437a9 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ copy-exchange-client: cp -r ../injective-indexer/api/gen/grpc/injective_derivative_exchange_rpc/pb exchange/derivative_exchange_rpc/pb cp -r ../injective-indexer/api/gen/grpc/injective_portfolio_rpc/pb exchange/portfolio_rpc/pb -.PHONY: copy-exchange-client +.PHONY: copy-exchange-client tests coverage copy-chain-types: cp ../injective-core/injective-chain/types/*.go chain/types @@ -53,3 +53,8 @@ copy-chain-types: echo "👉 Replace injective-core/injective-chain/modules with sdk-go/chain" echo "👉 Replace injective-core/injective-chain/types with sdk-go/chain/types" echo "👉 Replace injective-core/injective-chain/crypto with sdk-go/chain/crypto" + +tests: + go test -race ./client/... ./ethereum/... +coverage: + go test -race -coverprofile=coverage.out -covermode=atomic ./client/... ./ethereum/... From f581f64e864d0840a5ce53b2e7d9517445dfe121 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 22 Dec 2023 00:36:35 -0300 Subject: [PATCH 12/13] (feat) Added Codecov badge in README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 32653a09..1ab21609 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Injective Protocol Golang SDK 🌟 +[![codecov](https://codecov.io/gh/InjectiveLabs/sdk-go/graph/badge.svg?token=XDGZV265EE)](https://codecov.io/gh/InjectiveLabs/sdk-go) + --- ## 📚 Getting Started From 6aa890a3a8788ac185aab3a91311988ed02a793c Mon Sep 17 00:00:00 2001 From: abel Date: Mon, 1 Jan 2024 15:44:23 -0300 Subject: [PATCH 13/13] (fix) Fixed incorrect numbers in example script module names --- .../example.go | 0 examples/chain/49_DenomOwners/example.go | 72 ------------------- 2 files changed, 72 deletions(-) rename examples/chain/{50_BankSendEnabled => 49_BankSendEnabled}/example.go (100%) delete mode 100644 examples/chain/49_DenomOwners/example.go diff --git a/examples/chain/50_BankSendEnabled/example.go b/examples/chain/49_BankSendEnabled/example.go similarity index 100% rename from examples/chain/50_BankSendEnabled/example.go rename to examples/chain/49_BankSendEnabled/example.go diff --git a/examples/chain/49_DenomOwners/example.go b/examples/chain/49_DenomOwners/example.go deleted file mode 100644 index e40b1d82..00000000 --- a/examples/chain/49_DenomOwners/example.go +++ /dev/null @@ -1,72 +0,0 @@ -package main - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/InjectiveLabs/sdk-go/client" - chainclient "github.com/InjectiveLabs/sdk-go/client/chain" - "github.com/InjectiveLabs/sdk-go/client/common" - rpchttp "github.com/cometbft/cometbft/rpc/client/http" - "github.com/cosmos/cosmos-sdk/types/query" - - "os" -) - -func main() { - network := common.LoadNetwork("testnet", "lb") - tmClient, err := rpchttp.New(network.TmEndpoint, "/websocket") - if err != nil { - panic(err) - } - - senderAddress, cosmosKeyring, err := chainclient.InitCosmosKeyring( - os.Getenv("HOME")+"/.injectived", - "injectived", - "file", - "inj-user", - "12345678", - "5d386fbdbf11f1141010f81a46b40f94887367562bd33b452bbaa6ce1cd1381e", // keyring will be used if pk not provided - false, - ) - - if err != nil { - panic(err) - } - - clientCtx, err := chainclient.NewClientContext( - network.ChainId, - senderAddress.String(), - cosmosKeyring, - ) - - if err != nil { - panic(err) - } - - clientCtx = clientCtx.WithNodeURI(network.TmEndpoint).WithClient(tmClient) - - chainClient, err := chainclient.NewChainClient( - clientCtx, - network, - common.OptionGasPrices(client.DefaultGasPriceWithDenom), - ) - - if err != nil { - panic(err) - } - - denom := "factory/inj107aqkjc3t5r3l9j4n9lgrma5tm3jav8qgppz6m/position" - pagination := query.PageRequest{Limit: 10} - ctx := context.Background() - - res, err := chainClient.GetDenomOwners(ctx, denom, &pagination) - if err != nil { - fmt.Println(err) - } - - str, _ := json.MarshalIndent(res, "", " ") - fmt.Print(string(str)) - -}