@injectivelabs/wallet-base 1.20.15 → 1.20.16
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/base-B8XjA7be.d.cts +79 -0
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/light.d.cts +2 -1
- package/dist/cjs/runtime-light.cjs +166 -0
- package/dist/cjs/runtime-light.d.cts +175 -0
- package/dist/cjs/{base-jZTVPFxY.d.cts → strategy-4vrShg5z.d.cts} +2 -77
- package/dist/esm/base-Byi_qk4c.d.ts +79 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/light.d.ts +2 -1
- package/dist/esm/light.js +1 -1
- package/dist/esm/runtime-light.d.ts +175 -0
- package/dist/esm/runtime-light.js +146 -0
- package/dist/esm/{base-CBGzsBZK.d.ts → strategy-C_dU586T.d.ts} +2 -77
- package/package.json +24 -4
- /package/dist/esm/{base-peAgOWO4.js → base-CzyhamIP.js} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
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-4vrShg5z.cjs";
|
|
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 };
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
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";
|
|
2
3
|
import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
3
4
|
import { Msgs } from "@injectivelabs/sdk-ts/core/modules";
|
|
4
5
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
package/dist/cjs/light.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
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";
|
|
2
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 };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/runtime-light.ts
|
|
3
|
+
const BroadcastMode = {
|
|
4
|
+
Block: "block",
|
|
5
|
+
Sync: "sync",
|
|
6
|
+
Async: "async"
|
|
7
|
+
};
|
|
8
|
+
const Wallet = {
|
|
9
|
+
Leap: "leap",
|
|
10
|
+
Keplr: "keplr",
|
|
11
|
+
Ninji: "ninji",
|
|
12
|
+
Magic: "magic",
|
|
13
|
+
Rabby: "rabby",
|
|
14
|
+
Ledger: "ledger",
|
|
15
|
+
BitGet: "BitGet",
|
|
16
|
+
OWallet: "owallet",
|
|
17
|
+
Phantom: "phantom",
|
|
18
|
+
Rainbow: "rainbow",
|
|
19
|
+
Turnkey: "turnkey",
|
|
20
|
+
Metamask: "metamask",
|
|
21
|
+
KeplrEvm: "keplr-evm",
|
|
22
|
+
OkxWallet: "okx-wallet",
|
|
23
|
+
PrivateKey: "private-key",
|
|
24
|
+
TrustWallet: "trust-wallet",
|
|
25
|
+
TrezorBip32: "trezor-bip32",
|
|
26
|
+
TrezorBip44: "trezor-bip44",
|
|
27
|
+
Cosmostation: "cosmostation",
|
|
28
|
+
LedgerCosmos: "ledger-cosmos",
|
|
29
|
+
LedgerLegacy: "ledger-legacy",
|
|
30
|
+
WalletConnect: "wallet-connect",
|
|
31
|
+
CosmostationEth: "cosmostation-eth",
|
|
32
|
+
PrivateKeyCosmos: "private-key-cosmos"
|
|
33
|
+
};
|
|
34
|
+
const MagicProvider = {
|
|
35
|
+
Email: "email",
|
|
36
|
+
Apple: "apple",
|
|
37
|
+
Github: "github",
|
|
38
|
+
Google: "google",
|
|
39
|
+
Discord: "discord",
|
|
40
|
+
Twitter: "twitter",
|
|
41
|
+
Facebook: "facebook"
|
|
42
|
+
};
|
|
43
|
+
const WalletDeviceType = {
|
|
44
|
+
Mobile: "mobile",
|
|
45
|
+
Other: "other",
|
|
46
|
+
Browser: "browser",
|
|
47
|
+
Hardware: "hardware"
|
|
48
|
+
};
|
|
49
|
+
const WalletEventListener = {
|
|
50
|
+
AccountChange: "account-change",
|
|
51
|
+
ChainIdChange: "chain-id-change"
|
|
52
|
+
};
|
|
53
|
+
const EvmWalletProviderErrorCode = {
|
|
54
|
+
InternalError: -32603,
|
|
55
|
+
UserRejectedRequest: 4001,
|
|
56
|
+
UnrecognizedChain: 4902
|
|
57
|
+
};
|
|
58
|
+
const WalletAction = {
|
|
59
|
+
GetChainId: "get-chain-id",
|
|
60
|
+
GetAccounts: "get-accounts",
|
|
61
|
+
GetNetworkId: "get-network-id",
|
|
62
|
+
SignArbitrary: "sign-arbitrary",
|
|
63
|
+
SignTransaction: "sign-transaction",
|
|
64
|
+
SendTransaction: "send-transaction",
|
|
65
|
+
SendEvmTransaction: "send-evm-transaction",
|
|
66
|
+
SignEvmTransaction: "sign-evm-transaction",
|
|
67
|
+
GetEvmTransactionReceipt: "get-evm-transaction-receipt"
|
|
68
|
+
};
|
|
69
|
+
const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
70
|
+
const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
71
|
+
const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
72
|
+
const TurnkeyProvider = {
|
|
73
|
+
Sms: "sms",
|
|
74
|
+
Apple: "apple",
|
|
75
|
+
Email: "email",
|
|
76
|
+
Google: "google",
|
|
77
|
+
Twitter: "twitter"
|
|
78
|
+
};
|
|
79
|
+
const StrategyEventType = {
|
|
80
|
+
ConnectionEnd: "connection-end",
|
|
81
|
+
ConnectionStart: "connection-start",
|
|
82
|
+
WalletSigningEnd: "wallet-signing-end",
|
|
83
|
+
WalletSigningStart: "wallet-signing-start"
|
|
84
|
+
};
|
|
85
|
+
const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
|
|
86
|
+
const WalletStrategyEmitterEventType = {
|
|
87
|
+
TransactionFail: "transaction-fail",
|
|
88
|
+
TransactionSigned: "transaction-signed",
|
|
89
|
+
TransactionSignStart: "transaction-sign-start",
|
|
90
|
+
TransactionBroadcastEnd: "transaction-broadcast-end",
|
|
91
|
+
TransactionBroadcastStart: "transaction-broadcast-start",
|
|
92
|
+
TransactionBroadcastSynced: "transaction-broadcast-synced",
|
|
93
|
+
TransactionPreparationEnd: "transaction-preparation-end",
|
|
94
|
+
TransactionPreparationStart: "transaction-preparation-start",
|
|
95
|
+
WalletStrategyDisconnect: "wallet-strategy-disconnect"
|
|
96
|
+
};
|
|
97
|
+
const evmWallets = [
|
|
98
|
+
Wallet.Magic,
|
|
99
|
+
Wallet.Rabby,
|
|
100
|
+
Wallet.BitGet,
|
|
101
|
+
Wallet.Ledger,
|
|
102
|
+
Wallet.Phantom,
|
|
103
|
+
Wallet.Rainbow,
|
|
104
|
+
Wallet.Turnkey,
|
|
105
|
+
Wallet.Metamask,
|
|
106
|
+
Wallet.KeplrEvm,
|
|
107
|
+
Wallet.OkxWallet,
|
|
108
|
+
Wallet.PrivateKey,
|
|
109
|
+
Wallet.TrezorBip32,
|
|
110
|
+
Wallet.TrezorBip44,
|
|
111
|
+
Wallet.TrustWallet,
|
|
112
|
+
Wallet.LedgerLegacy,
|
|
113
|
+
Wallet.WalletConnect,
|
|
114
|
+
Wallet.CosmostationEth
|
|
115
|
+
];
|
|
116
|
+
const evmBrowserWallets = [
|
|
117
|
+
Wallet.Rabby,
|
|
118
|
+
Wallet.BitGet,
|
|
119
|
+
Wallet.Phantom,
|
|
120
|
+
Wallet.Rainbow,
|
|
121
|
+
Wallet.Metamask,
|
|
122
|
+
Wallet.KeplrEvm,
|
|
123
|
+
Wallet.OkxWallet,
|
|
124
|
+
Wallet.TrustWallet
|
|
125
|
+
];
|
|
126
|
+
const cosmosBrowserWallets = [
|
|
127
|
+
Wallet.Leap,
|
|
128
|
+
Wallet.Keplr,
|
|
129
|
+
Wallet.Ninji,
|
|
130
|
+
Wallet.OWallet,
|
|
131
|
+
Wallet.Cosmostation
|
|
132
|
+
];
|
|
133
|
+
const eip712V2OnlyWallets = [
|
|
134
|
+
Wallet.Magic,
|
|
135
|
+
Wallet.Phantom,
|
|
136
|
+
Wallet.Metamask,
|
|
137
|
+
Wallet.WalletConnect
|
|
138
|
+
];
|
|
139
|
+
const isEvmWallet = (wallet) => evmWallets.includes(wallet);
|
|
140
|
+
const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
|
|
141
|
+
const isEvmBrowserWallet = (wallet) => evmBrowserWallets.includes(wallet);
|
|
142
|
+
const isCosmosBrowserWallet = (wallet) => cosmosBrowserWallets.includes(wallet);
|
|
143
|
+
const isEip712V2OnlyWallet = (wallet) => eip712V2OnlyWallets.includes(wallet);
|
|
144
|
+
const isCosmosAminoOnlyWallet = (wallet) => wallet === Wallet.LedgerCosmos;
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
exports.BroadcastMode = BroadcastMode;
|
|
148
|
+
exports.DEFAULT_ADDRESS_SEARCH_LIMIT = DEFAULT_ADDRESS_SEARCH_LIMIT;
|
|
149
|
+
exports.DEFAULT_BASE_DERIVATION_PATH = DEFAULT_BASE_DERIVATION_PATH;
|
|
150
|
+
exports.DEFAULT_NUM_ADDRESSES_TO_FETCH = DEFAULT_NUM_ADDRESSES_TO_FETCH;
|
|
151
|
+
exports.EvmWalletProviderErrorCode = EvmWalletProviderErrorCode;
|
|
152
|
+
exports.MagicProvider = MagicProvider;
|
|
153
|
+
exports.StrategyEventType = StrategyEventType;
|
|
154
|
+
exports.TurnkeyProvider = TurnkeyProvider;
|
|
155
|
+
exports.Wallet = Wallet;
|
|
156
|
+
exports.WalletAction = WalletAction;
|
|
157
|
+
exports.WalletConnectStrategyEventType = WalletConnectStrategyEventType;
|
|
158
|
+
exports.WalletDeviceType = WalletDeviceType;
|
|
159
|
+
exports.WalletEventListener = WalletEventListener;
|
|
160
|
+
exports.WalletStrategyEmitterEventType = WalletStrategyEmitterEventType;
|
|
161
|
+
exports.isCosmosAminoOnlyWallet = isCosmosAminoOnlyWallet;
|
|
162
|
+
exports.isCosmosBrowserWallet = isCosmosBrowserWallet;
|
|
163
|
+
exports.isCosmosWallet = isCosmosWallet;
|
|
164
|
+
exports.isEip712V2OnlyWallet = isEip712V2OnlyWallet;
|
|
165
|
+
exports.isEvmBrowserWallet = isEvmBrowserWallet;
|
|
166
|
+
exports.isEvmWallet = isEvmWallet;
|
|
@@ -0,0 +1,175 @@
|
|
|
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-4vrShg5z.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime-light.d.ts
|
|
4
|
+
declare const BroadcastMode: {
|
|
5
|
+
readonly Block: "block";
|
|
6
|
+
readonly Sync: "sync";
|
|
7
|
+
readonly Async: "async";
|
|
8
|
+
};
|
|
9
|
+
type BroadcastMode = (typeof BroadcastMode)[keyof typeof BroadcastMode];
|
|
10
|
+
declare const Wallet: {
|
|
11
|
+
readonly Leap: "leap";
|
|
12
|
+
readonly Keplr: "keplr";
|
|
13
|
+
readonly Ninji: "ninji";
|
|
14
|
+
readonly Magic: "magic";
|
|
15
|
+
readonly Rabby: "rabby";
|
|
16
|
+
readonly Ledger: "ledger";
|
|
17
|
+
readonly BitGet: "BitGet";
|
|
18
|
+
readonly OWallet: "owallet";
|
|
19
|
+
readonly Phantom: "phantom";
|
|
20
|
+
readonly Rainbow: "rainbow";
|
|
21
|
+
readonly Turnkey: "turnkey";
|
|
22
|
+
readonly Metamask: "metamask";
|
|
23
|
+
readonly KeplrEvm: "keplr-evm";
|
|
24
|
+
readonly OkxWallet: "okx-wallet";
|
|
25
|
+
readonly PrivateKey: "private-key";
|
|
26
|
+
readonly TrustWallet: "trust-wallet";
|
|
27
|
+
readonly TrezorBip32: "trezor-bip32";
|
|
28
|
+
readonly TrezorBip44: "trezor-bip44";
|
|
29
|
+
readonly Cosmostation: "cosmostation";
|
|
30
|
+
readonly LedgerCosmos: "ledger-cosmos";
|
|
31
|
+
readonly LedgerLegacy: "ledger-legacy";
|
|
32
|
+
readonly WalletConnect: "wallet-connect";
|
|
33
|
+
readonly CosmostationEth: "cosmostation-eth";
|
|
34
|
+
readonly PrivateKeyCosmos: "private-key-cosmos";
|
|
35
|
+
};
|
|
36
|
+
type Wallet = (typeof Wallet)[keyof typeof Wallet];
|
|
37
|
+
declare const MagicProvider: {
|
|
38
|
+
readonly Email: "email";
|
|
39
|
+
readonly Apple: "apple";
|
|
40
|
+
readonly Github: "github";
|
|
41
|
+
readonly Google: "google";
|
|
42
|
+
readonly Discord: "discord";
|
|
43
|
+
readonly Twitter: "twitter";
|
|
44
|
+
readonly Facebook: "facebook";
|
|
45
|
+
};
|
|
46
|
+
type MagicProvider = (typeof MagicProvider)[keyof typeof MagicProvider];
|
|
47
|
+
declare const WalletDeviceType: {
|
|
48
|
+
readonly Mobile: "mobile";
|
|
49
|
+
readonly Other: "other";
|
|
50
|
+
readonly Browser: "browser";
|
|
51
|
+
readonly Hardware: "hardware";
|
|
52
|
+
};
|
|
53
|
+
type WalletDeviceType = (typeof WalletDeviceType)[keyof typeof WalletDeviceType];
|
|
54
|
+
declare const WalletEventListener: {
|
|
55
|
+
readonly AccountChange: "account-change";
|
|
56
|
+
readonly ChainIdChange: "chain-id-change";
|
|
57
|
+
};
|
|
58
|
+
type WalletEventListener = (typeof WalletEventListener)[keyof typeof WalletEventListener];
|
|
59
|
+
declare const EvmWalletProviderErrorCode: {
|
|
60
|
+
readonly InternalError: -32603;
|
|
61
|
+
readonly UserRejectedRequest: 4001;
|
|
62
|
+
readonly UnrecognizedChain: 4902;
|
|
63
|
+
};
|
|
64
|
+
type EvmWalletProviderErrorCode = (typeof EvmWalletProviderErrorCode)[keyof typeof EvmWalletProviderErrorCode];
|
|
65
|
+
declare const WalletAction: {
|
|
66
|
+
readonly GetChainId: "get-chain-id";
|
|
67
|
+
readonly GetAccounts: "get-accounts";
|
|
68
|
+
readonly GetNetworkId: "get-network-id";
|
|
69
|
+
readonly SignArbitrary: "sign-arbitrary";
|
|
70
|
+
readonly SignTransaction: "sign-transaction";
|
|
71
|
+
readonly SendTransaction: "send-transaction";
|
|
72
|
+
readonly SendEvmTransaction: "send-evm-transaction";
|
|
73
|
+
readonly SignEvmTransaction: "sign-evm-transaction";
|
|
74
|
+
readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
|
|
75
|
+
};
|
|
76
|
+
type WalletAction = (typeof WalletAction)[keyof typeof WalletAction];
|
|
77
|
+
declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
78
|
+
declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
79
|
+
declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
80
|
+
declare const TurnkeyProvider: {
|
|
81
|
+
readonly Sms: "sms";
|
|
82
|
+
readonly Apple: "apple";
|
|
83
|
+
readonly Email: "email";
|
|
84
|
+
readonly Google: "google";
|
|
85
|
+
readonly Twitter: "twitter";
|
|
86
|
+
};
|
|
87
|
+
type TurnkeyProvider = (typeof TurnkeyProvider)[keyof typeof TurnkeyProvider];
|
|
88
|
+
type TurnkeyOAuthProvider = typeof TurnkeyProvider.Apple | typeof TurnkeyProvider.Google | typeof TurnkeyProvider.Twitter;
|
|
89
|
+
declare const StrategyEventType: {
|
|
90
|
+
readonly ConnectionEnd: "connection-end";
|
|
91
|
+
readonly ConnectionStart: "connection-start";
|
|
92
|
+
readonly WalletSigningEnd: "wallet-signing-end";
|
|
93
|
+
readonly WalletSigningStart: "wallet-signing-start";
|
|
94
|
+
};
|
|
95
|
+
declare const WalletConnectStrategyEventType: {
|
|
96
|
+
readonly WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout";
|
|
97
|
+
};
|
|
98
|
+
declare const WalletStrategyEmitterEventType: {
|
|
99
|
+
readonly TransactionFail: "transaction-fail";
|
|
100
|
+
readonly TransactionSigned: "transaction-signed";
|
|
101
|
+
readonly TransactionSignStart: "transaction-sign-start";
|
|
102
|
+
readonly TransactionBroadcastEnd: "transaction-broadcast-end";
|
|
103
|
+
readonly TransactionBroadcastStart: "transaction-broadcast-start";
|
|
104
|
+
readonly TransactionBroadcastSynced: "transaction-broadcast-synced";
|
|
105
|
+
readonly TransactionPreparationEnd: "transaction-preparation-end";
|
|
106
|
+
readonly TransactionPreparationStart: "transaction-preparation-start";
|
|
107
|
+
readonly WalletStrategyDisconnect: "wallet-strategy-disconnect";
|
|
108
|
+
};
|
|
109
|
+
type StrategyEventType = (typeof StrategyEventType)[keyof typeof StrategyEventType] | (typeof WalletConnectStrategyEventType)[keyof typeof WalletConnectStrategyEventType];
|
|
110
|
+
type WalletStrategyEmitterEventType = (typeof WalletStrategyEmitterEventType)[keyof typeof WalletStrategyEmitterEventType] | StrategyEventType;
|
|
111
|
+
type WalletStrategyEmitterEvents = { [K in WalletStrategyEmitterEventType]: Record<string, any> };
|
|
112
|
+
interface WalletStrategyEmitter {
|
|
113
|
+
on(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
|
|
114
|
+
off(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
|
|
115
|
+
emit(event: WalletStrategyEmitterEventType, ...args: any[]): boolean;
|
|
116
|
+
}
|
|
117
|
+
interface BrowserEip1193Provider {
|
|
118
|
+
removeAllListeners(): void;
|
|
119
|
+
request(args: {
|
|
120
|
+
method: string;
|
|
121
|
+
params?: unknown[];
|
|
122
|
+
}): Promise<unknown>;
|
|
123
|
+
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
124
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): void;
|
|
125
|
+
providers?: BrowserEip1193Provider[];
|
|
126
|
+
isTrust: boolean;
|
|
127
|
+
isKeplr: boolean;
|
|
128
|
+
isRabby: boolean;
|
|
129
|
+
isRainbow: boolean;
|
|
130
|
+
isPhantom: boolean;
|
|
131
|
+
isBitGet?: boolean;
|
|
132
|
+
isBitKeep?: boolean;
|
|
133
|
+
isMetaMask: boolean;
|
|
134
|
+
isOkxWallet: boolean;
|
|
135
|
+
isTrustWallet: boolean;
|
|
136
|
+
}
|
|
137
|
+
type BrowserEip1993Provider = BrowserEip1193Provider;
|
|
138
|
+
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
139
|
+
rainbow: BrowserEip1193Provider;
|
|
140
|
+
rabby: BrowserEip1193Provider;
|
|
141
|
+
ethereum: BrowserEip1193Provider;
|
|
142
|
+
okxwallet: BrowserEip1193Provider;
|
|
143
|
+
providers: BrowserEip1193Provider[];
|
|
144
|
+
trustWallet?: BrowserEip1193Provider;
|
|
145
|
+
bitkeep: {
|
|
146
|
+
ethereum: BrowserEip1193Provider;
|
|
147
|
+
};
|
|
148
|
+
phantom?: {
|
|
149
|
+
ethereum?: BrowserEip1193Provider;
|
|
150
|
+
};
|
|
151
|
+
keplr?: {
|
|
152
|
+
ethereum?: BrowserEip1193Provider;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
interface EIP6963ProviderInfo {
|
|
156
|
+
rdns: string;
|
|
157
|
+
uuid: string;
|
|
158
|
+
name: string;
|
|
159
|
+
icon: string;
|
|
160
|
+
}
|
|
161
|
+
interface EIP6963ProviderDetail {
|
|
162
|
+
info: EIP6963ProviderInfo;
|
|
163
|
+
provider: BrowserEip1193Provider;
|
|
164
|
+
}
|
|
165
|
+
type EIP6963AnnounceProviderEvent = {
|
|
166
|
+
detail: EIP6963ProviderDetail;
|
|
167
|
+
};
|
|
168
|
+
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
169
|
+
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
170
|
+
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
171
|
+
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
172
|
+
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
173
|
+
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
174
|
+
//#endregion
|
|
175
|
+
export { BroadcastMode, BrowserEip1193Provider, BrowserEip1993Provider, type ConcreteCosmosWalletStrategy, type ConcreteCosmosWalletStrategyArgs, type ConcreteEvmWalletStrategyArgs, type ConcreteStrategiesArg, type ConcreteWalletStrategy, type ConcreteWalletStrategyArgs, type CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, type Eip1193Provider, EvmWalletProviderErrorCode, type MagicMetadata, MagicProvider, type PrivateKeyMetadata, type SendTransactionOptions, type StrategyEmitter, StrategyEventType, type TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, type TurnkeySession, Wallet, WalletAction, type WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, type WalletMetadata, type WalletStrategy, type WalletStrategy as WalletStrategyInterface, type WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, type WalletStrategyEvmOptions, WindowWithEip1193Provider, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, type onAccountChangeCallback, type onChainIdChangeCallback };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
2
2
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
3
|
-
import { AccountAddress, ChainId,
|
|
3
|
+
import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
4
|
import { TxClientInclusionOptions, TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
5
5
|
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
6
|
-
import { EIP1193Provider } from "eip1193-provider";
|
|
7
6
|
|
|
8
7
|
//#region src/types/events.d.ts
|
|
9
8
|
declare const StrategyEventType: {
|
|
@@ -400,78 +399,4 @@ interface WalletStrategy {
|
|
|
400
399
|
}>;
|
|
401
400
|
}
|
|
402
401
|
//#endregion
|
|
403
|
-
|
|
404
|
-
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
405
|
-
removeAllListeners(): void;
|
|
406
|
-
providers?: BrowserEip1993Provider[];
|
|
407
|
-
isTrust: boolean;
|
|
408
|
-
isKeplr: boolean;
|
|
409
|
-
isRabby: boolean;
|
|
410
|
-
isRainbow: boolean;
|
|
411
|
-
isPhantom: boolean;
|
|
412
|
-
isBitGet?: boolean;
|
|
413
|
-
isBitKeep?: boolean;
|
|
414
|
-
isMetaMask: boolean;
|
|
415
|
-
isOkxWallet: boolean;
|
|
416
|
-
isTrustWallet: boolean;
|
|
417
|
-
}
|
|
418
|
-
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
419
|
-
rainbow: BrowserEip1993Provider;
|
|
420
|
-
rabby: BrowserEip1993Provider;
|
|
421
|
-
ethereum: BrowserEip1993Provider;
|
|
422
|
-
okxwallet: BrowserEip1993Provider;
|
|
423
|
-
providers: BrowserEip1993Provider[];
|
|
424
|
-
trustWallet?: BrowserEip1993Provider;
|
|
425
|
-
bitkeep: {
|
|
426
|
-
ethereum: BrowserEip1993Provider;
|
|
427
|
-
};
|
|
428
|
-
phantom?: {
|
|
429
|
-
ethereum?: BrowserEip1993Provider;
|
|
430
|
-
};
|
|
431
|
-
keplr?: {
|
|
432
|
-
ethereum?: BrowserEip1993Provider;
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
interface EIP6963ProviderInfo {
|
|
436
|
-
rdns: string;
|
|
437
|
-
uuid: string;
|
|
438
|
-
name: string;
|
|
439
|
-
icon: string;
|
|
440
|
-
}
|
|
441
|
-
interface EIP6963ProviderDetail {
|
|
442
|
-
info: EIP6963ProviderInfo;
|
|
443
|
-
provider: BrowserEip1993Provider;
|
|
444
|
-
}
|
|
445
|
-
type EIP6963AnnounceProviderEvent = {
|
|
446
|
-
detail: EIP6963ProviderDetail;
|
|
447
|
-
};
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/utils/wallet.d.ts
|
|
450
|
-
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
451
|
-
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
452
|
-
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
453
|
-
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
454
|
-
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
455
|
-
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
456
|
-
//#endregion
|
|
457
|
-
//#region src/base.d.ts
|
|
458
|
-
declare abstract class BaseConcreteStrategy {
|
|
459
|
-
protected chainId: ChainId | CosmosChainId;
|
|
460
|
-
protected evmChainId?: EvmChainId;
|
|
461
|
-
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
462
|
-
metadata?: WalletMetadata;
|
|
463
|
-
/**
|
|
464
|
-
* Optional emitter passed from parent WalletStrategy.
|
|
465
|
-
* When provided, strategies emit events directly on the parent's emitter.
|
|
466
|
-
*/
|
|
467
|
-
protected emitter?: StrategyEmitter;
|
|
468
|
-
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
469
|
-
setMetadata(metadata?: WalletMetadata): void;
|
|
470
|
-
/**
|
|
471
|
-
* Emit an event from this strategy.
|
|
472
|
-
* If emitter was provided from parent, events go directly to parent.
|
|
473
|
-
*/
|
|
474
|
-
protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
|
|
475
|
-
}
|
|
476
|
-
//#endregion
|
|
477
|
-
export { WalletConnectMetadata as A, Wallet as B, SendTransactionOptions as C, TurnkeyOAuthProvider as D, TurnkeyMetadata as E, onAccountChangeCallback as F, WalletConnectStrategyEventType as G, WalletDeviceType as H, onChainIdChangeCallback as I, WalletStrategyEmitterEvents as J, WalletStrategyEmitter as K, BroadcastMode as L, WalletStrategy as M, WalletStrategyArguments as N, TurnkeyProvider as O, WalletStrategyEvmOptions as P, EvmWalletProviderErrorCode as R, PrivateKeyMetadata as S, StrategyEmitter as T, WalletEventListener as U, WalletAction as V, StrategyEventType as W, ConcreteWalletStrategy as _, isEip712V2OnlyWallet as a, Eip1193Provider as b, BrowserEip1993Provider as c, EIP6963ProviderInfo as d, WindowWithEip1193Provider as f, ConcreteStrategiesArg as g, ConcreteEvmWalletStrategyArgs as h, isCosmosWallet as i, WalletMetadata as j, TurnkeySession as k, EIP6963AnnounceProviderEvent as l, ConcreteCosmosWalletStrategyArgs as m, isCosmosAminoOnlyWallet as n, isEvmBrowserWallet as o, ConcreteCosmosWalletStrategy as p, WalletStrategyEmitterEventType as q, isCosmosBrowserWallet as r, isEvmWallet as s, BaseConcreteStrategy as t, EIP6963ProviderDetail as u, ConcreteWalletStrategyArgs as v, StdSignDoc as w, MagicMetadata as x, CosmosWalletAbstraction as y, MagicProvider as z };
|
|
402
|
+
export { WalletDeviceType as A, onAccountChangeCallback as C, MagicProvider as D, EvmWalletProviderErrorCode as E, WalletStrategyEmitterEventType as F, WalletStrategyEmitterEvents as I, StrategyEventType as M, WalletConnectStrategyEventType as N, Wallet as O, WalletStrategyEmitter as P, WalletStrategyEvmOptions as S, BroadcastMode as T, TurnkeySession as _, ConcreteWalletStrategy as a, WalletStrategy as b, Eip1193Provider as c, SendTransactionOptions as d, StdSignDoc as f, TurnkeyProvider as g, TurnkeyOAuthProvider as h, ConcreteStrategiesArg as i, WalletEventListener as j, WalletAction as k, MagicMetadata as l, TurnkeyMetadata as m, ConcreteCosmosWalletStrategyArgs as n, ConcreteWalletStrategyArgs as o, StrategyEmitter as p, ConcreteEvmWalletStrategyArgs as r, CosmosWalletAbstraction as s, ConcreteCosmosWalletStrategy as t, PrivateKeyMetadata as u, WalletConnectMetadata as v, onChainIdChangeCallback as w, WalletStrategyArguments as x, WalletMetadata as y };
|
|
@@ -0,0 +1,79 @@
|
|
|
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 };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
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";
|
|
2
3
|
import { BigNumber } from "@injectivelabs/utils";
|
|
3
4
|
import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
5
|
import { Account, Chain, LocalAccount, PublicClient, WalletClient } from "viem";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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
2
|
import { getStdFee, toBigNumber } from "@injectivelabs/utils";
|
|
3
3
|
import * as viemChains from "viem/chains";
|
|
4
4
|
import { injective } from "viem/chains";
|
package/dist/esm/light.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
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";
|
|
2
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
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
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
2
|
|
|
3
3
|
export { BaseConcreteStrategy, BroadcastMode, EvmWalletProviderErrorCode, MagicProvider, StrategyEventType, TurnkeyProvider, Wallet, WalletAction, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletStrategyEmitterEventType, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet };
|
|
@@ -0,0 +1,175 @@
|
|
|
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-C_dU586T.js";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime-light.d.ts
|
|
4
|
+
declare const BroadcastMode: {
|
|
5
|
+
readonly Block: "block";
|
|
6
|
+
readonly Sync: "sync";
|
|
7
|
+
readonly Async: "async";
|
|
8
|
+
};
|
|
9
|
+
type BroadcastMode = (typeof BroadcastMode)[keyof typeof BroadcastMode];
|
|
10
|
+
declare const Wallet: {
|
|
11
|
+
readonly Leap: "leap";
|
|
12
|
+
readonly Keplr: "keplr";
|
|
13
|
+
readonly Ninji: "ninji";
|
|
14
|
+
readonly Magic: "magic";
|
|
15
|
+
readonly Rabby: "rabby";
|
|
16
|
+
readonly Ledger: "ledger";
|
|
17
|
+
readonly BitGet: "BitGet";
|
|
18
|
+
readonly OWallet: "owallet";
|
|
19
|
+
readonly Phantom: "phantom";
|
|
20
|
+
readonly Rainbow: "rainbow";
|
|
21
|
+
readonly Turnkey: "turnkey";
|
|
22
|
+
readonly Metamask: "metamask";
|
|
23
|
+
readonly KeplrEvm: "keplr-evm";
|
|
24
|
+
readonly OkxWallet: "okx-wallet";
|
|
25
|
+
readonly PrivateKey: "private-key";
|
|
26
|
+
readonly TrustWallet: "trust-wallet";
|
|
27
|
+
readonly TrezorBip32: "trezor-bip32";
|
|
28
|
+
readonly TrezorBip44: "trezor-bip44";
|
|
29
|
+
readonly Cosmostation: "cosmostation";
|
|
30
|
+
readonly LedgerCosmos: "ledger-cosmos";
|
|
31
|
+
readonly LedgerLegacy: "ledger-legacy";
|
|
32
|
+
readonly WalletConnect: "wallet-connect";
|
|
33
|
+
readonly CosmostationEth: "cosmostation-eth";
|
|
34
|
+
readonly PrivateKeyCosmos: "private-key-cosmos";
|
|
35
|
+
};
|
|
36
|
+
type Wallet = (typeof Wallet)[keyof typeof Wallet];
|
|
37
|
+
declare const MagicProvider: {
|
|
38
|
+
readonly Email: "email";
|
|
39
|
+
readonly Apple: "apple";
|
|
40
|
+
readonly Github: "github";
|
|
41
|
+
readonly Google: "google";
|
|
42
|
+
readonly Discord: "discord";
|
|
43
|
+
readonly Twitter: "twitter";
|
|
44
|
+
readonly Facebook: "facebook";
|
|
45
|
+
};
|
|
46
|
+
type MagicProvider = (typeof MagicProvider)[keyof typeof MagicProvider];
|
|
47
|
+
declare const WalletDeviceType: {
|
|
48
|
+
readonly Mobile: "mobile";
|
|
49
|
+
readonly Other: "other";
|
|
50
|
+
readonly Browser: "browser";
|
|
51
|
+
readonly Hardware: "hardware";
|
|
52
|
+
};
|
|
53
|
+
type WalletDeviceType = (typeof WalletDeviceType)[keyof typeof WalletDeviceType];
|
|
54
|
+
declare const WalletEventListener: {
|
|
55
|
+
readonly AccountChange: "account-change";
|
|
56
|
+
readonly ChainIdChange: "chain-id-change";
|
|
57
|
+
};
|
|
58
|
+
type WalletEventListener = (typeof WalletEventListener)[keyof typeof WalletEventListener];
|
|
59
|
+
declare const EvmWalletProviderErrorCode: {
|
|
60
|
+
readonly InternalError: -32603;
|
|
61
|
+
readonly UserRejectedRequest: 4001;
|
|
62
|
+
readonly UnrecognizedChain: 4902;
|
|
63
|
+
};
|
|
64
|
+
type EvmWalletProviderErrorCode = (typeof EvmWalletProviderErrorCode)[keyof typeof EvmWalletProviderErrorCode];
|
|
65
|
+
declare const WalletAction: {
|
|
66
|
+
readonly GetChainId: "get-chain-id";
|
|
67
|
+
readonly GetAccounts: "get-accounts";
|
|
68
|
+
readonly GetNetworkId: "get-network-id";
|
|
69
|
+
readonly SignArbitrary: "sign-arbitrary";
|
|
70
|
+
readonly SignTransaction: "sign-transaction";
|
|
71
|
+
readonly SendTransaction: "send-transaction";
|
|
72
|
+
readonly SendEvmTransaction: "send-evm-transaction";
|
|
73
|
+
readonly SignEvmTransaction: "sign-evm-transaction";
|
|
74
|
+
readonly GetEvmTransactionReceipt: "get-evm-transaction-receipt";
|
|
75
|
+
};
|
|
76
|
+
type WalletAction = (typeof WalletAction)[keyof typeof WalletAction];
|
|
77
|
+
declare const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
78
|
+
declare const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
79
|
+
declare const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
80
|
+
declare const TurnkeyProvider: {
|
|
81
|
+
readonly Sms: "sms";
|
|
82
|
+
readonly Apple: "apple";
|
|
83
|
+
readonly Email: "email";
|
|
84
|
+
readonly Google: "google";
|
|
85
|
+
readonly Twitter: "twitter";
|
|
86
|
+
};
|
|
87
|
+
type TurnkeyProvider = (typeof TurnkeyProvider)[keyof typeof TurnkeyProvider];
|
|
88
|
+
type TurnkeyOAuthProvider = typeof TurnkeyProvider.Apple | typeof TurnkeyProvider.Google | typeof TurnkeyProvider.Twitter;
|
|
89
|
+
declare const StrategyEventType: {
|
|
90
|
+
readonly ConnectionEnd: "connection-end";
|
|
91
|
+
readonly ConnectionStart: "connection-start";
|
|
92
|
+
readonly WalletSigningEnd: "wallet-signing-end";
|
|
93
|
+
readonly WalletSigningStart: "wallet-signing-start";
|
|
94
|
+
};
|
|
95
|
+
declare const WalletConnectStrategyEventType: {
|
|
96
|
+
readonly WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout";
|
|
97
|
+
};
|
|
98
|
+
declare const WalletStrategyEmitterEventType: {
|
|
99
|
+
readonly TransactionFail: "transaction-fail";
|
|
100
|
+
readonly TransactionSigned: "transaction-signed";
|
|
101
|
+
readonly TransactionSignStart: "transaction-sign-start";
|
|
102
|
+
readonly TransactionBroadcastEnd: "transaction-broadcast-end";
|
|
103
|
+
readonly TransactionBroadcastStart: "transaction-broadcast-start";
|
|
104
|
+
readonly TransactionBroadcastSynced: "transaction-broadcast-synced";
|
|
105
|
+
readonly TransactionPreparationEnd: "transaction-preparation-end";
|
|
106
|
+
readonly TransactionPreparationStart: "transaction-preparation-start";
|
|
107
|
+
readonly WalletStrategyDisconnect: "wallet-strategy-disconnect";
|
|
108
|
+
};
|
|
109
|
+
type StrategyEventType = (typeof StrategyEventType)[keyof typeof StrategyEventType] | (typeof WalletConnectStrategyEventType)[keyof typeof WalletConnectStrategyEventType];
|
|
110
|
+
type WalletStrategyEmitterEventType = (typeof WalletStrategyEmitterEventType)[keyof typeof WalletStrategyEmitterEventType] | StrategyEventType;
|
|
111
|
+
type WalletStrategyEmitterEvents = { [K in WalletStrategyEmitterEventType]: Record<string, any> };
|
|
112
|
+
interface WalletStrategyEmitter {
|
|
113
|
+
on(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
|
|
114
|
+
off(event: WalletStrategyEmitterEventType, listener: (...args: any[]) => void): this;
|
|
115
|
+
emit(event: WalletStrategyEmitterEventType, ...args: any[]): boolean;
|
|
116
|
+
}
|
|
117
|
+
interface BrowserEip1193Provider {
|
|
118
|
+
removeAllListeners(): void;
|
|
119
|
+
request(args: {
|
|
120
|
+
method: string;
|
|
121
|
+
params?: unknown[];
|
|
122
|
+
}): Promise<unknown>;
|
|
123
|
+
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
124
|
+
removeListener(event: string, listener: (...args: unknown[]) => void): void;
|
|
125
|
+
providers?: BrowserEip1193Provider[];
|
|
126
|
+
isTrust: boolean;
|
|
127
|
+
isKeplr: boolean;
|
|
128
|
+
isRabby: boolean;
|
|
129
|
+
isRainbow: boolean;
|
|
130
|
+
isPhantom: boolean;
|
|
131
|
+
isBitGet?: boolean;
|
|
132
|
+
isBitKeep?: boolean;
|
|
133
|
+
isMetaMask: boolean;
|
|
134
|
+
isOkxWallet: boolean;
|
|
135
|
+
isTrustWallet: boolean;
|
|
136
|
+
}
|
|
137
|
+
type BrowserEip1993Provider = BrowserEip1193Provider;
|
|
138
|
+
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
139
|
+
rainbow: BrowserEip1193Provider;
|
|
140
|
+
rabby: BrowserEip1193Provider;
|
|
141
|
+
ethereum: BrowserEip1193Provider;
|
|
142
|
+
okxwallet: BrowserEip1193Provider;
|
|
143
|
+
providers: BrowserEip1193Provider[];
|
|
144
|
+
trustWallet?: BrowserEip1193Provider;
|
|
145
|
+
bitkeep: {
|
|
146
|
+
ethereum: BrowserEip1193Provider;
|
|
147
|
+
};
|
|
148
|
+
phantom?: {
|
|
149
|
+
ethereum?: BrowserEip1193Provider;
|
|
150
|
+
};
|
|
151
|
+
keplr?: {
|
|
152
|
+
ethereum?: BrowserEip1193Provider;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
interface EIP6963ProviderInfo {
|
|
156
|
+
rdns: string;
|
|
157
|
+
uuid: string;
|
|
158
|
+
name: string;
|
|
159
|
+
icon: string;
|
|
160
|
+
}
|
|
161
|
+
interface EIP6963ProviderDetail {
|
|
162
|
+
info: EIP6963ProviderInfo;
|
|
163
|
+
provider: BrowserEip1193Provider;
|
|
164
|
+
}
|
|
165
|
+
type EIP6963AnnounceProviderEvent = {
|
|
166
|
+
detail: EIP6963ProviderDetail;
|
|
167
|
+
};
|
|
168
|
+
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
169
|
+
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
170
|
+
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
171
|
+
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
172
|
+
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
173
|
+
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
174
|
+
//#endregion
|
|
175
|
+
export { BroadcastMode, BrowserEip1193Provider, BrowserEip1993Provider, type ConcreteCosmosWalletStrategy, type ConcreteCosmosWalletStrategyArgs, type ConcreteEvmWalletStrategyArgs, type ConcreteStrategiesArg, type ConcreteWalletStrategy, type ConcreteWalletStrategyArgs, type CosmosWalletAbstraction, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EIP6963AnnounceProviderEvent, EIP6963ProviderDetail, EIP6963ProviderInfo, type Eip1193Provider, EvmWalletProviderErrorCode, type MagicMetadata, MagicProvider, type PrivateKeyMetadata, type SendTransactionOptions, type StrategyEmitter, StrategyEventType, type TurnkeyMetadata, TurnkeyOAuthProvider, TurnkeyProvider, type TurnkeySession, Wallet, WalletAction, type WalletConnectMetadata, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, type WalletMetadata, type WalletStrategy, type WalletStrategy as WalletStrategyInterface, type WalletStrategyArguments, WalletStrategyEmitter, WalletStrategyEmitterEventType, WalletStrategyEmitterEvents, type WalletStrategyEvmOptions, WindowWithEip1193Provider, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet, type onAccountChangeCallback, type onChainIdChangeCallback };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
//#region src/runtime-light.ts
|
|
2
|
+
const BroadcastMode = {
|
|
3
|
+
Block: "block",
|
|
4
|
+
Sync: "sync",
|
|
5
|
+
Async: "async"
|
|
6
|
+
};
|
|
7
|
+
const Wallet = {
|
|
8
|
+
Leap: "leap",
|
|
9
|
+
Keplr: "keplr",
|
|
10
|
+
Ninji: "ninji",
|
|
11
|
+
Magic: "magic",
|
|
12
|
+
Rabby: "rabby",
|
|
13
|
+
Ledger: "ledger",
|
|
14
|
+
BitGet: "BitGet",
|
|
15
|
+
OWallet: "owallet",
|
|
16
|
+
Phantom: "phantom",
|
|
17
|
+
Rainbow: "rainbow",
|
|
18
|
+
Turnkey: "turnkey",
|
|
19
|
+
Metamask: "metamask",
|
|
20
|
+
KeplrEvm: "keplr-evm",
|
|
21
|
+
OkxWallet: "okx-wallet",
|
|
22
|
+
PrivateKey: "private-key",
|
|
23
|
+
TrustWallet: "trust-wallet",
|
|
24
|
+
TrezorBip32: "trezor-bip32",
|
|
25
|
+
TrezorBip44: "trezor-bip44",
|
|
26
|
+
Cosmostation: "cosmostation",
|
|
27
|
+
LedgerCosmos: "ledger-cosmos",
|
|
28
|
+
LedgerLegacy: "ledger-legacy",
|
|
29
|
+
WalletConnect: "wallet-connect",
|
|
30
|
+
CosmostationEth: "cosmostation-eth",
|
|
31
|
+
PrivateKeyCosmos: "private-key-cosmos"
|
|
32
|
+
};
|
|
33
|
+
const MagicProvider = {
|
|
34
|
+
Email: "email",
|
|
35
|
+
Apple: "apple",
|
|
36
|
+
Github: "github",
|
|
37
|
+
Google: "google",
|
|
38
|
+
Discord: "discord",
|
|
39
|
+
Twitter: "twitter",
|
|
40
|
+
Facebook: "facebook"
|
|
41
|
+
};
|
|
42
|
+
const WalletDeviceType = {
|
|
43
|
+
Mobile: "mobile",
|
|
44
|
+
Other: "other",
|
|
45
|
+
Browser: "browser",
|
|
46
|
+
Hardware: "hardware"
|
|
47
|
+
};
|
|
48
|
+
const WalletEventListener = {
|
|
49
|
+
AccountChange: "account-change",
|
|
50
|
+
ChainIdChange: "chain-id-change"
|
|
51
|
+
};
|
|
52
|
+
const EvmWalletProviderErrorCode = {
|
|
53
|
+
InternalError: -32603,
|
|
54
|
+
UserRejectedRequest: 4001,
|
|
55
|
+
UnrecognizedChain: 4902
|
|
56
|
+
};
|
|
57
|
+
const WalletAction = {
|
|
58
|
+
GetChainId: "get-chain-id",
|
|
59
|
+
GetAccounts: "get-accounts",
|
|
60
|
+
GetNetworkId: "get-network-id",
|
|
61
|
+
SignArbitrary: "sign-arbitrary",
|
|
62
|
+
SignTransaction: "sign-transaction",
|
|
63
|
+
SendTransaction: "send-transaction",
|
|
64
|
+
SendEvmTransaction: "send-evm-transaction",
|
|
65
|
+
SignEvmTransaction: "sign-evm-transaction",
|
|
66
|
+
GetEvmTransactionReceipt: "get-evm-transaction-receipt"
|
|
67
|
+
};
|
|
68
|
+
const DEFAULT_BASE_DERIVATION_PATH = "m/44'/60'";
|
|
69
|
+
const DEFAULT_NUM_ADDRESSES_TO_FETCH = 5;
|
|
70
|
+
const DEFAULT_ADDRESS_SEARCH_LIMIT = 100;
|
|
71
|
+
const TurnkeyProvider = {
|
|
72
|
+
Sms: "sms",
|
|
73
|
+
Apple: "apple",
|
|
74
|
+
Email: "email",
|
|
75
|
+
Google: "google",
|
|
76
|
+
Twitter: "twitter"
|
|
77
|
+
};
|
|
78
|
+
const StrategyEventType = {
|
|
79
|
+
ConnectionEnd: "connection-end",
|
|
80
|
+
ConnectionStart: "connection-start",
|
|
81
|
+
WalletSigningEnd: "wallet-signing-end",
|
|
82
|
+
WalletSigningStart: "wallet-signing-start"
|
|
83
|
+
};
|
|
84
|
+
const WalletConnectStrategyEventType = { WalletConnectSigningWithTxTimeout: "signing-with-tx-timeout" };
|
|
85
|
+
const WalletStrategyEmitterEventType = {
|
|
86
|
+
TransactionFail: "transaction-fail",
|
|
87
|
+
TransactionSigned: "transaction-signed",
|
|
88
|
+
TransactionSignStart: "transaction-sign-start",
|
|
89
|
+
TransactionBroadcastEnd: "transaction-broadcast-end",
|
|
90
|
+
TransactionBroadcastStart: "transaction-broadcast-start",
|
|
91
|
+
TransactionBroadcastSynced: "transaction-broadcast-synced",
|
|
92
|
+
TransactionPreparationEnd: "transaction-preparation-end",
|
|
93
|
+
TransactionPreparationStart: "transaction-preparation-start",
|
|
94
|
+
WalletStrategyDisconnect: "wallet-strategy-disconnect"
|
|
95
|
+
};
|
|
96
|
+
const evmWallets = [
|
|
97
|
+
Wallet.Magic,
|
|
98
|
+
Wallet.Rabby,
|
|
99
|
+
Wallet.BitGet,
|
|
100
|
+
Wallet.Ledger,
|
|
101
|
+
Wallet.Phantom,
|
|
102
|
+
Wallet.Rainbow,
|
|
103
|
+
Wallet.Turnkey,
|
|
104
|
+
Wallet.Metamask,
|
|
105
|
+
Wallet.KeplrEvm,
|
|
106
|
+
Wallet.OkxWallet,
|
|
107
|
+
Wallet.PrivateKey,
|
|
108
|
+
Wallet.TrezorBip32,
|
|
109
|
+
Wallet.TrezorBip44,
|
|
110
|
+
Wallet.TrustWallet,
|
|
111
|
+
Wallet.LedgerLegacy,
|
|
112
|
+
Wallet.WalletConnect,
|
|
113
|
+
Wallet.CosmostationEth
|
|
114
|
+
];
|
|
115
|
+
const evmBrowserWallets = [
|
|
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
|
+
];
|
|
125
|
+
const cosmosBrowserWallets = [
|
|
126
|
+
Wallet.Leap,
|
|
127
|
+
Wallet.Keplr,
|
|
128
|
+
Wallet.Ninji,
|
|
129
|
+
Wallet.OWallet,
|
|
130
|
+
Wallet.Cosmostation
|
|
131
|
+
];
|
|
132
|
+
const eip712V2OnlyWallets = [
|
|
133
|
+
Wallet.Magic,
|
|
134
|
+
Wallet.Phantom,
|
|
135
|
+
Wallet.Metamask,
|
|
136
|
+
Wallet.WalletConnect
|
|
137
|
+
];
|
|
138
|
+
const isEvmWallet = (wallet) => evmWallets.includes(wallet);
|
|
139
|
+
const isCosmosWallet = (wallet) => !isEvmWallet(wallet);
|
|
140
|
+
const isEvmBrowserWallet = (wallet) => evmBrowserWallets.includes(wallet);
|
|
141
|
+
const isCosmosBrowserWallet = (wallet) => cosmosBrowserWallets.includes(wallet);
|
|
142
|
+
const isEip712V2OnlyWallet = (wallet) => eip712V2OnlyWallets.includes(wallet);
|
|
143
|
+
const isCosmosAminoOnlyWallet = (wallet) => wallet === Wallet.LedgerCosmos;
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { BroadcastMode, DEFAULT_ADDRESS_SEARCH_LIMIT, DEFAULT_BASE_DERIVATION_PATH, DEFAULT_NUM_ADDRESSES_TO_FETCH, EvmWalletProviderErrorCode, MagicProvider, StrategyEventType, TurnkeyProvider, Wallet, WalletAction, WalletConnectStrategyEventType, WalletDeviceType, WalletEventListener, WalletStrategyEmitterEventType, isCosmosAminoOnlyWallet, isCosmosBrowserWallet, isCosmosWallet, isEip712V2OnlyWallet, isEvmBrowserWallet, isEvmWallet };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { AccountAddress, ChainId,
|
|
1
|
+
import { AccountAddress, ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
2
2
|
import { StdSignDoc } from "@keplr-wallet/types";
|
|
3
3
|
import { OfflineSigner } from "@cosmjs/proto-signing";
|
|
4
4
|
import { TxClientInclusionOptions, TxResponse } from "@injectivelabs/sdk-ts/core/tx";
|
|
5
5
|
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
6
|
-
import { EIP1193Provider } from "eip1193-provider";
|
|
7
6
|
|
|
8
7
|
//#region src/types/events.d.ts
|
|
9
8
|
declare const StrategyEventType: {
|
|
@@ -400,78 +399,4 @@ interface WalletStrategy {
|
|
|
400
399
|
}>;
|
|
401
400
|
}
|
|
402
401
|
//#endregion
|
|
403
|
-
|
|
404
|
-
interface BrowserEip1993Provider extends EIP1193Provider {
|
|
405
|
-
removeAllListeners(): void;
|
|
406
|
-
providers?: BrowserEip1993Provider[];
|
|
407
|
-
isTrust: boolean;
|
|
408
|
-
isKeplr: boolean;
|
|
409
|
-
isRabby: boolean;
|
|
410
|
-
isRainbow: boolean;
|
|
411
|
-
isPhantom: boolean;
|
|
412
|
-
isBitGet?: boolean;
|
|
413
|
-
isBitKeep?: boolean;
|
|
414
|
-
isMetaMask: boolean;
|
|
415
|
-
isOkxWallet: boolean;
|
|
416
|
-
isTrustWallet: boolean;
|
|
417
|
-
}
|
|
418
|
-
interface WindowWithEip1193Provider extends Omit<Window, 'ethereum' | 'keplr'> {
|
|
419
|
-
rainbow: BrowserEip1993Provider;
|
|
420
|
-
rabby: BrowserEip1993Provider;
|
|
421
|
-
ethereum: BrowserEip1993Provider;
|
|
422
|
-
okxwallet: BrowserEip1993Provider;
|
|
423
|
-
providers: BrowserEip1993Provider[];
|
|
424
|
-
trustWallet?: BrowserEip1993Provider;
|
|
425
|
-
bitkeep: {
|
|
426
|
-
ethereum: BrowserEip1993Provider;
|
|
427
|
-
};
|
|
428
|
-
phantom?: {
|
|
429
|
-
ethereum?: BrowserEip1993Provider;
|
|
430
|
-
};
|
|
431
|
-
keplr?: {
|
|
432
|
-
ethereum?: BrowserEip1993Provider;
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
interface EIP6963ProviderInfo {
|
|
436
|
-
rdns: string;
|
|
437
|
-
uuid: string;
|
|
438
|
-
name: string;
|
|
439
|
-
icon: string;
|
|
440
|
-
}
|
|
441
|
-
interface EIP6963ProviderDetail {
|
|
442
|
-
info: EIP6963ProviderInfo;
|
|
443
|
-
provider: BrowserEip1993Provider;
|
|
444
|
-
}
|
|
445
|
-
type EIP6963AnnounceProviderEvent = {
|
|
446
|
-
detail: EIP6963ProviderDetail;
|
|
447
|
-
};
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/utils/wallet.d.ts
|
|
450
|
-
declare const isEvmWallet: (wallet: Wallet) => boolean;
|
|
451
|
-
declare const isCosmosWallet: (wallet: Wallet) => boolean;
|
|
452
|
-
declare const isEvmBrowserWallet: (wallet: Wallet) => boolean;
|
|
453
|
-
declare const isCosmosBrowserWallet: (wallet: Wallet) => boolean;
|
|
454
|
-
declare const isEip712V2OnlyWallet: (wallet: Wallet) => boolean;
|
|
455
|
-
declare const isCosmosAminoOnlyWallet: (wallet: Wallet) => boolean;
|
|
456
|
-
//#endregion
|
|
457
|
-
//#region src/base.d.ts
|
|
458
|
-
declare abstract class BaseConcreteStrategy {
|
|
459
|
-
protected chainId: ChainId | CosmosChainId;
|
|
460
|
-
protected evmChainId?: EvmChainId;
|
|
461
|
-
protected listeners: Partial<Record<WalletEventListener, any>>;
|
|
462
|
-
metadata?: WalletMetadata;
|
|
463
|
-
/**
|
|
464
|
-
* Optional emitter passed from parent WalletStrategy.
|
|
465
|
-
* When provided, strategies emit events directly on the parent's emitter.
|
|
466
|
-
*/
|
|
467
|
-
protected emitter?: StrategyEmitter;
|
|
468
|
-
constructor(args: ConcreteWalletStrategyArgs | ConcreteEvmWalletStrategyArgs | ConcreteCosmosWalletStrategyArgs);
|
|
469
|
-
setMetadata(metadata?: WalletMetadata): void;
|
|
470
|
-
/**
|
|
471
|
-
* Emit an event from this strategy.
|
|
472
|
-
* If emitter was provided from parent, events go directly to parent.
|
|
473
|
-
*/
|
|
474
|
-
protected emit(event: WalletStrategyEmitterEventType, data?: Record<string, any>): void;
|
|
475
|
-
}
|
|
476
|
-
//#endregion
|
|
477
|
-
export { WalletConnectMetadata as A, Wallet as B, SendTransactionOptions as C, TurnkeyOAuthProvider as D, TurnkeyMetadata as E, onAccountChangeCallback as F, WalletConnectStrategyEventType as G, WalletDeviceType as H, onChainIdChangeCallback as I, WalletStrategyEmitterEvents as J, WalletStrategyEmitter as K, BroadcastMode as L, WalletStrategy as M, WalletStrategyArguments as N, TurnkeyProvider as O, WalletStrategyEvmOptions as P, EvmWalletProviderErrorCode as R, PrivateKeyMetadata as S, StrategyEmitter as T, WalletEventListener as U, WalletAction as V, StrategyEventType as W, ConcreteWalletStrategy as _, isEip712V2OnlyWallet as a, Eip1193Provider as b, BrowserEip1993Provider as c, EIP6963ProviderInfo as d, WindowWithEip1193Provider as f, ConcreteStrategiesArg as g, ConcreteEvmWalletStrategyArgs as h, isCosmosWallet as i, WalletMetadata as j, TurnkeySession as k, EIP6963AnnounceProviderEvent as l, ConcreteCosmosWalletStrategyArgs as m, isCosmosAminoOnlyWallet as n, isEvmBrowserWallet as o, ConcreteCosmosWalletStrategy as p, WalletStrategyEmitterEventType as q, isCosmosBrowserWallet as r, isEvmWallet as s, BaseConcreteStrategy as t, EIP6963ProviderDetail as u, ConcreteWalletStrategyArgs as v, StdSignDoc as w, MagicMetadata as x, CosmosWalletAbstraction as y, MagicProvider as z };
|
|
402
|
+
export { WalletDeviceType as A, onAccountChangeCallback as C, MagicProvider as D, EvmWalletProviderErrorCode as E, WalletStrategyEmitterEventType as F, WalletStrategyEmitterEvents as I, StrategyEventType as M, WalletConnectStrategyEventType as N, Wallet as O, WalletStrategyEmitter as P, WalletStrategyEvmOptions as S, BroadcastMode as T, TurnkeySession as _, ConcreteWalletStrategy as a, WalletStrategy as b, Eip1193Provider as c, SendTransactionOptions as d, StdSignDoc as f, TurnkeyProvider as g, TurnkeyOAuthProvider as h, ConcreteStrategiesArg as i, WalletEventListener as j, WalletAction as k, MagicMetadata as l, TurnkeyMetadata as m, ConcreteCosmosWalletStrategyArgs as n, ConcreteWalletStrategyArgs as o, StrategyEmitter as p, ConcreteEvmWalletStrategyArgs as r, CosmosWalletAbstraction as s, ConcreteCosmosWalletStrategy as t, PrivateKeyMetadata as u, WalletConnectMetadata as v, onChainIdChangeCallback as w, WalletStrategyArguments as x, WalletMetadata as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-base",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.16",
|
|
4
4
|
"description": "Base wallet strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -53,6 +53,26 @@
|
|
|
53
53
|
"types": "./dist/cjs/light.d.cts",
|
|
54
54
|
"default": "./dist/cjs/light.cjs"
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
"./runtime-light": {
|
|
58
|
+
"react-native": {
|
|
59
|
+
"import": "./dist/esm/runtime-light.js",
|
|
60
|
+
"require": "./dist/cjs/runtime-light.cjs",
|
|
61
|
+
"types": "./dist/cjs/runtime-light.d.cts",
|
|
62
|
+
"default": "./dist/cjs/runtime-light.cjs"
|
|
63
|
+
},
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/cjs/runtime-light.d.cts",
|
|
66
|
+
"default": "./dist/cjs/runtime-light.cjs"
|
|
67
|
+
},
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./dist/esm/runtime-light.d.ts",
|
|
70
|
+
"default": "./dist/esm/runtime-light.js"
|
|
71
|
+
},
|
|
72
|
+
"default": {
|
|
73
|
+
"types": "./dist/cjs/runtime-light.d.cts",
|
|
74
|
+
"default": "./dist/cjs/runtime-light.cjs"
|
|
75
|
+
}
|
|
56
76
|
}
|
|
57
77
|
},
|
|
58
78
|
"main": "dist/cjs/index.cjs",
|
|
@@ -64,9 +84,9 @@
|
|
|
64
84
|
"dependencies": {
|
|
65
85
|
"eip1193-provider": "^1.0.1",
|
|
66
86
|
"viem": "^2.41.2",
|
|
67
|
-
"@injectivelabs/exceptions": "1.20.
|
|
68
|
-
"@injectivelabs/sdk-ts": "1.20.
|
|
69
|
-
"@injectivelabs/ts-types": "1.20.
|
|
87
|
+
"@injectivelabs/exceptions": "1.20.16",
|
|
88
|
+
"@injectivelabs/sdk-ts": "1.20.16",
|
|
89
|
+
"@injectivelabs/ts-types": "1.20.16"
|
|
70
90
|
},
|
|
71
91
|
"publishConfig": {
|
|
72
92
|
"access": "public"
|
|
File without changes
|