@injectivelabs/wallet-base 1.20.16 → 1.20.18
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
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_base = require('./base-qBbSiPrE.cjs');
|
|
29
28
|
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
30
29
|
let viem_chains = require("viem/chains");
|
|
31
30
|
viem_chains = __toESM(viem_chains);
|
|
@@ -34,6 +33,106 @@ let viem = require("viem");
|
|
|
34
33
|
let __injectivelabs_sdk_ts_proto_cosmos_tx = require("@injectivelabs/sdk-ts/proto/cosmos-tx");
|
|
35
34
|
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
36
35
|
|
|
36
|
+
//#region src/types/events.ts
|
|
37
|
+
const StrategyEventType = {
|
|
38
|
+
ConnectionEnd: "connection-end",
|
|
39
|
+
ConnectionStart: "connection-start",
|
|
40
|
+
WalletSigningEnd: "wallet-signing-end",
|
|
41
|
+
WalletSigningStart: "wallet-signing-start"
|
|
42
|
+
};
|
|
43
|
+
const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
|
|
44
|
+
const WalletStrategyEmitterEventType = {
|
|
45
|
+
TransactionFail: "transaction-fail",
|
|
46
|
+
TransactionSigned: "transaction-signed",
|
|
47
|
+
TransactionSignStart: "transaction-sign-start",
|
|
48
|
+
TransactionBroadcastEnd: "transaction-broadcast-end",
|
|
49
|
+
TransactionBroadcastStart: "transaction-broadcast-start",
|
|
50
|
+
TransactionBroadcastSynced: "transaction-broadcast-synced",
|
|
51
|
+
TransactionPreparationEnd: "transaction-preparation-end",
|
|
52
|
+
TransactionPreparationStart: "transaction-preparation-start",
|
|
53
|
+
WalletStrategyDisconnect: "wallet-strategy-disconnect"
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/types/enums.ts
|
|
58
|
+
const BroadcastMode = {
|
|
59
|
+
Block: "block",
|
|
60
|
+
Sync: "sync",
|
|
61
|
+
Async: "async"
|
|
62
|
+
};
|
|
63
|
+
const Wallet = {
|
|
64
|
+
Leap: "leap",
|
|
65
|
+
Keplr: "keplr",
|
|
66
|
+
Ninji: "ninji",
|
|
67
|
+
Magic: "magic",
|
|
68
|
+
Rabby: "rabby",
|
|
69
|
+
Ledger: "ledger",
|
|
70
|
+
BitGet: "BitGet",
|
|
71
|
+
OWallet: "owallet",
|
|
72
|
+
Phantom: "phantom",
|
|
73
|
+
Rainbow: "rainbow",
|
|
74
|
+
Turnkey: "turnkey",
|
|
75
|
+
Metamask: "metamask",
|
|
76
|
+
KeplrEvm: "keplr-evm",
|
|
77
|
+
OkxWallet: "okx-wallet",
|
|
78
|
+
PrivateKey: "private-key",
|
|
79
|
+
TrustWallet: "trust-wallet",
|
|
80
|
+
TrezorBip32: "trezor-bip32",
|
|
81
|
+
TrezorBip44: "trezor-bip44",
|
|
82
|
+
Cosmostation: "cosmostation",
|
|
83
|
+
LedgerCosmos: "ledger-cosmos",
|
|
84
|
+
LedgerLegacy: "ledger-legacy",
|
|
85
|
+
WalletConnect: "wallet-connect",
|
|
86
|
+
CosmostationEth: "cosmostation-eth",
|
|
87
|
+
PrivateKeyCosmos: "private-key-cosmos"
|
|
88
|
+
};
|
|
89
|
+
const MagicProvider = {
|
|
90
|
+
Email: "email",
|
|
91
|
+
Apple: "apple",
|
|
92
|
+
Github: "github",
|
|
93
|
+
Google: "google",
|
|
94
|
+
Discord: "discord",
|
|
95
|
+
Twitter: "twitter",
|
|
96
|
+
Facebook: "facebook"
|
|
97
|
+
};
|
|
98
|
+
const WalletDeviceType = {
|
|
99
|
+
Mobile: "mobile",
|
|
100
|
+
Other: "other",
|
|
101
|
+
Browser: "browser",
|
|
102
|
+
Hardware: "hardware"
|
|
103
|
+
};
|
|
104
|
+
const WalletEventListener = {
|
|
105
|
+
AccountChange: "account-change",
|
|
106
|
+
ChainIdChange: "chain-id-change"
|
|
107
|
+
};
|
|
108
|
+
const EvmWalletProviderErrorCode = {
|
|
109
|
+
InternalError: -32603,
|
|
110
|
+
UserRejectedRequest: 4001,
|
|
111
|
+
UnrecognizedChain: 4902
|
|
112
|
+
};
|
|
113
|
+
const WalletAction = {
|
|
114
|
+
GetChainId: "get-chain-id",
|
|
115
|
+
GetAccounts: "get-accounts",
|
|
116
|
+
GetNetworkId: "get-network-id",
|
|
117
|
+
SignArbitrary: "sign-arbitrary",
|
|
118
|
+
SignTransaction: "sign-transaction",
|
|
119
|
+
SendTransaction: "send-transaction",
|
|
120
|
+
SendEvmTransaction: "send-evm-transaction",
|
|
121
|
+
SignEvmTransaction: "sign-evm-transaction",
|
|
122
|
+
GetEvmTransactionReceipt: "get-evm-transaction-receipt"
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/types/strategy.ts
|
|
127
|
+
const TurnkeyProvider = {
|
|
128
|
+
Sms: "sms",
|
|
129
|
+
Apple: "apple",
|
|
130
|
+
Email: "email",
|
|
131
|
+
Google: "google",
|
|
132
|
+
Twitter: "twitter"
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
37
136
|
//#region src/utils/tx.ts
|
|
38
137
|
const createEip712StdSignDoc = ({ memo, chainId, accountNumber, timeoutHeight, sequence, gas, msgs }) => ({
|
|
39
138
|
chain_id: chainId,
|
|
@@ -114,6 +213,53 @@ const getViemPublicClientFromEip1193Provider = (chainId, provider) => {
|
|
|
114
213
|
});
|
|
115
214
|
};
|
|
116
215
|
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/utils/wallet.ts
|
|
218
|
+
const isEvmWallet = (wallet) => [
|
|
219
|
+
Wallet.Magic,
|
|
220
|
+
Wallet.Rabby,
|
|
221
|
+
Wallet.BitGet,
|
|
222
|
+
Wallet.Ledger,
|
|
223
|
+
Wallet.Phantom,
|
|
224
|
+
Wallet.Rainbow,
|
|
225
|
+
Wallet.Turnkey,
|
|
226
|
+
Wallet.Metamask,
|
|
227
|
+
Wallet.KeplrEvm,
|
|
228
|
+
Wallet.OkxWallet,
|
|
229
|
+
Wallet.PrivateKey,
|
|
230
|
+
Wallet.TrezorBip32,
|
|
231
|
+
Wallet.TrezorBip44,
|
|
232
|
+
Wallet.TrustWallet,
|
|
233
|
+
Wallet.LedgerLegacy,
|
|
234
|
+
Wallet.WalletConnect,
|
|
235
|
+
Wallet.CosmostationEth
|
|
236
|
+
].includes(wallet);
|
|
237
|
+
const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
|
|
238
|
+
const isEvmBrowserWallet = (wallet) => [
|
|
239
|
+
Wallet.Rabby,
|
|
240
|
+
Wallet.BitGet,
|
|
241
|
+
Wallet.Phantom,
|
|
242
|
+
Wallet.Rainbow,
|
|
243
|
+
Wallet.Metamask,
|
|
244
|
+
Wallet.KeplrEvm,
|
|
245
|
+
Wallet.OkxWallet,
|
|
246
|
+
Wallet.TrustWallet
|
|
247
|
+
].includes(wallet);
|
|
248
|
+
const isCosmosBrowserWallet = (wallet) => [
|
|
249
|
+
Wallet.Leap,
|
|
250
|
+
Wallet.Keplr,
|
|
251
|
+
Wallet.Ninji,
|
|
252
|
+
Wallet.OWallet,
|
|
253
|
+
Wallet.Cosmostation
|
|
254
|
+
].includes(wallet);
|
|
255
|
+
const isEip712V2OnlyWallet = (wallet) => [
|
|
256
|
+
Wallet.Magic,
|
|
257
|
+
Wallet.Phantom,
|
|
258
|
+
Wallet.Metamask,
|
|
259
|
+
Wallet.WalletConnect
|
|
260
|
+
].includes(wallet);
|
|
261
|
+
const isCosmosAminoOnlyWallet = (wallet) => [Wallet.LedgerCosmos].includes(wallet);
|
|
262
|
+
|
|
117
263
|
//#endregion
|
|
118
264
|
//#region src/utils/cosmos.ts
|
|
119
265
|
const createCosmosSignDocFromSignDoc = (signDoc) => {
|
|
@@ -149,24 +295,92 @@ const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
|
149
295
|
const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
150
296
|
|
|
151
297
|
//#endregion
|
|
152
|
-
|
|
153
|
-
|
|
298
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
|
|
299
|
+
function _typeof(o) {
|
|
300
|
+
"@babel/helpers - typeof";
|
|
301
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
302
|
+
return typeof o$1;
|
|
303
|
+
} : function(o$1) {
|
|
304
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
305
|
+
}, _typeof(o);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
|
|
310
|
+
function toPrimitive(t, r) {
|
|
311
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
312
|
+
var e = t[Symbol.toPrimitive];
|
|
313
|
+
if (void 0 !== e) {
|
|
314
|
+
var i = e.call(t, r || "default");
|
|
315
|
+
if ("object" != _typeof(i)) return i;
|
|
316
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
317
|
+
}
|
|
318
|
+
return ("string" === r ? String : Number)(t);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
|
|
323
|
+
function toPropertyKey(t) {
|
|
324
|
+
var i = toPrimitive(t, "string");
|
|
325
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
|
|
330
|
+
function _defineProperty(e, r, t) {
|
|
331
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
332
|
+
value: t,
|
|
333
|
+
enumerable: !0,
|
|
334
|
+
configurable: !0,
|
|
335
|
+
writable: !0
|
|
336
|
+
}) : e[r] = t, e;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/base.ts
|
|
341
|
+
var BaseConcreteStrategy = class {
|
|
342
|
+
constructor(args) {
|
|
343
|
+
_defineProperty(this, "chainId", void 0);
|
|
344
|
+
_defineProperty(this, "evmChainId", void 0);
|
|
345
|
+
_defineProperty(this, "listeners", {});
|
|
346
|
+
_defineProperty(this, "metadata", void 0);
|
|
347
|
+
_defineProperty(this, "emitter", void 0);
|
|
348
|
+
this.evmChainId = "evmOptions" in args && args.evmOptions ? args.evmOptions.evmChainId : void 0;
|
|
349
|
+
this.chainId = args.chainId;
|
|
350
|
+
this.metadata = args.metadata;
|
|
351
|
+
this.emitter = args.emitter;
|
|
352
|
+
}
|
|
353
|
+
setMetadata(metadata) {
|
|
354
|
+
this.metadata = metadata;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Emit an event from this strategy.
|
|
358
|
+
* If emitter was provided from parent, events go directly to parent.
|
|
359
|
+
*/
|
|
360
|
+
emit(event, data) {
|
|
361
|
+
var _this$emitter;
|
|
362
|
+
(_this$emitter = this.emitter) === null || _this$emitter === void 0 || _this$emitter.emit(event, data);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
//#endregion
|
|
367
|
+
exports.BaseConcreteStrategy = BaseConcreteStrategy;
|
|
368
|
+
exports.BroadcastMode = BroadcastMode;
|
|
154
369
|
exports.DEFAULT_ADDRESS_SEARCH_LIMIT = DEFAULT_ADDRESS_SEARCH_LIMIT;
|
|
155
370
|
exports.DEFAULT_BASE_DERIVATION_PATH = DEFAULT_BASE_DERIVATION_PATH;
|
|
156
371
|
exports.DEFAULT_NUM_ADDRESSES_TO_FETCH = DEFAULT_NUM_ADDRESSES_TO_FETCH;
|
|
157
|
-
exports.EvmWalletProviderErrorCode =
|
|
372
|
+
exports.EvmWalletProviderErrorCode = EvmWalletProviderErrorCode;
|
|
158
373
|
exports.GWEI_IN_WEI = GWEI_IN_WEI;
|
|
159
|
-
exports.MagicProvider =
|
|
160
|
-
exports.StrategyEventType =
|
|
374
|
+
exports.MagicProvider = MagicProvider;
|
|
375
|
+
exports.StrategyEventType = StrategyEventType;
|
|
161
376
|
exports.TIP_IN_GWEI = TIP_IN_GWEI;
|
|
162
|
-
exports.TurnkeyProvider =
|
|
163
|
-
exports.Wallet =
|
|
164
|
-
exports.WalletAction =
|
|
165
|
-
exports.WalletConnectStrategyEventType =
|
|
166
|
-
exports.WalletDeviceType =
|
|
167
|
-
exports.WalletEventListener =
|
|
168
|
-
exports.WalletStrategyEmitterEventType =
|
|
169
|
-
exports.__toESM = __toESM;
|
|
377
|
+
exports.TurnkeyProvider = TurnkeyProvider;
|
|
378
|
+
exports.Wallet = Wallet;
|
|
379
|
+
exports.WalletAction = WalletAction;
|
|
380
|
+
exports.WalletConnectStrategyEventType = WalletConnectStrategyEventType;
|
|
381
|
+
exports.WalletDeviceType = WalletDeviceType;
|
|
382
|
+
exports.WalletEventListener = WalletEventListener;
|
|
383
|
+
exports.WalletStrategyEmitterEventType = WalletStrategyEmitterEventType;
|
|
170
384
|
exports.createCosmosSignDocFromSignDoc = createCosmosSignDocFromSignDoc;
|
|
171
385
|
exports.createEip712StdSignDoc = createEip712StdSignDoc;
|
|
172
386
|
exports.getEthereumSignerAddress = getEthereumSignerAddress;
|
|
@@ -175,9 +389,9 @@ exports.getInjectiveSignerAddress = getInjectiveSignerAddress;
|
|
|
175
389
|
exports.getViemPublicClient = getViemPublicClient;
|
|
176
390
|
exports.getViemPublicClientFromEip1193Provider = getViemPublicClientFromEip1193Provider;
|
|
177
391
|
exports.getViemWalletClient = getViemWalletClient;
|
|
178
|
-
exports.isCosmosAminoOnlyWallet =
|
|
179
|
-
exports.isCosmosBrowserWallet =
|
|
180
|
-
exports.isCosmosWallet =
|
|
181
|
-
exports.isEip712V2OnlyWallet =
|
|
182
|
-
exports.isEvmBrowserWallet =
|
|
183
|
-
exports.isEvmWallet =
|
|
392
|
+
exports.isCosmosAminoOnlyWallet = isCosmosAminoOnlyWallet;
|
|
393
|
+
exports.isCosmosBrowserWallet = isCosmosBrowserWallet;
|
|
394
|
+
exports.isCosmosWallet = isCosmosWallet;
|
|
395
|
+
exports.isEip712V2OnlyWallet = isEip712V2OnlyWallet;
|
|
396
|
+
exports.isEvmBrowserWallet = isEvmBrowserWallet;
|
|
397
|
+
exports.isEvmWallet = isEvmWallet;
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,11 +1,57 @@
|
|
|
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-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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-CjnVi-ci.cjs";
|
|
2
|
+
import { ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
|
+
import { EIP1193Provider } from "eip1193-provider";
|
|
4
4
|
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
5
5
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
|
6
6
|
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts/proto/cosmos-tx";
|
|
7
7
|
import { BigNumber } from "@injectivelabs/utils";
|
|
8
8
|
|
|
9
|
+
//#region src/types/provider.d.ts
|
|
10
|
+
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
11
|
+
removeAllListeners(): void;
|
|
12
|
+
providers?: BrowserEip1993Provider[];
|
|
13
|
+
isTrust: boolean;
|
|
14
|
+
isKeplr: boolean;
|
|
15
|
+
isRabby: boolean;
|
|
16
|
+
isRainbow: boolean;
|
|
17
|
+
isPhantom: boolean;
|
|
18
|
+
isBitGet?: boolean;
|
|
19
|
+
isBitKeep?: boolean;
|
|
20
|
+
isMetaMask: boolean;
|
|
21
|
+
isOkxWallet: boolean;
|
|
22
|
+
isTrustWallet: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
25
|
+
rainbow: BrowserEip1993Provider;
|
|
26
|
+
rabby: BrowserEip1993Provider;
|
|
27
|
+
ethereum: BrowserEip1993Provider;
|
|
28
|
+
okxwallet: BrowserEip1993Provider;
|
|
29
|
+
providers: BrowserEip1993Provider[];
|
|
30
|
+
trustWallet?: BrowserEip1993Provider;
|
|
31
|
+
bitkeep: {
|
|
32
|
+
ethereum: BrowserEip1993Provider;
|
|
33
|
+
};
|
|
34
|
+
phantom?: {
|
|
35
|
+
ethereum?: BrowserEip1993Provider;
|
|
36
|
+
};
|
|
37
|
+
keplr?: {
|
|
38
|
+
ethereum?: BrowserEip1993Provider;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface EIP6963ProviderInfo {
|
|
42
|
+
rdns: string;
|
|
43
|
+
uuid: string;
|
|
44
|
+
name: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
}
|
|
47
|
+
interface EIP6963ProviderDetail {
|
|
48
|
+
info: EIP6963ProviderInfo;
|
|
49
|
+
provider: BrowserEip1993Provider;
|
|
50
|
+
}
|
|
51
|
+
type EIP6963AnnounceProviderEvent = {
|
|
52
|
+
detail: EIP6963ProviderDetail;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
9
55
|
//#region src/utils/tx.d.ts
|
|
10
56
|
declare const createEip712StdSignDoc: ({
|
|
11
57
|
memo,
|
|
@@ -59,6 +105,14 @@ declare const getViemWalletClient: ({
|
|
|
59
105
|
}) => WalletClient;
|
|
60
106
|
declare const getViemPublicClientFromEip1193Provider: (chainId: EvmChainId | number, provider: BrowserEip1993Provider) => PublicClient;
|
|
61
107
|
//#endregion
|
|
108
|
+
//#region src/utils/wallet.d.ts
|
|
109
|
+
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
110
|
+
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
111
|
+
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
112
|
+
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
113
|
+
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
114
|
+
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
115
|
+
//#endregion
|
|
62
116
|
//#region src/utils/cosmos.d.ts
|
|
63
117
|
declare const createCosmosSignDocFromSignDoc: (signDoc: CosmosTxV1Beta1TxPb.SignDoc) => any;
|
|
64
118
|
//#endregion
|
|
@@ -73,4 +127,24 @@ declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
|
73
127
|
declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
74
128
|
declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
75
129
|
//#endregion
|
|
130
|
+
//#region src/base.d.ts
|
|
131
|
+
declare abstract class BaseConcreteStrategy {
|
|
132
|
+
protected chainId: ChainId | CosmosChainId;
|
|
133
|
+
protected evmChainId?: EvmChainId;
|
|
134
|
+
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
135
|
+
metadata?: WalletMetadata;
|
|
136
|
+
/**
|
|
137
|
+
* Optional emitter passed from parent WalletStrategy.
|
|
138
|
+
* When provided, strategies emit events directly on the parent's emitter.
|
|
139
|
+
*/
|
|
140
|
+
protected emitter?: StrategyEmitter;
|
|
141
|
+
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
142
|
+
setMetadata(metadata?: WalletMetadata): void;
|
|
143
|
+
/**
|
|
144
|
+
* Emit an event from this strategy.
|
|
145
|
+
* If emitter was provided from parent, events go directly to parent.
|
|
146
|
+
*/
|
|
147
|
+
protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
76
150
|
export { BaseConcreteStrategy, BroadcastMode, BrowserEip1993Provider, ConcreteCosmosWalletStrategy, ConcreteCosmosWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteStrategiesArg, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, Eip1193Provider, EvmWalletProviderErrorCode, GWEI_IN_WEI, MagicMetadata, MagicProvider, PrivateKeyMetadata, SendTransactionOptions, StdSignDoc, StrategyEmitter, StrategyEventType, TIP_IN_GWEI, TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, TurnkeySession, Wallet, WalletAction, WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletMetadata, WalletStrategy, WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, WalletStrategyEvmOptions, WindowWithEip1193Provider, createCosmosSignDocFromSignDoc, createEip712StdSignDoc, getEthereumSignerAddress, getEvmChainConfig, getInjectiveSignerAddress, getViemPublicClient, getViemPublicClientFromEip1193Provider, getViemWalletClient, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, onAccountChangeCallback, onChainIdChangeCallback };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as onAccountChangeCallback, S as WalletStrategyEvmOptions, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, i as ConcreteStrategiesArg, 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-
|
|
1
|
+
import { C as onAccountChangeCallback, S as WalletStrategyEvmOptions, _ as TurnkeySession, a as ConcreteWalletStrategy, b as WalletStrategy, c as Eip1193Provider, d as SendTransactionOptions, i as ConcreteStrategiesArg, 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-CjnVi-ci.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime-light.d.ts
|
|
4
4
|
declare const BroadcastMode: {
|
|
@@ -97,16 +97,17 @@ declare const EvmWalletProviderErrorCode: {
|
|
|
97
97
|
};
|
|
98
98
|
type EvmWalletProviderErrorCode = (typeof EvmWalletProviderErrorCode)[keyof typeof EvmWalletProviderErrorCode];
|
|
99
99
|
declare const WalletAction: {
|
|
100
|
-
GetChainId: "get-chain-id";
|
|
101
|
-
GetAccounts: "get-accounts";
|
|
102
|
-
GetNetworkId: "get-network-id";
|
|
103
|
-
SignArbitrary: "sign-arbitrary";
|
|
104
|
-
SignTransaction: "sign-transaction";
|
|
105
|
-
SendTransaction: "send-transaction";
|
|
106
|
-
SendEvmTransaction: "send-evm-transaction";
|
|
107
|
-
SignEvmTransaction: "sign-evm-transaction";
|
|
108
|
-
GetEvmTransactionReceipt: "get-evm-transaction-receipt";
|
|
100
|
+
readonly GetChainId: "get-chain-id";
|
|
101
|
+
readonly GetAccounts: "get-accounts";
|
|
102
|
+
readonly GetNetworkId: "get-network-id";
|
|
103
|
+
readonly SignArbitrary: "sign-arbitrary";
|
|
104
|
+
readonly SignTransaction: "sign-transaction";
|
|
105
|
+
readonly SendTransaction: "send-transaction";
|
|
106
|
+
readonly SendEvmTransaction: "send-evm-transaction";
|
|
107
|
+
readonly SignEvmTransaction: "sign-evm-transaction";
|
|
108
|
+
readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
|
|
109
109
|
};
|
|
110
|
+
type WalletAction = (typeof WalletAction)[keyof typeof WalletAction];
|
|
110
111
|
//#endregion
|
|
111
112
|
//#region src/types/strategy.d.ts
|
|
112
113
|
interface StrategyEmitter {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,11 +1,57 @@
|
|
|
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-
|
|
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";
|
|
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-BGAy7FJw.js";
|
|
3
2
|
import { BigNumber } from "@injectivelabs/utils";
|
|
4
|
-
import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
|
+
import { ChainId, CosmosChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
5
4
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
|
6
5
|
import { CosmosTxV1Beta1TxPb } from "@injectivelabs/sdk-ts/proto/cosmos-tx";
|
|
6
|
+
import { EIP1193Provider } from "eip1193-provider";
|
|
7
7
|
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
8
8
|
|
|
9
|
+
//#region src/types/provider.d.ts
|
|
10
|
+
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
11
|
+
removeAllListeners(): void;
|
|
12
|
+
providers?: BrowserEip1993Provider[];
|
|
13
|
+
isTrust: boolean;
|
|
14
|
+
isKeplr: boolean;
|
|
15
|
+
isRabby: boolean;
|
|
16
|
+
isRainbow: boolean;
|
|
17
|
+
isPhantom: boolean;
|
|
18
|
+
isBitGet?: boolean;
|
|
19
|
+
isBitKeep?: boolean;
|
|
20
|
+
isMetaMask: boolean;
|
|
21
|
+
isOkxWallet: boolean;
|
|
22
|
+
isTrustWallet: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
25
|
+
rainbow: BrowserEip1993Provider;
|
|
26
|
+
rabby: BrowserEip1993Provider;
|
|
27
|
+
ethereum: BrowserEip1993Provider;
|
|
28
|
+
okxwallet: BrowserEip1993Provider;
|
|
29
|
+
providers: BrowserEip1993Provider[];
|
|
30
|
+
trustWallet?: BrowserEip1993Provider;
|
|
31
|
+
bitkeep: {
|
|
32
|
+
ethereum: BrowserEip1993Provider;
|
|
33
|
+
};
|
|
34
|
+
phantom?: {
|
|
35
|
+
ethereum?: BrowserEip1993Provider;
|
|
36
|
+
};
|
|
37
|
+
keplr?: {
|
|
38
|
+
ethereum?: BrowserEip1993Provider;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface EIP6963ProviderInfo {
|
|
42
|
+
rdns: string;
|
|
43
|
+
uuid: string;
|
|
44
|
+
name: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
}
|
|
47
|
+
interface EIP6963ProviderDetail {
|
|
48
|
+
info: EIP6963ProviderInfo;
|
|
49
|
+
provider: BrowserEip1993Provider;
|
|
50
|
+
}
|
|
51
|
+
type EIP6963AnnounceProviderEvent = {
|
|
52
|
+
detail: EIP6963ProviderDetail;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
9
55
|
//#region src/utils/tx.d.ts
|
|
10
56
|
declare const createEip712StdSignDoc: ({
|
|
11
57
|
memo,
|
|
@@ -59,6 +105,14 @@ declare const getViemWalletClient: ({
|
|
|
59
105
|
}) => WalletClient;
|
|
60
106
|
declare const getViemPublicClientFromEip1193Provider: (chainId: EvmChainId | number, provider: BrowserEip1993Provider) => PublicClient;
|
|
61
107
|
//#endregion
|
|
108
|
+
//#region src/utils/wallet.d.ts
|
|
109
|
+
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
110
|
+
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
111
|
+
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
112
|
+
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
113
|
+
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
114
|
+
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
115
|
+
//#endregion
|
|
62
116
|
//#region src/utils/cosmos.d.ts
|
|
63
117
|
declare const createCosmosSignDocFromSignDoc: (signDoc: CosmosTxV1Beta1TxPb.SignDoc) => any;
|
|
64
118
|
//#endregion
|
|
@@ -73,4 +127,24 @@ declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
|
73
127
|
declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
74
128
|
declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
75
129
|
//#endregion
|
|
130
|
+
//#region src/base.d.ts
|
|
131
|
+
declare abstract class BaseConcreteStrategy {
|
|
132
|
+
protected chainId: ChainId | CosmosChainId;
|
|
133
|
+
protected evmChainId?: EvmChainId;
|
|
134
|
+
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
135
|
+
metadata?: WalletMetadata;
|
|
136
|
+
/**
|
|
137
|
+
* Optional emitter passed from parent WalletStrategy.
|
|
138
|
+
* When provided, strategies emit events directly on the parent's emitter.
|
|
139
|
+
*/
|
|
140
|
+
protected emitter?: StrategyEmitter;
|
|
141
|
+
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
142
|
+
setMetadata(metadata?: WalletMetadata): void;
|
|
143
|
+
/**
|
|
144
|
+
* Emit an event from this strategy.
|
|
145
|
+
* If emitter was provided from parent, events go directly to parent.
|
|
146
|
+
*/
|
|
147
|
+
protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
76
150
|
export { BaseConcreteStrategy, BroadcastMode, BrowserEip1993Provider, ConcreteCosmosWalletStrategy, ConcreteCosmosWalletStrategyArgs, ConcreteEvmWalletStrategyArgs, ConcreteStrategiesArg, ConcreteWalletStrategy, ConcreteWalletStrategyArgs, CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, Eip1193Provider, EvmWalletProviderErrorCode, GWEI_IN_WEI, MagicMetadata, MagicProvider, PrivateKeyMetadata, SendTransactionOptions, StdSignDoc, StrategyEmitter, StrategyEventType, TIP_IN_GWEI, TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, TurnkeySession, Wallet, WalletAction, WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletMetadata, WalletStrategy, WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, WalletStrategyEvmOptions, WindowWithEip1193Provider, createCosmosSignDocFromSignDoc, createEip712StdSignDoc, getEthereumSignerAddress, getEvmChainConfig, getInjectiveSignerAddress, getViemPublicClient, getViemPublicClientFromEip1193Provider, getViemWalletClient, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, onAccountChangeCallback, onChainIdChangeCallback };
|