@injectivelabs/wallet-strategy 1.17.2-alpha.1 → 1.17.2-alpha.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.
@@ -2,6 +2,61 @@ let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
2
2
  let __injectivelabs_wallet_core = require("@injectivelabs/wallet-core");
3
3
  let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
4
4
 
5
+ //#region src/strategy/loaders.ts
6
+ let cachedEvmStrategy = null;
7
+ let cachedCosmosStrategy = null;
8
+ let cachedLedgerStrategies = null;
9
+ let cachedTrezorStrategies = null;
10
+ let cachedPrivateKeyStrategy = null;
11
+ let cachedTurnkeyStrategy = null;
12
+ let cachedMagicStrategy = null;
13
+ let cachedWalletConnectStrategy = null;
14
+ const loadEvmStrategy = async () => {
15
+ if (!cachedEvmStrategy) cachedEvmStrategy = (await import("@injectivelabs/wallet-evm")).EvmWalletStrategy;
16
+ return cachedEvmStrategy;
17
+ };
18
+ const loadCosmosStrategy = async () => {
19
+ if (!cachedCosmosStrategy) cachedCosmosStrategy = (await import("@injectivelabs/wallet-cosmos")).CosmosWalletStrategy;
20
+ return cachedCosmosStrategy;
21
+ };
22
+ const loadLedgerStrategies = async () => {
23
+ if (!cachedLedgerStrategies) {
24
+ const m = await import("@injectivelabs/wallet-ledger");
25
+ cachedLedgerStrategies = {
26
+ LedgerLiveStrategy: m.LedgerLiveStrategy,
27
+ LedgerLegacyStrategy: m.LedgerLegacyStrategy
28
+ };
29
+ }
30
+ return cachedLedgerStrategies;
31
+ };
32
+ const loadTrezorStrategies = async () => {
33
+ if (!cachedTrezorStrategies) {
34
+ const m = await import("@injectivelabs/wallet-trezor");
35
+ cachedTrezorStrategies = {
36
+ TrezorBip32Strategy: m.TrezorBip32Strategy,
37
+ TrezorBip44Strategy: m.TrezorBip44Strategy
38
+ };
39
+ }
40
+ return cachedTrezorStrategies;
41
+ };
42
+ const loadPrivateKeyStrategy = async () => {
43
+ if (!cachedPrivateKeyStrategy) cachedPrivateKeyStrategy = (await import("@injectivelabs/wallet-private-key")).PrivateKeyWalletStrategy;
44
+ return cachedPrivateKeyStrategy;
45
+ };
46
+ const loadTurnkeyStrategy = async () => {
47
+ if (!cachedTurnkeyStrategy) cachedTurnkeyStrategy = (await import("@injectivelabs/wallet-turnkey")).TurnkeyWalletStrategy;
48
+ return cachedTurnkeyStrategy;
49
+ };
50
+ const loadMagicStrategy = async () => {
51
+ if (!cachedMagicStrategy) cachedMagicStrategy = (await import("@injectivelabs/wallet-magic")).MagicStrategy;
52
+ return cachedMagicStrategy;
53
+ };
54
+ const loadWalletConnectStrategy = async () => {
55
+ if (!cachedWalletConnectStrategy) cachedWalletConnectStrategy = (await import("@injectivelabs/wallet-wallet-connect")).WalletConnectStrategy;
56
+ return cachedWalletConnectStrategy;
57
+ };
58
+
59
+ //#endregion
5
60
  //#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
