Skip to content

Commit

Permalink
Cosmwasm tm37 client builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ba1ciu committed Jun 5, 2023
1 parent 09680cd commit c844350
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions frontend/empowerjs/src/utils/signing-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { GeneratedType, OfflineSigner } from '@cosmjs/proto-signing';
import { SigningStargateClient, defaultRegistryTypes } from '@cosmjs/stargate';
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
import { Tendermint37Client } from '@cosmjs/tendermint-rpc';
import type { HttpEndpoint } from '@cosmjs/tendermint-rpc';
import { getSigningEmpowerchainClientOptions } from '../codegen';
Expand Down Expand Up @@ -28,3 +29,27 @@ export const getSigningTM37EmpowerchainClient = async ({
);
return client;
};

export const getSigningCosmWasmTM37EmpowerchainClient = async ({
rpcEndpoint,
signer,
defaultTypes = defaultRegistryTypes
}: {
rpcEndpoint: string | HttpEndpoint;
signer: OfflineSigner;
defaultTypes?: ReadonlyArray<[string, GeneratedType]>;
}) => {
const { registry, aminoTypes } = getSigningEmpowerchainClientOptions({
defaultTypes
});
const tm37Client = await Tendermint37Client.connect(rpcEndpoint);
const client = await SigningCosmWasmClient.createWithSigner(
tm37Client,
signer,
{
registry,
aminoTypes
}
);
return client;
};

0 comments on commit c844350

Please sign in to comment.