@imtbl/wallet 2.12.7-alpha.1 → 2.12.7-alpha.10
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 +1 -34
- 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
package/src/types.ts
CHANGED
|
@@ -2,11 +2,6 @@ import { Flow } from '@imtbl/metrics';
|
|
|
2
2
|
import { TypedEventEmitter, User } from '@imtbl/auth';
|
|
3
3
|
import { JsonRpcError } from './zkEvm/JsonRpcError';
|
|
4
4
|
|
|
5
|
-
export enum EvmChain {
|
|
6
|
-
ZKEVM = 'zkevm',
|
|
7
|
-
ARBITRUM_ONE = 'arbitrum_one',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
5
|
/**
|
|
11
6
|
* A viem-compatible signer interface for wallet operations.
|
|
12
7
|
* This replaces ethers' AbstractSigner/Signer.
|
|
@@ -206,17 +201,6 @@ export interface ChainConfig {
|
|
|
206
201
|
* Defaults to 'https://tee.express.magiclabs.com'
|
|
207
202
|
*/
|
|
208
203
|
magicTeeBasePath?: string;
|
|
209
|
-
|
|
210
|
-
/** Preferred token symbol for relayer fees (default: 'IMX') */
|
|
211
|
-
feeTokenSymbol?: string;
|
|
212
|
-
|
|
213
|
-
/** Sequence RPC node URL TODO: check if this can be removed and only use rpcUrl */
|
|
214
|
-
nodeUrl?: string;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Sequence Identity Instrument endpoint (for non-zkEVM chains in prod/sandbox)
|
|
218
|
-
*/
|
|
219
|
-
sequenceIdentityInstrumentEndpoint?: string;
|
|
220
204
|
}
|
|
221
205
|
|
|
222
206
|
/**
|
package/src/zkEvm/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JsonRpcError } from './JsonRpcError';
|
|
2
|
-
import type { Provider as ProviderType } from '../types';
|
|
3
2
|
|
|
4
3
|
export enum RelayerTransactionStatus {
|
|
5
4
|
PENDING = 'PENDING',
|
|
@@ -92,9 +91,16 @@ export interface JsonRpcResponsePayload {
|
|
|
92
91
|
id?: string | number;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
/**
|
|
95
|
+
* EIP-1193 Provider Interface
|
|
96
|
+
* Standard Ethereum provider interface
|
|
97
|
+
*/
|
|
98
|
+
export type Provider = {
|
|
99
|
+
request: (request: RequestArguments) => Promise<any>;
|
|
100
|
+
on: (event: string, listener: (...args: any[]) => void) => void;
|
|
101
|
+
removeListener: (event: string, listener: (...args: any[]) => void) => void;
|
|
102
|
+
isPassport: boolean;
|
|
103
|
+
};
|
|
98
104
|
|
|
99
105
|
export enum ProviderEvent {
|
|
100
106
|
ACCOUNTS_CHANGED = 'accountsChanged',
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Environment } from '@imtbl/config';
|
|
2
|
-
import { ChainConfig, EvmChain } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Get chain config for non-zkEVM chains
|
|
5
|
-
* @throws Error if chain is not in registry
|
|
6
|
-
*/
|
|
7
|
-
export declare function getChainConfig(chain: Exclude<EvmChain, EvmChain.ZKEVM>, environment: Environment): ChainConfig;
|
|
8
|
-
/**
|
|
9
|
-
* Get EvmChain from chainId
|
|
10
|
-
* @param chainId - Chain ID (can be number or string like "eip155:42161")
|
|
11
|
-
* @returns EvmChain enum value, defaults to ZKEVM if not found
|
|
12
|
-
*/
|
|
13
|
-
export declare function getEvmChainFromChainId(chainId: string | number): EvmChain;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { MultiRollupApiClients } from '@imtbl/generated-clients';
|
|
2
|
-
import { TypedEventEmitter } from '@imtbl/auth';
|
|
3
|
-
import { Provider, ProviderEventMap, RequestArguments, ChainConfig, GetUserFunction } from '../types';
|
|
4
|
-
import GuardianClient from '../guardian';
|
|
5
|
-
import { SequenceSigner } from './signer';
|
|
6
|
-
export type SequenceProviderInput = {
|
|
7
|
-
getUser: GetUserFunction;
|
|
8
|
-
chainConfig: ChainConfig;
|
|
9
|
-
multiRollupApiClients: MultiRollupApiClients;
|
|
10
|
-
guardianClient: GuardianClient;
|
|
11
|
-
ethSigner: SequenceSigner;
|
|
12
|
-
passportEventEmitter: TypedEventEmitter<ProviderEventMap>;
|
|
13
|
-
};
|
|
14
|
-
export declare class SequenceProvider implements Provider {
|
|
15
|
-
#private;
|
|
16
|
-
readonly isPassport: boolean;
|
|
17
|
-
constructor({ getUser, chainConfig, multiRollupApiClients, guardianClient, ethSigner, passportEventEmitter, }: SequenceProviderInput);
|
|
18
|
-
request(request: RequestArguments): Promise<any>;
|
|
19
|
-
on(event: string, listener: (...args: any[]) => void): void;
|
|
20
|
-
removeListener(event: string, listener: (...args: any[]) => void): void;
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Address } from 'ox';
|
|
2
|
-
import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives';
|
|
3
|
-
import { SequenceSigner } from './types';
|
|
4
|
-
import { GetUserFunction } from '../../types';
|
|
5
|
-
export interface IdentityInstrumentSignerConfig {
|
|
6
|
-
/** Sequence Identity Instrument endpoint URL */
|
|
7
|
-
identityInstrumentEndpoint: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class IdentityInstrumentSigner implements SequenceSigner {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(getUser: GetUserFunction, config: IdentityInstrumentSignerConfig);
|
|
12
|
-
getAddress(): Promise<string>;
|
|
13
|
-
signPayload(walletAddress: Address.Address, chainId: number, payload: Payload.Parented): Promise<SequenceSignature.SignatureOfSignerLeaf>;
|
|
14
|
-
signMessage(message: string | Uint8Array): Promise<string>;
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SequenceSigner } from './types';
|
|
2
|
-
import { GetUserFunction } from '../../types';
|
|
3
|
-
export type { SequenceSigner } from './types';
|
|
4
|
-
export { IdentityInstrumentSigner } from './identityInstrumentSigner';
|
|
5
|
-
export type { IdentityInstrumentSignerConfig } from './identityInstrumentSigner';
|
|
6
|
-
export { PrivateKeySigner } from './privateKeySigner';
|
|
7
|
-
export interface CreateSequenceSignerConfig {
|
|
8
|
-
/** Identity Instrument endpoint (required for prod/sandbox) */
|
|
9
|
-
identityInstrumentEndpoint?: string;
|
|
10
|
-
/** Whether this is a dev environment (uses PrivateKeySigner instead of IdentityInstrumentSigner) */
|
|
11
|
-
isDevEnvironment?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Create the appropriate signer based on environment.
|
|
15
|
-
* - Dev environment (behind VPN): uses PrivateKeySigner
|
|
16
|
-
* - Prod/Sandbox: uses IdentityInstrumentSigner
|
|
17
|
-
*
|
|
18
|
-
* @param getUser - Function to get the current user
|
|
19
|
-
* @param config - Signer configuration
|
|
20
|
-
*/
|
|
21
|
-
export declare function createSequenceSigner(getUser: GetUserFunction, config?: CreateSequenceSignerConfig): SequenceSigner;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives';
|
|
2
|
-
import { SequenceSigner } from './types';
|
|
3
|
-
import { Address } from 'ox';
|
|
4
|
-
import { GetUserFunction } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* Private key signer for dev environments (behind VPN).
|
|
7
|
-
* Uses a deterministic private key derived from the user's sub.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PrivateKeySigner implements SequenceSigner {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(getUser: GetUserFunction);
|
|
12
|
-
getAddress(): Promise<string>;
|
|
13
|
-
signPayload(walletAddress: Address.Address, chainId: number, payload: Payload.Parented): Promise<SequenceSignature.SignatureOfSignerLeaf>;
|
|
14
|
-
signMessage(message: string | Uint8Array): Promise<string>;
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Address } from 'ox';
|
|
2
|
-
import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives';
|
|
3
|
-
/**
|
|
4
|
-
* Signer interface for Sequence wallet operations.
|
|
5
|
-
* Used by non-zkEVM chains (e.g., Arbitrum).
|
|
6
|
-
*/
|
|
7
|
-
export interface SequenceSigner {
|
|
8
|
-
/** Get the signer's address */
|
|
9
|
-
getAddress(): Promise<string>;
|
|
10
|
-
/** Sign a Sequence payload (for transactions) */
|
|
11
|
-
signPayload(walletAddress: Address.Address, chainId: number, payload: Payload.Parented): Promise<SequenceSignature.SignatureOfSignerLeaf>;
|
|
12
|
-
/** Sign a message (EIP-191 personal_sign) */
|
|
13
|
-
signMessage(message: string | Uint8Array): Promise<string>;
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { MultiRollupApiClients } from '@imtbl/generated-clients';
|
|
2
|
-
import { Flow } from '@imtbl/metrics';
|
|
3
|
-
import type { PublicClient } from 'viem';
|
|
4
|
-
import { SequenceSigner } from '../signer';
|
|
5
|
-
import { GetUserFunction } from '../../types';
|
|
6
|
-
export type RegisterUserInput = {
|
|
7
|
-
getUser: GetUserFunction;
|
|
8
|
-
ethSigner: SequenceSigner;
|
|
9
|
-
multiRollupApiClients: MultiRollupApiClients;
|
|
10
|
-
accessToken: string;
|
|
11
|
-
rpcProvider: PublicClient;
|
|
12
|
-
flow: Flow;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Register a user for a non-zkEVM chain (e.g., Arbitrum).
|
|
16
|
-
* Creates a counterfactual address for the user on the specified chain.
|
|
17
|
-
*/
|
|
18
|
-
export declare function registerUser({ getUser, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterUserInput): Promise<string>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Environment } from '@imtbl/config';
|
|
2
|
-
import { getChainConfig, getEvmChainFromChainId } from './chainRegistry';
|
|
3
|
-
import { EvmChain } from '../types';
|
|
4
|
-
import { ARBITRUM_ONE_CHAIN, ETHEREUM_SEPOLIA_CHAIN } from './presets';
|
|
5
|
-
|
|
6
|
-
describe('chainRegistry', () => {
|
|
7
|
-
describe('getChainConfig', () => {
|
|
8
|
-
it('returns Arbitrum One mainnet config for PRODUCTION', () => {
|
|
9
|
-
const config = getChainConfig(EvmChain.ARBITRUM_ONE, Environment.PRODUCTION);
|
|
10
|
-
|
|
11
|
-
expect(config).toEqual(ARBITRUM_ONE_CHAIN);
|
|
12
|
-
expect(config.chainId).toBe(42161);
|
|
13
|
-
expect(config.name).toBe('Arbitrum One');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('returns Ethereum Sepolia config for SANDBOX', () => {
|
|
17
|
-
const config = getChainConfig(EvmChain.ARBITRUM_ONE, Environment.SANDBOX);
|
|
18
|
-
|
|
19
|
-
expect(config).toEqual(ETHEREUM_SEPOLIA_CHAIN);
|
|
20
|
-
expect(config.chainId).toBe(11155111);
|
|
21
|
-
expect(config.name).toBe('Ethereum Sepolia');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('throws error for unsupported chain', () => {
|
|
25
|
-
expect(() => {
|
|
26
|
-
getChainConfig('unsupported_chain' as any, Environment.PRODUCTION);
|
|
27
|
-
}).toThrow('Chain unsupported_chain is not supported');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('getEvmChainFromChainId', () => {
|
|
32
|
-
it('returns ZKEVM for mainnet chainId', () => {
|
|
33
|
-
expect(getEvmChainFromChainId(13371)).toBe(EvmChain.ZKEVM);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('returns ZKEVM for testnet chainId', () => {
|
|
37
|
-
expect(getEvmChainFromChainId(13473)).toBe(EvmChain.ZKEVM);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('returns ZKEVM for devnet chainId', () => {
|
|
41
|
-
expect(getEvmChainFromChainId(15003)).toBe(EvmChain.ZKEVM);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('returns ARBITRUM_ONE for Arbitrum mainnet chainId', () => {
|
|
45
|
-
expect(getEvmChainFromChainId(42161)).toBe(EvmChain.ARBITRUM_ONE);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('returns ARBITRUM_ONE for Ethereum Sepolia chainId', () => {
|
|
49
|
-
expect(getEvmChainFromChainId(11155111)).toBe(EvmChain.ARBITRUM_ONE);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('handles string chainId', () => {
|
|
53
|
-
expect(getEvmChainFromChainId('42161')).toBe(EvmChain.ARBITRUM_ONE);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('handles eip155 format chainId', () => {
|
|
57
|
-
expect(getEvmChainFromChainId('eip155:42161')).toBe(EvmChain.ARBITRUM_ONE);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('defaults to ZKEVM for unknown chainId', () => {
|
|
61
|
-
expect(getEvmChainFromChainId(99999)).toBe(EvmChain.ZKEVM);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Environment } from '@imtbl/config';
|
|
2
|
-
import { ChainConfig, EvmChain } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
IMMUTABLE_ZKEVM_MAINNET_CHAIN,
|
|
5
|
-
IMMUTABLE_ZKEVM_TESTNET_CHAIN,
|
|
6
|
-
ARBITRUM_ONE_CHAIN,
|
|
7
|
-
ETHEREUM_SEPOLIA_CHAIN,
|
|
8
|
-
} from './presets';
|
|
9
|
-
import { ChainId } from './chains';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Registry mapping (EvmChain, Environment) to ChainConfig
|
|
13
|
-
*/
|
|
14
|
-
const CHAIN_REGISTRY: Record<EvmChain, Record<Environment, ChainConfig>> = {
|
|
15
|
-
[EvmChain.ZKEVM]: {
|
|
16
|
-
[Environment.PRODUCTION]: IMMUTABLE_ZKEVM_MAINNET_CHAIN,
|
|
17
|
-
[Environment.SANDBOX]: IMMUTABLE_ZKEVM_TESTNET_CHAIN,
|
|
18
|
-
},
|
|
19
|
-
[EvmChain.ARBITRUM_ONE]: {
|
|
20
|
-
[Environment.PRODUCTION]: ARBITRUM_ONE_CHAIN,
|
|
21
|
-
[Environment.SANDBOX]: ETHEREUM_SEPOLIA_CHAIN,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Build chainId → EvmChain mapping from CHAIN_REGISTRY (derived, not manual)
|
|
27
|
-
*/
|
|
28
|
-
function buildChainIdToEvmChainMap(): Record<number, EvmChain> {
|
|
29
|
-
const map: Record<number, EvmChain> = {};
|
|
30
|
-
for (const [evmChain, envConfigs] of Object.entries(CHAIN_REGISTRY)) {
|
|
31
|
-
for (const config of Object.values(envConfigs)) {
|
|
32
|
-
map[config.chainId] = evmChain as EvmChain;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Devnet doesn't have a preset
|
|
36
|
-
map[ChainId.IMTBL_ZKEVM_DEVNET] = EvmChain.ZKEVM;
|
|
37
|
-
return map;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const CHAIN_ID_TO_EVM_CHAIN = buildChainIdToEvmChainMap();
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get chain config for non-zkEVM chains
|
|
44
|
-
* @throws Error if chain is not in registry
|
|
45
|
-
*/
|
|
46
|
-
export function getChainConfig(
|
|
47
|
-
chain: Exclude<EvmChain, EvmChain.ZKEVM>,
|
|
48
|
-
environment: Environment,
|
|
49
|
-
): ChainConfig {
|
|
50
|
-
const envConfigs = CHAIN_REGISTRY[chain];
|
|
51
|
-
if (!envConfigs) {
|
|
52
|
-
throw new Error(`Chain ${chain} is not supported`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const config = envConfigs[environment];
|
|
56
|
-
if (!config) {
|
|
57
|
-
throw new Error(`Chain ${chain} is not configured for environment ${environment}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return config;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get EvmChain from chainId
|
|
65
|
-
* @param chainId - Chain ID (can be number or string like "eip155:42161")
|
|
66
|
-
* @returns EvmChain enum value, defaults to ZKEVM if not found
|
|
67
|
-
*/
|
|
68
|
-
export function getEvmChainFromChainId(chainId: string | number): EvmChain {
|
|
69
|
-
const numericChainId = typeof chainId === 'string'
|
|
70
|
-
? parseInt(chainId.includes(':') ? chainId.split(':')[1] : chainId, 10)
|
|
71
|
-
: chainId;
|
|
72
|
-
|
|
73
|
-
return CHAIN_ID_TO_EVM_CHAIN[numericChainId] ?? EvmChain.ZKEVM;
|
|
74
|
-
}
|
package/src/network/presets.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { ChainConfig } from '../types';
|
|
2
|
-
import {
|
|
3
|
-
IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID,
|
|
4
|
-
IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID,
|
|
5
|
-
ARBITRUM_ONE_CHAIN_ID,
|
|
6
|
-
ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
7
|
-
ETHEREUM_SEPOLIA_CHAIN_ID,
|
|
8
|
-
MAGIC_CONFIG,
|
|
9
|
-
} from '../constants';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Immutable zkEVM Mainnet chain configuration
|
|
13
|
-
*/
|
|
14
|
-
export const IMMUTABLE_ZKEVM_MAINNET_CHAIN: ChainConfig = {
|
|
15
|
-
chainId: IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID,
|
|
16
|
-
name: 'Immutable zkEVM',
|
|
17
|
-
rpcUrl: 'https://rpc.immutable.com',
|
|
18
|
-
relayerUrl: 'https://api.immutable.com/relayer-mr',
|
|
19
|
-
apiUrl: 'https://api.immutable.com',
|
|
20
|
-
passportDomain: 'https://passport.immutable.com',
|
|
21
|
-
magicPublishableApiKey: MAGIC_CONFIG[IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID].magicPublishableApiKey,
|
|
22
|
-
magicProviderId: MAGIC_CONFIG[IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID].magicProviderId,
|
|
23
|
-
magicTeeBasePath: 'https://tee.express.magiclabs.com',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Immutable zkEVM Testnet chain configuration
|
|
28
|
-
*/
|
|
29
|
-
export const IMMUTABLE_ZKEVM_TESTNET_CHAIN: ChainConfig = {
|
|
30
|
-
chainId: IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID,
|
|
31
|
-
name: 'Immutable zkEVM Testnet',
|
|
32
|
-
rpcUrl: 'https://rpc.testnet.immutable.com',
|
|
33
|
-
relayerUrl: 'https://api.sandbox.immutable.com/relayer-mr',
|
|
34
|
-
apiUrl: 'https://api.sandbox.immutable.com',
|
|
35
|
-
passportDomain: 'https://passport.sandbox.immutable.com',
|
|
36
|
-
magicPublishableApiKey: MAGIC_CONFIG[IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID].magicPublishableApiKey,
|
|
37
|
-
magicProviderId: MAGIC_CONFIG[IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID].magicProviderId,
|
|
38
|
-
magicTeeBasePath: 'https://tee.express.magiclabs.com',
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Arbitrum One Mainnet chain configuration
|
|
43
|
-
*/
|
|
44
|
-
export const ARBITRUM_ONE_CHAIN: ChainConfig = {
|
|
45
|
-
chainId: ARBITRUM_ONE_CHAIN_ID,
|
|
46
|
-
name: 'Arbitrum One',
|
|
47
|
-
rpcUrl: 'https://arb1.arbitrum.io/rpc',
|
|
48
|
-
relayerUrl: 'https://next-arbitrum-one-relayer.sequence.app',
|
|
49
|
-
nodeUrl: 'https://next-nodes.sequence.app/arbitrum-one',
|
|
50
|
-
apiUrl: 'https://api.immutable.com',
|
|
51
|
-
passportDomain: 'https://passport.immutable.com',
|
|
52
|
-
feeTokenSymbol: 'ETH',
|
|
53
|
-
sequenceIdentityInstrumentEndpoint: 'https://next-identity.sequence.app',
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Arbitrum Sepolia Testnet chain configuration
|
|
58
|
-
*/
|
|
59
|
-
export const ARBITRUM_SEPOLIA_CHAIN: ChainConfig = {
|
|
60
|
-
chainId: ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
61
|
-
name: 'Arbitrum Sepolia',
|
|
62
|
-
rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
|
|
63
|
-
relayerUrl: 'https://next-arbitrum-sepolia-relayer.sequence.app',
|
|
64
|
-
nodeUrl: 'https://next-nodes.sequence.app/arbitrum-sepolia',
|
|
65
|
-
apiUrl: 'https://api.sandbox.immutable.com',
|
|
66
|
-
passportDomain: 'https://passport.sandbox.immutable.com',
|
|
67
|
-
feeTokenSymbol: 'ETH',
|
|
68
|
-
sequenceIdentityInstrumentEndpoint: 'https://next-identity.sequence-dev.app',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Ethereum Sepolia Testnet chain configuration
|
|
73
|
-
*/
|
|
74
|
-
export const ETHEREUM_SEPOLIA_CHAIN: ChainConfig = {
|
|
75
|
-
chainId: ETHEREUM_SEPOLIA_CHAIN_ID,
|
|
76
|
-
name: 'Ethereum Sepolia',
|
|
77
|
-
rpcUrl: 'https://rpc.sepolia.org',
|
|
78
|
-
relayerUrl: 'https://next-sepolia-relayer.sequence.app',
|
|
79
|
-
nodeUrl: 'https://next-nodes.sequence.app/sepolia',
|
|
80
|
-
apiUrl: 'https://api.sandbox.immutable.com',
|
|
81
|
-
passportDomain: 'https://passport.sandbox.immutable.com',
|
|
82
|
-
feeTokenSymbol: 'ETH',
|
|
83
|
-
sequenceIdentityInstrumentEndpoint: 'https://next-identity.sequence-dev.app',
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Default chains (testnet + mainnet)
|
|
88
|
-
* Testnet is first (default initial chain)
|
|
89
|
-
*/
|
|
90
|
-
export const DEFAULT_CHAINS: ChainConfig[] = [
|
|
91
|
-
IMMUTABLE_ZKEVM_TESTNET_CHAIN,
|
|
92
|
-
IMMUTABLE_ZKEVM_MAINNET_CHAIN,
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Mainnet only preset
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* const provider = await connectWallet({
|
|
101
|
-
* ...IMMUTABLE_ZKEVM_MAINNET,
|
|
102
|
-
* auth,
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
export const IMMUTABLE_ZKEVM_MAINNET = {
|
|
107
|
-
chains: [IMMUTABLE_ZKEVM_MAINNET_CHAIN],
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Testnet only preset
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* const provider = await connectWallet({
|
|
116
|
-
* ...IMMUTABLE_ZKEVM_TESTNET,
|
|
117
|
-
* auth,
|
|
118
|
-
* });
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export const IMMUTABLE_ZKEVM_TESTNET = {
|
|
122
|
-
chains: [IMMUTABLE_ZKEVM_TESTNET_CHAIN],
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Multi-chain preset (testnet + mainnet)
|
|
127
|
-
* Defaults to testnet as initial chain
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const provider = await connectWallet({
|
|
132
|
-
* ...IMMUTABLE_ZKEVM_MULTICHAIN,
|
|
133
|
-
* auth,
|
|
134
|
-
* initialChainId: IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID, // Optional: start on mainnet
|
|
135
|
-
* });
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
export const IMMUTABLE_ZKEVM_MULTICHAIN = {
|
|
139
|
-
chains: DEFAULT_CHAINS,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Arbitrum mainnet only preset
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const provider = await connectWallet({
|
|
148
|
-
* ...ARBITRUM_ONE_MAINNET,
|
|
149
|
-
* auth,
|
|
150
|
-
* });
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
export const ARBITRUM_ONE = {
|
|
154
|
-
chains: [ARBITRUM_ONE_CHAIN],
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Arbitrum testnet only preset
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```typescript
|
|
162
|
-
* const provider = await connectWallet({
|
|
163
|
-
* ...ARBITRUM_SEPOLIA,
|
|
164
|
-
* auth,
|
|
165
|
-
* });
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
export const ARBITRUM_SEPOLIA = {
|
|
169
|
-
chains: [ARBITRUM_SEPOLIA_CHAIN],
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Ethereum Sepolia testnet only preset
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```typescript
|
|
177
|
-
* const provider = await connectWallet({
|
|
178
|
-
* ...ETHEREUM_SEPOLIA,
|
|
179
|
-
* auth,
|
|
180
|
-
* });
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
export const ETHEREUM_SEPOLIA = {
|
|
184
|
-
chains: [ETHEREUM_SEPOLIA_CHAIN],
|
|
185
|
-
};
|