@injectivelabs/wallet-cosmostation 1.16.12 → 1.16.13-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/strategy/strategy.d.ts +6 -4
- package/dist/cjs/strategy/strategy.js +10 -12
- package/dist/cjs/wallet.d.ts +1 -1
- package/dist/cjs/wallet.js +2 -2
- package/dist/esm/strategy/strategy.d.ts +6 -4
- package/dist/esm/strategy/strategy.js +6 -8
- package/dist/esm/wallet.d.ts +1 -1
- package/dist/esm/wallet.js +2 -2
- package/package.json +7 -7
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChainId, EvmChainId, CosmosChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
3
|
-
import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
|
|
1
|
+
import { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
2
|
import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
|
|
5
|
-
import {
|
|
3
|
+
import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
|
|
4
|
+
import type { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
|
+
import type { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
6
|
+
import type { StdSignDoc, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
|
|
7
|
+
import type { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
6
8
|
export declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
7
9
|
private cosmostationWallet?;
|
|
8
10
|
chainName: string;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Cosmostation = void 0;
|
|
4
|
-
|
|
5
|
-
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
4
|
+
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
6
5
|
const ts_types_1 = require("@injectivelabs/ts-types");
|
|
7
|
-
const
|
|
8
|
-
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
9
|
-
const sdk_ts_2 = require("@injectivelabs/sdk-ts");
|
|
6
|
+
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
10
7
|
const extension_client_1 = require("@cosmostation/extension-client");
|
|
11
|
-
const
|
|
8
|
+
const cosmos_client_1 = require("@cosmostation/cosmos-client");
|
|
12
9
|
const cosmos_js_1 = require("@cosmostation/extension-client/cosmos.js");
|
|
10
|
+
const sdk_ts_2 = require("@injectivelabs/sdk-ts");
|
|
11
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
12
|
+
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
13
13
|
const wallet_js_1 = require("./../wallet.js");
|
|
14
|
-
const cosmos_client_1 = require("@cosmostation/cosmos-client");
|
|
15
14
|
const getChainNameFromChainId = (chainId) => {
|
|
16
15
|
const [chainName] = chainId.split('-');
|
|
17
16
|
if (chainName.includes('cosmoshub')) {
|
|
@@ -64,7 +63,6 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
|
|
|
64
63
|
async getSessionOrConfirm(address) {
|
|
65
64
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
66
65
|
}
|
|
67
|
-
// eslint-disable-next-line class-methods-use-this
|
|
68
66
|
async sendEvmTransaction(_transaction, _options) {
|
|
69
67
|
throw new exceptions_1.CosmosWalletException(new Error('sendEvmTransaction is not supported. Cosmostation only supports sending cosmos transactions'), {
|
|
70
68
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
@@ -73,9 +71,9 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
|
|
|
73
71
|
}
|
|
74
72
|
async sendTransaction(transaction, _options) {
|
|
75
73
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
76
|
-
const txRaw = (0,
|
|
74
|
+
const txRaw = (0, sdk_ts_2.createTxRawFromSigResponse)(transaction);
|
|
77
75
|
try {
|
|
78
|
-
const response = await cosmostationWallet.sendTransaction(this.chainName,
|
|
76
|
+
const response = await cosmostationWallet.sendTransaction(this.chainName, sdk_ts_1.CosmosTxV1Beta1Tx.TxRaw.encode(txRaw).finish(), cosmos_js_1.SEND_TRANSACTION_MODE.SYNC);
|
|
79
77
|
return {
|
|
80
78
|
...response.tx_response,
|
|
81
79
|
gasUsed: parseInt((response.tx_response.gas_used || '0'), 10),
|
|
@@ -104,7 +102,7 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
|
|
|
104
102
|
async signCosmosTransaction(transaction) {
|
|
105
103
|
const { chainId } = this;
|
|
106
104
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
107
|
-
const signDoc = (0,
|
|
105
|
+
const signDoc = (0, sdk_ts_2.createSignDocFromTransaction)(transaction);
|
|
108
106
|
try {
|
|
109
107
|
/* Sign the transaction */
|
|
110
108
|
const signDirectResponse = await cosmostationWallet.signDirect(this.chainName, {
|
|
@@ -155,7 +153,7 @@ class Cosmostation extends wallet_base_1.BaseConcreteStrategy {
|
|
|
155
153
|
async signArbitrary(signer, data) {
|
|
156
154
|
try {
|
|
157
155
|
const cosmostationWallet = await this.getCosmostationWallet();
|
|
158
|
-
const signature = await cosmostationWallet.signMessage(this.chainName, signer, (0,
|
|
156
|
+
const signature = await cosmostationWallet.signMessage(this.chainName, signer, (0, sdk_ts_2.toUtf8)(data));
|
|
159
157
|
return signature.signature;
|
|
160
158
|
}
|
|
161
159
|
catch (e) {
|
package/dist/cjs/wallet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
|
|
1
|
+
import type { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
export declare class CosmostationWallet {
|
|
3
3
|
private chainId;
|
|
4
4
|
constructor(chainId: CosmosChainId | TestnetCosmosChainId | ChainId);
|
package/dist/cjs/wallet.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CosmostationWallet = void 0;
|
|
4
|
-
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
5
4
|
const extension_client_1 = require("@cosmostation/extension-client");
|
|
5
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
6
6
|
class CosmostationWallet {
|
|
7
7
|
chainId;
|
|
8
8
|
constructor(chainId) {
|
|
@@ -19,7 +19,7 @@ class CosmostationWallet {
|
|
|
19
19
|
const supportedChainIds = await provider.getSupportedChainIds();
|
|
20
20
|
return !!supportedChainIds.official.find((chainId) => chainId === actualChainId);
|
|
21
21
|
}
|
|
22
|
-
catch
|
|
22
|
+
catch {
|
|
23
23
|
throw new exceptions_1.CosmosWalletException(new Error(`Cosmostation doesn't support ${chainName[0] || actualChainId} network. Please use another Cosmos wallet`));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChainId, EvmChainId, CosmosChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
3
|
-
import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
|
|
1
|
+
import { CosmosChainId } from '@injectivelabs/ts-types';
|
|
4
2
|
import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
|
|
5
|
-
import {
|
|
3
|
+
import { WalletDeviceType, BaseConcreteStrategy } from '@injectivelabs/wallet-base';
|
|
4
|
+
import type { OfflineSigner } from '@cosmjs/proto-signing';
|
|
5
|
+
import type { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
6
|
+
import type { StdSignDoc, ConcreteWalletStrategy } from '@injectivelabs/wallet-base';
|
|
7
|
+
import type { TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
6
8
|
export declare class Cosmostation extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
7
9
|
private cosmostationWallet?;
|
|
8
10
|
chainName: string;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { CosmosChainId, } from '@injectivelabs/ts-types';
|
|
4
|
-
import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, TransactionException, } from '@injectivelabs/exceptions';
|
|
5
|
-
import { WalletAction, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
|
|
1
|
+
import { makeSignDoc } from '@cosmjs/proto-signing';
|
|
2
|
+
import { CosmosChainId } from '@injectivelabs/ts-types';
|
|
6
3
|
import { CosmosTxV1Beta1Tx } from '@injectivelabs/sdk-ts';
|
|
7
4
|
import { InstallError } from '@cosmostation/extension-client';
|
|
8
|
-
import {
|
|
5
|
+
import { getOfflineSigner } from '@cosmostation/cosmos-client';
|
|
9
6
|
import { SEND_TRANSACTION_MODE } from '@cosmostation/extension-client/cosmos.js';
|
|
7
|
+
import { toUtf8, createTxRawFromSigResponse, createSignDocFromTransaction, } from '@injectivelabs/sdk-ts';
|
|
8
|
+
import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, TransactionException, } from '@injectivelabs/exceptions';
|
|
9
|
+
import { WalletAction, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
|
|
10
10
|
import { CosmostationWallet } from './../wallet.js';
|
|
11
|
-
import { getOfflineSigner } from '@cosmostation/cosmos-client';
|
|
12
11
|
const getChainNameFromChainId = (chainId) => {
|
|
13
12
|
const [chainName] = chainId.split('-');
|
|
14
13
|
if (chainName.includes('cosmoshub')) {
|
|
@@ -61,7 +60,6 @@ export class Cosmostation extends BaseConcreteStrategy {
|
|
|
61
60
|
async getSessionOrConfirm(address) {
|
|
62
61
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
63
62
|
}
|
|
64
|
-
// eslint-disable-next-line class-methods-use-this
|
|
65
63
|
async sendEvmTransaction(_transaction, _options) {
|
|
66
64
|
throw new CosmosWalletException(new Error('sendEvmTransaction is not supported. Cosmostation only supports sending cosmos transactions'), {
|
|
67
65
|
code: UnspecifiedErrorCode,
|
package/dist/esm/wallet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
|
|
1
|
+
import type { ChainId, CosmosChainId, TestnetCosmosChainId } from '@injectivelabs/ts-types';
|
|
2
2
|
export declare class CosmostationWallet {
|
|
3
3
|
private chainId;
|
|
4
4
|
constructor(chainId: CosmosChainId | TestnetCosmosChainId | ChainId);
|
package/dist/esm/wallet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, } from '@injectivelabs/exceptions';
|
|
2
1
|
import { cosmos, InstallError } from '@cosmostation/extension-client';
|
|
2
|
+
import { ErrorType, UnspecifiedErrorCode, CosmosWalletException, } from '@injectivelabs/exceptions';
|
|
3
3
|
export class CosmostationWallet {
|
|
4
4
|
chainId;
|
|
5
5
|
constructor(chainId) {
|
|
@@ -16,7 +16,7 @@ export class CosmostationWallet {
|
|
|
16
16
|
const supportedChainIds = await provider.getSupportedChainIds();
|
|
17
17
|
return !!supportedChainIds.official.find((chainId) => chainId === actualChainId);
|
|
18
18
|
}
|
|
19
|
-
catch
|
|
19
|
+
catch {
|
|
20
20
|
throw new CosmosWalletException(new Error(`Cosmostation doesn't support ${chainName[0] || actualChainId} network. Please use another Cosmos wallet`));
|
|
21
21
|
}
|
|
22
22
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-cosmostation",
|
|
3
3
|
"description": "Cosmostation strategy for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.13-alpha.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
@@ -59,17 +59,17 @@
|
|
|
59
59
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
60
60
|
"@cosmostation/cosmos-client": "^0.0.5",
|
|
61
61
|
"@cosmostation/extension-client": "^0.1.15",
|
|
62
|
-
"@injectivelabs/exceptions": "1.16.
|
|
63
|
-
"@injectivelabs/sdk-ts": "1.16.
|
|
64
|
-
"@injectivelabs/ts-types": "1.16.
|
|
65
|
-
"@injectivelabs/utils": "1.16.
|
|
66
|
-
"@injectivelabs/wallet-base": "1.16.
|
|
62
|
+
"@injectivelabs/exceptions": "1.16.13-alpha.1",
|
|
63
|
+
"@injectivelabs/sdk-ts": "1.16.13-alpha.1",
|
|
64
|
+
"@injectivelabs/ts-types": "1.16.13-alpha.1",
|
|
65
|
+
"@injectivelabs/utils": "1.16.13-alpha.1",
|
|
66
|
+
"@injectivelabs/wallet-base": "1.16.13-alpha.1",
|
|
67
67
|
"@walletconnect/ethereum-provider": "2.18.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"shx": "^0.3.4"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "feb3e8f6bd6fa67bb489c94f6373a8d68a9846ae",
|
|
73
73
|
"typedoc": {
|
|
74
74
|
"entryPoint": "./src/index.ts",
|
|
75
75
|
"readmeFile": "./README.md",
|