Skip to content

Commit

Permalink
fix: patch pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
quangdz1704 committed Nov 22, 2024
1 parent 5d6e209 commit b582c6c
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 309 deletions.
4 changes: 3 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
nodeLinker: node-modules
npmAuthToken: ${{ secrets.NPM_TOKEN }}

npmAuthToken: "${{ secrets.NPM_TOKEN }}"

npmRegistryServer: "https://registry.npmjs.org"
87 changes: 0 additions & 87 deletions patches/@cosmjs+cosmwasm-stargate+0.31.3.patch

This file was deleted.

64 changes: 64 additions & 0 deletions patches/@cosmjs+cosmwasm-stargate+0.32.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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);
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 b582c6c

Please sign in to comment.