Skip to content
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

chore: v50 chain upgrade #480

Merged
merged 52 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
dd71181
chore: v50 chain upgrade
bangjelkoski Jun 17, 2024
c1b472f
chore(release): publish
bangjelkoski Jun 17, 2024
2c46332
chore: update canary gh workflow
ThomasRalee Jun 17, 2024
4accbb2
fix: tests
bangjelkoski Jun 17, 2024
2f85724
fix: canary gh workflow
ThomasRalee Jun 17, 2024
4ac9df5
chore(release): publish
ThomasRalee Jun 17, 2024
744846a
wallet ts debug prints
dbrajovic Jun 20, 2024
41dc414
fix certain toAmino methods for qa
dbrajovic Jun 21, 2024
058c2e6
chore(release): publish
dbrajovic Jun 21, 2024
b370102
chore: update msg fields sorting order based on protobuf
ThomasRalee Jun 26, 2024
7784ca7
chore(release): publish
ThomasRalee Jun 26, 2024
05d8156
chore: package bump
ThomasRalee Jul 10, 2024
8d075dd
chore(release): publish
ThomasRalee Jul 10, 2024
d1f31e5
fix: minor
ThomasRalee Jul 10, 2024
d4e0cfc
chore(release): publish
ThomasRalee Jul 10, 2024
5c9e79c
fix: minor
ThomasRalee Jul 10, 2024
cf41efd
chore(release): publish
ThomasRalee Jul 10, 2024
a462cf7
fix: minor
ThomasRalee Jul 10, 2024
a1e0c06
chore(release): publish
ThomasRalee Jul 10, 2024
65a005c
chore: package bump
ThomasRalee Jul 10, 2024
dd32511
chore(release): publish
ThomasRalee Jul 10, 2024
b572e23
chore: package bump
ThomasRalee Jul 15, 2024
5aef61e
chore(release): publish
ThomasRalee Jul 15, 2024
59e8163
fix: msgSubmitProposalPerpetualMarketLaunch toWeb3 format
ThomasRalee Jul 17, 2024
eb60b8b
chore(release): publish
ThomasRalee Jul 17, 2024
dff2f6c
chore: pacakge bump
ThomasRalee Jul 17, 2024
902a1f0
chore(release): publish
ThomasRalee Jul 17, 2024
5ac179f
chore: evmos testnet bridge config
shane-moore Jul 10, 2024
0d95d45
chore(release): publish
shane-moore Jul 18, 2024
4d11055
chore: evmos testnet chain id
shane-moore Jul 18, 2024
b479223
chore(release): publish
shane-moore Jul 18, 2024
5d7b001
chore: sdk-ts update types export
ThomasRalee Jul 23, 2024
55a6198
chore(release): publish
ThomasRalee Jul 23, 2024
3213f1e
chore: revert typing export
ThomasRalee Jul 23, 2024
4d71d68
chore(release): publish
ThomasRalee Jul 23, 2024
b813000
Merge branch 'dev' into chore/chain-v50-canary
shane-moore Jul 24, 2024
29758d1
chore: add xion testnet ibc config
shane-moore Jul 23, 2024
bf19b4c
chore(release): publish
shane-moore Jul 24, 2024
0561ad8
fix: msgTransferCosmJs toAmino
shane-moore Jul 23, 2024
d953bea
chore(release): publish
shane-moore Jul 24, 2024
4c535a2
chore: minor
ThomasRalee Jul 25, 2024
0ee449f
Merge pull request #487 from InjectiveLabs/chore/merge-dev-to-chain-u…
Jul 25, 2024
80546db
chore(release): publish
ThomasRalee Jul 25, 2024
8bd257d
fix: msgTransfer tokens param
shane-moore Jul 29, 2024
60f1703
chore: updates per core-proto-ts
shane-moore Jul 29, 2024
8984591
Merge pull request #488 from InjectiveLabs/fix/msg-transfer
Jul 29, 2024
8bd91a8
chore(release): publish
ThomasRalee Jul 29, 2024
253737c
fix: minor
ThomasRalee Jul 30, 2024
7966105
chore(release): publish
ThomasRalee Jul 30, 2024
c9bf21c
fix: ledger and trezor testnet alchemy network
ThomasRalee Jul 30, 2024
00711b2
chore(release): publish
ThomasRalee Jul 30, 2024
b88ecb0
chore: revert package versions
ThomasRalee Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 41 additions & 45 deletions .gitbook/core-modules/token-factory.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,99 +19,93 @@ Creates a denom of `factory/{creator address}/{subdenom}` given the denom creato
Keep in mind that that the `admin` of the token can change the supply (mint or burn new tokens). Its recommended that the `admin` is unset using the `MsgChangeAdmin`, as explained below.

