Skip to content

[CP-127] add exchange v2 support #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dec5d55
(feat) Added support for Exchange V2 queries, messages and types
aarmoa Nov 8, 2024
b78770a
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-go into fe…
aarmoa Nov 14, 2024
5acf635
Merge branch 'dev' into feat/add_exchange_v2_support
aarmoa Nov 14, 2024
bcafaa0
(feat) Added support for chain stream V2 types
aarmoa Nov 20, 2024
95e6e8b
(fix) Fixed pre-commit issues
aarmoa Nov 20, 2024
dd659b9
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-go into fe…
aarmoa Mar 13, 2025
d5b0498
fix: fix error in golangci-lint configuration
aarmoa Mar 13, 2025
7ff73cb
fix: sync golangci-lint configuration with injective-core
aarmoa Mar 13, 2025
9a9d61e
fix: fixed a couple of lint errors and a pre-commit issue
aarmoa Mar 13, 2025
7d83c17
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-go into fe…
aarmoa Apr 30, 2025
5824e4e
chore: Updated all proto dependencies to the latest version of `maste…
aarmoa May 7, 2025
cbc585b
chore: updated the branch with the latest version of `master` in inje…
aarmoa May 7, 2025
14bc7ef
chore: updated the branch with the latest version of in injective co…
aarmoa May 12, 2025
5066aa5
fix: fixed lint errors
aarmoa May 12, 2025
6f2486d
fix: update lint configuration
aarmoa May 12, 2025
6e0faea
fix: fix errors in ling config yml file
aarmoa May 12, 2025
922829c
fix: fix lint errors
aarmoa May 12, 2025
1362b2e
fix: fix lint errors
aarmoa May 13, 2025
de0458f
fix: fixed issues when creating rpchttp connections to the tendermint…
aarmoa May 14, 2025
fec751e
fix: fixed lint errors
aarmoa May 15, 2025
8f2dda0
chore: updated market's logic to convert values now that markets have…
aarmoa May 20, 2025
6dc05e3
feat: updated examples and helper functions for GTB orders and the ne…
aarmoa May 21, 2025
0da105a
chore: updated indexer version to v1.16.0-rc2
aarmoa May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
version: v2.1.6

Comment on lines +22 to 26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

version: v2.1.6 is invalid for golangci-lint

golangci-lint releases are still on the v1.x series (latest ≈ v1.55.x).
Setting version: v2.1.6 causes the action to 404 and the workflow to fail.

-          version: v2.1.6
+#         version: v1.55.2   # ← pin to an existing release
+          version: latest     # or drop the line to track the default

Please adjust the version or omit the key entirely.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
version: v2.1.6
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v1.55.2 # ← pin to an existing release
version: latest # or drop the line to track the default
🤖 Prompt for AI Agents
In .github/workflows/golangci-lint.yml around lines 22 to 26, the golangci-lint
version is set to v2.1.6, which is invalid because golangci-lint releases are
still in the v1.x series. To fix this, change the version to a valid v1.x
version like v1.55.2 or remove the version key entirely to use the default
latest v1.x release.

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
92 changes: 48 additions & 44 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
version: "2"
run:
tests: false
linters:
fast: false
enable:
- errcheck
- errorlint
- gas
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- megacheck
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unparam
disable:
- unused

linters-settings:
revive:
enable-all-rules: true
settings:
gocritic:
disabled-checks:
- singleCaseSwitch
- deferInLoop
- hugeParam
- unnamedResult
enabled-tags:
- performance
- diagnostic
- style
- opinionated
- experimental
revive:
enable-all-rules: true
rules:
- name: var-naming
arguments:
- - ID
- name: add-constant
disabled: true
- name: line-length-limit
arguments:
- 140
- name: cognitive-complexity
arguments:
- 20
disabled: false
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- name: var-naming
arguments:
- ["ID"]
- name: add-constant
disabled: true
- name: line-length-limit
arguments:
- 140
gocritic:
enabled-tags:
- performance
- diagnostic
- style
- opinionated
- experimental
disabled-checks:
- singleCaseSwitch
- deferInLoop
- hugeParam
- unnamedResult
- linters:
- revive
text: ALL_CAPS
paths:
- chain
- exchange
- injective_data
- proto
- client/keyring/testdata
- client/chain/chain_test_support.go
issues:
exclude-rules:
- linters:
- revive
text: ALL_CAPS
exclude-dirs:
- chain
- exchange
- injective_data
- proto
- client/keyring/testdata
max-issues-per-linter: 0

run:
tests: false
41 changes: 37 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all:

clone-injective-indexer:
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.15.6 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-indexer.git -b v1.16.0-rc2 --depth 1 --single-branch

clone-injective-core:
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.15.0 --depth 1 --single-branch
git clone https://github.com/InjectiveLabs/injective-core.git -b v1.16.0-beta.2 --depth 1 --single-branch

copy-exchange-client: clone-injective-indexer
rm -rf exchange/*
Expand Down Expand Up @@ -51,9 +51,34 @@ copy-chain-types: clone-injective-core
mkdir -p chain/auction/types && \
cp injective-core/injective-chain/modules/auction/types/*.pb.go chain/auction/types && \
cp injective-core/injective-chain/modules/auction/types/codec.go chain/auction/types
mkdir -p chain/erc20/types && \
cp injective-core/injective-chain/modules/erc20/types/*.pb.go chain/erc20/types && \
cp injective-core/injective-chain/modules/erc20/types/codec.go chain/erc20/types
mkdir -p chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/*.pb.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/access_list.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/access_list_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/chain_config.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/codec.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/dynamic_fee_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/errors.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/eth.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/events.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/key.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/legacy_tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/logs.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/msg.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/params.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/storage.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/tx.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/tx_data.go chain/evm/types && \
cp injective-core/injective-chain/modules/evm/types/utils.go chain/evm/types
mkdir -p chain/exchange/types && \
cp injective-core/injective-chain/modules/exchange/types/*.go chain/exchange/types && \
rm -rf chain/exchange/types/*test.go && rm -rf chain/exchange/types/*gw.go
mkdir -p chain/exchange/types/v2 && \
cp injective-core/injective-chain/modules/exchange/types/v2/*.go chain/exchange/types/v2 && \
rm -rf chain/exchange/types/v2/*test.go && rm -rf chain/exchange/types/v2/*gw.go
mkdir -p chain/insurance/types && \
cp injective-core/injective-chain/modules/insurance/types/*.pb.go chain/insurance/types && \
cp injective-core/injective-chain/modules/insurance/types/codec.go chain/insurance/types
Expand Down Expand Up @@ -109,10 +134,14 @@ copy-chain-types: clone-injective-core
cp injective-core/injective-chain/modules/wasmx/types/proposal.go chain/wasmx/types
mkdir -p chain/stream/types && \
cp injective-core/injective-chain/stream/types/*.pb.go chain/stream/types
mkdir -p chain/stream/types/v2 && \
cp injective-core/injective-chain/stream/types/v2/*.pb.go chain/stream/types/v2
mkdir -p chain/types && \
cp injective-core/injective-chain/types/*.pb.go injective-core/injective-chain/types/config.go chain/types && \
cp injective-core/injective-chain/types/codec.go chain/types && \
cp injective-core/injective-chain/types/util.go chain/types
cp injective-core/injective-chain/types/int.go chain/types && \
cp injective-core/injective-chain/types/util.go chain/types && \
cp injective-core/injective-chain/types/validation.go chain/types

@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain/modules|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
@find ./chain -type f -name "*.go" -exec sed -i "" -e "s|github.com/InjectiveLabs/injective-core/injective-chain|github.com/InjectiveLabs/sdk-go/chain|g" {} \;
Expand Down Expand Up @@ -168,4 +197,8 @@ lint-master: export GOPROXY=direct
lint-master:
golangci-lint run --timeout=15m -v --new-from-rev=master

.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master
lint-all: export GOPROXY=direct
lint-all:
golangci-lint run --timeout=15m -v

.PHONY: copy-exchange-client tests coverage lint lint-last-commit lint-master lint-all
3 changes: 2 additions & 1 deletion auth_vote/authz_vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

//revive:disable:function-length // this is an example script
func main() {
network := common.LoadNetwork("testnet", "lb")
tmClient, err := rpchttp.New(network.TmEndpoint, "/websocket")
tmClient, err := rpchttp.New(network.TmEndpoint)
if err != nil {
panic(err)
}
Expand Down
96 changes: 48 additions & 48 deletions chain/auction/types/query.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions chain/crypto/ethsecp256k1/ethsecp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (privKey *PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool {
}

// Type returns eth_secp256k1
func (privKey *PrivKey) Type() string {
func (*PrivKey) Type() string {
return KeyType
}

Expand Down Expand Up @@ -153,7 +153,7 @@ func (pubKey *PubKey) String() string {
}

// Type returns eth_secp256k1
func (pubKey *PubKey) Type() string {
func (*PubKey) Type() string {
return KeyType
}

Expand Down
8 changes: 4 additions & 4 deletions chain/crypto/hd/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const (
)

var (
// SupportedAlgorithms defines the list of signing algorithms used on Ethermint:
// SupportedAlgorithms defines the list of signing algorithms used on Injective:
// - eth_secp256k1 (Ethereum)
// - secp256k1 (Tendermint)
SupportedAlgorithms = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Ethermint for the Ledger device:
// SupportedAlgorithmsLedger defines the list of signing algorithms used on Injective for the Ledger device:
// - eth_secp256k1 (Ethereum)
// - secp256k1 (Tendermint)
SupportedAlgorithmsLedger = keyring.SigningAlgoList{EthSecp256k1, hd.Secp256k1}
Expand All @@ -49,7 +49,7 @@ type ethSecp256k1Algo struct {
}

// Name returns eth_secp256k1
func (s ethSecp256k1Algo) Name() hd.PubKeyType {
func (ethSecp256k1Algo) Name() hd.PubKeyType {
return EthSecp256k1Type
}

Expand Down Expand Up @@ -94,7 +94,7 @@ func (s ethSecp256k1Algo) Derive() hd.DeriveFn {
}

// Generate generates a secp256k1 private key from the given bytes.
func (s ethSecp256k1Algo) Generate() hd.GenerateFn {
func (ethSecp256k1Algo) Generate() hd.GenerateFn {
return func(bz []byte) cryptotypes.PrivKey {
var bzArr = make([]byte, ethsecp256k1.PrivKeySize)
copy(bzArr, bz)
Expand Down
Loading
Loading