connect-cosmos-wallet
v0.0.9
Published
Help connect cosmos blockchain.
Downloads
14
Maintainers
Readme
Connect Cosmos network by Metamask
- Create folder patches at root of project
- Add file @cosmjs+cosmwasm-stargate+0.32.2.patch
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.d.ts b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.d.ts
index 1e8a930..8f781c8 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.d.ts
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.d.ts
@@ -88,10 +88,21 @@ export interface ExecuteResult {
/** Block height in which the transaction is included */
readonly height: number;
/** Transaction hash (might be used as transaction ID). Guaranteed to be non-empty upper-case hex */
+ /** The position of the transaction within the block. This is a 0-based index. */
+ readonly txIndex: number;
readonly transactionHash: string;
readonly events: readonly Event[];
readonly gasWanted: bigint;
readonly gasUsed: bigint;
+ /**
+ * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140)
+ * as `Any`s.
+ * This field is an empty list for chains running Cosmos SDK < 0.46.
+ */
+ readonly msgResponses: Array<{
+ readonly typeUrl: string;
+ readonly value: Uint8Array;
+ }>;
}
export interface SigningCosmWasmClientOptions {
readonly registry?: Registry;
diff --git a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
index 80e6bd5..ebc234f 100644
--- a/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
+++ b/node_modules/@cosmjs/cosmwasm-stargate/build/signingcosmwasmclient.js
@@ -262,6 +262,7 @@ class SigningCosmWasmClient extends cosmwasmclient_1.CosmWasmClient {
throw new Error(createDeliverTxResponseErrorMessage(result));
}
return {
+ ...result,
logs: stargate_1.logs.parseRawLog(result.rawLog),
height: result.height,
transactionHash: result.transactionHash,
@@ -383,7 +384,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);
- Add file @cosmjs+proto-signing+0.31.3.patch
diff --git a/node_modules/@cosmjs/proto-signing/build/signer.d.ts b/node_modules/@cosmjs/proto-signing/build/signer.d.ts
index 71d6f72..74540ad 100644
--- a/node_modules/@cosmjs/proto-signing/build/signer.d.ts
+++ b/node_modules/@cosmjs/proto-signing/build/signer.d.ts
@@ -19,5 +19,24 @@ export interface OfflineDirectSigner {
readonly getAccounts: () => Promise<readonly AccountData[]>;
readonly signDirect: (signerAddress: string, signDoc: SignDoc) => Promise<DirectSignResponse>;
}
-export type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner;
+
+export interface OfflineEip191Signer {
+/**
+ + * Get AccountData array from wallet. Rejects if not enabled.
+ + */
+ readonly getAccounts: () => Promise<readonly AccountData[]>;
+/**
+ + * Request signature from whichever key corresponds to provided bech32-encoded address. Rejects if not enabled.
+ + *
+ + * The signer implementation may offer the user the ability to override parts of the signDoc. It must
+ + * return the doc that was signed in the response.
+ + *
+ + * @param signerAddress The address of the account that should sign the transaction
+ + * @param signDoc The content that should be signed
+ + */
+ readonly signEip191: (signerAddress: string, signDoc: StdSignDoc) => Promise<AminoSignResponse>;
+}
+
+export type OfflineSigner = OfflineAminoSigner | OfflineDirectSigner | OfflineEip191Signer;
+
export declare function isOfflineDirectSigner(signer: OfflineSigner): signer is OfflineDirectSigner;
diff --git a/node_modules/@cosmjs/proto-signing/build/signer.js b/node_modules/@cosmjs/proto-signing/build/signer.js
index 5f3b8ee..a43572e 100644
--- a/node_modules/@cosmjs/proto-signing/build/signer.js
+++ b/node_modules/@cosmjs/proto-signing/build/signer.js
@@ -1,8 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOfflineDirectSigner = void 0;
+exports.isOfflineEip191Signer = void 0;
function isOfflineDirectSigner(signer) {
return signer.signDirect !== undefined;
}
+function isOfflineEip191Signer(signer) {
+ return signer.signEip191 !== undefined;
+}
exports.isOfflineDirectSigner = isOfflineDirectSigner;
+exports.isOfflineEip191Signer = isOfflineEip191Signer;
//# sourceMappingURL=signer.js.map
\ No newline at end of file
- Add command in scripts of package.json:
"postinstall": "npx patch-package"
"scripts": {
...
"postinstall": "npx patch-package"
},