@injectivelabs/wallet-cosmostation 1.16.38-alpha.2 → 1.16.38-alpha.4
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 +13 -5
- package/dist/cjs/index.d.cts +8 -1
- package/dist/esm/index.d.ts +8 -1
- package/dist/esm/index.js +9 -1
- package/package.json +6 -8
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,6 +5,8 @@ let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
|
|
|
5
5
|
let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
|
|
6
6
|
let __cosmostation_cosmos_client = require("@cosmostation/cosmos-client");
|
|
7
7
|
let __cosmostation_extension_client_cosmos_js = require("@cosmostation/extension-client/cosmos.js");
|
|
8
|
+
let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
|
|
9
|
+
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
8
10
|
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
9
11
|
|
|
10
12
|
//#region src/utils/index.ts
|
|
@@ -126,8 +128,14 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
}
|
|
131
|
+
async getAddressesInfo() {
|
|
132
|
+
throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
|
|
133
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
134
|
+
context: __injectivelabs_wallet_base.WalletAction.GetAccounts
|
|
135
|
+
});
|
|
136
|
+
}
|
|
129
137
|
async getSessionOrConfirm(address) {
|
|
130
|
-
return Promise.resolve(`0x${(0,
|
|
138
|
+
return Promise.resolve(`0x${(0, __injectivelabs_sdk_ts_utils.uint8ArrayToHex)((0, __injectivelabs_sdk_ts_utils.stringToUint8Array)(`Confirmation for ${address} at time: ${Date.now()}`))}`);
|
|
131
139
|
}
|
|
132
140
|
async sendEvmTransaction(_transaction, _options) {
|
|
133
141
|
throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("sendEvmTransaction is not supported. Cosmostation only supports sending cosmos transactions"), {
|
|
@@ -137,7 +145,7 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
137
145
|
}
|
|
138
146
|
async sendTransaction(transaction, _options) {
|
|
139
147
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
140
|
-
const txRaw = (0,
|
|
148
|
+
const txRaw = (0, __injectivelabs_sdk_ts_core_tx.createTxRawFromSigResponse)(transaction);
|
|
141
149
|
try {
|
|
142
150
|
const response = await cosmostationWallet.sendTransaction(this.chainName, __injectivelabs_sdk_ts.CosmosTxV1Beta1TxPb.TxRaw.toBinary(txRaw), __cosmostation_extension_client_cosmos_js.SEND_TRANSACTION_MODE.SYNC);
|
|
143
151
|
return {
|
|
@@ -165,7 +173,7 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
165
173
|
async signCosmosTransaction(transaction) {
|
|
166
174
|
const { chainId } = this;
|
|
167
175
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
168
|
-
const signDoc = (0,
|
|
176
|
+
const signDoc = (0, __injectivelabs_sdk_ts_core_tx.createSignDocFromTransaction)(transaction);
|
|
169
177
|
try {
|
|
170
178
|
const signDirectResponse = await cosmostationWallet.signDirect(this.chainName, {
|
|
171
179
|
chain_id: chainId,
|
|
@@ -190,7 +198,7 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
190
198
|
async getPubKey() {
|
|
191
199
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
192
200
|
try {
|
|
193
|
-
return (0,
|
|
201
|
+
return (0, __injectivelabs_sdk_ts_utils.uint8ArrayToBase64)((await cosmostationWallet.requestAccount(this.chainName)).publicKey);
|
|
194
202
|
} catch (e) {
|
|
195
203
|
if (e.code === 4001) throw new __injectivelabs_exceptions.CosmosWalletException(/* @__PURE__ */ new Error("The user rejected the request"), {
|
|
196
204
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
@@ -210,7 +218,7 @@ var Cosmostation = class extends __injectivelabs_wallet_base.BaseConcreteStrateg
|
|
|
210
218
|
}
|
|
211
219
|
async signArbitrary(signer, data) {
|
|
212
220
|
try {
|
|
213
|
-
return (await (await this.getCosmostationWallet()).signMessage(this.chainName, signer, (0,
|
|
221
|
+
return (await (await this.getCosmostationWallet()).signMessage(this.chainName, signer, (0, __injectivelabs_sdk_ts_utils.toUtf8)(data))).signature;
|
|
214
222
|
} catch (e) {
|
|
215
223
|
throw new __injectivelabs_exceptions.CosmosWalletException(new Error(e.message), {
|
|
216
224
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _cosmostation_extension_client_cosmos0 from "@cosmostation/extension-client/cosmos";
|
|
2
2
|
import { AccountAddress, ChainId, CosmosChainId, EvmChainId, TestnetCosmosChainId } from "@injectivelabs/ts-types";
|
|
3
|
-
import {
|
|
3
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
4
4
|
import { BaseConcreteStrategy, ConcreteWalletStrategy, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
5
5
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
6
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
7
|
+
import { AminoSignResponse, DirectSignResponse } from "@injectivelabs/sdk-ts/types";
|
|
6
8
|
|
|
7
9
|
//#region src/utils/index.d.ts
|
|
8
10
|
declare const isCosmosStationWalletInstalled: () => boolean;
|
|
@@ -26,6 +28,11 @@ declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalle
|
|
|
26
28
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
27
29
|
enable(): Promise<boolean>;
|
|
28
30
|
getAddresses(): Promise<string[]>;
|
|
31
|
+
getAddressesInfo(): Promise<{
|
|
32
|
+
address: string;
|
|
33
|
+
derivationPath: string;
|
|
34
|
+
baseDerivationPath: string;
|
|
35
|
+
}[]>;
|
|
29
36
|
getSessionOrConfirm(address?: AccountAddress): Promise<string>;
|
|
30
37
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
31
38
|
address: AccountAddress;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
2
2
|
import { AccountAddress, ChainId, CosmosChainId, EvmChainId, TestnetCosmosChainId } from "@injectivelabs/ts-types";
|
|
3
|
-
import {
|
|
3
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
4
|
+
import { TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
4
5
|
import { BaseConcreteStrategy, ConcreteWalletStrategy, StdSignDoc, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
5
6
|
import * as _cosmostation_extension_client_cosmos0 from "@cosmostation/extension-client/cosmos";
|
|
7
|
+
import { AminoSignResponse, DirectSignResponse } from "@injectivelabs/sdk-ts/types";
|
|
6
8
|
|
|
7
9
|
//#region src/utils/index.d.ts
|
|
8
10
|
declare const isCosmosStationWalletInstalled: () => boolean;
|
|
@@ -26,6 +28,11 @@ declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalle
|
|
|
26
28
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
27
29
|
enable(): Promise<boolean>;
|
|
28
30
|
getAddresses(): Promise<string[]>;
|
|
31
|
+
getAddressesInfo(): Promise<{
|
|
32
|
+
address: string;
|
|
33
|
+
derivationPath: string;
|
|
34
|
+
baseDerivationPath: string;
|
|
35
|
+
}[]>;
|
|
29
36
|
getSessionOrConfirm(address?: AccountAddress): Promise<string>;
|
|
30
37
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
31
38
|
address: AccountAddress;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import { InstallError, cosmos } from "@cosmostation/extension-client";
|
|
|
2
2
|
import { CosmosWalletException, ErrorType, TransactionException, UnspecifiedErrorCode } from "@injectivelabs/exceptions";
|
|
3
3
|
import { makeSignDoc } from "@cosmjs/proto-signing";
|
|
4
4
|
import { CosmosChainId } from "@injectivelabs/ts-types";
|
|
5
|
-
import { CosmosTxV1Beta1TxPb
|
|
5
|
+
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts";
|
|
6
6
|
import { getOfflineSigner } from "@cosmostation/cosmos-client";
|
|
7
7
|
import { SEND_TRANSACTION_MODE } from "@cosmostation/extension-client/cosmos.js";
|
|
8
|
+
import { createSignDocFromTransaction, createTxRawFromSigResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
9
|
+
import { stringToUint8Array, toUtf8, uint8ArrayToBase64, uint8ArrayToHex } from "@injectivelabs/sdk-ts/utils";
|
|
8
10
|
import { BaseConcreteStrategy, WalletAction, WalletDeviceType } from "@injectivelabs/wallet-base";
|
|
9
11
|
|
|
10
12
|
//#region src/utils/index.ts
|
|
@@ -126,6 +128,12 @@ var Cosmostation = class extends BaseConcreteStrategy {
|
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
}
|
|
131
|
+
async getAddressesInfo() {
|
|
132
|
+
throw new CosmosWalletException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
|
|
133
|
+
code: UnspecifiedErrorCode,
|
|
134
|
+
context: WalletAction.GetAccounts
|
|
135
|
+
});
|
|
136
|
+
}
|
|
129
137
|
async getSessionOrConfirm(address) {
|
|
130
138
|
return Promise.resolve(`0x${uint8ArrayToHex(stringToUint8Array(`Confirmation for ${address} at time: ${Date.now()}`))}`);
|
|
131
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-cosmostation",
|
|
3
|
-
"version": "1.16.38-alpha.
|
|
3
|
+
"version": "1.16.38-alpha.4",
|
|
4
4
|
"description": "Cosmostation strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -38,15 +38,13 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cosmjs/proto-signing": "^0.
|
|
41
|
+
"@cosmjs/proto-signing": "^0.37.0",
|
|
42
42
|
"@cosmostation/cosmos-client": "^0.0.5",
|
|
43
43
|
"@cosmostation/extension-client": "^0.1.15",
|
|
44
|
-
"@
|
|
45
|
-
"@injectivelabs/
|
|
46
|
-
"@injectivelabs/
|
|
47
|
-
"@injectivelabs/sdk-ts": "1.16.38-alpha.
|
|
48
|
-
"@injectivelabs/utils": "1.16.38-alpha.1",
|
|
49
|
-
"@injectivelabs/wallet-base": "1.16.38-alpha.2"
|
|
44
|
+
"@injectivelabs/exceptions": "1.16.38-alpha.3",
|
|
45
|
+
"@injectivelabs/ts-types": "1.16.38-alpha.2",
|
|
46
|
+
"@injectivelabs/wallet-base": "1.16.38-alpha.4",
|
|
47
|
+
"@injectivelabs/sdk-ts": "1.16.38-alpha.4"
|
|
50
48
|
},
|
|
51
49
|
"publishConfig": {
|
|
52
50
|
"access": "public"
|