Skip to content

Commit

Permalink
fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
vuonghuuhung committed Nov 28, 2024
1 parent f258213 commit dd7290d
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 308 deletions.
87 changes: 0 additions & 87 deletions patches/@cosmjs+cosmwasm-stargate+0.31.3.patch

This file was deleted.

80 changes: 80 additions & 0 deletions patches/@cosmjs+cosmwasm-stargate+0.32.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts
index a770785..3f427c8 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.d.ts
@@ -58,6 +58,7 @@ export declare class CosmWasmClient {
protected constructor(cometClient: CometClient | undefined);
protected getCometClient(): CometClient | undefined;
protected forceGetCometClient(): CometClient;
+ public setQueryClientWithHeight(height?: number): void;
protected getQueryClient(): (QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension) | undefined;
protected forceGetQueryClient(): QueryClient & AuthExtension & BankExtension & TxExtension & WasmExtension;
getChainId(): Promise<string>;
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js
index af8341d..bc91fbc 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/cosmwasmclient.js
@@ -35,6 +35,13 @@ class CosmWasmClient {
this.queryClient = stargate_1.QueryClient.withExtensions(cometClient, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension);
}
}
+
+ setQueryClientWithHeight(height = undefined) {
+ if (this.tmClient) {
+ this.queryClient = stargate_1.QueryClient.withExtensionsWithHeight(this.tmClient, height, stargate_1.setupAuthExtension, stargate_1.setupBankExtension, modules_1.setupWasmExtension, stargate_1.setupTxExtension);
+ }
+ }
+
getCometClient() {
return this.cometClient;
}
@@ -120,12 +127,12 @@ class CosmWasmClient {
else if ((0, stargate_1.isSearchTxQueryArray)(query)) {
rawQuery = query
.map((t) => {
- // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462
- if (typeof t.value === "string")
- return `${t.key}='${t.value}'`;
- else
- return `${t.key}=${t.value}`;
- })
+ // numeric values must not have quotes https://github.com/cosmos/cosmjs/issues/1462
+ if (typeof t.value === "string")
+ return `${t.key}='${t.value}'`;
+ else
+ return `${t.key}=${t.value}`;
+ })
.join(" AND ");
}
else {
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js
index e5bf448..878f7e4 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/modules/wasm/queries.js
@@ -4,8 +4,8 @@ exports.setupWasmExtension = void 0;
const encoding_1 = require("@cosmjs/encoding");
const stargate_1 = require("@cosmjs/stargate");
const query_1 = require("cosmjs-types/cosmwasm/wasm/v1/query");
-function setupWasmExtension(base) {
- const rpc = (0, stargate_1.createProtobufRpcClient)(base);
+function setupWasmExtension(base, height) {
+ const rpc = (0, stargate_1.createProtobufRpcClient)(base, height);
// Use this service to get easy typed access to query methods
// This cannot be used for proof verification
const queryService = new query_1.QueryClientImpl(rpc);
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
index 6eb95bb..24d3038 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
@@ -397,7 +397,10 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient {
throw new Error("Failed to retrieve account from signer");
}
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
- const signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
+ let signMode = signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
+ if (this.signer.signEip191) {
+ signMode = signing_1.SignMode.SIGN_MODE_EIP_191;
+ }
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
const signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight);
const { signature, signed } = await this.signer.signAmino(signerAddress, signDoc);
87 changes: 0 additions & 87 deletions patches/@cosmjs+stargate+0.31.3.patch

This file was deleted.

72 changes: 72 additions & 0 deletions patches/@cosmjs+stargate+0.32.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
diff --git a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js
index 634b2e5..c2daa9c 100644
--- a/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js
+++ b/node_modules/@cosmjs/stargate/build/queryclient/queryclient.js
@@ -32,6 +32,24 @@ class QueryClient {
}
return client;
}
+
+ static withExtensionsWithHeight(cometClient, height, ...extensionSetups) {
+ const client = new QueryClient(cometClient, height);
+ const extensions = extensionSetups.map((setupExtension) => setupExtension(client, height));
+ for (const extension of extensions) {
+ (0, utils_1.assert)((0, utils_1.isNonNullObject)(extension), `Extension must be a non-null object`);
+ for (const [moduleKey, moduleValue] of Object.entries(extension)) {
+ (0, utils_1.assert)((0, utils_1.isNonNullObject)(moduleValue), `Module must be a non-null object. Found type ${typeof moduleValue} for module "${moduleKey}".`);
+ const current = client[moduleKey] || {};
+ client[moduleKey] = {
+ ...current,
+ ...moduleValue,
+ };
+ }
+ }
+ return client;
+ }
+
constructor(cometClient) {
this.cometClient = cometClient;
}
diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
index ec5b471..92d5737 100644
--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.d.ts
@@ -18,7 +18,7 @@ export declare function createPagination(paginationKey?: Uint8Array): PageReques
export interface ProtobufRpcClient {
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}
-export declare function createProtobufRpcClient(base: QueryClient): ProtobufRpcClient;
+export declare function createProtobufRpcClient(base: QueryClient, height?: number): ProtobufRpcClient;
/**
* Takes a uint64 value as string, number, BigInt or Uint64 and returns a BigInt
* of it.
diff --git a/node_modules/@cosmjs/stargate/build/queryclient/utils.js b/node_modules/@cosmjs/stargate/build/queryclient/utils.js
index ea25080..a0cb539 100644
--- a/node_modules/@cosmjs/stargate/build/queryclient/utils.js
+++ b/node_modules/@cosmjs/stargate/build/queryclient/utils.js
@@ -24,11 +24,11 @@ function createPagination(paginationKey) {
return paginationKey ? pagination_1.PageRequest.fromPartial({ key: paginationKey }) : pagination_1.PageRequest.fromPartial({});
}
exports.createPagination = createPagination;
-function createProtobufRpcClient(base) {
+function createProtobufRpcClient(base, height = undefined) {
return {
request: async (service, method, data) => {
const path = `/${service}/${method}`;
- const response = await base.queryAbci(path, data, undefined);
+ const response = await base.queryAbci(path, data, height);
return response.value;
},
};
diff --git a/node_modules/@cosmjs/stargate/build/stargateclient.js b/node_modules/@cosmjs/stargate/build/stargateclient.js
index a6da130..0918f14 100644
--- a/node_modules/@cosmjs/stargate/build/stargateclient.js
+++ b/node_modules/@cosmjs/stargate/build/stargateclient.js
@@ -297,6 +297,7 @@ class StargateClient {
return results.txs.map((tx) => {
const txMsgData = abci_1.TxMsgData.decode(tx.result.data ?? new Uint8Array());
return {
+ ...tx,
height: tx.height,
txIndex: tx.index,
hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(),
Loading

0 comments on commit dd7290d

Please sign in to comment.