```ts
import {
MsgCreateDenom,
} from "@injectivelabs/sdk-ts";
import { BigNumberInBase } from "@injectivelabs/utils";
import { Network } from "@injectivelabs/networks";
import { MsgCreateDenom } from '@injectivelabs/sdk-ts'
import { BigNumberInBase } from '@injectivelabs/utils'
import { Network } from '@injectivelabs/networks'

const injectiveAddress = "inj1...";
const privateKey = "0x...";
const subdenom = "inj-test";
const injectiveAddress = 'inj1...'
const privateKey = '0x...'
const subdenom = 'inj-test'

const msg = MsgCreateDenom.fromJSON({
subdenom,
symbol: 'InjTest',
name: 'Inj Testing',
sender: injectiveAddress,
});
})

const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet
network: Network.Testnet,
}).broadcast({
msgs: msg
});
msgs: msg,
})

console.log(txHash);
console.log(txHash)
```

#### MsgMint

Minting of a specific denom is only allowed for the current admin. Note, the current admin is defaulted to the creator of the denom.

```ts
import {
MsgMint,
} from "@injectivelabs/sdk-ts";
import { BigNumberInBase } from "@injectivelabs/utils";
import { Network } from "@injectivelabs/networks";
import { MsgMint } from '@injectivelabs/sdk-ts'
import { BigNumberInBase } from '@injectivelabs/utils'
import { Network } from '@injectivelabs/networks'

const injectiveAddress = "inj1...";
const privateKey = "0x...";
const subdenom = "inj-test";
const injectiveAddress = 'inj1...'
const privateKey = '0x...'
const subdenom = 'inj-test'
const amountToMint = 1_000_000_000

const msg = MsgMint.fromJSON({
sender: injectiveAddress,
amount: {
denom: `factory/${injectiveAddress}/${subdenom}`,
amount: amountToMint
}
});
amount: amountToMint,
},
})

const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet
network: Network.Testnet,
}).broadcast({
msgs: msg
});
msgs: msg,
})

console.log(txHash);
console.log(txHash)
```

#### MsgBurn

Burning of a specific denom is only allowed for the current admin. Note, the current admin is defaulted to the creator of the denom.

```ts
import {
MsgBurn,
} from "@injectivelabs/sdk-ts";
import { BigNumberInBase } from "@injectivelabs/utils";
import { Network } from "@injectivelabs/networks";
import { MsgBurn } from '@injectivelabs/sdk-ts'
import { BigNumberInBase } from '@injectivelabs/utils'
import { Network } from '@injectivelabs/networks'

const injectiveAddress = "inj1...";
const privateKey = "0x...";
const subdenom = "inj-test";
const injectiveAddress = 'inj1...'
const privateKey = '0x...'
const subdenom = 'inj-test'
const amountToBurn = 1_000_000_000

const msg = MsgBurn.fromJSON({
sender: injectiveAddress,
amount: {
denom: `factory/${injectiveAddress}/${subdenom}`,
amount: amountToBurn
}
});
amount: amountToBurn,
},
})

const txHash = await new MsgBroadcasterWithPk({
privateKey,
network: Network.Testnet
network: Network.Testnet,
}).broadcast({
msgs: msg
});
msgs: msg,
})

console.log(txHash);
console.log(txHash)
```

