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