Skip to content

Commit

Permalink
Update ts-client (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0p3yee authored Mar 18, 2024
1 parent 4936093 commit be6d717
Show file tree
Hide file tree
Showing 572 changed files with 198,800 additions and 65,604 deletions.
82,990 changes: 63,736 additions & 19,254 deletions docs/static/openapi.yml

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions ts-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import {
EncodeObject,
Registry,
} from "@cosmjs/proto-signing";
import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { SigningStargateClient, StdFee } from "@cosmjs/stargate";
import { Env } from "./env";
import { UnionToIntersection, Return, Constructor } from "./helpers";
import { Module } from "./modules";
import { IgntModule } from "./modules";
import { EventEmitter } from "events";
import { ChainInfo } from "@keplr-wallet/types";

Expand All @@ -19,11 +18,11 @@ const defaultFee = {
};

export class IgniteClient extends EventEmitter {
static plugins: Module[] = [];
static plugins: IgntModule[] = [];
env: Env;
signer?: OfflineSigner;
registry: Array<[string, GeneratedType]> = [];
static plugin<T extends Module | Module[]>(plugin: T) {
static plugin<T extends IgntModule | IgntModule[]>(plugin: T) {
const currentPlugins = this.plugins;

class AugmentedClient extends this {
Expand All @@ -42,7 +41,7 @@ export class IgniteClient extends EventEmitter {
async signAndBroadcast(msgs: EncodeObject[], fee: StdFee, memo: string) {
if (this.signer) {
const { address } = (await this.signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, { registry: new Registry(this.registry), prefix: this.env.prefix });
const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, { registry: new Registry(this.registry) });
return await signingClient.signAndBroadcast(address, msgs, fee ? fee : defaultFee, memo)
} else {
throw new Error(" Signer is not present.");
Expand Down Expand Up @@ -134,8 +133,6 @@ export class IgniteClient extends EventEmitter {
return y;
}) ?? [];

let coinType = 118;

if (chainId) {
const suggestOptions: ChainInfo = {
chainId,
Expand All @@ -147,7 +144,6 @@ export class IgniteClient extends EventEmitter {
bech32Config,
currencies,
feeCurrencies,
coinType,
...keplrChainInfo,
};
await window.keplr.experimentalSuggestChain(suggestOptions);
Expand Down
Loading

0 comments on commit be6d717

Please sign in to comment.