#### MsgSetDenomMetadata
Expand Down Expand Up @@ -159,7 +153,8 @@ const msg = MsgSetDenomMetadata.fromJSON({
name: '', /** the name of your token */
symbol: '', /** the symbol of your token */
uri: '' /** the logo of your token, should be hosted on IPFS and should be a small webp image */
denomUnits: denomUnitsIfTokenHas6Decimals /** choose if you want to have 6 or 0 decimals for the token */
denomUnits: denomUnitsIfTokenHas6Decimals /** choose if you want to have 6 or 0 decimals for the token */,
decimals: 6 /** choose if you want to have 6 or 0 decimals for the token */
}
});

Expand Down Expand Up @@ -190,7 +185,8 @@ const denom = `factory/${injectiveAddress}/${subdenom}`
const msg = MsgChangeAdmin.fromJSON({
denom,
sender: injectiveAddress,
newAdmin: 'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49' /** SET TO ZERO ADDRESS */,
newAdmin:
'inj1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqe2hm49' /** SET TO ZERO ADDRESS */,
})

const txHash = await new MsgBroadcasterWithPk({
Expand Down
3 changes: 2 additions & 1 deletion .gitbook/core-modules/tokenfactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ const msg = MsgSetDenomMetadata.fromJSON({
name: '', /** the name of your token */,
symbol: '' /** the symbol of your token */,
uri: '' /** the logo of your token, should be hosted on IPFS and should be a small webp image */
denomUnits: denomUnitsIfTokenHas6Decimals /** choose if you want to have 6 or 0 decimals for the token */
denomUnits: denomUnitsIfTokenHas6Decimals /** choose if you want to have 6 or 0 decimals for the token */,
decimals: 6 /** choose if you want to have 6 or 0 decimals for the token */
}
});

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ on:
jobs:
publish-canary:
runs-on: ubuntu-latest
permissions: write-all
if: contains(github.ref_name, 'canary')
steps:
- name: 'Checkout' # Download code from the repository
uses: actions/checkout@v2 # Public action
with:
fetch-depth: 0 # Checkout all branches and tags

- name: 'Use NodeJS 16' # Setup node using version 14
- name: 'Use NodeJS 18' # Setup node using version 14
uses: actions/setup-node@v2 # Public action
with:
node-version: '16.18.1'
node-version: '18.17.0'

- name: 'Setup [email protected]'
run: yarn global add [email protected] --ignore-engines
Expand All @@ -31,6 +32,7 @@ jobs:

- name: Build dependencies
run: |
lerna clean --yes
node etc/bootstrapEnv
yarn install --ignore-engines
yarn build
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module.exports = {
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: ['/node_modules/'],
testPathIgnorePatterns: ['/node_modules/', '/deprecated/'],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
Expand Down
4 changes: 2 additions & 2 deletions packages/exceptions/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/exceptions",
"description": "List of exceptions that can be reused throughout Injective's projects.",
"version": "1.14.14-beta.2",
"version": "1.14.13-dev.2",
"sideEffects": false,
"license": "Apache-2.0",
"types": "dist/cjs/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@injectivelabs/grpc-web": "^0.0.1",
"@injectivelabs/ts-types": "^1.14.14-beta.2",
"@injectivelabs/ts-types": "^1.14.13-dev.2",
"http-status-codes": "^2.2.0",
"link-module-alias": "^1.2.0",
"shx": "^0.3.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/networks/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/networks",
"description": "Endpoints, networks, etc. Can be reused throughout Injective's projects.",
"version": "1.14.14-beta.2",
"version": "1.14.13-dev.2",
"sideEffects": false,
"license": "Apache-2.0",
"author": {
Expand Down Expand Up @@ -32,9 +32,9 @@
"start": "node dist/index.js"
},
"dependencies": {
"@injectivelabs/exceptions": "^1.14.14-beta.2",
"@injectivelabs/ts-types": "^1.14.14-beta.2",
"@injectivelabs/utils": "^1.14.14-beta.2",
"@injectivelabs/exceptions": "^1.14.13-dev.2",
"@injectivelabs/ts-types": "^1.14.13-dev.2",
"@injectivelabs/utils": "^1.14.13-dev.2",
"link-module-alias": "^1.2.0",
"shx": "^0.3.2"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/sdk-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/sdk-ts",
"description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
"version": "1.14.14-beta.5",
"version": "1.14.12-dev.17",
"sideEffects": false,
"license": "Apache-2.0",
"author": {
Expand Down Expand Up @@ -37,18 +37,18 @@
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@ethersproject/bytes": "^5.7.0",
"@injectivelabs/core-proto-ts": "^0.0.21",
"@injectivelabs/core-proto-ts": "0.0.27",
"@injectivelabs/dmm-proto-ts": "1.0.20",
"@injectivelabs/exceptions": "^1.14.14-beta.2",
"@injectivelabs/exceptions": "^1.14.13-dev.2",
"@injectivelabs/grpc-web": "^0.0.1",
"@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
"@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
"@injectivelabs/indexer-proto-ts": "1.11.42",
"@injectivelabs/indexer-proto-ts": "1.11.44",
"@injectivelabs/mito-proto-ts": "1.0.65",
"@injectivelabs/networks": "^1.14.14-beta.2",
"@injectivelabs/test-utils": "^1.14.14-beta.0",
"@injectivelabs/ts-types": "^1.14.14-beta.2",
"@injectivelabs/utils": "^1.14.14-beta.2",
"@injectivelabs/networks": "^1.14.13-dev.2",
"@injectivelabs/test-utils": "^1.14.13-beta.0",
"@injectivelabs/ts-types": "^1.14.13-dev.2",
"@injectivelabs/utils": "^1.14.13-dev.2",
"@metamask/eth-sig-util": "^4.0.0",
"@noble/curves": "^1.4.0",
"axios": "^1.6.4",
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getNetworkEndpoints, Network } from '@injectivelabs/networks'
import { ChainGrpcIbcApi } from './ChainGrpcIbcApi'
import { sha256 } from '../../../utils/crypto'
import { fromUtf8 } from '../../../utils/utf8'
import { IbcApplicationsTransferV1Transfer } from '@injectivelabs/core-proto-ts'
import { IbcApplicationsTransferV2Token } from '@injectivelabs/core-proto-ts'

const endpoints = getNetworkEndpoints(Network.MainnetSentry)
const chainGrpcIbcApi = new ChainGrpcIbcApi(endpoints.grpc)
Expand All @@ -17,7 +17,7 @@ describe('ChainGrpcIbcApi', () => {

expect(response).toBeDefined()
expect(response).toEqual(
expect.objectContaining<IbcApplicationsTransferV1Transfer.DenomTrace[]>(
expect.objectContaining<IbcApplicationsTransferV2Token.Denom[]>(
Copy link

Choose a reason for hiding this comment

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

Ensure Correct Type Assertion in Test

The type assertion using IbcApplicationsTransferV2Token.Denom[] should directly check the elements of the response array rather than the response itself to ensure that each item meets the expected structure.

- expect.objectContaining<IbcApplicationsTransferV2Token.Denom[]>(
-   response,
- ),
+ response.forEach(item => expect(item).toEqual(expect.objectContaining<IbcApplicationsTransferV2Token.Denom>()))
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
expect.objectContaining<IbcApplicationsTransferV2Token.Denom[]>(
response.forEach(item => expect(item).toEqual(expect.objectContaining<IbcApplicationsTransferV2Token.Denom>()))

response,
),
)
Expand All @@ -30,13 +30,13 @@ describe('ChainGrpcIbcApi', () => {
try {
const [trace] = await chainGrpcIbcApi.fetchDenomsTrace()
const ibcHash = Buffer.from(
sha256(fromUtf8(`${trace.path}/${trace.baseDenom}`)),
sha256(fromUtf8(`${trace.trace}/${trace.base}`)),
).toString('hex')
const response = await chainGrpcIbcApi.fetchDenomTrace(ibcHash)

expect(response).toBeDefined()
expect(response).toEqual(
expect.objectContaining<IbcApplicationsTransferV1Transfer.DenomTrace>(
expect.objectContaining<IbcApplicationsTransferV2Token.Denom>(
Copy link

Choose a reason for hiding this comment

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

Refine Test Assertion for Specificity

Similar to the previous comment, ensure the individual item in the response matches the expected type IbcApplicationsTransferV2Token.Denom.

- expect.objectContaining<IbcApplicationsTransferV2Token.Denom>(
-   response,
- ),
+ expect(response).toEqual(expect.objectContaining<IbcApplicationsTransferV2Token.Denom>())
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
expect.objectContaining<IbcApplicationsTransferV2Token.Denom>(
expect(response).toEqual(expect.objectContaining<IbcApplicationsTransferV2Token.Denom>())

response,
),
)
Expand Down
26 changes: 13 additions & 13 deletions packages/sdk-ts/src/client/chain/grpc/ChainGrpcIbcApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
GrpcUnaryRequestException,
UnspecifiedErrorCode,
} from '@injectivelabs/exceptions'
import { IbcApplicationsTransferV1Query } from '@injectivelabs/core-proto-ts'
import { IbcApplicationsTransferV2Query } from '@injectivelabs/core-proto-ts'
import BaseGrpcConsumer from '../../base/BaseGrpcConsumer'
import { ChainModule } from '../types'
import { PaginationOption } from '../../../types/pagination'
Expand All @@ -14,31 +14,31 @@ import { paginationRequestFromPagination } from '../../../utils/pagination'
export class ChainGrpcIbcApi extends BaseGrpcConsumer {
protected module: string = ChainModule.Ibc

protected client: IbcApplicationsTransferV1Query.QueryClientImpl
protected client: IbcApplicationsTransferV2Query.QueryV2ClientImpl

constructor(endpoint: string) {
super(endpoint)

this.client = new IbcApplicationsTransferV1Query.QueryClientImpl(
this.client = new IbcApplicationsTransferV2Query.QueryV2ClientImpl(
this.getGrpcWebImpl(endpoint),
)
}

async fetchDenomTrace(hash: string) {
const request =
IbcApplicationsTransferV1Query.QueryDenomTraceRequest.create()
IbcApplicationsTransferV2Query.QueryDenomRequest.create()

request.hash = hash

try {
const response =
await this.retry<IbcApplicationsTransferV1Query.QueryDenomTraceResponse>(
() => this.client.DenomTrace(request, this.metadata),
await this.retry<IbcApplicationsTransferV2Query.QueryDenomResponse>(
() => this.client.Denom(request, this.metadata),
)

return response.denomTrace!
return response.denom!
} catch (e: any) {
if (e instanceof IbcApplicationsTransferV1Query.GrpcWebError) {
if (e instanceof IbcApplicationsTransferV2Query.GrpcWebError) {
throw new GrpcUnaryRequestException(new Error(e.toString()), {
code: e.code,
context: 'DenomTrace',
Expand All @@ -56,7 +56,7 @@ export class ChainGrpcIbcApi extends BaseGrpcConsumer {

async fetchDenomsTrace(pagination?: PaginationOption) {
const request =
IbcApplicationsTransferV1Query.QueryDenomTracesRequest.create()
IbcApplicationsTransferV2Query.QueryDenomsRequest.create()

const paginationForRequest = paginationRequestFromPagination(pagination)

Expand All @@ -66,13 +66,13 @@ export class ChainGrpcIbcApi extends BaseGrpcConsumer {

try {
const response =
await this.retry<IbcApplicationsTransferV1Query.QueryDenomTracesResponse>(
() => this.client.DenomTraces(request, this.metadata),
await this.retry<IbcApplicationsTransferV2Query.QueryDenomsResponse>(
() => this.client.Denoms(request, this.metadata),
)

return response.denomTraces
return response.denoms
} catch (e: any) {
if (e instanceof IbcApplicationsTransferV1Query.GrpcWebError) {
if (e instanceof IbcApplicationsTransferV2Query.GrpcWebError) {
throw new GrpcUnaryRequestException(new Error(e.toString()), {
code: e.code,
context: 'DenomTraces',
Expand Down
Loading
Loading