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 12 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
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/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.13-beta.4",
"version": "1.14.12-dev.3",
"sideEffects": false,
"license": "Apache-2.0",
"author": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"@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.25",
"@injectivelabs/dmm-proto-ts": "1.0.20",
"@injectivelabs/exceptions": "^1.14.13-beta.0",
"@injectivelabs/grpc-web": "^0.0.1",
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
8 changes: 5 additions & 3 deletions packages/sdk-ts/src/core/modules/auction/msgs/MsgBid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export declare namespace MsgBid {
round: number
injectiveAddress: string
amount: {
amount: string
denom: string
amount: string
}
}

Expand All @@ -30,13 +30,15 @@ export default class MsgBid extends MsgBase<MsgBid.Params, MsgBid.Proto> {
const { params } = this

const amountCoin = CosmosBaseV1Beta1Coin.Coin.create()
amountCoin.amount = params.amount.amount

amountCoin.denom = params.amount.denom
amountCoin.amount = params.amount.amount

const message = InjectiveAuctionV1Beta1Tx.MsgBid.create()

message.sender = params.injectiveAddress
message.round = params.round.toString()
message.bidAmount = amountCoin
message.round = params.round.toString()

return InjectiveAuctionV1Beta1Tx.MsgBid.fromPartial(message)
}
Expand Down
17 changes: 10 additions & 7 deletions packages/sdk-ts/src/core/modules/authz/msgs/MsgExec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import snakecaseKeys from 'snakecase-keys'
// import snakecaseKeys from 'snakecase-keys'
import { MsgBase } from '../../MsgBase'
Copy link

Choose a reason for hiding this comment

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

Consider removing or utilizing the commented import.

The import snakecaseKeys from 'snakecase-keys' is commented out, which could indicate that it is no longer needed. If it's not being used anywhere in the file, consider removing it to clean up the code.

