@injectivelabs/wallet-cosmos 1.16.2-alpha.1 → 1.16.3
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/README.md
CHANGED
|
@@ -13,7 +13,7 @@ _Package to use Cosmos Wallets on Injective via the wallet strategy._
|
|
|
13
13
|
## 📚 Installation
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
yarn add @injectivelabs/wallet-cosmos
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
---
|
|
@@ -30,16 +30,17 @@ dependencies and implementations for their specific wallets.
|
|
|
30
30
|
Here's a brief example of how to use this package to send 1 INJ.:
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { Wallet } from '@injectivelabs/wallet-base'
|
|
34
|
-
import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core'
|
|
35
|
-
import { CosmosWalletStrategy } from '@injectivelabs/wallet-cosmos'
|
|
33
|
+
import { Wallet } from '@injectivelabs/wallet-base';
|
|
34
|
+
import { BaseWalletStrategy, MsgBroadcaster } from '@injectivelabs/wallet-core';
|
|
35
|
+
import { CosmosWalletStrategy } from '@injectivelabs/wallet-cosmos';
|
|
36
|
+
|
|
36
37
|
|
|
37
38
|
const strategyArgs: WalletStrategyArguments = {
|
|
38
39
|
chainId: ChainId.Mainnet,
|
|
39
40
|
wallet: Wallet.Keplr,
|
|
40
41
|
strategies: {
|
|
41
42
|
[Wallet.Keplr]: new CosmosWalletStrategy({
|
|
42
|
-
chainId: ChainId.Mainnet
|
|
43
|
+
chainId: ChainId.Mainnet
|
|
43
44
|
}),
|
|
44
45
|
},
|
|
45
46
|
}
|
|
@@ -52,21 +53,21 @@ const msgBroadcaster = new MsgBroadcaster({
|
|
|
52
53
|
})
|
|
53
54
|
|
|
54
55
|
const sendTX = async () => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
56
|
+
const injectiveAddress = 'someInjectiveAddress'
|
|
57
|
+
|
|
58
|
+
const message = MsgSend.fromJSON({
|
|
59
|
+
srcInjectiveAddress: injectiveAddress,
|
|
60
|
+
dstInjectiveAddress: injectiveAddress,
|
|
61
|
+
amount: {
|
|
62
|
+
amount: '1',
|
|
63
|
+
denom: 'inj',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
return await msgBroadcaster.broadcast({ msgs: message })
|
|
68
|
+
}
|
|
68
69
|
|
|
69
|
-
const result = await sendTX()
|
|
70
|
+
const result = await sendTX()
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
Read more and find example usages on our [WalletStrategy Docs](https://docs.ts.injective.network/wallet/wallet-wallet-strategy)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
2
|
-
import { ChainId,
|
|
2
|
+
import { ChainId, CosmosChainId, AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
3
3
|
import { Wallet, StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions } from '@injectivelabs/wallet-base';
|
|
4
4
|
import { CosmosWallet } from './../wallet.js';
|
|
5
5
|
export declare class CosmosWalletStrategy extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
@@ -21,7 +21,7 @@ export declare class CosmosWalletStrategy extends BaseConcreteStrategy implement
|
|
|
21
21
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
22
22
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
23
23
|
address: AccountAddress;
|
|
24
|
-
|
|
24
|
+
ethereumChainId: EthereumChainId;
|
|
25
25
|
}): Promise<string>;
|
|
26
26
|
sendTransaction(transaction: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
27
27
|
signAminoCosmosTransaction(transaction: {
|
|
@@ -33,7 +33,7 @@ export declare class CosmosWalletStrategy extends BaseConcreteStrategy implement
|
|
|
33
33
|
accountNumber: number;
|
|
34
34
|
chainId: string;
|
|
35
35
|
address: AccountAddress;
|
|
36
|
-
}): Promise<DirectSignResponse>;
|
|
36
|
+
}): Promise<import("@cosmjs/proto-signing").DirectSignResponse>;
|
|
37
37
|
signEip712TypedData(_eip712TypedData: string, _address: AccountAddress): Promise<string>;
|
|
38
38
|
signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
|
|
39
39
|
getEthereumChainId(): Promise<string>;
|
|
@@ -121,7 +121,7 @@ class CosmosWalletStrategy extends wallet_base_1.BaseConcreteStrategy {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
async signEip712TypedData(_eip712TypedData, _address) {
|
|
124
|
-
throw new exceptions_1.CosmosWalletException(new Error('This wallet does not support signing
|
|
124
|
+
throw new exceptions_1.CosmosWalletException(new Error('This wallet does not support signing Ethereum transactions'), {
|
|
125
125
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
126
126
|
context: wallet_base_1.WalletAction.SendTransaction,
|
|
127
127
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
2
|
-
import { ChainId,
|
|
2
|
+
import { ChainId, CosmosChainId, AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
3
3
|
import { Wallet, StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions } from '@injectivelabs/wallet-base';
|
|
4
4
|
import { CosmosWallet } from './../wallet.js';
|
|
5
5
|
export declare class CosmosWalletStrategy extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
@@ -21,7 +21,7 @@ export declare class CosmosWalletStrategy extends BaseConcreteStrategy implement
|
|
|
21
21
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
22
22
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
23
23
|
address: AccountAddress;
|
|
24
|
-
|
|
24
|
+
ethereumChainId: EthereumChainId;
|
|
25
25
|
}): Promise<string>;
|
|
26
26
|
sendTransaction(transaction: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
27
27
|
signAminoCosmosTransaction(transaction: {
|
|
@@ -33,7 +33,7 @@ export declare class CosmosWalletStrategy extends BaseConcreteStrategy implement
|
|
|
33
33
|
accountNumber: number;
|
|
34
34
|
chainId: string;
|
|
35
35
|
address: AccountAddress;
|
|
36
|
-
}): Promise<DirectSignResponse>;
|
|
36
|
+
}): Promise<import("@cosmjs/proto-signing").DirectSignResponse>;
|
|
37
37
|
signEip712TypedData(_eip712TypedData: string, _address: AccountAddress): Promise<string>;
|
|
38
38
|
signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
|
|
39
39
|
getEthereumChainId(): Promise<string>;
|
|
@@ -118,7 +118,7 @@ export class CosmosWalletStrategy extends BaseConcreteStrategy {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
async signEip712TypedData(_eip712TypedData, _address) {
|
|
121
|
-
throw new CosmosWalletException(new Error('This wallet does not support signing
|
|
121
|
+
throw new CosmosWalletException(new Error('This wallet does not support signing Ethereum transactions'), {
|
|
122
122
|
code: UnspecifiedErrorCode,
|
|
123
123
|
context: WalletAction.SendTransaction,
|
|
124
124
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-cosmos",
|
|
3
3
|
"description": "Cosmos wallet strategies for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "
|
|
44
|
+
"build": "yarn build:cjs && yarn build:esm && yarn build:post",
|
|
45
45
|
"build:cjs": "tsc --build --force tsconfig.build.json",
|
|
46
46
|
"build:esm": "tsc --build --force tsconfig.build.esm.json",
|
|
47
|
-
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json &&
|
|
47
|
+
"build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post",
|
|
48
48
|
"build:post": "shx cp ../../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../../etc/stub/package.esm.json.stub dist/esm/package.json",
|
|
49
49
|
"clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist",
|
|
50
50
|
"test": "jest",
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@cosmjs/proto-signing": "^0.
|
|
60
|
-
"@cosmjs/stargate": "^0.
|
|
61
|
-
"@injectivelabs/exceptions": "1.16.
|
|
62
|
-
"@injectivelabs/sdk-ts": "1.16.
|
|
63
|
-
"@injectivelabs/ts-types": "1.16.
|
|
64
|
-
"@injectivelabs/utils": "1.16.
|
|
65
|
-
"@injectivelabs/wallet-base": "1.16.
|
|
59
|
+
"@cosmjs/proto-signing": "^0.32.3",
|
|
60
|
+
"@cosmjs/stargate": "^0.32.3",
|
|
61
|
+
"@injectivelabs/exceptions": "^1.16.3",
|
|
62
|
+
"@injectivelabs/sdk-ts": "^1.16.3",
|
|
63
|
+
"@injectivelabs/ts-types": "^1.16.3",
|
|
64
|
+
"@injectivelabs/utils": "^1.16.3",
|
|
65
|
+
"@injectivelabs/wallet-base": "^1.16.3",
|
|
66
66
|
"@keplr-wallet/types": "^0.12.71"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"shx": "^0.3.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "6d6bc4a37888d089b67e5787555e760bdf29c780",
|
|
72
72
|
"typedoc": {
|
|
73
73
|
"entryPoint": "./src/index.ts",
|
|
74
74
|
"readmeFile": "./README.md",
|