@injectivelabs/wallet-cosmostation 1.17.2-alpha.0 → 1.17.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +49 -2
- package/dist/esm/index.js +49 -2
- package/package.json +5 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@ let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
|
3
3
|
let __cosmjs_proto_signing = require("@cosmjs/proto-signing");
|
|
4
4
|
let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
|
|
5
5
|
let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
|
|
6
|
-
let __cosmostation_cosmos_client = require("@cosmostation/cosmos-client");
|
|
7
6
|
let __cosmostation_extension_client_cosmos_js = require("@cosmostation/extension-client/cosmos.js");
|
|
8
7
|
let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
|
|
9
8
|
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
@@ -91,6 +90,54 @@ var CosmostationWallet = class CosmostationWallet {
|
|
|
91
90
|
|
|
92
91
|
//#endregion
|
|
93
92
|
//#region src/strategy/strategy.ts
|
|
93
|
+
/**
|
|
94
|
+
* Get an offline signer from the Cosmostation extension.
|
|
95
|
+
* This replaces @cosmostation/cosmos-client's getOfflineSigner to avoid
|
|
96
|
+
* WalletConnect v1 dependencies that cause ESM bundling issues.
|
|
97
|
+
*/
|
|
98
|
+
async function getExtensionOfflineSigner(chainId) {
|
|
99
|
+
const provider = await (0, __cosmostation_extension_client.cosmos)();
|
|
100
|
+
return {
|
|
101
|
+
getAccounts: async () => {
|
|
102
|
+
const response = await provider.getAccount(chainId);
|
|
103
|
+
return [{
|
|
104
|
+
address: response.address,
|
|
105
|
+
pubkey: response.publicKey,
|
|
106
|
+
algo: "secp256k1"
|
|
107
|
+
}];
|
|
108
|
+
},
|
|
109
|
+
signAmino: async (_signerAddress, signDoc) => {
|
|
110
|
+
const response = await provider.signAmino(chainId, signDoc);
|
|
111
|
+
return {
|
|
112
|
+
signed: response.signed_doc,
|
|
113
|
+
signature: {
|
|
114
|
+
pub_key: response.pub_key,
|
|
115
|
+
signature: response.signature
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
signDirect: async (_signerAddress, signDoc) => {
|
|
120
|
+
const response = await provider.signDirect(chainId, {
|
|
121
|
+
account_number: String(signDoc.accountNumber),
|
|
122
|
+
auth_info_bytes: signDoc.authInfoBytes,
|
|
123
|
+
body_bytes: signDoc.bodyBytes,
|
|
124
|
+
chain_id: signDoc.chainId
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
signed: {
|
|
128
|
+
accountNumber: response.signed_doc.account_number,
|
|
129
|
+
chainId: response.signed_doc.chain_id,
|
|
130
|
+
authInfoBytes: response.signed_doc.auth_info_bytes,
|
|
131
|
+
bodyBytes: response.signed_doc.body_bytes
|
|
132
|
+
},
|
|
133
|
+
signature: {
|
|
134
|
+
pub_key: response.pub_key,
|
|
135
|
+
signature: response.signature
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
94
141
|
const getChainNameFromChainId = (chainId) => {
|
|
95
142
|
const [chainName] = chainId.split("-");
|
|
96
143
|
if (chainName.includes("cosmoshub")) return "cosmos";
|
|
@@ -240,7 +287,7 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
240
287
|
});
|
|
241
288
|
}
|
|
242
289
|
async getOfflineSigner(chainId) {
|
|
243
|
-
return await (
|
|
290
|
+
return await getExtensionOfflineSigner(chainId);
|
|
244
291
|
}
|
|
245
292
|
async getCosmostationWallet() {
|
|
246
293
|
if (this.cosmostationWallet) return this.cosmostationWallet;
|
package/dist/esm/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import { CosmosWalletException, ErrorType, TransactionException, UnspecifiedErro
|
|
|
3
3
|
import { makeSignDoc } from "@cosmjs/proto-signing";
|
|
4
4
|
import { CosmosChainId } from "@injectivelabs/ts-types";
|
|
5
5
|
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
6
|
-
import { getOfflineSigner } from "@cosmostation/cosmos-client";
|
|
7
6
|
import { SEND_TRANSACTION_MODE } from "@cosmostation/extension-client/cosmos.js";
|
|
8
7
|
import { createSignDocFromTransaction, createTxRawFromSigResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
9
8
|
import { stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts/utils";
|
|
@@ -91,6 +90,54 @@ var CosmostationWallet = class CosmostationWallet {
|
|
|
91
90
|
|
|
92
91
|
//#endregion
|
|
93
92
|
//#region src/strategy/strategy.ts
|
|
93
|
+
/**
|
|
94
|
+
* Get an offline signer from the Cosmostation extension.
|
|
95
|
+
* This replaces @cosmostation/cosmos-client's getOfflineSigner to avoid
|
|
96
|
+
* WalletConnect v1 dependencies that cause ESM bundling issues.
|
|
97
|
+
*/
|
|
98
|
+
async function getExtensionOfflineSigner(chainId) {
|
|
99
|
+
const provider = await cosmos();
|
|
100
|
+
return {
|
|
101
|
+
getAccounts: async () => {
|
|
102
|
+
const response = await provider.getAccount(chainId);
|
|
103
|
+
return [{
|
|
104
|
+
address: response.address,
|
|
105
|
+
pubkey: response.publicKey,
|
|
106
|
+
algo: "secp256k1"
|
|
107
|
+
}];
|
|
108
|
+
},
|
|
109
|
+
signAmino: async (_signerAddress, signDoc) => {
|
|
110
|
+
const response = await provider.signAmino(chainId, signDoc);
|
|
111
|
+
return {
|
|
112
|
+
signed: response.signed_doc,
|
|
113
|
+
signature: {
|
|
114
|
+
pub_key: response.pub_key,
|
|
115
|
+
signature: response.signature
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
signDirect: async (_signerAddress, signDoc) => {
|
|
120
|
+
const response = await provider.signDirect(chainId, {
|
|
121
|
+
account_number: String(signDoc.accountNumber),
|
|
122
|
+
auth_info_bytes: signDoc.authInfoBytes,
|
|
123
|
+
body_bytes: signDoc.bodyBytes,
|
|
124
|
+
chain_id: signDoc.chainId
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
signed: {
|
|
128
|
+
accountNumber: response.signed_doc.account_number,
|
|
129
|
+
chainId: response.signed_doc.chain_id,
|
|
130
|
+
authInfoBytes: response.signed_doc.auth_info_bytes,
|
|
131
|
+
bodyBytes: response.signed_doc.body_bytes
|
|
132
|
+
},
|
|
133
|
+
signature: {
|
|
134
|
+
pub_key: response.pub_key,
|
|
135
|
+
signature: response.signature
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
94
141
|
const getChainNameFromChainId = (chainId) => {
|
|
95
142
|
const [chainName] = chainId.split("-");
|
|
96
143
|
if (chainName.includes("cosmoshub")) return "cosmos";
|
|
@@ -240,7 +287,7 @@ var Cosmostation = class extends BaseConcreteStrategy {
|
|
|
240
287
|
});
|
|
241
288
|
}
|
|
242
289
|
async getOfflineSigner(chainId) {
|
|
243
|
-
return await
|
|
290
|
+
return await getExtensionOfflineSigner(chainId);
|
|
244
291
|
}
|
|
245
292
|
async getCosmostationWallet() {
|
|
246
293
|
if (this.cosmostationWallet) return this.cosmostationWallet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-cosmostation",
|
|
3
|
-
"version": "1.17.2-alpha.
|
|
3
|
+
"version": "1.17.2-alpha.1",
|
|
4
4
|
"description": "Cosmostation strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -39,12 +39,11 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@cosmjs/proto-signing": "0.33.0",
|
|
42
|
-
"@cosmostation/cosmos-client": "^0.0.5",
|
|
43
42
|
"@cosmostation/extension-client": "^0.1.15",
|
|
44
|
-
"@injectivelabs/exceptions": "1.17.2-alpha.
|
|
45
|
-
"@injectivelabs/sdk-ts": "1.17.2-alpha.
|
|
46
|
-
"@injectivelabs/ts-types": "1.17.2-alpha.
|
|
47
|
-
"@injectivelabs/wallet-base": "1.17.2-alpha.
|
|
43
|
+
"@injectivelabs/exceptions": "1.17.2-alpha.1",
|
|
44
|
+
"@injectivelabs/sdk-ts": "1.17.2-alpha.1",
|
|
45
|
+
"@injectivelabs/ts-types": "1.17.2-alpha.1",
|
|
46
|
+
"@injectivelabs/wallet-base": "1.17.2-alpha.1"
|
|
48
47
|
},
|
|
49
48
|
"publishConfig": {
|
|
50
49
|
"access": "public"
|