import type { Msgs } from '../../msgs'
import {
Expand Down Expand Up @@ -44,6 +44,7 @@ export default class MsgExec extends MsgBase<

const actualMsgs = msgs.map((msg) => {
const msgValue = GoogleProtobufAny.Any.create()

msgValue.typeUrl = msg.toDirectSign().type
msgValue.value = msg.toBinary()

Expand All @@ -65,15 +66,17 @@ export default class MsgExec extends MsgBase<
}

public toAmino() {
const proto = this.toProto()
const message = {
...snakecaseKeys(proto),
msgs: proto.msgs,
}
const { params } = this
const msgs = Array.isArray(params.msgs) ? params.msgs : [params.msgs]

return {
type: 'cosmos-sdk/MsgExec',
value: message as unknown as MsgExec.Object,
value: {
grantee: params.grantee,
msgs: msgs.map((msg) => {
return msg.toEip712()
}),
},
}
Comment on lines +68 to +78
Copy link

Choose a reason for hiding this comment

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

Refactor toAmino method to improve clarity and efficiency.

The toAmino method can be refactored to improve the mapping logic and reduce redundancy.

-    const msgs = Array.isArray(params.msgs) ? params.msgs : [params.msgs]
-    return {
-      type: 'cosmos-sdk/MsgExec',
-      value: {
-        grantee: params.grantee,
-        msgs: msgs.map((msg) => {
-          return msg.toEip712()
-        }),
-      },
-    }
+    return {
+      type: 'cosmos-sdk/MsgExec',
+      value: {
+        grantee: params.grantee,
+        msgs: (Array.isArray(params.msgs) ? params.msgs : [params.msgs]).map(msg => msg.toEip712()),
+      },
+    }
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
const { params } = this
const msgs = Array.isArray(params.msgs) ? params.msgs : [params.msgs]
return {
type: 'cosmos-sdk/MsgExec',
value: message as unknown as MsgExec.Object,
value: {
grantee: params.grantee,
msgs: msgs.map((msg) => {
return msg.toEip712()
}),
},
const { params } = this
return {
type: 'cosmos-sdk/MsgExec',
value: {
grantee: params.grantee,
msgs: (Array.isArray(params.msgs) ? params.msgs : [params.msgs]).map(msg => msg.toEip712()),
},

}

Expand Down
5 changes: 3 additions & 2 deletions packages/sdk-ts/src/core/modules/authz/msgs/MsgGrant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ export default class MsgGrant extends MsgBase<MsgGrant.Params, MsgGrant.Proto> {
grant.expiration = new Date(Number(timestamp.seconds) * 1000)

const message = CosmosAuthzV1Beta1Tx.MsgGrant.create()
message.grantee = params.grantee

message.granter = params.granter
message.grantee = params.grantee
message.grant = grant

return CosmosAuthzV1Beta1Tx.MsgGrant.fromJSON(message)
Expand Down Expand Up @@ -110,7 +111,6 @@ export default class MsgGrant extends MsgBase<MsgGrant.Params, MsgGrant.Proto> {
const messageWithAuthorizationType = snakecaseKeys({
...message,
grant: {
...message.grant,
authorization: {
type: 'cosmos-sdk/GenericAuthorization',
value: { msg: genericAuthorization.msg },
Expand Down Expand Up @@ -200,6 +200,7 @@ export default class MsgGrant extends MsgBase<MsgGrant.Params, MsgGrant.Proto> {
)

const timestamp = GoogleProtobufTimestamp.Timestamp.create()

const timestampInSeconds = (
expiration.getTime() / 1000 +
(params.expiryInSeconds || 0)
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-ts/src/core/modules/authz/msgs/MsgRevoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default class MsgRevoke extends MsgBase<
const { params } = this

const message = CosmosAuthzV1Beta1Tx.MsgRevoke.create()
message.grantee = params.grantee
message.granter = params.granter
message.grantee = params.grantee
message.msgTypeUrl = params.messageType

return CosmosAuthzV1Beta1Tx.MsgRevoke.fromPartial(message)
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk-ts/src/core/modules/bank/msgs/MsgMultiSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default class MsgMultiSend extends MsgBase<
input.coins = i.coins.map((c) => {
const coin = CosmosBaseV1Beta1Coin.Coin.create()

coin.amount = c.amount
coin.denom = c.denom
coin.amount = c.amount

return coin
})
Expand All @@ -58,8 +58,8 @@ export default class MsgMultiSend extends MsgBase<
output.coins = o.coins.map((c) => {
const coin = CosmosBaseV1Beta1Coin.Coin.create()

coin.amount = c.amount
coin.denom = c.denom
coin.amount = c.amount

return coin
})
Expand All @@ -68,6 +68,7 @@ export default class MsgMultiSend extends MsgBase<
})

const message = CosmosBankV1Beta1Tx.MsgMultiSend.create()

message.inputs = inputs
message.outputs = outputs

Expand Down
4 changes: 3 additions & 1 deletion packages/sdk-ts/src/core/modules/bank/msgs/MsgSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export default class MsgSend extends MsgBase<MsgSend.Params, MsgSend.Proto> {
: [params.amount]
const amountsToSend = amounts.map((amount) => {
const amountToSend = CosmosBaseV1Beta1Coin.Coin.create()
amountToSend.amount = amount.amount

amountToSend.denom = amount.denom
amountToSend.amount = amount.amount

return amountToSend
})

const message = CosmosBankV1Beta1Tx.MsgSend.create()

message.fromAddress = params.srcInjectiveAddress
message.toAddress = params.dstInjectiveAddress
message.amount = amountsToSend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default class MsgWithdrawDelegatorReward extends MsgBase<

const message =
CosmosDistributionV1Beta1Tx.MsgWithdrawDelegatorReward.create()

message.delegatorAddress = params.delegatorAddress
message.validatorAddress = params.validatorAddress

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class MsgWithdrawValidatorCommission extends MsgBase<

const message =
CosmosDistributionV1Beta1Tx.MsgWithdrawValidatorCommission.create()

message.validatorAddress = params.validatorAddress

return message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ export default class MsgAdminUpdateBinaryOptionsMarket extends MsgBase<

const message =
InjectiveExchangeV1Beta1Tx.MsgAdminUpdateBinaryOptionsMarket.create()

message.sender = params.sender
message.marketId = params.marketId
message.settlementPrice = params.settlementPrice
message.settlementTimestamp = params.settlementTimestamp
message.expirationTimestamp = params.expirationTimestamp
message.settlementTimestamp = params.settlementTimestamp
message.status = params.status

return InjectiveExchangeV1Beta1Tx.MsgAdminUpdateBinaryOptionsMarket.fromPartial(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ export default class MsgBatchCancelBinaryOptionsOrders extends MsgBase<

const orderDataList = params.orders.map((order) => {
const orderData = InjectiveExchangeV1Beta1Tx.OrderData.create()

orderData.marketId = order.marketId
orderData.subaccountId = order.subaccountId

if (order.orderHash) {
orderData.orderHash = order.orderHash
}

// TODO: Send order.orderMask instead when chain handles order mask properly.
orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY

if (order.cid) {
orderData.cid = order.cid
}

// TODO: Send order.orderMask instead when chain handles order mask properly.
orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY

return orderData
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,27 @@ export default class MsgBatchCancelDerivativeOrders extends MsgBase<

const orderDataList = params.orders.map((order) => {
const orderData = InjectiveExchangeV1Beta1Tx.OrderData.create()

orderData.marketId = order.marketId
orderData.subaccountId = order.subaccountId

if (order.cid) {
orderData.cid = order.cid
}

if (order.orderHash) {
orderData.orderHash = order.orderHash
}

// TODO: Send order.orderMask instead when chain handles order mask properly.
orderData.orderMask = InjectiveExchangeV1Beta1Exchange.OrderMask.ANY

if (order.cid) {
orderData.cid = order.cid
}

return orderData
})

const message =
InjectiveExchangeV1Beta1Tx.MsgBatchCancelDerivativeOrders.create()

message.sender = params.injectiveAddress
message.data = orderDataList.map((o) => o)

Expand Down
Loading
Loading