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 all 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
10 changes: 6 additions & 4 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 All @@ -44,8 +46,8 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
lerna version prerelease --preid dev --force-git-tag --no-changelog --yes
lerna publish from-git --force-git-tag --dist-tag dev --yes --summary-file
lerna version prerelease --preid alpha --force-git-tag --no-changelog --yes
lerna publish from-git --force-git-tag --dist-tag alpha --yes --summary-file

- name: 'Broadcast published versions on Slack'
run: node etc/slack --api=$SLACK_API --actor=$GIT_ACTOR --commit-message=$GIT_LATEST_COMMIT_MESSAGE
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/sdk-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
"@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.28",
"@injectivelabs/dmm-proto-ts": "1.0.20",
"@injectivelabs/exceptions": "^1.14.14-beta.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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export class ChainGrpcDistributionApi extends BaseGrpcConsumer {
response,
)
} catch (e: any) {
if (e.message.includes('does not exist')) {
if (
e.message.includes('does not exist') ||
e.message.includes('no delegation for (address, validator) tuple')
) {
return [] as Coin[]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { InjectiveExchangeV1Beta1Query } from '@injectivelabs/core-proto-ts'
import { AtomicMarketOrderAccessLevel } from '@injectivelabs/core-proto-ts/cjs/injective/exchange/v1beta1/exchange'
import {
IsOptedOutOfRewards,
FeeDiscountSchedule,
Expand Down Expand Up @@ -65,6 +66,29 @@ export class ChainGrpcExchangeTransformer {
params.tradingRewardsVestingDuration,
10,
),
liquidatorRewardShareRate: params.liquidatorRewardShareRate,
binaryOptionsMarketInstantListingFee:
params.binaryOptionsMarketInstantListingFee
? {
amount: params.binaryOptionsMarketInstantListingFee.amount,
denom: params.binaryOptionsMarketInstantListingFee.denom,
}
: undefined,
atomicMarketOrderAccessLevel:
AtomicMarketOrderAccessLevel[params.atomicMarketOrderAccessLevel],
spotAtomicMarketOrderFeeMultiplier:
params.spotAtomicMarketOrderFeeMultiplier,
derivativeAtomicMarketOrderFeeMultiplier:
params.derivativeAtomicMarketOrderFeeMultiplier,
binaryOptionsAtomicMarketOrderFeeMultiplier:
params.binaryOptionsAtomicMarketOrderFeeMultiplier,
minimalProtocolFeeRate: params.minimalProtocolFeeRate,
isInstantDerivativeMarketLaunchEnabled:
params.isInstantDerivativeMarketLaunchEnabled,
postOnlyModeHeightThreshold: params.postOnlyModeHeightThreshold,
marginDecreasePriceTimestampThresholdSeconds:
params.marginDecreasePriceTimestampThresholdSeconds,
exchangeAdmins: params.exchangeAdmins,
}
}

Expand Down
11 changes: 11 additions & 0 deletions packages/sdk-ts/src/client/chain/types/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ export interface ExchangeParams {
maxDerivativeOrderSideCount: number
injRewardStakedRequirementThreshold: string
tradingRewardsVestingDuration: number
liquidatorRewardShareRate: string
binaryOptionsMarketInstantListingFee?: Coin
atomicMarketOrderAccessLevel: string
spotAtomicMarketOrderFeeMultiplier: string
derivativeAtomicMarketOrderFeeMultiplier: string
binaryOptionsAtomicMarketOrderFeeMultiplier: string
minimalProtocolFeeRate: string
isInstantDerivativeMarketLaunchEnabled: boolean
postOnlyModeHeightThreshold: string
marginDecreasePriceTimestampThresholdSeconds: string
exchangeAdmins: string[]
}

export interface ExchangeModuleParams extends ExchangeParams {
Expand Down
24 changes: 12 additions & 12 deletions packages/sdk-ts/src/client/indexer/grpc/IndexerGrpcArchiverApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
UnspecifiedErrorCode,
GrpcUnaryRequestException,
} from '@injectivelabs/exceptions'
import { InjectiveArchiverRPC } from '@injectivelabs/indexer-proto-ts'
import { InjectiveArchiverRpc } from '@injectivelabs/indexer-proto-ts'
import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer'
import { IndexerModule } from '../types'
import { IndexerGrpcArchiverTransformer } from '../transformers'
Expand All @@ -13,12 +13,12 @@ import { IndexerGrpcArchiverTransformer } from '../transformers'
export class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
protected module: string = IndexerModule.Archiver

protected client: InjectiveArchiverRPC.InjectiveArchiverRPCClientImpl
protected client: InjectiveArchiverRpc.InjectiveArchiverRPCClientImpl

constructor(endpoint: string) {
super(endpoint)

this.client = new InjectiveArchiverRPC.InjectiveArchiverRPCClientImpl(
this.client = new InjectiveArchiverRpc.InjectiveArchiverRPCClientImpl(
this.getGrpcWebImpl(endpoint),
)
}
Expand All @@ -30,21 +30,21 @@ export class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
account: string
resolution: string
}) {
const request = InjectiveArchiverRPC.BalanceRequest.create()
const request = InjectiveArchiverRpc.BalanceRequest.create()

request.account = account
request.resolution = resolution

try {
const response = await this.retry<InjectiveArchiverRPC.BalanceResponse>(
const response = await this.retry<InjectiveArchiverRpc.BalanceResponse>(
() => this.client.Balance(request),
)

return IndexerGrpcArchiverTransformer.grpcHistoricalBalanceResponseToHistoricalBalances(
response,
)
} catch (e: unknown) {
if (e instanceof InjectiveArchiverRPC.GrpcWebError) {
if (e instanceof InjectiveArchiverRpc.GrpcWebError) {
throw new GrpcUnaryRequestException(new Error(e.toString()), {
code: e.code,
context: 'Historical Balance',
Expand All @@ -67,21 +67,21 @@ export class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
account: string
resolution: string
}) {
const request = InjectiveArchiverRPC.RpnlRequest.create()
const request = InjectiveArchiverRpc.RpnlRequest.create()

request.account = account
request.resolution = resolution

try {
const response = await this.retry<InjectiveArchiverRPC.RpnlResponse>(() =>
const response = await this.retry<InjectiveArchiverRpc.RpnlResponse>(() =>
this.client.Rpnl(request),
)

return IndexerGrpcArchiverTransformer.grpcHistoricalRPNLResponseToHistoricalRPNL(
response,
)
} catch (e: unknown) {
if (e instanceof InjectiveArchiverRPC.GrpcWebError) {
if (e instanceof InjectiveArchiverRpc.GrpcWebError) {
throw new GrpcUnaryRequestException(new Error(e.toString()), {
code: e.code,
context: 'Historical Rpnl',
Expand All @@ -104,21 +104,21 @@ export class IndexerGrpcArchiverApi extends BaseGrpcConsumer {
account: string
resolution: string
}) {
const request = InjectiveArchiverRPC.VolumesRequest.create()
const request = InjectiveArchiverRpc.VolumesRequest.create()

request.account = account
request.resolution = resolution

try {
const response = await this.retry<InjectiveArchiverRPC.VolumesResponse>(
const response = await this.retry<InjectiveArchiverRpc.VolumesResponse>(
() => this.client.Volumes(request),
)

return IndexerGrpcArchiverTransformer.grpcHistoricalVolumesResponseToHistoricalVolumes(
response,
)
} catch (e: unknown) {
if (e instanceof InjectiveArchiverRPC.GrpcWebError) {
if (e instanceof InjectiveArchiverRpc.GrpcWebError) {
throw new GrpcUnaryRequestException(new Error(e.toString()), {
code: e.code,
context: 'Historical Volumes',
Expand Down
Loading
Loading