6
61
  function _typeof(o) {
7
62
  "@babel/helpers - typeof";
@@ -45,21 +100,6 @@ function _defineProperty(e, r, t) {
45
100
 
46
101
  //#endregion
47
102
  //#region src/strategy/index.ts
48
- const loadEvmStrategy = () => import("@injectivelabs/wallet-evm").then((m) => m.EvmWalletStrategy);
49
- const loadCosmosStrategy = () => import("@injectivelabs/wallet-cosmos").then((m) => m.CosmosWalletStrategy);
50
- const loadCosmostationStrategy = () => import("@injectivelabs/wallet-cosmostation").then((m) => m.CosmostationWalletStrategy);
51
- const loadLedgerStrategies = () => import("@injectivelabs/wallet-ledger").then((m) => ({
52
- LedgerLiveStrategy: m.LedgerLiveStrategy,
53
- LedgerLegacyStrategy: m.LedgerLegacyStrategy
54
- }));
55
- const loadTrezorStrategies = () => import("@injectivelabs/wallet-trezor").then((m) => ({
56
- TrezorBip32Strategy: m.TrezorBip32Strategy,
57
- TrezorBip44Strategy: m.TrezorBip44Strategy
58
- }));
59
- const loadPrivateKeyStrategy = () => import("@injectivelabs/wallet-private-key").then((m) => m.PrivateKeyWalletStrategy);
60
- const loadTurnkeyStrategy = () => import("@injectivelabs/wallet-turnkey").then((m) => m.TurnkeyWalletStrategy);
61
- const loadMagicStrategy = () => import("@injectivelabs/wallet-magic").then((m) => m.MagicStrategy);
62
- const loadWalletConnectStrategy = () => import("@injectivelabs/wallet-wallet-connect").then((m) => m.WalletConnectStrategy);
63
103
  const ethereumWalletsDisabled = (args) => {
64
104
  const { evmOptions } = args;
65
105
  if (!evmOptions) return true;
@@ -95,11 +135,11 @@ const createStrategy = async ({ args, wallet }) => {
95
135
  case __injectivelabs_wallet_base.Wallet.Keplr:
96
136
  case __injectivelabs_wallet_base.Wallet.Leap:
97
137
  case __injectivelabs_wallet_base.Wallet.Ninji:
98
- case __injectivelabs_wallet_base.Wallet.OWallet: return new (await (loadCosmosStrategy()))({
138
+ case __injectivelabs_wallet_base.Wallet.OWallet:
139
+ case __injectivelabs_wallet_base.Wallet.Cosmostation: return new (await (loadCosmosStrategy()))({
99
140
  ...args,
100
141
  wallet
101
142
  });
102
- case __injectivelabs_wallet_base.Wallet.Cosmostation: return new (await (loadCosmostationStrategy()))({ ...args });
103
143
  case __injectivelabs_wallet_base.Wallet.Ledger: {
104
144
  const { LedgerLiveStrategy } = await loadLedgerStrategies();
105
145
  return new LedgerLiveStrategy(ethWalletArgs);
package/dist/esm/index.js CHANGED
@@ -2,6 +2,61 @@ import { GeneralException } from "@injectivelabs/exceptions";
2
2
  import { BaseWalletStrategy } from "@injectivelabs/wallet-core";
3
3
  import { Wallet, isEvmWallet } from "@injectivelabs/wallet-base";
4
4
 
5
+ //#region src/strategy/loaders.ts
6
+ let cachedEvmStrategy = null;
7
+ let cachedCosmosStrategy = null;
8
+ let cachedLedgerStrategies = null;
9
+ let cachedTrezorStrategies = null;
10
+ let cachedPrivateKeyStrategy = null;
11
+ let cachedTurnkeyStrategy = null;
12
+ let cachedMagicStrategy = null;
13
+ let cachedWalletConnectStrategy = null;
14
+ const loadEvmStrategy = async () => {
15
+ if (!cachedEvmStrategy) cachedEvmStrategy = (await import("@injectivelabs/wallet-evm")).EvmWalletStrategy;
16
+ return cachedEvmStrategy;
17
+ };
18
+ const loadCosmosStrategy = async () => {
19
+ if (!cachedCosmosStrategy) cachedCosmosStrategy = (await import("@injectivelabs/wallet-cosmos")).CosmosWalletStrategy;
20
+ return cachedCosmosStrategy;
21
+ };
22
+ const loadLedgerStrategies = async () => {
23
+ if (!cachedLedgerStrategies) {
24
+ const m = await import("@injectivelabs/wallet-ledger");
25
+ cachedLedgerStrategies = {
26
+ LedgerLiveStrategy: m.LedgerLiveStrategy,
27
+ LedgerLegacyStrategy: m.LedgerLegacyStrategy
28
+ };
29
+ }
30
+ return cachedLedgerStrategies;
31
+ };
32
+ const loadTrezorStrategies = async () => {
33
+ if (!cachedTrezorStrategies) {
34
+ const m = await import("@injectivelabs/wallet-trezor");
35
+ cachedTrezorStrategies = {
36
+ TrezorBip32Strategy: m.TrezorBip32Strategy,
37
+ TrezorBip44Strategy: m.TrezorBip44Strategy
38
+ };
39
+ }
40
+ return cachedTrezorStrategies;
41
+ };
42
+ const loadPrivateKeyStrategy = async () => {
43
+ if (!cachedPrivateKeyStrategy) cachedPrivateKeyStrategy = (await import("@injectivelabs/wallet-private-key")).PrivateKeyWalletStrategy;
44
+ return cachedPrivateKeyStrategy;
45
+ };
46
+ const loadTurnkeyStrategy = async () => {
47
+ if (!cachedTurnkeyStrategy) cachedTurnkeyStrategy = (await import("@injectivelabs/wallet-turnkey")).TurnkeyWalletStrategy;
48
+ return cachedTurnkeyStrategy;
49
+ };
50
+ const loadMagicStrategy = async () => {
51
+ if (!cachedMagicStrategy) cachedMagicStrategy = (await import("@injectivelabs/wallet-magic")).MagicStrategy;
52
+ return cachedMagicStrategy;
53
+ };
54
+ const loadWalletConnectStrategy = async () => {
55
+ if (!cachedWalletConnectStrategy) cachedWalletConnectStrategy = (await import("@injectivelabs/wallet-wallet-connect")).WalletConnectStrategy;
56
+ return cachedWalletConnectStrategy;
57
+ };
58
+
59
+ //#endregion
5
60
  //#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
6
61
  function _typeof(o) {
7
62
  "@babel/helpers - typeof";
@@ -45,21 +100,6 @@ function _defineProperty(e, r, t) {
45
100
 
46
101
  //#endregion
47
102
  //#region src/strategy/index.ts
48
- const loadEvmStrategy = () => import("@injectivelabs/wallet-evm").then((m) => m.EvmWalletStrategy);
49
- const loadCosmosStrategy = () => import("@injectivelabs/wallet-cosmos").then((m) => m.CosmosWalletStrategy);
50
- const loadCosmostationStrategy = () => import("@injectivelabs/wallet-cosmostation").then((m) => m.CosmostationWalletStrategy);
51
- const loadLedgerStrategies = () => import("@injectivelabs/wallet-ledger").then((m) => ({
52
- LedgerLiveStrategy: m.LedgerLiveStrategy,
53
- LedgerLegacyStrategy: m.LedgerLegacyStrategy
54
- }));
55
- const loadTrezorStrategies = () => import("@injectivelabs/wallet-trezor").then((m) => ({
56
- TrezorBip32Strategy: m.TrezorBip32Strategy,
57
- TrezorBip44Strategy: m.TrezorBip44Strategy
58
- }));
59
- const loadPrivateKeyStrategy = () => import("@injectivelabs/wallet-private-key").then((m) => m.PrivateKeyWalletStrategy);
60
- const loadTurnkeyStrategy = () => import("@injectivelabs/wallet-turnkey").then((m) => m.TurnkeyWalletStrategy);
61
- const loadMagicStrategy = () => import("@injectivelabs/wallet-magic").then((m) => m.MagicStrategy);
62
- const loadWalletConnectStrategy = () => import("@injectivelabs/wallet-wallet-connect").then((m) => m.WalletConnectStrategy);
63
103
  const ethereumWalletsDisabled = (args) => {
64
104
  const { evmOptions } = args;
65
105
  if (!evmOptions) return true;
@@ -95,11 +135,11 @@ const createStrategy = async ({ args, wallet }) => {
95
135
  case Wallet.Keplr:
96
136
  case Wallet.Leap:
97
137
  case Wallet.Ninji:
98
- case Wallet.OWallet: return new (await (loadCosmosStrategy()))({
138
+ case Wallet.OWallet:
139
+ case Wallet.Cosmostation: return new (await (loadCosmosStrategy()))({
99
140
  ...args,
100
141
  wallet
101
142
  });
102
- case Wallet.Cosmostation: return new (await (loadCosmostationStrategy()))({ ...args });
103
143
  case Wallet.Ledger: {
104
144
  const { LedgerLiveStrategy } = await loadLedgerStrategies();
105
145
  return new LedgerLiveStrategy(ethWalletArgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-strategy",
3
- "version": "1.17.2-alpha.1",
3
+ "version": "1.17.2-alpha.3",
4
4
  "description": "Wallet strategy with instantiated wallets",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -38,18 +38,17 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "@injectivelabs/wallet-core": "1.17.2-alpha.1",
42
- "@injectivelabs/wallet-base": "1.17.2-alpha.1",
43
- "@injectivelabs/wallet-cosmostation": "1.17.2-alpha.1",
44
- "@injectivelabs/exceptions": "1.17.2-alpha.1",
45
- "@injectivelabs/wallet-evm": "1.17.2-alpha.1",
46
- "@injectivelabs/wallet-cosmos": "1.17.2-alpha.1",
47
- "@injectivelabs/wallet-ledger": "1.17.2-alpha.1",
48
- "@injectivelabs/wallet-magic": "1.17.2-alpha.1",
49
- "@injectivelabs/wallet-private-key": "1.17.2-alpha.1",
50
- "@injectivelabs/wallet-wallet-connect": "1.17.2-alpha.1",
51
- "@injectivelabs/wallet-turnkey": "1.17.2-alpha.1",
52
- "@injectivelabs/wallet-trezor": "1.17.2-alpha.1"
41
+ "@injectivelabs/exceptions": "1.17.2-alpha.3",
42
+ "@injectivelabs/wallet-base": "1.17.2-alpha.3",
43
+ "@injectivelabs/wallet-core": "1.17.2-alpha.3",
44
+ "@injectivelabs/wallet-cosmos": "1.17.2-alpha.3",
45
+ "@injectivelabs/wallet-evm": "1.17.2-alpha.3",
46
+ "@injectivelabs/wallet-ledger": "1.17.2-alpha.3",
47
+ "@injectivelabs/wallet-magic": "1.17.2-alpha.3",
48
+ "@injectivelabs/wallet-private-key": "1.17.2-alpha.3",
49
+ "@injectivelabs/wallet-turnkey": "1.17.2-alpha.3",
50
+ "@injectivelabs/wallet-trezor": "1.17.2-alpha.3",
51
+ "@injectivelabs/wallet-wallet-connect": "1.17.2-alpha.3"
53
52
  },
54
53
  "publishConfig": {
55
54
  "access": "public"