Skip to content

Commit

Permalink
chore: develop -> main (#388)
Browse files Browse the repository at this point in the history
* chore: update eth proto to latest

* refactor: updating to latest graphql schema since featureflags don't include spot & perp (#385)

* fix: test

* fix: test

* chore: upgrade graphql (#387)

* refactor: adding eth & tokenfactory types (#389)

* refactor: adding eth & tokenfactory types

* chore: remove test file

* fix: typo

* refactor: wasmclient doesn't need nibi registry

---------

Co-authored-by: Calico Nino <[email protected]>
  • Loading branch information
cgilbe27 and CalicoNino authored Nov 20, 2024
1 parent 5ba3c52 commit 24ea6e8
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
"@cosmjs/tendermint-rpc": "^0.32.3",
"bignumber.js": "^9.1.1",
"cross-fetch": "4.0.0",
"graphql": "^16.7.1",
"graphql-ws": "^5.14.0",
"graphql": "^16.9.0",
"graphql-ws": "^5.16.0",
"pako": "^2.1.0"
},
"peerDependencies": {
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@cosmjs/tendermint-rpc": "^0.32.3",
"graphql": "^16.7.1"
"graphql": "^16.9.0"
},
"devDependencies": {
"@bufbuild/buf": "^1.28.1",
Expand Down
16 changes: 16 additions & 0 deletions src/sdk/msg/eth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate"
import {
MsgServiceName,
MsgClientImpl,
MsgConvertCoinToEvm,
MsgConvertCoinToEvmResponse,
Expand All @@ -10,6 +11,21 @@ import {
MsgUpdateParams,
MsgUpdateParamsResponse,
} from "../../protojs/eth/evm/v1/tx"
import { GeneratedType } from "@cosmjs/proto-signing"

export const ETH_MSG_TYPE_URLS = {
MsgEthereumTx: `/${MsgServiceName}EthereumTx`,
MsgUpdateParams: `/${MsgServiceName}UpdateParams`,
MsgCreateFunToken: `/${MsgServiceName}CreateFunToken`,
MsgConvertCoinToEvm: `/${MsgServiceName}ConvertCoinToEvm`,
}

export const ethTypes: ReadonlyArray<[string, GeneratedType]> = [
[ETH_MSG_TYPE_URLS.MsgEthereumTx, MsgEthereumTx],
[ETH_MSG_TYPE_URLS.MsgUpdateParams, MsgUpdateParams],
[ETH_MSG_TYPE_URLS.MsgCreateFunToken, MsgCreateFunToken],
[ETH_MSG_TYPE_URLS.MsgConvertCoinToEvm, MsgConvertCoinToEvm],
]

export interface EthMsgExtension {
ethereumTx: (body: MsgEthereumTx) => Promise<MsgEthereumTxResponse>
Expand Down
40 changes: 40 additions & 0 deletions src/sdk/msg/tokenfactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate"
import {
MsgServiceName,
MsgCreateDenom,
MsgClientImpl,
MsgCreateDenomResponse,
Expand All @@ -16,6 +17,27 @@ import {
MsgBurnNative,
MsgBurnNativeResponse,
} from "../../protojs/nibiru/tokenfactory/v1/tx"
import { GeneratedType } from "@cosmjs/proto-signing"

export const TOKENFACTORY_MSG_TYPE_URLS = {
MsgCreateDenom: `/${MsgServiceName}CreateDenom`,
MsgChangeAdmin: `/${MsgServiceName}ChangeAdmin`,
MsgUpdateModuleParams: `/${MsgServiceName}UpdateModuleParams`,
MsgMint: `/${MsgServiceName}Mint`,
MsgBurn: `/${MsgServiceName}Burn`,
MsgSetDenomMetadata: `/${MsgServiceName}SetDenomMetadata`,
MsgBurnNative: `/${MsgServiceName}BurnNative`,
}

export const tokenfactoryTypes: ReadonlyArray<[string, GeneratedType]> = [
[TOKENFACTORY_MSG_TYPE_URLS.MsgCreateDenom, MsgCreateDenom],
[TOKENFACTORY_MSG_TYPE_URLS.MsgChangeAdmin, MsgChangeAdmin],
[TOKENFACTORY_MSG_TYPE_URLS.MsgUpdateModuleParams, MsgUpdateModuleParams],
[TOKENFACTORY_MSG_TYPE_URLS.MsgMint, MsgMint],
[TOKENFACTORY_MSG_TYPE_URLS.MsgBurn, MsgBurn],
[TOKENFACTORY_MSG_TYPE_URLS.MsgSetDenomMetadata, MsgSetDenomMetadata],
[TOKENFACTORY_MSG_TYPE_URLS.MsgBurnNative, MsgBurnNative],
]

export interface TokenFactoryMsgExtension {
createDenom: (body: MsgCreateDenom) => Promise<MsgCreateDenomResponse>
Expand Down Expand Up @@ -57,3 +79,21 @@ export const setupTokenFactoryMsgExtension = (
queryService.BurnNative(MsgBurnNative.fromPartial(body)),
}
}

export {
MsgCreateDenom,
MsgClientImpl,
MsgCreateDenomResponse,
MsgChangeAdmin,
MsgChangeAdminResponse,
MsgUpdateModuleParams,
MsgUpdateModuleParamsResponse,
MsgBurn,
MsgBurnResponse,
MsgMint,
MsgMintResponse,
MsgSetDenomMetadata,
MsgSetDenomMetadataResponse,
MsgBurnNative,
MsgBurnNativeResponse,
}
9 changes: 8 additions & 1 deletion src/sdk/tx/txClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {
} from "@cosmjs/stargate"
import { Tendermint37Client } from "@cosmjs/tendermint-rpc"
import { setupWasmExtension } from "@cosmjs/cosmwasm-stargate"
import { NibiruExtensions, setupNibiruExtension } from ".."
import {
ethTypes,
NibiruExtensions,
setupNibiruExtension,
tokenfactoryTypes,
} from ".."
import { accountFromNibiru } from "./account"
import {
NibiSigningCosmWasmClient,
Expand All @@ -22,6 +27,8 @@ import {

export const nibiruRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [
...defaultRegistryTypes,
...tokenfactoryTypes,
...ethTypes,
]

export class NibiruTxClient extends SigningStargateClient {
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4802,10 +4802,15 @@ graphql-ws@^5.14.0:
resolved "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.14.0.tgz"
integrity sha512-itrUTQZP/TgswR4GSSYuwWUzrE/w5GhbwM2GX3ic2U7aw33jgEsayfIlvaj7/GcIvZgNMzsPTrE5hqPuFUiE5g==

graphql@^16.7.1:
version "16.8.0"
resolved "https://registry.npmjs.org/graphql/-/graphql-16.8.0.tgz"
integrity sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg==
graphql-ws@^5.16.0:
version "5.16.0"
resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.16.0.tgz#849efe02f384b4332109329be01d74c345842729"
integrity sha512-Ju2RCU2dQMgSKtArPbEtsK5gNLnsQyTNIo/T7cZNp96niC1x0KdJNZV0TIoilceBPQwfb5itrGl8pkFeOUMl4A==

graphql@^16.9.0:
version "16.9.0"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f"
integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==

handlebars@^4.7.7:
version "4.7.8"
Expand Down

1 comment on commit 24ea6e8

@github-actions
Copy link

Choose a reason for hiding this comment

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

Lines Statements Branches Functions
Coverage: 95%
95.51% (895/937) 80.66% (171/212) 89.82% (300/334)

Please sign in to comment.