@injectivelabs/wallet-base 1.16.2-alpha.1 → 1.16.2

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 @@ _Base Package for the Wallet Strategy._
13
13
  ## 📚 Installation
14
14
 
15
15
  ```bash
16
- pnpm add @injectivelabs/wallet-base
16
+ yarn add @injectivelabs/wallet-base
17
17
  ```
18
18
 
19
19
  ---
@@ -1,9 +1,9 @@
1
- import { ChainId, EvmChainId, CosmosChainId } from '@injectivelabs/ts-types';
2
- import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs } from './types/index.js';
1
+ import { ChainId, CosmosChainId, EthereumChainId } from '@injectivelabs/ts-types';
2
+ import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs, ConcreteEthereumWalletStrategyArgs } from './types/index.js';
3
3
  export default abstract class BaseConcreteStrategy {
4
4
  protected chainId: ChainId | CosmosChainId;
5
- protected evmChainId?: EvmChainId;
5
+ protected ethereumChainId?: EthereumChainId;
6
6
  protected listeners: Partial<Record<WalletEventListener, any>>;
7
7
  metadata?: WalletMetadata;
8
- constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
8
+ constructor(args: ConcreteWalletStrategyArgs | ConcreteEthereumWalletStrategyArgs | 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
- evmChainId;
5
+ ethereumChainId;
6
6
  listeners = {};
7
7
  metadata;
8
8
  constructor(args) {
9
- this.evmChainId =
10
- 'evmOptions' in args && args.evmOptions
11
- ? args.evmOptions.evmChainId
9
+ this.ethereumChainId =
10
+ 'ethereumOptions' in args && args.ethereumOptions
11
+ ? args.ethereumOptions.ethereumChainId
12
12
  : undefined;
13
13
  this.chainId = args.chainId;
14
14
  this.metadata = args.metadata;
@@ -12,7 +12,6 @@ export declare enum Wallet {
12
12
  Keplr = "keplr",
13
13
  Ninji = "ninji",
14
14
  Magic = "magic",
15
- Rabby = "rabby",
16
15
  Ledger = "ledger",
17
16
  BitGet = "BitGet",
18
17
  OWallet = "owallet",
@@ -17,7 +17,6 @@ var Wallet;
17
17
  Wallet["Keplr"] = "keplr";
18
18
  Wallet["Ninji"] = "ninji";
19
19
  Wallet["Magic"] = "magic";
20
- Wallet["Rabby"] = "rabby";
21
20
  Wallet["Ledger"] = "ledger";
22
21
  Wallet["BitGet"] = "BitGet";
23
22
  Wallet["OWallet"] = "owallet";
@@ -2,7 +2,6 @@ import { type EIP1193Provider } from 'eip1193-provider';
2
2
  export interface BrowserEip1993Provider extends EIP1193Provider {
3
3
  removeAllListeners(): void;
4
4
  isTrust: boolean;
5
- isRabby: boolean;
6
5
  isRainbow: boolean;
7
6
  isPhantom: boolean;
8
7
  isMetaMask: boolean;
@@ -11,7 +10,6 @@ export interface BrowserEip1993Provider extends EIP1193Provider {
11
10
  }
12
11
  export interface WindowWithEip1193Provider extends Window {
13
12
  rainbow: BrowserEip1993Provider;
14
- rabby: BrowserEip1993Provider;
15
13
  ethereum: BrowserEip1993Provider;
16
14
  okxwallet: BrowserEip1993Provider;
17
15
  providers: BrowserEip1993Provider[];
@@ -1,4 +1,4 @@
1
- import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
1
+ import { ChainId, AccountAddress, EthereumChainId } 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 WalletStrategyEvmOptions {
26
- evmChainId: EvmChainId;
25
+ export interface WalletStrategyEthereumOptions {
26
+ ethereumChainId: EthereumChainId;
27
27
  rpcUrl?: string;
28
- rpcUrls?: Partial<Record<EvmChainId, string>>;
28
+ rpcUrls?: Partial<Record<EthereumChainId, string>>;
29
29
  }
30
30
  export interface SendTransactionOptions {
31
31
  address: string;
@@ -51,12 +51,16 @@ export type TurnkeySession = {
51
51
  };
52
52
  export interface TurnkeyMetadata {
53
53
  apiBaseUrl: string;
54
+ iframeUrl?: string;
54
55
  otpInitPath?: string;
56
+ organizationId: string;
55
57
  otpVerifyPath?: string;
56
58
  googleClientId?: string;
57
59
  oauthLoginPath?: string;
58
60
  session?: TurnkeySession;
61
+ iframeElementId?: string;
59
62
  apiServerEndpoint: string;
63
+ iframeContainerId: string;
60
64
  credentialBundle?: string;
61
65
  googleRedirectUri?: string;
62
66
  expirationSeconds?: string;
@@ -72,12 +76,12 @@ export interface ConcreteWalletStrategyArgs {
72
76
  chainId: ChainId;
73
77
  metadata?: WalletMetadata;
74
78
  }
75
- export interface ConcreteEvmWalletStrategyArgs extends ConcreteWalletStrategyArgs {
76
- evmOptions: WalletStrategyEvmOptions;
77
- }
78
79
  export interface ConcreteCosmosWalletStrategyArgs extends ConcreteWalletStrategyArgs {
79
80
  wallet?: Wallet;
80
81
  }
82
+ export interface ConcreteEthereumWalletStrategyArgs extends ConcreteWalletStrategyArgs {
83
+ ethereumOptions: WalletStrategyEthereumOptions;
84
+ }
81
85
  export interface ConcreteCosmosWalletStrategy {
82
86
  metadata?: WalletMetadata;
83
87
  setMetadata?(metadata?: WalletMetadata): void;
@@ -123,7 +127,7 @@ export type ConcreteStrategiesArg = {
123
127
  export interface WalletStrategyArguments {
124
128
  chainId: ChainId;
125
129
  metadata?: WalletMetadata;
126
- evmOptions?: WalletStrategyEvmOptions;
130
+ ethereumOptions?: WalletStrategyEthereumOptions;
127
131
  disabledWallets?: Wallet[];
128
132
  wallet?: Wallet;
129
133
  strategies: ConcreteStrategiesArg;
@@ -156,7 +160,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
156
160
  */
157
161
  sendEvmTransaction(transaction: unknown, options: {
158
162
  address: string;
159
- evmChainId: EvmChainId;
163
+ ethereumChainId: EthereumChainId;
160
164
  }): Promise<string>;
161
165
  /**
162
166
  * Sign a cosmos transaction using the wallet provider
@@ -188,7 +192,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
188
192
  signEip712TypedData(eip712TypedData: string, address: string): Promise<string>;
189
193
  signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
190
194
  getEthereumChainId(): Promise<string>;
191
- getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): void;
195
+ getEvmTransactionReceipt(txHash: string, ethereumChainId?: EthereumChainId): void;
192
196
  onAccountChange?(callback: onAccountChangeCallback): Promise<void> | void;
193
197
  onChainIdChange?(callback: onChainIdChangeCallback): Promise<void> | void;
194
198
  disconnect?(): Promise<void> | void;
@@ -211,12 +215,12 @@ export interface WalletStrategy {
211
215
  enable(args?: unknown): Promise<boolean>;
212
216
  enableAndGetAddresses(args?: unknown): Promise<AccountAddress[]>;
213
217
  getEthereumChainId(): Promise<string>;
214
- getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<void>;
218
+ getEvmTransactionReceipt(txHash: string, ethereumChainId?: EthereumChainId): Promise<void>;
215
219
  getSessionOrConfirm(address?: AccountAddress): Promise<string>;
216
220
  sendTransaction(tx: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
217
221
  sendEvmTransaction(tx: any, options: {
218
222
  address: AccountAddress;
219
- evmChainId: EvmChainId;
223
+ ethereumChainId: EthereumChainId;
220
224
  }): Promise<string>;
221
225
  signEip712TypedData(eip712TypedData: string, address: AccountAddress): Promise<string>;
222
226
  signAminoCosmosTransaction(transaction: {
@@ -4,7 +4,6 @@ exports.isCosmosAminoOnlyWallet = exports.isEip712V2OnlyWallet = exports.isCosmo
4
4
  const enums_js_1 = require("./../types/enums.js");
5
5
  const isEvmWallet = (wallet) => [
6
6
  enums_js_1.Wallet.Magic,
7
- enums_js_1.Wallet.Rabby,
8
7
  enums_js_1.Wallet.BitGet,
9
8
  enums_js_1.Wallet.Ledger,
10
9
  enums_js_1.Wallet.Phantom,
@@ -24,7 +23,6 @@ exports.isEvmWallet = isEvmWallet;
24
23
  const isCosmosWallet = (wallet) => !(0, exports.isEvmWallet)(wallet);
25
24
  exports.isCosmosWallet = isCosmosWallet;
26
25
  const isEvmBrowserWallet = (wallet) => [
27
- enums_js_1.Wallet.Rabby,
28
26
  enums_js_1.Wallet.BitGet,
29
27
  enums_js_1.Wallet.Rainbow,
30
28
  enums_js_1.Wallet.Phantom,
@@ -1,9 +1,9 @@
1
- import { ChainId, EvmChainId, CosmosChainId } from '@injectivelabs/ts-types';
2
- import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs } from './types/index.js';
1
+ import { ChainId, CosmosChainId, EthereumChainId } from '@injectivelabs/ts-types';
2
+ import { WalletMetadata, WalletEventListener, ConcreteWalletStrategyArgs, ConcreteCosmosWalletStrategyArgs, ConcreteEthereumWalletStrategyArgs } from './types/index.js';
3
3
  export default abstract class BaseConcreteStrategy {
4
4
  protected chainId: ChainId | CosmosChainId;
5
- protected evmChainId?: EvmChainId;
5
+ protected ethereumChainId?: EthereumChainId;
6
6
  protected listeners: Partial<Record<WalletEventListener, any>>;
7
7
  metadata?: WalletMetadata;
8
- constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
8
+ constructor(args: ConcreteWalletStrategyArgs | ConcreteEthereumWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
9
9
  }
package/dist/esm/base.js CHANGED
@@ -1,12 +1,12 @@
1
1
  export default class BaseConcreteStrategy {
2
2
  chainId;
3
- evmChainId;
3
+ ethereumChainId;
4
4
  listeners = {};
5
5
  metadata;
6
6
  constructor(args) {
7
- this.evmChainId =
8
- 'evmOptions' in args && args.evmOptions
9
- ? args.evmOptions.evmChainId
7
+ this.ethereumChainId =
8
+ 'ethereumOptions' in args && args.ethereumOptions
9
+ ? args.ethereumOptions.ethereumChainId
10
10
  : undefined;
11
11
  this.chainId = args.chainId;
12
12
  this.metadata = args.metadata;
@@ -12,7 +12,6 @@ export declare enum Wallet {
12
12
  Keplr = "keplr",
13
13
  Ninji = "ninji",
14
14
  Magic = "magic",
15
- Rabby = "rabby",
16
15
  Ledger = "ledger",
17
16
  BitGet = "BitGet",
18
17
  OWallet = "owallet",
@@ -14,7 +14,6 @@ export var Wallet;
14
14
  Wallet["Keplr"] = "keplr";
15
15
  Wallet["Ninji"] = "ninji";
16
16
  Wallet["Magic"] = "magic";
17
- Wallet["Rabby"] = "rabby";
18
17
  Wallet["Ledger"] = "ledger";
19
18
  Wallet["BitGet"] = "BitGet";
20
19
  Wallet["OWallet"] = "owallet";
@@ -2,7 +2,6 @@ import { type EIP1193Provider } from 'eip1193-provider';
2
2
  export interface BrowserEip1993Provider extends EIP1193Provider {
3
3
  removeAllListeners(): void;
4
4
  isTrust: boolean;
5
- isRabby: boolean;
6
5
  isRainbow: boolean;
7
6
  isPhantom: boolean;
8
7
  isMetaMask: boolean;
@@ -11,7 +10,6 @@ export interface BrowserEip1993Provider extends EIP1193Provider {
11
10
  }
12
11
  export interface WindowWithEip1193Provider extends Window {
13
12
  rainbow: BrowserEip1993Provider;
14
- rabby: BrowserEip1993Provider;
15
13
  ethereum: BrowserEip1993Provider;
16
14
  okxwallet: BrowserEip1993Provider;
17
15
  providers: BrowserEip1993Provider[];
@@ -1,4 +1,4 @@
1
- import { ChainId, EvmChainId, AccountAddress } from '@injectivelabs/ts-types';
1
+ import { ChainId, AccountAddress, EthereumChainId } 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 WalletStrategyEvmOptions {
26
- evmChainId: EvmChainId;
25
+ export interface WalletStrategyEthereumOptions {
26
+ ethereumChainId: EthereumChainId;
27
27
  rpcUrl?: string;
28
- rpcUrls?: Partial<Record<EvmChainId, string>>;
28
+ rpcUrls?: Partial<Record<EthereumChainId, string>>;
29
29
  }
30
30
  export interface SendTransactionOptions {
31
31
  address: string;
@@ -51,12 +51,16 @@ export type TurnkeySession = {
51
51
  };
52
52
  export interface TurnkeyMetadata {
53
53
  apiBaseUrl: string;
54
+ iframeUrl?: string;
54
55
  otpInitPath?: string;
56
+ organizationId: string;
55
57
  otpVerifyPath?: string;
56
58
  googleClientId?: string;
57
59
  oauthLoginPath?: string;
58
60
  session?: TurnkeySession;
61
+ iframeElementId?: string;
59
62
  apiServerEndpoint: string;
63
+ iframeContainerId: string;
60
64
  credentialBundle?: string;
61
65
  googleRedirectUri?: string;
62
66
  expirationSeconds?: string;
@@ -72,12 +76,12 @@ export interface ConcreteWalletStrategyArgs {
72
76
  chainId: ChainId;
73
77
  metadata?: WalletMetadata;
74
78
  }
75
- export interface ConcreteEvmWalletStrategyArgs extends ConcreteWalletStrategyArgs {
76
- evmOptions: WalletStrategyEvmOptions;
77
- }
78
79
  export interface ConcreteCosmosWalletStrategyArgs extends ConcreteWalletStrategyArgs {
79
80
  wallet?: Wallet;
80
81
  }
82
+ export interface ConcreteEthereumWalletStrategyArgs extends ConcreteWalletStrategyArgs {
83
+ ethereumOptions: WalletStrategyEthereumOptions;
84
+ }
81
85
  export interface ConcreteCosmosWalletStrategy {
82
86
  metadata?: WalletMetadata;
83
87
  setMetadata?(metadata?: WalletMetadata): void;
@@ -123,7 +127,7 @@ export type ConcreteStrategiesArg = {
123
127
  export interface WalletStrategyArguments {
124
128
  chainId: ChainId;
125
129
  metadata?: WalletMetadata;
126
- evmOptions?: WalletStrategyEvmOptions;
130
+ ethereumOptions?: WalletStrategyEthereumOptions;
127
131
  disabledWallets?: Wallet[];
128
132
  wallet?: Wallet;
129
133
  strategies: ConcreteStrategiesArg;
@@ -156,7 +160,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
156
160
  */
157
161
  sendEvmTransaction(transaction: unknown, options: {
158
162
  address: string;
159
- evmChainId: EvmChainId;
163
+ ethereumChainId: EthereumChainId;
160
164
  }): Promise<string>;
161
165
  /**
162
166
  * Sign a cosmos transaction using the wallet provider
@@ -188,7 +192,7 @@ export interface ConcreteWalletStrategy extends Omit<ConcreteCosmosWalletStrateg
188
192
  signEip712TypedData(eip712TypedData: string, address: string): Promise<string>;
189
193
  signArbitrary(signer: string, data: string | Uint8Array): Promise<string>;
190
194
  getEthereumChainId(): Promise<string>;
191
- getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): void;
195
+ getEvmTransactionReceipt(txHash: string, ethereumChainId?: EthereumChainId): void;
192
196
  onAccountChange?(callback: onAccountChangeCallback): Promise<void> | void;
193
197
  onChainIdChange?(callback: onChainIdChangeCallback): Promise<void> | void;
194
198
  disconnect?(): Promise<void> | void;
@@ -211,12 +215,12 @@ export interface WalletStrategy {
211
215
  enable(args?: unknown): Promise<boolean>;
212
216
  enableAndGetAddresses(args?: unknown): Promise<AccountAddress[]>;
213
217
  getEthereumChainId(): Promise<string>;
214
- getEvmTransactionReceipt(txHash: string, evmChainId?: EvmChainId): Promise<void>;
218
+ getEvmTransactionReceipt(txHash: string, ethereumChainId?: EthereumChainId): Promise<void>;
215
219
  getSessionOrConfirm(address?: AccountAddress): Promise<string>;
216
220
  sendTransaction(tx: DirectSignResponse | TxRaw, options: SendTransactionOptions): Promise<TxResponse>;
217
221
  sendEvmTransaction(tx: any, options: {
218
222
  address: AccountAddress;
219
- evmChainId: EvmChainId;
223
+ ethereumChainId: EthereumChainId;
220
224
  }): Promise<string>;
221
225
  signEip712TypedData(eip712TypedData: string, address: AccountAddress): Promise<string>;
222
226
  signAminoCosmosTransaction(transaction: {
@@ -1,7 +1,6 @@
1
1
  import { Wallet } from './../types/enums.js';
2
2
  export const isEvmWallet = (wallet) => [
3
3
  Wallet.Magic,
4
- Wallet.Rabby,
5
4
  Wallet.BitGet,
6
5
  Wallet.Ledger,
7
6
  Wallet.Phantom,
@@ -19,7 +18,6 @@ export const isEvmWallet = (wallet) => [
19
18
  ].includes(wallet);
20
19
  export const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
21
20
  export const isEvmBrowserWallet = (wallet) => [
22
- Wallet.Rabby,
23
21
  Wallet.BitGet,
24
22
  Wallet.Rainbow,
25
23
  Wallet.Phantom,
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.16.2-alpha.1",
4
+ "version": "1.16.2",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -41,10 +41,10 @@
41
41
  }
42
42
  },
43
43
  "scripts": {
44
- "build": "pnpm build:cjs && pnpm build:esm && pnpm build:post",
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 && pnpm build:post",
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,14 +56,14 @@
56
56
  "start": "node dist/index.js"
57
57
  },
58
58
  "dependencies": {
59
- "@injectivelabs/exceptions": "1.16.2-alpha.1",
60
- "@injectivelabs/networks": "1.16.2-alpha.1",
61
- "@injectivelabs/sdk-ts": "1.16.2-alpha.1",
62
- "@injectivelabs/ts-types": "1.16.2-alpha.1",
59
+ "@injectivelabs/exceptions": "^1.16.2",
60
+ "@injectivelabs/networks": "^1.16.2",
61
+ "@injectivelabs/sdk-ts": "^1.16.2",
62
+ "@injectivelabs/ts-types": "^1.16.2",
63
63
  "eip1193-provider": "^1.0.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "shx": "^0.3.3"
67
67
  },
68
- "gitHead": "25f2492ee251504d8b0c1f3e4ce49e96e759294b"
68
+ "gitHead": "56e3f6c8f399c2d881a65858e8e0b1b39828a917"
69
69
  }