@injectivelabs/wallet-strategy 1.17.2-alpha.4 → 1.17.2-alpha.5
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/index.cjs +16 -7
- package/dist/esm/index.js +16 -7
- package/package.json +27 -22
package/dist/cjs/index.cjs
CHANGED
|
@@ -107,7 +107,7 @@ const ethereumWalletsDisabled = (args) => {
|
|
|
107
107
|
if (!evmChainId) return true;
|
|
108
108
|
return false;
|
|
109
109
|
};
|
|
110
|
-
const createStrategy = async ({ args, wallet }) => {
|
|
110
|
+
const createStrategy = async ({ args, wallet, emitter }) => {
|
|
111
111
|
/**
|
|
112
112
|
* If we only want to use Cosmos Native Wallets
|
|
113
113
|
* We are not creating strategies for Ethereum Native Wallets
|
|
@@ -119,7 +119,12 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
119
119
|
const ethWalletArgs = {
|
|
120
120
|
...args,
|
|
121
121
|
chainId: args.chainId,
|
|
122
|
-
evmOptions: args.evmOptions
|
|
122
|
+
evmOptions: args.evmOptions,
|
|
123
|
+
emitter
|
|
124
|
+
};
|
|
125
|
+
const cosmosWalletArgs = {
|
|
126
|
+
...args,
|
|
127
|
+
emitter
|
|
123
128
|
};
|
|
124
129
|
switch (wallet) {
|
|
125
130
|
case __injectivelabs_wallet_base.Wallet.Metamask:
|
|
@@ -137,7 +142,7 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
137
142
|
case __injectivelabs_wallet_base.Wallet.Ninji:
|
|
138
143
|
case __injectivelabs_wallet_base.Wallet.OWallet:
|
|
139
144
|
case __injectivelabs_wallet_base.Wallet.Cosmostation: return new (await (loadCosmosStrategy()))({
|
|
140
|
-
...
|
|
145
|
+
...cosmosWalletArgs,
|
|
141
146
|
wallet
|
|
142
147
|
});
|
|
143
148
|
case __injectivelabs_wallet_base.Wallet.Ledger: {
|
|
@@ -164,7 +169,7 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
164
169
|
case __injectivelabs_wallet_base.Wallet.Magic:
|
|
165
170
|
var _args$metadata2, _args$metadata3;
|
|
166
171
|
if (!((_args$metadata2 = args.metadata) === null || _args$metadata2 === void 0 || (_args$metadata2 = _args$metadata2.magic) === null || _args$metadata2 === void 0 ? void 0 : _args$metadata2.apiKey) || !((_args$metadata3 = args.metadata) === null || _args$metadata3 === void 0 || (_args$metadata3 = _args$metadata3.magic) === null || _args$metadata3 === void 0 ? void 0 : _args$metadata3.rpcEndpoint)) return;
|
|
167
|
-
return new (await (loadMagicStrategy()))(
|
|
172
|
+
return new (await (loadMagicStrategy()))(cosmosWalletArgs);
|
|
168
173
|
case __injectivelabs_wallet_base.Wallet.WalletConnect:
|
|
169
174
|
var _args$metadata4;
|
|
170
175
|
if (!((_args$metadata4 = args.metadata) === null || _args$metadata4 === void 0 || (_args$metadata4 = _args$metadata4.walletConnect) === null || _args$metadata4 === void 0 ? void 0 : _args$metadata4.projectId)) return;
|
|
@@ -189,8 +194,10 @@ var WalletStrategy = class extends __injectivelabs_wallet_core.BaseWalletStrateg
|
|
|
189
194
|
* @throws GeneralException if the wallet strategy cannot be loaded
|
|
190
195
|
*/
|
|
191
196
|
async setWallet(wallet) {
|
|
197
|
+
var _strategy$initStrateg;
|
|
192
198
|
this.wallet = wallet;
|
|
193
|
-
await this.loadStrategy(wallet);
|
|
199
|
+
const strategy = await this.loadStrategy(wallet);
|
|
200
|
+
await (strategy === null || strategy === void 0 || (_strategy$initStrateg = strategy.initStrategy) === null || _strategy$initStrateg === void 0 ? void 0 : _strategy$initStrateg.call(strategy));
|
|
194
201
|
}
|
|
195
202
|
/**
|
|
196
203
|
* This method is used to set the metadata for the wallet strategies.
|
|
@@ -226,7 +233,8 @@ var WalletStrategy = class extends __injectivelabs_wallet_core.BaseWalletStrateg
|
|
|
226
233
|
...metadata
|
|
227
234
|
}
|
|
228
235
|
},
|
|
229
|
-
wallet: walletEnum
|
|
236
|
+
wallet: walletEnum,
|
|
237
|
+
emitter: this.getEmitter()
|
|
230
238
|
});
|
|
231
239
|
continue;
|
|
232
240
|
}
|
|
@@ -258,7 +266,8 @@ var WalletStrategy = class extends __injectivelabs_wallet_core.BaseWalletStrateg
|
|
|
258
266
|
if (existingLoad) return existingLoad;
|
|
259
267
|
const loadPromise = createStrategy({
|
|
260
268
|
args: this.args,
|
|
261
|
-
wallet
|
|
269
|
+
wallet,
|
|
270
|
+
emitter: this.getEmitter()
|
|
262
271
|
});
|
|
263
272
|
this.loadingStrategies.set(wallet, loadPromise);
|
|
264
273
|
try {
|
package/dist/esm/index.js
CHANGED
|
@@ -107,7 +107,7 @@ const ethereumWalletsDisabled = (args) => {
|
|
|
107
107
|
if (!evmChainId) return true;
|
|
108
108
|
return false;
|
|
109
109
|
};
|
|
110
|
-
const createStrategy = async ({ args, wallet }) => {
|
|
110
|
+
const createStrategy = async ({ args, wallet, emitter }) => {
|
|
111
111
|
/**
|
|
112
112
|
* If we only want to use Cosmos Native Wallets
|
|
113
113
|
* We are not creating strategies for Ethereum Native Wallets
|
|
@@ -119,7 +119,12 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
119
119
|
const ethWalletArgs = {
|
|
120
120
|
...args,
|
|
121
121
|
chainId: args.chainId,
|
|
122
|
-
evmOptions: args.evmOptions
|
|
122
|
+
evmOptions: args.evmOptions,
|
|
123
|
+
emitter
|
|
124
|
+
};
|
|
125
|
+
const cosmosWalletArgs = {
|
|
126
|
+
...args,
|
|
127
|
+
emitter
|
|
123
128
|
};
|
|
124
129
|
switch (wallet) {
|
|
125
130
|
case Wallet.Metamask:
|
|
@@ -137,7 +142,7 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
137
142
|
case Wallet.Ninji:
|
|
138
143
|
case Wallet.OWallet:
|
|
139
144
|
case Wallet.Cosmostation: return new (await (loadCosmosStrategy()))({
|
|
140
|
-
...
|
|
145
|
+
...cosmosWalletArgs,
|
|
141
146
|
wallet
|
|
142
147
|
});
|
|
143
148
|
case Wallet.Ledger: {
|
|
@@ -164,7 +169,7 @@ const createStrategy = async ({ args, wallet }) => {
|
|
|
164
169
|
case Wallet.Magic:
|
|
165
170
|
var _args$metadata2, _args$metadata3;
|
|
166
171
|
if (!((_args$metadata2 = args.metadata) === null || _args$metadata2 === void 0 || (_args$metadata2 = _args$metadata2.magic) === null || _args$metadata2 === void 0 ? void 0 : _args$metadata2.apiKey) || !((_args$metadata3 = args.metadata) === null || _args$metadata3 === void 0 || (_args$metadata3 = _args$metadata3.magic) === null || _args$metadata3 === void 0 ? void 0 : _args$metadata3.rpcEndpoint)) return;
|
|
167
|
-
return new (await (loadMagicStrategy()))(
|
|
172
|
+
return new (await (loadMagicStrategy()))(cosmosWalletArgs);
|
|
168
173
|
case Wallet.WalletConnect:
|
|
169
174
|
var _args$metadata4;
|
|
170
175
|
if (!((_args$metadata4 = args.metadata) === null || _args$metadata4 === void 0 || (_args$metadata4 = _args$metadata4.walletConnect) === null || _args$metadata4 === void 0 ? void 0 : _args$metadata4.projectId)) return;
|
|
@@ -189,8 +194,10 @@ var WalletStrategy = class extends BaseWalletStrategy {
|
|
|
189
194
|
* @throws GeneralException if the wallet strategy cannot be loaded
|
|
190
195
|
*/
|
|
191
196
|
async setWallet(wallet) {
|
|
197
|
+
var _strategy$initStrateg;
|
|
192
198
|
this.wallet = wallet;
|
|
193
|
-
await this.loadStrategy(wallet);
|
|
199
|
+
const strategy = await this.loadStrategy(wallet);
|
|
200
|
+
await (strategy === null || strategy === void 0 || (_strategy$initStrateg = strategy.initStrategy) === null || _strategy$initStrateg === void 0 ? void 0 : _strategy$initStrateg.call(strategy));
|
|
194
201
|
}
|
|
195
202
|
/**
|
|
196
203
|
* This method is used to set the metadata for the wallet strategies.
|
|
@@ -226,7 +233,8 @@ var WalletStrategy = class extends BaseWalletStrategy {
|
|
|
226
233
|
...metadata
|
|
227
234
|
}
|
|
228
235
|
},
|
|
229
|
-
wallet: walletEnum
|
|
236
|
+
wallet: walletEnum,
|
|
237
|
+
emitter: this.getEmitter()
|
|
230
238
|
});
|
|
231
239
|
continue;
|
|
232
240
|
}
|
|
@@ -258,7 +266,8 @@ var WalletStrategy = class extends BaseWalletStrategy {
|
|
|
258
266
|
if (existingLoad) return existingLoad;
|
|
259
267
|
const loadPromise = createStrategy({
|
|
260
268
|
args: this.args,
|
|
261
|
-
wallet
|
|
269
|
+
wallet,
|
|
270
|
+
emitter: this.getEmitter()
|
|
262
271
|
});
|
|
263
272
|
this.loadingStrategies.set(wallet, loadPromise);
|
|
264
273
|
try {
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-strategy",
|
|
3
|
-
"version": "1.17.2-alpha.
|
|
3
|
+
"version": "1.17.2-alpha.5",
|
|
4
4
|
"description": "Wallet strategy with instantiated wallets",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "InjectiveLabs",
|
|
8
8
|
"email": "admin@injectivelabs.org"
|
|
9
9
|
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/InjectiveLabs/injective-ts"
|
|
13
|
+
},
|
|
10
14
|
"type": "module",
|
|
11
15
|
"sideEffects": false,
|
|
12
16
|
"exports": {
|
|
@@ -37,25 +41,6 @@
|
|
|
37
41
|
"files": [
|
|
38
42
|
"dist"
|
|
39
43
|
],
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@injectivelabs/exceptions": "1.17.2-alpha.4",
|
|
42
|
-
"@injectivelabs/wallet-core": "1.17.2-alpha.4",
|
|
43
|
-
"@injectivelabs/wallet-evm": "1.17.2-alpha.4",
|
|
44
|
-
"@injectivelabs/wallet-cosmos": "1.17.2-alpha.4",
|
|
45
|
-
"@injectivelabs/wallet-private-key": "1.17.2-alpha.4",
|
|
46
|
-
"@injectivelabs/wallet-ledger": "1.17.2-alpha.4",
|
|
47
|
-
"@injectivelabs/wallet-base": "1.17.2-alpha.4",
|
|
48
|
-
"@injectivelabs/wallet-magic": "1.17.2-alpha.4",
|
|
49
|
-
"@injectivelabs/wallet-turnkey": "1.17.2-alpha.4",
|
|
50
|
-
"@injectivelabs/wallet-trezor": "1.17.2-alpha.4",
|
|
51
|
-
"@injectivelabs/wallet-wallet-connect": "1.17.2-alpha.4"
|
|
52
|
-
},
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
},
|
|
56
|
-
"_moduleAliases": {
|
|
57
|
-
"~wallet-strategy": "dist"
|
|
58
|
-
},
|
|
59
44
|
"scripts": {
|
|
60
45
|
"build": "pnpm type-check && tsdown",
|
|
61
46
|
"build:fast": "tsdown",
|
|
@@ -70,5 +55,25 @@
|
|
|
70
55
|
"dev": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
71
56
|
"start": "node dist/index.js",
|
|
72
57
|
"lint": "eslint . --ext .ts,.js"
|
|
73
|
-
}
|
|
74
|
-
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@injectivelabs/exceptions": "1.17.2-alpha.5",
|
|
61
|
+
"@injectivelabs/wallet-base": "1.17.2-alpha.5",
|
|
62
|
+
"@injectivelabs/wallet-core": "1.17.2-alpha.5",
|
|
63
|
+
"@injectivelabs/wallet-cosmos": "1.17.2-alpha.5",
|
|
64
|
+
"@injectivelabs/wallet-evm": "1.17.2-alpha.5",
|
|
65
|
+
"@injectivelabs/wallet-ledger": "1.17.2-alpha.5",
|
|
66
|
+
"@injectivelabs/wallet-magic": "1.17.2-alpha.5",
|
|
67
|
+
"@injectivelabs/wallet-private-key": "1.17.2-alpha.5",
|
|
68
|
+
"@injectivelabs/wallet-trezor": "1.17.2-alpha.5",
|
|
69
|
+
"@injectivelabs/wallet-turnkey": "1.17.2-alpha.5",
|
|
70
|
+
"@injectivelabs/wallet-wallet-connect": "1.17.2-alpha.5"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"_moduleAliases": {
|
|
76
|
+
"~wallet-strategy": "dist"
|
|
77
|
+
},
|
|
78
|
+
"gitHead": "2c4676388410f2e4557b3ba2846c912f52c57224"
|
|
79
|
+
}
|