@injectivelabs/wallet-private-key 1.16.1 → 1.16.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/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
2
1
|
import { AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
3
2
|
import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions } from '@injectivelabs/wallet-base';
|
|
4
3
|
import { TxRaw, TxResponse } from '@injectivelabs/sdk-ts';
|
|
4
|
+
import { EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
5
5
|
export declare class PrivateKeyWallet extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
6
6
|
private privateKey?;
|
|
7
7
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
@@ -11,7 +11,7 @@ export declare class PrivateKeyWallet extends BaseConcreteStrategy implements Co
|
|
|
11
11
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
12
12
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
13
13
|
address: AccountAddress;
|
|
14
|
-
|
|
14
|
+
evmChainId: EvmChainId;
|
|
15
15
|
}): Promise<string>;
|
|
16
16
|
sendTransaction(transaction: TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
17
17
|
signEip712TypedData(eip712json: string, address: AccountAddress): Promise<string>;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PrivateKeyWallet = void 0;
|
|
4
4
|
/* eslint-disable class-methods-use-this */
|
|
5
|
-
const ts_types_1 = require("@injectivelabs/ts-types");
|
|
6
5
|
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
7
6
|
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
8
7
|
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
9
8
|
const sdk_ts_2 = require("@injectivelabs/sdk-ts");
|
|
9
|
+
const ts_types_1 = require("@injectivelabs/ts-types");
|
|
10
10
|
class PrivateKeyWallet extends wallet_base_1.BaseConcreteStrategy {
|
|
11
11
|
privateKey;
|
|
12
12
|
async getWalletDeviceType() {
|
|
@@ -36,7 +36,7 @@ class PrivateKeyWallet extends wallet_base_1.BaseConcreteStrategy {
|
|
|
36
36
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
37
37
|
}
|
|
38
38
|
async sendEvmTransaction(_transaction, _options) {
|
|
39
|
-
throw new exceptions_1.WalletException(new Error('This wallet does not support sending
|
|
39
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support sending Evm transactions'), {
|
|
40
40
|
code: exceptions_1.UnspecifiedErrorCode,
|
|
41
41
|
type: exceptions_1.ErrorType.WalletError,
|
|
42
42
|
contextModule: wallet_base_1.WalletAction.SendEvmTransaction,
|
|
@@ -118,8 +118,8 @@ class PrivateKeyWallet extends wallet_base_1.BaseConcreteStrategy {
|
|
|
118
118
|
async getEthereumChainId() {
|
|
119
119
|
try {
|
|
120
120
|
return Promise.resolve((this.chainId === ts_types_1.ChainId.Mainnet
|
|
121
|
-
? ts_types_1.
|
|
122
|
-
: ts_types_1.
|
|
121
|
+
? ts_types_1.EvmChainId.Mainnet
|
|
122
|
+
: ts_types_1.EvmChainId.Sepolia).toString(16));
|
|
123
123
|
}
|
|
124
124
|
catch (e) {
|
|
125
125
|
throw new exceptions_1.MetamaskException(new Error(e.message), {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
2
1
|
import { AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
3
2
|
import { StdSignDoc, WalletDeviceType, BaseConcreteStrategy, ConcreteWalletStrategy, SendTransactionOptions } from '@injectivelabs/wallet-base';
|
|
4
3
|
import { TxRaw, TxResponse } from '@injectivelabs/sdk-ts';
|
|
4
|
+
import { EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
5
5
|
export declare class PrivateKeyWallet extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
6
6
|
private privateKey?;
|
|
7
7
|
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
@@ -11,7 +11,7 @@ export declare class PrivateKeyWallet extends BaseConcreteStrategy implements Co
|
|
|
11
11
|
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
12
12
|
sendEvmTransaction(_transaction: unknown, _options: {
|
|
13
13
|
address: AccountAddress;
|
|
14
|
-
|
|
14
|
+
evmChainId: EvmChainId;
|
|
15
15
|
}): Promise<string>;
|
|
16
16
|
sendTransaction(transaction: TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
17
17
|
signEip712TypedData(eip712json: string, address: AccountAddress): Promise<string>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable class-methods-use-this */
|
|
2
|
-
import {
|
|
3
|
-
import { PrivateKey as PrivateKeySigner, getInjectiveSignerAddress, } from '@injectivelabs/sdk-ts';
|
|
2
|
+
import { getInjectiveSignerAddress, PrivateKey as PrivateKeySigner, } from '@injectivelabs/sdk-ts';
|
|
4
3
|
import { ErrorType, WalletException, MetamaskException, UnspecifiedErrorCode, TransactionException, } from '@injectivelabs/exceptions';
|
|
5
4
|
import { WalletAction, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
|
|
6
5
|
import { toUtf8, TxGrpcApi } from '@injectivelabs/sdk-ts';
|
|
6
|
+
import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
|
|
7
7
|
export class PrivateKeyWallet extends BaseConcreteStrategy {
|
|
8
8
|
privateKey;
|
|
9
9
|
async getWalletDeviceType() {
|
|
@@ -33,7 +33,7 @@ export class PrivateKeyWallet extends BaseConcreteStrategy {
|
|
|
33
33
|
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
34
34
|
}
|
|
35
35
|
async sendEvmTransaction(_transaction, _options) {
|
|
36
|
-
throw new WalletException(new Error('This wallet does not support sending
|
|
36
|
+
throw new WalletException(new Error('This wallet does not support sending Evm transactions'), {
|
|
37
37
|
code: UnspecifiedErrorCode,
|
|
38
38
|
type: ErrorType.WalletError,
|
|
39
39
|
contextModule: WalletAction.SendEvmTransaction,
|
|
@@ -115,8 +115,8 @@ export class PrivateKeyWallet extends BaseConcreteStrategy {
|
|
|
115
115
|
async getEthereumChainId() {
|
|
116
116
|
try {
|
|
117
117
|
return Promise.resolve((this.chainId === ChainId.Mainnet
|
|
118
|
-
?
|
|
119
|
-
:
|
|
118
|
+
? EvmChainId.Mainnet
|
|
119
|
+
: EvmChainId.Sepolia).toString(16));
|
|
120
120
|
}
|
|
121
121
|
catch (e) {
|
|
122
122
|
throw new MetamaskException(new Error(e.message), {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-private-key",
|
|
3
3
|
"description": "Private key wallet strategy for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.16.1",
|
|
4
|
+
"version": "1.16.2-alpha.1",
|
|
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": "pnpm build:cjs && pnpm build:esm && pnpm 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 && pnpm 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,12 +56,15 @@
|
|
|
56
56
|
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@injectivelabs/exceptions": "
|
|
60
|
-
"@injectivelabs/sdk-ts": "
|
|
61
|
-
"@injectivelabs/ts-types": "
|
|
62
|
-
"@injectivelabs/wallet-base": "
|
|
59
|
+
"@injectivelabs/exceptions": "1.16.2-alpha.1",
|
|
60
|
+
"@injectivelabs/sdk-ts": "1.16.2-alpha.1",
|
|
61
|
+
"@injectivelabs/ts-types": "1.16.2-alpha.1",
|
|
62
|
+
"@injectivelabs/wallet-base": "1.16.2-alpha.1"
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"shx": "^0.3.4"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "25f2492ee251504d8b0c1f3e4ce49e96e759294b",
|
|
65
68
|
"typedoc": {
|
|
66
69
|
"entryPoint": "./src/index.ts",
|
|
67
70
|
"readmeFile": "./README.md",
|