@injectivelabs/wallet-base 1.15.43 → 1.16.1-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/base.d.ts +4 -4
- package/dist/cjs/base.js +4 -4
- package/dist/cjs/types/strategy.d.ts +12 -12
- package/dist/esm/base.d.ts +4 -4
- package/dist/esm/base.js +4 -4
- package/dist/esm/types/strategy.d.ts +12 -12
- package/package.json +8 -8
package/dist/cjs/base.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChainId,
|
|
2
|
-
import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs,
|
|
1
|
+
import { ChainId, EvmChainId, CosmosChainId } from '@injectivelabs/ts-types';
|
|
2
|
+
import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs } from './types/index.js';
|
|
3
3
|
export default abstract class BaseConcreteStrategy {
|
|
4
4
|
protected chainId: ChainId | CosmosChainId;
|
|
5
|
-
protected
|
|
5
|
+
protected evmChainId?: EvmChainId;
|
|
6
6
|
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
7
7
|
metadata?: WalletMetadata;
|
|
8
|
-
constructor(args: ConcreteWalletStrategyArgs |
|
|
8
|
+
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
9
9
|
}
|
package/dist/cjs/base.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class BaseConcreteStrategy {
|
|
4
4
|
chainId;
|
|
5
|
-
|
|
5
|
+
evmChainId;
|
|
6
6
|
listeners = {};
|
|
7
7
|
metadata;
|
|
8
8
|
constructor(args) {
|
|
9
|
-
this.
|
|
10
|
-
'
|
|
11
|
-
? args.
|
|
9
|
+
this.evmChainId =
|
|
10
|
+
'evmOptions' in args && args.evmOptions
|
|
11
|
+
? args.evmOptions.evmChainId
|
|
12
12
|
: undefined;
|
|
13
13
|
this.chainId = args.chainId;
|
|
14
14
|
this.metadata = args.metadata;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId,
|
|
1
|
+
import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
2
2
|
import type { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
3
3
|
import { StdSignDoc } from '@keplr-wallet/types';
|
|
4
4
|
import { WalletDeviceType, Wallet } from './enums.js';
|
|
@@ -22,10 +22,10 @@ export type PrivateKeyMetadata = {
|
|
|
22
22
|
export type WalletConnectMetadata = {
|
|
23
23
|
projectId?: string;
|
|
24
24
|
};
|
|
25
|
-
export interface
|
|
26
|
-
|
|
25
|
+
export interface WalletStrategyEvmOptions {
|
|
26
|
+
evmChainId: EvmChainId;
|
|
27
27
|
rpcUrl?: string;
|
|
28
|
-
rpcUrls?: Partial<Record<
|
|
28
|
+
rpcUrls?: Partial<Record<EvmChainId, string>>;
|
|
29
29
|
}
|
|
30
30
|
export interface SendTransactionOptions {
|
|
31
31
|
address: string;
|
|
@@ -76,12 +76,12 @@ export interface ConcreteWalletStrategyArgs {
|
|
|
76
76
|
chainId: ChainId;
|
|
77
77
|
metadata?: WalletMetadata;
|
|
78
78
|
}
|
|
79
|
+
export interface ConcreteEvmWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
80
|
+
evmOptions: WalletStrategyEvmOptions;
|
|
81
|
+
}
|
|
79
82
|
export interface ConcreteCosmosWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
80
83
|
wallet?: Wallet;
|
|
81
84
|
}
|
|
82
|
-
export interface ConcreteEthereumWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
83
|
-
ethereumOptions: WalletStrategyEthereumOptions;
|
|
84
|
-
}
|
|
85
85
|
export interface ConcreteCosmosWalletStrategy {
|
|
86
86
|
metadata?: WalletMetadata;
|
|
87
87
|
setMetadata?(metadata?: WalletMetadata): void;
|
|
@@ -127,7 +127,7 @@ export type ConcreteStrategiesArg = {
|
|
|
127
127
|
export interface WalletStrategyArguments {
|
|
128
128
|
chainId: ChainId;
|
|
129
129
|
metadata?: WalletMetadata;
|
|
130
|
-
|
|
130
|
+
evmOptions?: WalletStrategyEvmOptions;
|
|
131
131
|
disabledWallets?: Wallet[];
|
|
132
132
|
wallet?: Wallet;
|
|
133
133
|
strategies: ConcreteStrategiesArg;
|
|
@@ -160,7 +160,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
|
|
|
160
160
|
*/
|
|
161
161
|
sendEvmTransaction(transaction: unknown, options: {
|
|
162
162
|
address: string;
|
|
163
|
-
|
|
163
|
+
evmChainId: EvmChainId;
|
|
164
164
|
}): Promise<string>;
|
|
165
165
|
/**
|
|
166
166
|
* Sign a cosmos transaction using the wallet provider
|
|
@@ -192,7 +192,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
|
|
|
192
192
|
signEip712TypedData(eip712TypedData: string, address: string): Promise<string>;
|
|
193
193
|
signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
|
|
194
194
|
getEthereumChainId(): Promise<string>;
|
|
195
|
-
getEvmTransactionReceipt(txHash: string,
|
|
195
|
+
getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): void;
|
|
196
196
|
onAccountChange?(callback: onAccountChangeCallback): Promise<void> | void;
|
|
197
197
|
onChainIdChange?(callback: onChainIdChangeCallback): Promise<void> | void;
|
|
198
198
|
disconnect?(): Promise<void> | void;
|
|
@@ -215,12 +215,12 @@ export interface WalletStrategy {
|
|
|
215
215
|
enable(args?: unknown): Promise<boolean>;
|
|
216
216
|
enableAndGetAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
217
217
|
getEthereumChainId(): Promise<string>;
|
|
218
|
-
getEvmTransactionReceipt(txHash: string,
|
|
218
|
+
getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<void>;
|
|
219
219
|
getSessionOrConfirm(address?: AccountAddress): Promise<string>;
|
|
220
220
|
sendTransaction(tx: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
221
221
|
sendEvmTransaction(tx: any, options: {
|
|
222
222
|
address: AccountAddress;
|
|
223
|
-
|
|
223
|
+
evmChainId: EvmChainId;
|
|
224
224
|
}): Promise<string>;
|
|
225
225
|
signEip712TypedData(eip712TypedData: string, address: AccountAddress): Promise<string>;
|
|
226
226
|
signAminoCosmosTransaction(transaction: {
|
package/dist/esm/base.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ChainId,
|
|
2
|
-
import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs,
|
|
1
|
+
import { ChainId, EvmChainId, CosmosChainId } from '@injectivelabs/ts-types';
|
|
2
|
+
import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs } from './types/index.js';
|
|
3
3
|
export default abstract class BaseConcreteStrategy {
|
|
4
4
|
protected chainId: ChainId | CosmosChainId;
|
|
5
|
-
protected
|
|
5
|
+
protected evmChainId?: EvmChainId;
|
|
6
6
|
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
7
7
|
metadata?: WalletMetadata;
|
|
8
|
-
constructor(args: ConcreteWalletStrategyArgs |
|
|
8
|
+
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
9
9
|
}
|
package/dist/esm/base.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export default class BaseConcreteStrategy {
|
|
2
2
|
chainId;
|
|
3
|
-
|
|
3
|
+
evmChainId;
|
|
4
4
|
listeners = {};
|
|
5
5
|
metadata;
|
|
6
6
|
constructor(args) {
|
|
7
|
-
this.
|
|
8
|
-
'
|
|
9
|
-
? args.
|
|
7
|
+
this.evmChainId =
|
|
8
|
+
'evmOptions' in args && args.evmOptions
|
|
9
|
+
? args.evmOptions.evmChainId
|
|
10
10
|
: undefined;
|
|
11
11
|
this.chainId = args.chainId;
|
|
12
12
|
this.metadata = args.metadata;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainId,
|
|
1
|
+
import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
|
|
2
2
|
import type { TxRaw, TxResponse, AminoSignResponse, DirectSignResponse } from '@injectivelabs/sdk-ts';
|
|
3
3
|
import { StdSignDoc } from '@keplr-wallet/types';
|
|
4
4
|
import { WalletDeviceType, Wallet } from './enums.js';
|
|
@@ -22,10 +22,10 @@ export type PrivateKeyMetadata = {
|
|
|
22
22
|
export type WalletConnectMetadata = {
|
|
23
23
|
projectId?: string;
|
|
24
24
|
};
|
|
25
|
-
export interface
|
|
26
|
-
|
|
25
|
+
export interface WalletStrategyEvmOptions {
|
|
26
|
+
evmChainId: EvmChainId;
|
|
27
27
|
rpcUrl?: string;
|
|
28
|
-
rpcUrls?: Partial<Record<
|
|
28
|
+
rpcUrls?: Partial<Record<EvmChainId, string>>;
|
|
29
29
|
}
|
|
30
30
|
export interface SendTransactionOptions {
|
|
31
31
|
address: string;
|
|
@@ -76,12 +76,12 @@ export interface ConcreteWalletStrategyArgs {
|
|
|
76
76
|
chainId: ChainId;
|
|
77
77
|
metadata?: WalletMetadata;
|
|
78
78
|
}
|
|
79
|
+
export interface ConcreteEvmWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
80
|
+
evmOptions: WalletStrategyEvmOptions;
|
|
81
|
+
}
|
|
79
82
|
export interface ConcreteCosmosWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
80
83
|
wallet?: Wallet;
|
|
81
84
|
}
|
|
82
|
-
export interface ConcreteEthereumWalletStrategyArgs extends ConcreteWalletStrategyArgs {
|
|
83
|
-
ethereumOptions: WalletStrategyEthereumOptions;
|
|
84
|
-
}
|
|
85
85
|
export interface ConcreteCosmosWalletStrategy {
|
|
86
86
|
metadata?: WalletMetadata;
|
|
87
87
|
setMetadata?(metadata?: WalletMetadata): void;
|
|
@@ -127,7 +127,7 @@ export type ConcreteStrategiesArg = {
|
|
|
127
127
|
export interface WalletStrategyArguments {
|
|
128
128
|
chainId: ChainId;
|
|
129
129
|
metadata?: WalletMetadata;
|
|
130
|
-
|
|
130
|
+
evmOptions?: WalletStrategyEvmOptions;
|
|
131
131
|
disabledWallets?: Wallet[];
|
|
132
132
|
wallet?: Wallet;
|
|
133
133
|
strategies: ConcreteStrategiesArg;
|
|
@@ -160,7 +160,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
|
|
|
160
160
|
*/
|
|
161
161
|
sendEvmTransaction(transaction: unknown, options: {
|
|
162
162
|
address: string;
|
|
163
|
-
|
|
163
|
+
evmChainId: EvmChainId;
|
|
164
164
|
}): Promise<string>;
|
|
165
165
|
/**
|
|
166
166
|
* Sign a cosmos transaction using the wallet provider
|
|
@@ -192,7 +192,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
|
|
|
192
192
|
signEip712TypedData(eip712TypedData: string, address: string): Promise<string>;
|
|
193
193
|
signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
|
|
194
194
|
getEthereumChainId(): Promise<string>;
|
|
195
|
-
getEvmTransactionReceipt(txHash: string,
|
|
195
|
+
getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): void;
|
|
196
196
|
onAccountChange?(callback: onAccountChangeCallback): Promise<void> | void;
|
|
197
197
|
onChainIdChange?(callback: onChainIdChangeCallback): Promise<void> | void;
|
|
198
198
|
disconnect?(): Promise<void> | void;
|
|
@@ -215,12 +215,12 @@ export interface WalletStrategy {
|
|
|
215
215
|
enable(args?: unknown): Promise<boolean>;
|
|
216
216
|
enableAndGetAddresses(args?: unknown): Promise<AccountAddress[]>;
|
|
217
217
|
getEthereumChainId(): Promise<string>;
|
|
218
|
-
getEvmTransactionReceipt(txHash: string,
|
|
218
|
+
getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<void>;
|
|
219
219
|
getSessionOrConfirm(address?: AccountAddress): Promise<string>;
|
|
220
220
|
sendTransaction(tx: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
|
|
221
221
|
sendEvmTransaction(tx: any, options: {
|
|
222
222
|
address: AccountAddress;
|
|
223
|
-
|
|
223
|
+
evmChainId: EvmChainId;
|
|
224
224
|
}): Promise<string>;
|
|
225
225
|
signEip712TypedData(eip712TypedData: string, address: AccountAddress): Promise<string>;
|
|
226
226
|
signAminoCosmosTransaction(transaction: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-base",
|
|
3
3
|
"description": "Base wallet strategy for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.16.1-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,14 +56,14 @@
|
|
|
56
56
|
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@injectivelabs/exceptions": "
|
|
60
|
-
"@injectivelabs/networks": "
|
|
61
|
-
"@injectivelabs/sdk-ts": "
|
|
62
|
-
"@injectivelabs/ts-types": "
|
|
59
|
+
"@injectivelabs/exceptions": "1.16.1-alpha.1",
|
|
60
|
+
"@injectivelabs/networks": "1.16.1-alpha.1",
|
|
61
|
+
"@injectivelabs/sdk-ts": "1.16.1-alpha.1",
|
|
62
|
+
"@injectivelabs/ts-types": "1.16.1-alpha.1",
|
|
63
63
|
"eip1193-provider": "^1.0.1"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"shx": "^0.3.3"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "aa24a5ba96800b6daea85666f7030619d3c18d91"
|
|
69
69
|
}
|