Skip to content

Commit

Permalink
Merge pull request #204 from oraichain/feat/update-signer
Browse files Browse the repository at this point in the history
pumb: common 1.0.76
  • Loading branch information
haunv3 authored Mar 15, 2024
2 parents 01b5697 + ad16172 commit 2242433
Show file tree
Hide file tree
Showing 3 changed files with 790 additions and 19 deletions.
5 changes: 3 additions & 2 deletions packages/oraidex-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-common",
"version": "1.0.75",
"version": "1.0.76",
"main": "build/index.js",
"files": [
"build/"
Expand All @@ -21,7 +21,8 @@
"@cosmjs/tendermint-rpc": "0.31.0",
"bignumber.js": "^9.0.1",
"cosmjs-types": "^0.8.0",
"@oraichain/oraidex-contracts-sdk": "^1.0.30"
"@oraichain/oraidex-contracts-sdk": "^1.0.30",
"@injectivelabs/sdk-ts": "1.12.1"
},
"devDependencies": {},
"resolutions": {
Expand Down
8 changes: 7 additions & 1 deletion packages/oraidex-common/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { JsonRpcSigner } from "@ethersproject/providers";
import { TronWeb } from "./tronweb";
import { EncodeObject } from "@cosmjs/proto-signing";
import { Tendermint37Client } from "@cosmjs/tendermint-rpc";
import { Stargate } from "@injectivelabs/sdk-ts";

export interface EvmResponse {
transactionHash: string;
Expand Down Expand Up @@ -41,7 +42,12 @@ export abstract class CosmosWallet {
const { chainId, rpc } = config;
const wallet = await this.createCosmosSigner(chainId);
const tmClient = await Tendermint37Client.connect(rpc);
const client = await SigningCosmWasmClient.createWithSigner(tmClient, wallet, options);
let client;
if (chainId === "injective-1") {
client = await Stargate.InjectiveSigningStargateClient.createWithSigner(tmClient as any, wallet, options as any);
} else {
client = await SigningCosmWasmClient.createWithSigner(tmClient, wallet, options);
}
const stargateClient = await SigningStargateClient.createWithSigner(tmClient, wallet, options);
return { wallet, client, stargateClient };
}
Expand Down
Loading

0 comments on commit 2242433

Please sign in to comment.