@injectivelabs/wallet-base 1.20.16 → 1.20.17
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 +234 -20
- package/dist/cjs/index.d.cts +77 -3
- package/dist/cjs/runtime-light.d.cts +1 -1
- package/dist/cjs/{strategy-4vrShg5z.d.cts → strategy-CjnVi-ci.d.cts} +10 -9
- package/dist/esm/index.d.ts +77 -3
- package/dist/esm/index.js +216 -1
- package/dist/esm/runtime-light.d.ts +1 -1
- package/dist/esm/{strategy-C_dU586T.d.ts → strategy-BGAy7FJw.d.ts} +10 -9
- package/package.json +14 -14
- package/dist/cjs/base-B8XjA7be.d.cts +0 -79
- package/dist/cjs/base-qBbSiPrE.cjs +0 -317
- package/dist/cjs/light.cjs +0 -20
- package/dist/cjs/light.d.cts +0 -3
- package/dist/esm/base-Byi_qk4c.d.ts +0 -79
- package/dist/esm/base-CzyhamIP.js +0 -209
- package/dist/esm/light.d.ts +0 -3
- package/dist/esm/light.js +0 -3
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
const require_index = require('./index.cjs');
|
|
2
|
-
let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
3
|
-
|
|
4
|
-
//#region src/types/events.ts
|
|
5
|
-
const StrategyEventType = {
|
|
6
|
-
ConnectionEnd: "connection-end",
|
|
7
|
-
ConnectionStart: "connection-start",
|
|
8
|
-
WalletSigningEnd: "wallet-signing-end",
|
|
9
|
-
WalletSigningStart: "wallet-signing-start"
|
|
10
|
-
};
|
|
11
|
-
const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
|
|
12
|
-
const WalletStrategyEmitterEventType = {
|
|
13
|
-
TransactionFail: "transaction-fail",
|
|
14
|
-
TransactionSigned: "transaction-signed",
|
|
15
|
-
TransactionSignStart: "transaction-sign-start",
|
|
16
|
-
TransactionBroadcastEnd: "transaction-broadcast-end",
|
|
17
|
-
TransactionBroadcastStart: "transaction-broadcast-start",
|
|
18
|
-
TransactionBroadcastSynced: "transaction-broadcast-synced",
|
|
19
|
-
TransactionPreparationEnd: "transaction-preparation-end",
|
|
20
|
-
TransactionPreparationStart: "transaction-preparation-start",
|
|
21
|
-
WalletStrategyDisconnect: "wallet-strategy-disconnect"
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/types/enums.ts
|
|
26
|
-
const BroadcastMode = {
|
|
27
|
-
Block: "block",
|
|
28
|
-
Sync: "sync",
|
|
29
|
-
Async: "async"
|
|
30
|
-
};
|
|
31
|
-
const Wallet = {
|
|
32
|
-
Leap: "leap",
|
|
33
|
-
Keplr: "keplr",
|
|
34
|
-
Ninji: "ninji",
|
|
35
|
-
Magic: "magic",
|
|
36
|
-
Rabby: "rabby",
|
|
37
|
-
Ledger: "ledger",
|
|
38
|
-
BitGet: "BitGet",
|
|
39
|
-
OWallet: "owallet",
|
|
40
|
-
Phantom: "phantom",
|
|
41
|
-
Rainbow: "rainbow",
|
|
42
|
-
Turnkey: "turnkey",
|
|
43
|
-
Metamask: "metamask",
|
|
44
|
-
KeplrEvm: "keplr-evm",
|
|
45
|
-
OkxWallet: "okx-wallet",
|
|
46
|
-
PrivateKey: "private-key",
|
|
47
|
-
TrustWallet: "trust-wallet",
|
|
48
|
-
TrezorBip32: "trezor-bip32",
|
|
49
|
-
TrezorBip44: "trezor-bip44",
|
|
50
|
-
Cosmostation: "cosmostation",
|
|
51
|
-
LedgerCosmos: "ledger-cosmos",
|
|
52
|
-
LedgerLegacy: "ledger-legacy",
|
|
53
|
-
WalletConnect: "wallet-connect",
|
|
54
|
-
CosmostationEth: "cosmostation-eth",
|
|
55
|
-
PrivateKeyCosmos: "private-key-cosmos"
|
|
56
|
-
};
|
|
57
|
-
const MagicProvider = {
|
|
58
|
-
Email: "email",
|
|
59
|
-
Apple: "apple",
|
|
60
|
-
Github: "github",
|
|
61
|
-
Google: "google",
|
|
62
|
-
Discord: "discord",
|
|
63
|
-
Twitter: "twitter",
|
|
64
|
-
Facebook: "facebook"
|
|
65
|
-
};
|
|
66
|
-
const WalletDeviceType = {
|
|
67
|
-
Mobile: "mobile",
|
|
68
|
-
Other: "other",
|
|
69
|
-
Browser: "browser",
|
|
70
|
-
Hardware: "hardware"
|
|
71
|
-
};
|
|
72
|
-
const WalletEventListener = {
|
|
73
|
-
AccountChange: "account-change",
|
|
74
|
-
ChainIdChange: "chain-id-change"
|
|
75
|
-
};
|
|
76
|
-
const EvmWalletProviderErrorCode = {
|
|
77
|
-
InternalError: -32603,
|
|
78
|
-
UserRejectedRequest: 4001,
|
|
79
|
-
UnrecognizedChain: 4902
|
|
80
|
-
};
|
|
81
|
-
const WalletAction = { ...__injectivelabs_exceptions.WalletErrorActionModule };
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/types/strategy.ts
|
|
85
|
-
const TurnkeyProvider = {
|
|
86
|
-
Sms: "sms",
|
|
87
|
-
Apple: "apple",
|
|
88
|
-
Email: "email",
|
|
89
|
-
Google: "google",
|
|
90
|
-
Twitter: "twitter"
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/utils/wallet.ts
|
|
95
|
-
const isEvmWallet = (wallet) => [
|
|
96
|
-
Wallet.Magic,
|
|
97
|
-
Wallet.Rabby,
|
|
98
|
-
Wallet.BitGet,
|
|
99
|
-
Wallet.Ledger,
|
|
100
|
-
Wallet.Phantom,
|
|
101
|
-
Wallet.Rainbow,
|
|
102
|
-
Wallet.Turnkey,
|
|
103
|
-
Wallet.Metamask,
|
|
104
|
-
Wallet.KeplrEvm,
|
|
105
|
-
Wallet.OkxWallet,
|
|
106
|
-
Wallet.PrivateKey,
|
|
107
|
-
Wallet.TrezorBip32,
|
|
108
|
-
Wallet.TrezorBip44,
|
|
109
|
-
Wallet.TrustWallet,
|
|
110
|
-
Wallet.LedgerLegacy,
|
|
111
|
-
Wallet.WalletConnect,
|
|
112
|
-
Wallet.CosmostationEth
|
|
113
|
-
].includes(wallet);
|
|
114
|
-
const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
|
|
115
|
-
const isEvmBrowserWallet = (wallet) => [
|
|
116
|
-
Wallet.Rabby,
|
|
117
|
-
Wallet.BitGet,
|
|
118
|
-
Wallet.Phantom,
|
|
119
|
-
Wallet.Rainbow,
|
|
120
|
-
Wallet.Metamask,
|
|
121
|
-
Wallet.KeplrEvm,
|
|
122
|
-
Wallet.OkxWallet,
|
|
123
|
-
Wallet.TrustWallet
|
|
124
|
-
].includes(wallet);
|
|
125
|
-
const isCosmosBrowserWallet = (wallet) => [
|
|
126
|
-
Wallet.Leap,
|
|
127
|
-
Wallet.Keplr,
|
|
128
|
-
Wallet.Ninji,
|
|
129
|
-
Wallet.OWallet,
|
|
130
|
-
Wallet.Cosmostation
|
|
131
|
-
].includes(wallet);
|
|
132
|
-
const isEip712V2OnlyWallet = (wallet) => [
|
|
133
|
-
Wallet.Magic,
|
|
134
|
-
Wallet.Phantom,
|
|
135
|
-
Wallet.Metamask,
|
|
136
|
-
Wallet.WalletConnect
|
|
137
|
-
].includes(wallet);
|
|
138
|
-
const isCosmosAminoOnlyWallet = (wallet) => [Wallet.LedgerCosmos].includes(wallet);
|
|
139
|
-
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
|
|
142
|
-
function _typeof(o) {
|
|
143
|
-
"@babel/helpers - typeof";
|
|
144
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
145
|
-
return typeof o$1;
|
|
146
|
-
} : function(o$1) {
|
|
147
|
-
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
148
|
-
}, _typeof(o);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
|
|
153
|
-
function toPrimitive(t, r) {
|
|
154
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
155
|
-
var e = t[Symbol.toPrimitive];
|
|
156
|
-
if (void 0 !== e) {
|
|
157
|
-
var i = e.call(t, r || "default");
|
|
158
|
-
if ("object" != _typeof(i)) return i;
|
|
159
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
160
|
-
}
|
|
161
|
-
return ("string" === r ? String : Number)(t);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
//#endregion
|
|
165
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
|
|
166
|
-
function toPropertyKey(t) {
|
|
167
|
-
var i = toPrimitive(t, "string");
|
|
168
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
|
|
173
|
-
function _defineProperty(e, r, t) {
|
|
174
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
175
|
-
value: t,
|
|
176
|
-
enumerable: !0,
|
|
177
|
-
configurable: !0,
|
|
178
|
-
writable: !0
|
|
179
|
-
}) : e[r] = t, e;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region src/base.ts
|
|
184
|
-
var BaseConcreteStrategy = class {
|
|
185
|
-
constructor(args) {
|
|
186
|
-
_defineProperty(this, "chainId", void 0);
|
|
187
|
-
_defineProperty(this, "evmChainId", void 0);
|
|
188
|
-
_defineProperty(this, "listeners", {});
|
|
189
|
-
_defineProperty(this, "metadata", void 0);
|
|
190
|
-
_defineProperty(this, "emitter", void 0);
|
|
191
|
-
this.evmChainId = "evmOptions" in args && args.evmOptions ? args.evmOptions.evmChainId : void 0;
|
|
192
|
-
this.chainId = args.chainId;
|
|
193
|
-
this.metadata = args.metadata;
|
|
194
|
-
this.emitter = args.emitter;
|
|
195
|
-
}
|
|
196
|
-
setMetadata(metadata) {
|
|
197
|
-
this.metadata = metadata;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Emit an event from this strategy.
|
|
201
|
-
* If emitter was provided from parent, events go directly to parent.
|
|
202
|
-
*/
|
|
203
|
-
emit(event, data) {
|
|
204
|
-
var _this$emitter;
|
|
205
|
-
(_this$emitter = this.emitter) === null || _this$emitter === void 0 || _this$emitter.emit(event, data);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
//#endregion
|
|
210
|
-
Object.defineProperty(exports, 'BaseConcreteStrategy', {
|
|
211
|
-
enumerable: true,
|
|
212
|
-
get: function () {
|
|
213
|
-
return BaseConcreteStrategy;
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(exports, 'BroadcastMode', {
|
|
217
|
-
enumerable: true,
|
|
218
|
-
get: function () {
|
|
219
|
-
return BroadcastMode;
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
Object.defineProperty(exports, 'EvmWalletProviderErrorCode', {
|
|
223
|
-
enumerable: true,
|
|
224
|
-
get: function () {
|
|
225
|
-
return EvmWalletProviderErrorCode;
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
Object.defineProperty(exports, 'MagicProvider', {
|
|
229
|
-
enumerable: true,
|
|
230
|
-
get: function () {
|
|
231
|
-
return MagicProvider;
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
Object.defineProperty(exports, 'StrategyEventType', {
|
|
235
|
-
enumerable: true,
|
|
236
|
-
get: function () {
|
|
237
|
-
return StrategyEventType;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
Object.defineProperty(exports, 'TurnkeyProvider', {
|
|
241
|
-
enumerable: true,
|
|
242
|
-
get: function () {
|
|
243
|
-
return TurnkeyProvider;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
Object.defineProperty(exports, 'Wallet', {
|
|
247
|
-
enumerable: true,
|
|
248
|
-
get: function () {
|
|
249
|
-
return Wallet;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
Object.defineProperty(exports, 'WalletAction', {
|
|
253
|
-
enumerable: true,
|
|
254
|
-
get: function () {
|
|
255
|
-
return WalletAction;
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
Object.defineProperty(exports, 'WalletConnectStrategyEventType', {
|
|
259
|
-
enumerable: true,
|
|
260
|
-
get: function () {
|
|
261
|
-
return WalletConnectStrategyEventType;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
Object.defineProperty(exports, 'WalletDeviceType', {
|
|
265
|
-
enumerable: true,
|
|
266
|
-
get: function () {
|
|
267
|
-
return WalletDeviceType;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
Object.defineProperty(exports, 'WalletEventListener', {
|
|
271
|
-
enumerable: true,
|
|
272
|
-
get: function () {
|
|
273
|
-
return WalletEventListener;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
Object.defineProperty(exports, 'WalletStrategyEmitterEventType', {
|
|
277
|
-
enumerable: true,
|
|
278
|
-
get: function () {
|
|
279
|
-
return WalletStrategyEmitterEventType;
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
Object.defineProperty(exports, 'isCosmosAminoOnlyWallet', {
|
|
283
|
-
enumerable: true,
|
|
284
|
-
get: function () {
|
|
285
|
-
return isCosmosAminoOnlyWallet;
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
Object.defineProperty(exports, 'isCosmosBrowserWallet', {
|
|
289
|
-
enumerable: true,
|
|
290
|
-
get: function () {
|
|
291
|
-
return isCosmosBrowserWallet;
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
Object.defineProperty(exports, 'isCosmosWallet', {
|
|
295
|
-
enumerable: true,
|
|
296
|
-
get: function () {
|
|
297
|
-
return isCosmosWallet;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
Object.defineProperty(exports, 'isEip712V2OnlyWallet', {
|
|
301
|
-
enumerable: true,
|
|
302
|
-
get: function () {
|
|
303
|
-
return isEip712V2OnlyWallet;
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
Object.defineProperty(exports, 'isEvmBrowserWallet', {
|
|
307
|
-
enumerable: true,
|
|
308
|
-
get: function () {
|
|
309
|
-
return isEvmBrowserWallet;
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
Object.defineProperty(exports, 'isEvmWallet', {
|
|
313
|
-
enumerable: true,
|
|
314
|
-
get: function () {
|
|
315
|
-
return isEvmWallet;
|
|
316
|
-
}
|
|
317
|
-
});
|
package/dist/cjs/light.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const require_base = require('./base-qBbSiPrE.cjs');
|
|
2
|
-
|
|
3
|
-
exports.BaseConcreteStrategy = require_base.BaseConcreteStrategy;
|
|
4
|
-
exports.BroadcastMode = require_base.BroadcastMode;
|
|
5
|
-
exports.EvmWalletProviderErrorCode = require_base.EvmWalletProviderErrorCode;
|
|
6
|
-
exports.MagicProvider = require_base.MagicProvider;
|
|
7
|
-
exports.StrategyEventType = require_base.StrategyEventType;
|
|
8
|
-
exports.TurnkeyProvider = require_base.TurnkeyProvider;
|
|
9
|
-
exports.Wallet = require_base.Wallet;
|
|
10
|
-
exports.WalletAction = require_base.WalletAction;
|
|
11
|
-
exports.WalletConnectStrategyEventType = require_base.WalletConnectStrategyEventType;
|
|
12
|
-
exports.WalletDeviceType = require_base.WalletDeviceType;
|
|
13
|
-
exports.WalletEventListener = require_base.WalletEventListener;
|
|
14
|
-
exports.WalletStrategyEmitterEventType = require_base.WalletStrategyEmitterEventType;
|
|
15
|
-
exports.isCosmosAminoOnlyWallet = require_base.isCosmosAminoOnlyWallet;
|
|
16
|
-
exports.isCosmosBrowserWallet = require_base.isCosmosBrowserWallet;
|
|
17
|
-
exports.isCosmosWallet = require_base.isCosmosWallet;
|
|
18
|
-
exports.isEip712V2OnlyWallet = require_base.isEip712V2OnlyWallet;
|
|
19
|
-
exports.isEvmBrowserWallet = require_base.isEvmBrowserWallet;
|
|
20
|
-
exports.isEvmWallet = require_base.isEvmWallet;
|
package/dist/cjs/light.d.cts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { A as WalletDeviceType, C as onAccountChangeCallback, D as MagicProvider, E as EvmWalletProviderErrorCode, F as WalletStrategyEmitterEventType, I as WalletStrategyEmitterEvents, M as StrategyEventType, N as WalletConnectStrategyEventType, O as Wallet, P as WalletStrategyEmitter, S as WalletStrategyEvmOptions, T as BroadcastMode, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, f as StdSignDoc, g as TurnkeyProvider, h as TurnkeyOAuthProvider, i as ConcreteStrategiesArg, j as WalletEventListener, k as WalletAction, l as MagicMetadata, m as TurnkeyMetadata, n as ConcreteCosmosWalletStrategyArgs, o as ConcreteWalletStrategyArgs, p as StrategyEmitter, r as ConcreteEvmWalletStrategyArgs, s as CosmosWalletAbstraction, t as ConcreteCosmosWalletStrategy, u as PrivateKeyMetadata, v as WalletConnectMetadata, w as onChainIdChangeCallback, x as WalletStrategyArguments, y as WalletMetadata } from "./strategy-4vrShg5z.cjs";
|
|
2
|
-
import { a as isEip712V2OnlyWallet, c as BrowserEip1993Provider, d as EIP6963ProviderInfo, f as WindowWithEip1193Provider, i as isCosmosWallet, l as EIP6963AnnounceProviderEvent, n as isCosmosAminoOnlyWallet, o as isEvmBrowserWallet, r as isCosmosBrowserWallet, s as isEvmWallet, t as BaseConcreteStrategy, u as EIP6963ProviderDetail } from "./base-B8XjA7be.cjs";
|
|
3
|
-
export { BaseConcreteStrategy, BroadcastMode, BrowserEip1993Provider, ConcreteCosmosWalletStrategy, ConcreteCosmosWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteStrategiesArg, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, CosmosWalletAbstraction, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, Eip1193Provider, EvmWalletProviderErrorCode, MagicMetadata, MagicProvider, PrivateKeyMetadata, SendTransactionOptions, StdSignDoc, StrategyEmitter, StrategyEventType, TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, TurnkeySession, Wallet, WalletAction, WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletMetadata, WalletStrategy, WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, WalletStrategyEvmOptions, WindowWithEip1193Provider, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, onAccountChangeCallback, onChainIdChangeCallback };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { F as WalletStrategyEmitterEventType, O as Wallet, j as WalletEventListener, n as ConcreteCosmosWalletStrategyArgs, o as ConcreteWalletStrategyArgs, p as StrategyEmitter, r as ConcreteEvmWalletStrategyArgs, y as WalletMetadata } from "./strategy-C_dU586T.js";
|
|
2
|
-
import { ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
|
-
import { EIP1193Provider } from "eip1193-provider";
|
|
4
|
-
|
|
5
|
-
//#region src/types/provider.d.ts
|
|
6
|
-
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
7
|
-
removeAllListeners(): void;
|
|
8
|
-
providers?: BrowserEip1993Provider[];
|
|
9
|
-
isTrust: boolean;
|
|
10
|
-
isKeplr: boolean;
|
|
11
|
-
isRabby: boolean;
|
|
12
|
-
isRainbow: boolean;
|
|
13
|
-
isPhantom: boolean;
|
|
14
|
-
isBitGet?: boolean;
|
|
15
|
-
isBitKeep?: boolean;
|
|
16
|
-
isMetaMask: boolean;
|
|
17
|
-
isOkxWallet: boolean;
|
|
18
|
-
isTrustWallet: boolean;
|
|
19
|
-
}
|
|
20
|
-
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
21
|
-
rainbow: BrowserEip1993Provider;
|
|
22
|
-
rabby: BrowserEip1993Provider;
|
|
23
|
-
ethereum: BrowserEip1993Provider;
|
|
24
|
-
okxwallet: BrowserEip1993Provider;
|
|
25
|
-
providers: BrowserEip1993Provider[];
|
|
26
|
-
trustWallet?: BrowserEip1993Provider;
|
|
27
|
-
bitkeep: {
|
|
28
|
-
ethereum: BrowserEip1993Provider;
|
|
29
|
-
};
|
|
30
|
-
phantom?: {
|
|
31
|
-
ethereum?: BrowserEip1993Provider;
|
|
32
|
-
};
|
|
33
|
-
keplr?: {
|
|
34
|
-
ethereum?: BrowserEip1993Provider;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
interface EIP6963ProviderInfo {
|
|
38
|
-
rdns: string;
|
|
39
|
-
uuid: string;
|
|
40
|
-
name: string;
|
|
41
|
-
icon: string;
|
|
42
|
-
}
|
|
43
|
-
interface EIP6963ProviderDetail {
|
|
44
|
-
info: EIP6963ProviderInfo;
|
|
45
|
-
provider: BrowserEip1993Provider;
|
|
46
|
-
}
|
|
47
|
-
type EIP6963AnnounceProviderEvent = {
|
|
48
|
-
detail: EIP6963ProviderDetail;
|
|
49
|
-
};
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/utils/wallet.d.ts
|
|
52
|
-
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
53
|
-
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
54
|
-
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
55
|
-
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
56
|
-
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
57
|
-
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/base.d.ts
|
|
60
|
-
declare abstract class BaseConcreteStrategy {
|
|
61
|
-
protected chainId: ChainId | CosmosChainId;
|
|
62
|
-
protected evmChainId?: EvmChainId;
|
|
63
|
-
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
64
|
-
metadata?: WalletMetadata;
|
|
65
|
-
/**
|
|
66
|
-
* Optional emitter passed from parent WalletStrategy.
|
|
67
|
-
* When provided, strategies emit events directly on the parent's emitter.
|
|
68
|
-
*/
|
|
69
|
-
protected emitter?: StrategyEmitter;
|
|
70
|
-
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
71
|
-
setMetadata(metadata?: WalletMetadata): void;
|
|
72
|
-
/**
|
|
73
|
-
* Emit an event from this strategy.
|
|
74
|
-
* If emitter was provided from parent, events go directly to parent.
|
|
75
|
-
*/
|
|
76
|
-
protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
export { isEip712V2OnlyWallet as a, BrowserEip1993Provider as c, EIP6963ProviderInfo as d, WindowWithEip1193Provider as f, isCosmosWallet as i, EIP6963AnnounceProviderEvent as l, isCosmosAminoOnlyWallet as n, isEvmBrowserWallet as o, isCosmosBrowserWallet as r, isEvmWallet as s, BaseConcreteStrategy as t, EIP6963ProviderDetail as u };
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { WalletErrorActionModule } from "@injectivelabs/exceptions";
|
|
2
|
-
|
|
3
|
-
//#region src/types/events.ts
|
|
4
|
-
const StrategyEventType = {
|
|
5
|
-
ConnectionEnd: "connection-end",
|
|
6
|
-
ConnectionStart: "connection-start",
|
|
7
|
-
WalletSigningEnd: "wallet-signing-end",
|
|
8
|
-
WalletSigningStart: "wallet-signing-start"
|
|
9
|
-
};
|
|
10
|
-
const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
|
|
11
|
-
const WalletStrategyEmitterEventType = {
|
|
12
|
-
TransactionFail: "transaction-fail",
|
|
13
|
-
TransactionSigned: "transaction-signed",
|
|
14
|
-
TransactionSignStart: "transaction-sign-start",
|
|
15
|
-
TransactionBroadcastEnd: "transaction-broadcast-end",
|
|
16
|
-
TransactionBroadcastStart: "transaction-broadcast-start",
|
|
17
|
-
TransactionBroadcastSynced: "transaction-broadcast-synced",
|
|
18
|
-
TransactionPreparationEnd: "transaction-preparation-end",
|
|
19
|
-
TransactionPreparationStart: "transaction-preparation-start",
|
|
20
|
-
WalletStrategyDisconnect: "wallet-strategy-disconnect"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/types/enums.ts
|
|
25
|
-
const BroadcastMode = {
|
|
26
|
-
Block: "block",
|
|
27
|
-
Sync: "sync",
|
|
28
|
-
Async: "async"
|
|
29
|
-
};
|
|
30
|
-
const Wallet = {
|
|
31
|
-
Leap: "leap",
|
|
32
|
-
Keplr: "keplr",
|
|
33
|
-
Ninji: "ninji",
|
|
34
|
-
Magic: "magic",
|
|
35
|
-
Rabby: "rabby",
|
|
36
|
-
Ledger: "ledger",
|
|
37
|
-
BitGet: "BitGet",
|
|
38
|
-
OWallet: "owallet",
|
|
39
|
-
Phantom: "phantom",
|
|
40
|
-
Rainbow: "rainbow",
|
|
41
|
-
Turnkey: "turnkey",
|
|
42
|
-
Metamask: "metamask",
|
|
43
|
-
KeplrEvm: "keplr-evm",
|
|
44
|
-
OkxWallet: "okx-wallet",
|
|
45
|
-
PrivateKey: "private-key",
|
|
46
|
-
TrustWallet: "trust-wallet",
|
|
47
|
-
TrezorBip32: "trezor-bip32",
|
|
48
|
-
TrezorBip44: "trezor-bip44",
|
|
49
|
-
Cosmostation: "cosmostation",
|
|
50
|
-
LedgerCosmos: "ledger-cosmos",
|
|
51
|
-
LedgerLegacy: "ledger-legacy",
|
|
52
|
-
WalletConnect: "wallet-connect",
|
|
53
|
-
CosmostationEth: "cosmostation-eth",
|
|
54
|
-
PrivateKeyCosmos: "private-key-cosmos"
|
|
55
|
-
};
|
|
56
|
-
const MagicProvider = {
|
|
57
|
-
Email: "email",
|
|
58
|
-
Apple: "apple",
|
|
59
|
-
Github: "github",
|
|
60
|
-
Google: "google",
|
|
61
|
-
Discord: "discord",
|
|
62
|
-
Twitter: "twitter",
|
|
63
|
-
Facebook: "facebook"
|
|
64
|
-
};
|
|
65
|
-
const WalletDeviceType = {
|
|
66
|
-
Mobile: "mobile",
|
|
67
|
-
Other: "other",
|
|
68
|
-
Browser: "browser",
|
|
69
|
-
Hardware: "hardware"
|
|
70
|
-
};
|
|
71
|
-
const WalletEventListener = {
|
|
72
|
-
AccountChange: "account-change",
|
|
73
|
-
ChainIdChange: "chain-id-change"
|
|
74
|
-
};
|
|
75
|
-
const EvmWalletProviderErrorCode = {
|
|
76
|
-
InternalError: -32603,
|
|
77
|
-
UserRejectedRequest: 4001,
|
|
78
|
-
UnrecognizedChain: 4902
|
|
79
|
-
};
|
|
80
|
-
const WalletAction = { ...WalletErrorActionModule };
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/types/strategy.ts
|
|
84
|
-
const TurnkeyProvider = {
|
|
85
|
-
Sms: "sms",
|
|
86
|
-
Apple: "apple",
|
|
87
|
-
Email: "email",
|
|
88
|
-
Google: "google",
|
|
89
|
-
Twitter: "twitter"
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/utils/wallet.ts
|
|
94
|
-
const isEvmWallet = (wallet) => [
|
|
95
|
-
Wallet.Magic,
|
|
96
|
-
Wallet.Rabby,
|
|
97
|
-
Wallet.BitGet,
|
|
98
|
-
Wallet.Ledger,
|
|
99
|
-
Wallet.Phantom,
|
|
100
|
-
Wallet.Rainbow,
|
|
101
|
-
Wallet.Turnkey,
|
|
102
|
-
Wallet.Metamask,
|
|
103
|
-
Wallet.KeplrEvm,
|
|
104
|
-
Wallet.OkxWallet,
|
|
105
|
-
Wallet.PrivateKey,
|
|
106
|
-
Wallet.TrezorBip32,
|
|
107
|
-
Wallet.TrezorBip44,
|
|
108
|
-
Wallet.TrustWallet,
|
|
109
|
-
Wallet.LedgerLegacy,
|
|
110
|
-
Wallet.WalletConnect,
|
|
111
|
-
Wallet.CosmostationEth
|
|
112
|
-
].includes(wallet);
|
|
113
|
-
const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
|
|
114
|
-
const isEvmBrowserWallet = (wallet) => [
|
|
115
|
-
Wallet.Rabby,
|
|
116
|
-
Wallet.BitGet,
|
|
117
|
-
Wallet.Phantom,
|
|
118
|
-
Wallet.Rainbow,
|
|
119
|
-
Wallet.Metamask,
|
|
120
|
-
Wallet.KeplrEvm,
|
|
121
|
-
Wallet.OkxWallet,
|
|
122
|
-
Wallet.TrustWallet
|
|
123
|
-
].includes(wallet);
|
|
124
|
-
const isCosmosBrowserWallet = (wallet) => [
|
|
125
|
-
Wallet.Leap,
|
|
126
|
-
Wallet.Keplr,
|
|
127
|
-
Wallet.Ninji,
|
|
128
|
-
Wallet.OWallet,
|
|
129
|
-
Wallet.Cosmostation
|
|
130
|
-
].includes(wallet);
|
|
131
|
-
const isEip712V2OnlyWallet = (wallet) => [
|
|
132
|
-
Wallet.Magic,
|
|
133
|
-
Wallet.Phantom,
|
|
134
|
-
Wallet.Metamask,
|
|
135
|
-
Wallet.WalletConnect
|
|
136
|
-
].includes(wallet);
|
|
137
|
-
const isCosmosAminoOnlyWallet = (wallet) => [Wallet.LedgerCosmos].includes(wallet);
|
|
138
|
-
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
|
|
141
|
-
function _typeof(o) {
|
|
142
|
-
"@babel/helpers - typeof";
|
|
143
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
144
|
-
return typeof o$1;
|
|
145
|
-
} : function(o$1) {
|
|
146
|
-
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
147
|
-
}, _typeof(o);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
|
|
152
|
-
function toPrimitive(t, r) {
|
|
153
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
154
|
-
var e = t[Symbol.toPrimitive];
|
|
155
|
-
if (void 0 !== e) {
|
|
156
|
-
var i = e.call(t, r || "default");
|
|
157
|
-
if ("object" != _typeof(i)) return i;
|
|
158
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
159
|
-
}
|
|
160
|
-
return ("string" === r ? String : Number)(t);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
|
|
165
|
-
function toPropertyKey(t) {
|
|
166
|
-
var i = toPrimitive(t, "string");
|
|
167
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
|
|
172
|
-
function _defineProperty(e, r, t) {
|
|
173
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
174
|
-
value: t,
|
|
175
|
-
enumerable: !0,
|
|
176
|
-
configurable: !0,
|
|
177
|
-
writable: !0
|
|
178
|
-
}) : e[r] = t, e;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/base.ts
|
|
183
|
-
var BaseConcreteStrategy = class {
|
|
184
|
-
constructor(args) {
|
|
185
|
-
_defineProperty(this, "chainId", void 0);
|
|
186
|
-
_defineProperty(this, "evmChainId", void 0);
|
|
187
|
-
_defineProperty(this, "listeners", {});
|
|
188
|
-
_defineProperty(this, "metadata", void 0);
|
|
189
|
-
_defineProperty(this, "emitter", void 0);
|
|
190
|
-
this.evmChainId = "evmOptions" in args && args.evmOptions ? args.evmOptions.evmChainId : void 0;
|
|
191
|
-
this.chainId = args.chainId;
|
|
192
|
-
this.metadata = args.metadata;
|
|
193
|
-
this.emitter = args.emitter;
|
|
194
|
-
}
|
|
195
|
-
setMetadata(metadata) {
|
|
196
|
-
this.metadata = metadata;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Emit an event from this strategy.
|
|
200
|
-
* If emitter was provided from parent, events go directly to parent.
|
|
201
|
-
*/
|
|
202
|
-
emit(event, data) {
|
|
203
|
-
var _this$emitter;
|
|
204
|
-
(_this$emitter = this.emitter) === null || _this$emitter === void 0 || _this$emitter.emit(event, data);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
//#endregion
|
|
209
|
-
export { WalletConnectStrategyEventType as _, isEip712V2OnlyWallet as a, TurnkeyProvider as c, MagicProvider as d, Wallet as f, StrategyEventType as g, WalletEventListener as h, isCosmosWallet as i, BroadcastMode as l, WalletDeviceType as m, isCosmosAminoOnlyWallet as n, isEvmBrowserWallet as o, WalletAction as p, isCosmosBrowserWallet as r, isEvmWallet as s, BaseConcreteStrategy as t, EvmWalletProviderErrorCode as u, WalletStrategyEmitterEventType as v };
|
package/dist/esm/light.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { A as WalletDeviceType, C as onAccountChangeCallback, D as MagicProvider, E as EvmWalletProviderErrorCode, F as WalletStrategyEmitterEventType, I as WalletStrategyEmitterEvents, M as StrategyEventType, N as WalletConnectStrategyEventType, O as Wallet, P as WalletStrategyEmitter, S as WalletStrategyEvmOptions, T as BroadcastMode, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, f as StdSignDoc, g as TurnkeyProvider, h as TurnkeyOAuthProvider, i as ConcreteStrategiesArg, j as WalletEventListener, k as WalletAction, l as MagicMetadata, m as TurnkeyMetadata, n as ConcreteCosmosWalletStrategyArgs, o as ConcreteWalletStrategyArgs, p as StrategyEmitter, r as ConcreteEvmWalletStrategyArgs, s as CosmosWalletAbstraction, t as ConcreteCosmosWalletStrategy, u as PrivateKeyMetadata, v as WalletConnectMetadata, w as onChainIdChangeCallback, x as WalletStrategyArguments, y as WalletMetadata } from "./strategy-C_dU586T.js";
|
|
2
|
-
import { a as isEip712V2OnlyWallet, c as BrowserEip1993Provider, d as EIP6963ProviderInfo, f as WindowWithEip1193Provider, i as isCosmosWallet, l as EIP6963AnnounceProviderEvent, n as isCosmosAminoOnlyWallet, o as isEvmBrowserWallet, r as isCosmosBrowserWallet, s as isEvmWallet, t as BaseConcreteStrategy, u as EIP6963ProviderDetail } from "./base-Byi_qk4c.js";
|
|
3
|
-
export { BaseConcreteStrategy, BroadcastMode, BrowserEip1993Provider, ConcreteCosmosWalletStrategy, ConcreteCosmosWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteStrategiesArg, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, CosmosWalletAbstraction, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, Eip1193Provider, EvmWalletProviderErrorCode, MagicMetadata, MagicProvider, PrivateKeyMetadata, SendTransactionOptions, StdSignDoc, StrategyEmitter, StrategyEventType, TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, TurnkeySession, Wallet, WalletAction, WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletMetadata, WalletStrategy, WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, WalletStrategyEvmOptions, WindowWithEip1193Provider, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, onAccountChangeCallback, onChainIdChangeCallback };
|
package/dist/esm/light.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { _ as WalletConnectStrategyEventType, a as isEip712V2OnlyWallet, c as TurnkeyProvider, d as MagicProvider, f as Wallet, g as StrategyEventType, h as WalletEventListener, i as isCosmosWallet, l as BroadcastMode, m as WalletDeviceType, n as isCosmosAminoOnlyWallet, o as isEvmBrowserWallet, p as WalletAction, r as isCosmosBrowserWallet, s as isEvmWallet, t as BaseConcreteStrategy, u as EvmWalletProviderErrorCode, v as WalletStrategyEmitterEventType } from "./base-CzyhamIP.js";
|
|
2
|
-
|
|
3
|
-
export { BaseConcreteStrategy, BroadcastMode, EvmWalletProviderErrorCode, MagicProvider, StrategyEventType, TurnkeyProvider, Wallet, WalletAction, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletStrategyEmitterEventType, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet };
|