@imtbl/wallet 2.12.7-alpha.1 → 2.12.7-alpha.11
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/README.md +1 -31
- package/dist/browser/index.js +30 -204
- package/dist/node/index.cjs +55 -244
- package/dist/node/index.js +29 -203
- package/dist/types/confirmation/confirmation.d.ts +1 -1
- package/dist/types/connectWallet.d.ts +3 -2
- package/dist/types/constants.d.ts +0 -9
- package/dist/types/index.d.ts +2 -4
- package/dist/types/{network/presets.d.ts → presets.d.ts} +1 -55
- package/dist/types/types.d.ts +0 -12
- package/dist/types/zkEvm/types.d.ts +10 -3
- package/package.json +4 -9
- package/src/confirmation/confirmation.ts +4 -14
- package/src/connectWallet.test.ts +464 -58
- package/src/connectWallet.ts +40 -81
- package/src/constants.ts +0 -13
- package/src/guardian/index.ts +0 -2
- package/src/index.ts +2 -18
- package/src/presets.ts +92 -0
- package/src/types.ts +0 -16
- package/src/zkEvm/types.ts +10 -4
- package/dist/types/network/chainRegistry.d.ts +0 -13
- package/dist/types/sequence/sequenceProvider.d.ts +0 -21
- package/dist/types/sequence/signer/identityInstrumentSigner.d.ts +0 -15
- package/dist/types/sequence/signer/index.d.ts +0 -21
- package/dist/types/sequence/signer/privateKeySigner.d.ts +0 -15
- package/dist/types/sequence/signer/types.d.ts +0 -14
- package/dist/types/sequence/user/index.d.ts +0 -2
- package/dist/types/sequence/user/registerUser.d.ts +0 -18
- package/src/network/chainRegistry.test.ts +0 -64
- package/src/network/chainRegistry.ts +0 -74
- package/src/network/presets.ts +0 -185
- package/src/sequence/sequenceProvider.ts +0 -284
- package/src/sequence/signer/identityInstrumentSigner.ts +0 -195
- package/src/sequence/signer/index.ts +0 -41
- package/src/sequence/signer/privateKeySigner.ts +0 -112
- package/src/sequence/signer/types.ts +0 -24
- package/src/sequence/user/index.ts +0 -2
- package/src/sequence/user/registerUser.ts +0 -101
|
@@ -15,7 +15,7 @@ export default class ConfirmationScreen {
|
|
|
15
15
|
constructor(config: IAuthConfiguration);
|
|
16
16
|
private getHref;
|
|
17
17
|
requestConfirmation(transactionId: string, etherAddress: string, chainType: GeneratedClients.mr.TransactionApprovalRequestChainTypeEnum, chainId?: string): Promise<ConfirmationResult>;
|
|
18
|
-
requestMessageConfirmation(messageID: string, etherAddress: string, messageType
|
|
18
|
+
requestMessageConfirmation(messageID: string, etherAddress: string, messageType?: MessageType): Promise<ConfirmationResult>;
|
|
19
19
|
showServiceUnavailable(): Promise<void>;
|
|
20
20
|
loading(popupOptions?: {
|
|
21
21
|
width: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ZkEvmProvider } from './zkEvm/zkEvmProvider';
|
|
2
|
+
import { ConnectWalletOptions } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Connect wallet with the provided configuration
|
|
4
5
|
*
|
|
@@ -25,4 +26,4 @@ import { ConnectWalletOptions, Provider } from './types';
|
|
|
25
26
|
* const accounts = await provider.request({ method: 'eth_requestAccounts' });
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
|
-
export declare function connectWallet(config?: ConnectWalletOptions): Promise<
|
|
29
|
+
export declare function connectWallet(config?: ConnectWalletOptions): Promise<ZkEvmProvider>;
|
|
@@ -5,15 +5,6 @@
|
|
|
5
5
|
export declare const IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID = 13371;
|
|
6
6
|
/** Immutable zkEVM Testnet chain ID */
|
|
7
7
|
export declare const IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID = 13473;
|
|
8
|
-
/**
|
|
9
|
-
* Chain ID constants for Arbitrum networks
|
|
10
|
-
*/
|
|
11
|
-
/** Arbitrum One Mainnet chain ID */
|
|
12
|
-
export declare const ARBITRUM_ONE_CHAIN_ID = 42161;
|
|
13
|
-
/** Arbitrum Sepolia Testnet chain ID */
|
|
14
|
-
export declare const ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
|
|
15
|
-
/** Ethereum Sepolia Testnet chain ID */
|
|
16
|
-
export declare const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111;
|
|
17
8
|
/**
|
|
18
9
|
* Magic configuration for Immutable networks
|
|
19
10
|
* @internal
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { connectWallet } from './connectWallet';
|
|
2
|
-
export { IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID, IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID,
|
|
3
|
-
export { IMMUTABLE_ZKEVM_MAINNET, IMMUTABLE_ZKEVM_TESTNET, IMMUTABLE_ZKEVM_MULTICHAIN, IMMUTABLE_ZKEVM_MAINNET_CHAIN, IMMUTABLE_ZKEVM_TESTNET_CHAIN, DEFAULT_CHAINS,
|
|
4
|
-
export { getChainConfig, getEvmChainFromChainId } from './network/chainRegistry';
|
|
2
|
+
export { IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID, IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID, } from './constants';
|
|
3
|
+
export { IMMUTABLE_ZKEVM_MAINNET, IMMUTABLE_ZKEVM_TESTNET, IMMUTABLE_ZKEVM_MULTICHAIN, IMMUTABLE_ZKEVM_MAINNET_CHAIN, IMMUTABLE_ZKEVM_TESTNET_CHAIN, DEFAULT_CHAINS, } from './presets';
|
|
5
4
|
export { ZkEvmProvider } from './zkEvm/zkEvmProvider';
|
|
6
|
-
export { SequenceProvider } from './sequence/sequenceProvider';
|
|
7
5
|
export { WalletConfiguration } from './config';
|
|
8
6
|
export * from './types';
|
|
9
7
|
export { WalletError, WalletErrorType } from './errors';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainConfig } from '
|
|
1
|
+
import { ChainConfig } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Immutable zkEVM Mainnet chain configuration
|
|
4
4
|
*/
|
|
@@ -7,18 +7,6 @@ export declare const IMMUTABLE_ZKEVM_MAINNET_CHAIN: ChainConfig;
|
|
|
7
7
|
* Immutable zkEVM Testnet chain configuration
|
|
8
8
|
*/
|
|
9
9
|
export declare const IMMUTABLE_ZKEVM_TESTNET_CHAIN: ChainConfig;
|
|
10
|
-
/**
|
|
11
|
-
* Arbitrum One Mainnet chain configuration
|
|
12
|
-
*/
|
|
13
|
-
export declare const ARBITRUM_ONE_CHAIN: ChainConfig;
|
|
14
|
-
/**
|
|
15
|
-
* Arbitrum Sepolia Testnet chain configuration
|
|
16
|
-
*/
|
|
17
|
-
export declare const ARBITRUM_SEPOLIA_CHAIN: ChainConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Ethereum Sepolia Testnet chain configuration
|
|
20
|
-
*/
|
|
21
|
-
export declare const ETHEREUM_SEPOLIA_CHAIN: ChainConfig;
|
|
22
10
|
/**
|
|
23
11
|
* Default chains (testnet + mainnet)
|
|
24
12
|
* Testnet is first (default initial chain)
|
|
@@ -68,45 +56,3 @@ export declare const IMMUTABLE_ZKEVM_TESTNET: {
|
|
|
68
56
|
export declare const IMMUTABLE_ZKEVM_MULTICHAIN: {
|
|
69
57
|
chains: ChainConfig[];
|
|
70
58
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Arbitrum mainnet only preset
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* const provider = await connectWallet({
|
|
77
|
-
* ...ARBITRUM_ONE_MAINNET,
|
|
78
|
-
* auth,
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export declare const ARBITRUM_ONE: {
|
|
83
|
-
chains: ChainConfig[];
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Arbitrum testnet only preset
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```typescript
|
|
90
|
-
* const provider = await connectWallet({
|
|
91
|
-
* ...ARBITRUM_SEPOLIA,
|
|
92
|
-
* auth,
|
|
93
|
-
* });
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
export declare const ARBITRUM_SEPOLIA: {
|
|
97
|
-
chains: ChainConfig[];
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Ethereum Sepolia testnet only preset
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const provider = await connectWallet({
|
|
105
|
-
* ...ETHEREUM_SEPOLIA,
|
|
106
|
-
* auth,
|
|
107
|
-
* });
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare const ETHEREUM_SEPOLIA: {
|
|
111
|
-
chains: ChainConfig[];
|
|
112
|
-
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Flow } from '@imtbl/metrics';
|
|
2
2
|
import { TypedEventEmitter, User } from '@imtbl/auth';
|
|
3
3
|
import { JsonRpcError } from './zkEvm/JsonRpcError';
|
|
4
|
-
export declare enum EvmChain {
|
|
5
|
-
ZKEVM = "zkevm",
|
|
6
|
-
ARBITRUM_ONE = "arbitrum_one"
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* A viem-compatible signer interface for wallet operations.
|
|
10
6
|
* This replaces ethers' AbstractSigner/Signer.
|
|
@@ -166,14 +162,6 @@ export interface ChainConfig {
|
|
|
166
162
|
* Defaults to 'https://tee.express.magiclabs.com'
|
|
167
163
|
*/
|
|
168
164
|
magicTeeBasePath?: string;
|
|
169
|
-
/** Preferred token symbol for relayer fees (default: 'IMX') */
|
|
170
|
-
feeTokenSymbol?: string;
|
|
171
|
-
/** Sequence RPC node URL TODO: check if this can be removed and only use rpcUrl */
|
|
172
|
-
nodeUrl?: string;
|
|
173
|
-
/**
|
|
174
|
-
* Sequence Identity Instrument endpoint (for non-zkEVM chains in prod/sandbox)
|
|
175
|
-
*/
|
|
176
|
-
sequenceIdentityInstrumentEndpoint?: string;
|
|
177
165
|
}
|
|
178
166
|
/**
|
|
179
167
|
* Popup overlay options for wallet UI
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JsonRpcError } from './JsonRpcError';
|
|
2
|
-
import type { Provider as ProviderType } from '../types';
|
|
3
2
|
export declare enum RelayerTransactionStatus {
|
|
4
3
|
PENDING = "PENDING",
|
|
5
4
|
SUBMITTED = "SUBMITTED",
|
|
@@ -83,8 +82,16 @@ export interface JsonRpcResponsePayload {
|
|
|
83
82
|
jsonrpc?: string;
|
|
84
83
|
id?: string | number;
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
/**
|
|
86
|
+
* EIP-1193 Provider Interface
|
|
87
|
+
* Standard Ethereum provider interface
|
|
88
|
+
*/
|
|
89
|
+
export type Provider = {
|
|
90
|
+
request: (request: RequestArguments) => Promise<any>;
|
|
91
|
+
on: (event: string, listener: (...args: any[]) => void) => void;
|
|
92
|
+
removeListener: (event: string, listener: (...args: any[]) => void) => void;
|
|
93
|
+
isPassport: boolean;
|
|
94
|
+
};
|
|
88
95
|
export declare enum ProviderEvent {
|
|
89
96
|
ACCOUNTS_CHANGED = "accountsChanged"
|
|
90
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/wallet",
|
|
3
|
-
"version": "2.12.7-alpha.
|
|
3
|
+
"version": "2.12.7-alpha.11",
|
|
4
4
|
"description": "Wallet SDK for Immutable",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -25,16 +25,12 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@imtbl/auth": "2.12.7-alpha.
|
|
29
|
-
"@imtbl/generated-clients": "2.12.7-alpha.
|
|
30
|
-
"@imtbl/metrics": "2.12.7-alpha.
|
|
28
|
+
"@imtbl/auth": "2.12.7-alpha.11",
|
|
29
|
+
"@imtbl/generated-clients": "2.12.7-alpha.11",
|
|
30
|
+
"@imtbl/metrics": "2.12.7-alpha.11",
|
|
31
31
|
"viem": "~2.18.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@0xsequence/identity-instrument": "3.0.0-beta.10",
|
|
35
|
-
"@0xsequence/wallet-wdk": "3.0.0-beta.10",
|
|
36
|
-
"@0xsequence/wallet-core": "3.0.0-beta.10",
|
|
37
|
-
"@0xsequence/wallet-primitives": "3.0.0-beta.10",
|
|
38
34
|
"@swc/core": "^1.4.2",
|
|
39
35
|
"@swc/jest": "^0.2.37",
|
|
40
36
|
"@types/jest": "^29.5.12",
|
|
@@ -42,7 +38,6 @@
|
|
|
42
38
|
"@jest/test-sequencer": "^29.7.0",
|
|
43
39
|
"jest": "^29.7.0",
|
|
44
40
|
"jest-environment-jsdom": "^29.4.3",
|
|
45
|
-
"ox": "^0.9.17",
|
|
46
41
|
"ts-node": "^10.9.1",
|
|
47
42
|
"tsup": "^8.3.0",
|
|
48
43
|
"typescript": "^5.6.2"
|
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
import { openPopupCenter } from './popup';
|
|
11
11
|
import { IAuthConfiguration } from '@imtbl/auth';
|
|
12
12
|
import ConfirmationOverlay from '../overlay/confirmationOverlay';
|
|
13
|
-
import { getEvmChainFromChainId } from '../network/chainRegistry';
|
|
14
|
-
import { EvmChain } from '../types';
|
|
15
13
|
|
|
16
14
|
const CONFIRMATION_WINDOW_TITLE = 'Confirm this transaction';
|
|
17
15
|
const CONFIRMATION_WINDOW_HEIGHT = 720;
|
|
@@ -107,10 +105,7 @@ export default class ConfirmationScreen {
|
|
|
107
105
|
if (chainType === GeneratedClients.mr.TransactionApprovalRequestChainTypeEnum.Starkex) {
|
|
108
106
|
href = this.getHref('transaction', { transactionId, etherAddress, chainType });
|
|
109
107
|
} else {
|
|
110
|
-
|
|
111
|
-
const chain = chainId ? getEvmChainFromChainId(chainId) : EvmChain.ZKEVM;
|
|
112
|
-
const chainPath = chain.replace('_', '-');
|
|
113
|
-
href = this.getHref(`${chainPath}/transaction`, {
|
|
108
|
+
href = this.getHref('zkevm/transaction', {
|
|
114
109
|
transactionID: transactionId, etherAddress, chainType, chainID: chainId,
|
|
115
110
|
});
|
|
116
111
|
}
|
|
@@ -122,8 +117,7 @@ export default class ConfirmationScreen {
|
|
|
122
117
|
requestMessageConfirmation(
|
|
123
118
|
messageID: string,
|
|
124
119
|
etherAddress: string,
|
|
125
|
-
messageType
|
|
126
|
-
chainId: string,
|
|
120
|
+
messageType?: MessageType,
|
|
127
121
|
): Promise<ConfirmationResult> {
|
|
128
122
|
return new Promise((resolve, reject) => {
|
|
129
123
|
const messageHandler = ({ data, origin }: MessageEvent) => {
|
|
@@ -163,14 +157,10 @@ export default class ConfirmationScreen {
|
|
|
163
157
|
};
|
|
164
158
|
|
|
165
159
|
window.addEventListener('message', messageHandler);
|
|
166
|
-
|
|
167
|
-
const chain = getEvmChainFromChainId(chainId);
|
|
168
|
-
const chainPath = chain.replace('_', '-');
|
|
169
|
-
const href = this.getHref(`${chainPath}/message`, {
|
|
160
|
+
const href = this.getHref('zkevm/message', {
|
|
170
161
|
messageID,
|
|
171
162
|
etherAddress,
|
|
172
|
-
|
|
173
|
-
messageType,
|
|
163
|
+
...(messageType ? { messageType } : {}),
|
|
174
164
|
});
|
|
175
165
|
this.showConfirmationScreen(href, messageHandler, resolve);
|
|
176
166
|
});
|