@imtbl/wallet 2.12.6 → 2.12.7-alpha.1

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.
@@ -5,30 +5,24 @@ import { ConnectWalletOptions, Provider } from './types';
5
5
  * @param config - Wallet configuration
6
6
  * @returns EIP-1193 compliant provider with multi-chain support
7
7
  *
8
- * If no Auth instance is provided, a default Immutable-hosted client id will be used.
8
+ * If getUser is not provided, a default implementation using @imtbl/auth will be created.
9
9
  *
10
- * @example
10
+ * @example Using external auth (e.g., NextAuth)
11
11
  * ```typescript
12
- * import { Auth } from '@imtbl/auth';
13
- * import { connectWallet, IMMUTABLE_ZKEVM_MAINNET_CHAIN } from '@imtbl/wallet';
12
+ * import { connectWallet } from '@imtbl/wallet';
13
+ * import { useImmutableSession } from '@imtbl/auth-next-client';
14
14
  *
15
- * // Create auth
16
- * const auth = new Auth({
17
- * authenticationDomain: 'https://auth.immutable.com',
18
- * passportDomain: 'https://passport.immutable.com',
19
- * clientId: 'your-client-id',
20
- * redirectUri: 'https://your-app.com/callback',
21
- * scope: 'openid profile email offline_access transact',
22
- * });
15
+ * const { getUser } = useImmutableSession();
16
+ * const provider = await connectWallet({ getUser });
17
+ * ```
23
18
  *
24
- * // Connect wallet (defaults to testnet + mainnet, starts on testnet)
25
- * const provider = await connectWallet({ auth });
19
+ * @example Using default auth (simplest setup)
20
+ * ```typescript
21
+ * import { connectWallet } from '@imtbl/wallet';
26
22
  *
27
- * // Or specify a single chain
28
- * const provider = await connectWallet({
29
- * auth,
30
- * chains: [IMMUTABLE_ZKEVM_MAINNET_CHAIN],
31
- * });
23
+ * // Uses default Immutable-hosted authentication
24
+ * const provider = await connectWallet();
25
+ * const accounts = await provider.request({ method: 'eth_requestAccounts' });
32
26
  * ```
33
27
  */
34
28
  export declare function connectWallet(config?: ConnectWalletOptions): Promise<Provider>;
@@ -1,12 +1,13 @@
1
1
  import * as GeneratedClients from '@imtbl/generated-clients';
2
- import { Auth, IAuthConfiguration } from '@imtbl/auth';
3
2
  import { MetaTransaction, TypedDataPayload } from '../zkEvm/types';
4
3
  import { WalletConfiguration } from '../config';
4
+ import type { GetUserFunction } from '../types';
5
5
  export type GuardianClientParams = {
6
6
  config: WalletConfiguration;
7
- auth: Auth;
7
+ getUser: GetUserFunction;
8
8
  guardianApi: GeneratedClients.mr.GuardianApi;
9
- authConfig: IAuthConfiguration;
9
+ passportDomain: string;
10
+ clientId: string;
10
11
  };
11
12
  type GuardianEVMTxnEvaluationParams = {
12
13
  chainId: string;
@@ -27,8 +28,12 @@ export default class GuardianClient {
27
28
  private readonly guardianApi;
28
29
  private readonly confirmationScreen;
29
30
  private readonly crossSdkBridgeEnabled;
30
- private readonly auth;
31
- constructor({ config, auth, guardianApi, authConfig, }: GuardianClientParams);
31
+ private readonly getUser;
32
+ constructor({ config, getUser, guardianApi, passportDomain, clientId, }: GuardianClientParams);
33
+ /**
34
+ * Get zkEvm user using getUser function.
35
+ */
36
+ private getUserZkEvm;
32
37
  /**
33
38
  * Open confirmation screen and close it automatically if the
34
39
  * underlying task fails.
@@ -1,16 +1,15 @@
1
1
  import { MagicTeeApiClients } from '@imtbl/generated-clients';
2
- import { Auth } from '@imtbl/auth';
3
- import { WalletSigner } from '../types';
2
+ import { WalletSigner, GetUserFunction } from '../types';
4
3
  /**
5
4
  * MagicTEESigner implements the WalletSigner interface for Magic TEE-based signing.
6
5
  * This signer delegates cryptographic operations to the Magic TEE service.
7
6
  */
8
7
  export default class MagicTEESigner implements WalletSigner {
9
- private readonly auth;
8
+ private readonly getUser;
10
9
  private readonly magicTeeApiClient;
11
10
  private userWallet;
12
11
  private createWalletPromise;
13
- constructor(auth: Auth, magicTeeApiClient: MagicTeeApiClients);
12
+ constructor(getUser: GetUserFunction, magicTeeApiClient: MagicTeeApiClients);
14
13
  private getUserWallet;
15
14
  /**
16
15
  * This method calls the createWallet endpoint. The user's wallet must be created before it can be used to sign messages.
@@ -1,10 +1,10 @@
1
1
  import { MultiRollupApiClients } from '@imtbl/generated-clients';
2
- import { Auth, TypedEventEmitter } from '@imtbl/auth';
3
- import { Provider, ProviderEventMap, RequestArguments, ChainConfig } from '../types';
2
+ import { TypedEventEmitter } from '@imtbl/auth';
3
+ import { Provider, ProviderEventMap, RequestArguments, ChainConfig, GetUserFunction } from '../types';
4
4
  import GuardianClient from '../guardian';
5
5
  import { SequenceSigner } from './signer';
6
6
  export type SequenceProviderInput = {
7
- auth: Auth;
7
+ getUser: GetUserFunction;
8
8
  chainConfig: ChainConfig;
9
9
  multiRollupApiClients: MultiRollupApiClients;
10
10
  guardianClient: GuardianClient;
@@ -14,7 +14,7 @@ export type SequenceProviderInput = {
14
14
  export declare class SequenceProvider implements Provider {
15
15
  #private;
16
16
  readonly isPassport: boolean;
17
- constructor({ auth, chainConfig, multiRollupApiClients, guardianClient, ethSigner, passportEventEmitter, }: SequenceProviderInput);
17
+ constructor({ getUser, chainConfig, multiRollupApiClients, guardianClient, ethSigner, passportEventEmitter, }: SequenceProviderInput);
18
18
  request(request: RequestArguments): Promise<any>;
19
19
  on(event: string, listener: (...args: any[]) => void): void;
20
20
  removeListener(event: string, listener: (...args: any[]) => void): void;
@@ -1,14 +1,14 @@
1
- import { Auth } from '@imtbl/auth';
2
1
  import { Address } from 'ox';
3
2
  import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives';
4
3
  import { SequenceSigner } from './types';
4
+ import { GetUserFunction } from '../../types';
5
5
  export interface IdentityInstrumentSignerConfig {
6
6
  /** Sequence Identity Instrument endpoint URL */
7
7
  identityInstrumentEndpoint: string;
8
8
  }
9
9
  export declare class IdentityInstrumentSigner implements SequenceSigner {
10
10
  #private;
11
- constructor(auth: Auth, config: IdentityInstrumentSignerConfig);
11
+ constructor(getUser: GetUserFunction, config: IdentityInstrumentSignerConfig);
12
12
  getAddress(): Promise<string>;
13
13
  signPayload(walletAddress: Address.Address, chainId: number, payload: Payload.Parented): Promise<SequenceSignature.SignatureOfSignerLeaf>;
14
14
  signMessage(message: string | Uint8Array): Promise<string>;
@@ -1,5 +1,5 @@
1
- import { Auth, IAuthConfiguration } from '@imtbl/auth';
2
1
  import { SequenceSigner } from './types';
2
+ import { GetUserFunction } from '../../types';
3
3
  export type { SequenceSigner } from './types';
4
4
  export { IdentityInstrumentSigner } from './identityInstrumentSigner';
5
5
  export type { IdentityInstrumentSignerConfig } from './identityInstrumentSigner';
@@ -7,14 +7,15 @@ export { PrivateKeySigner } from './privateKeySigner';
7
7
  export interface CreateSequenceSignerConfig {
8
8
  /** Identity Instrument endpoint (required for prod/sandbox) */
9
9
  identityInstrumentEndpoint?: string;
10
+ /** Whether this is a dev environment (uses PrivateKeySigner instead of IdentityInstrumentSigner) */
11
+ isDevEnvironment?: boolean;
10
12
  }
11
13
  /**
12
14
  * Create the appropriate signer based on environment.
13
15
  * - Dev environment (behind VPN): uses PrivateKeySigner
14
16
  * - Prod/Sandbox: uses IdentityInstrumentSigner
15
17
  *
16
- * @param auth - Auth instance
17
- * @param authConfig - Auth configuration (to determine environment)
18
+ * @param getUser - Function to get the current user
18
19
  * @param config - Signer configuration
19
20
  */
20
- export declare function createSequenceSigner(auth: Auth, authConfig: IAuthConfiguration, config?: CreateSequenceSignerConfig): SequenceSigner;
21
+ export declare function createSequenceSigner(getUser: GetUserFunction, config?: CreateSequenceSignerConfig): SequenceSigner;
@@ -1,14 +1,14 @@
1
- import { Auth } from '@imtbl/auth';
2
1
  import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives';
3
2
  import { SequenceSigner } from './types';
4
3
  import { Address } from 'ox';
4
+ import { GetUserFunction } from '../../types';
5
5
  /**
6
6
  * Private key signer for dev environments (behind VPN).
7
7
  * Uses a deterministic private key derived from the user's sub.
8
8
  */
9
9
  export declare class PrivateKeySigner implements SequenceSigner {
10
10
  #private;
11
- constructor(auth: Auth);
11
+ constructor(getUser: GetUserFunction);
12
12
  getAddress(): Promise<string>;
13
13
  signPayload(walletAddress: Address.Address, chainId: number, payload: Payload.Parented): Promise<SequenceSignature.SignatureOfSignerLeaf>;
14
14
  signMessage(message: string | Uint8Array): Promise<string>;
@@ -1,10 +1,10 @@
1
1
  import { MultiRollupApiClients } from '@imtbl/generated-clients';
2
2
  import { Flow } from '@imtbl/metrics';
3
3
  import type { PublicClient } from 'viem';
4
- import { Auth } from '@imtbl/auth';
5
4
  import { SequenceSigner } from '../signer';
5
+ import { GetUserFunction } from '../../types';
6
6
  export type RegisterUserInput = {
7
- auth: Auth;
7
+ getUser: GetUserFunction;
8
8
  ethSigner: SequenceSigner;
9
9
  multiRollupApiClients: MultiRollupApiClients;
10
10
  accessToken: string;
@@ -15,4 +15,4 @@ export type RegisterUserInput = {
15
15
  * Register a user for a non-zkEVM chain (e.g., Arbitrum).
16
16
  * Creates a counterfactual address for the user on the specified chain.
17
17
  */
18
- export declare function registerUser({ auth, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterUserInput): Promise<string>;
18
+ export declare function registerUser({ getUser, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterUserInput): Promise<string>;
@@ -1,5 +1,5 @@
1
1
  import { Flow } from '@imtbl/metrics';
2
- import { Auth, TypedEventEmitter, type AuthEventMap } from '@imtbl/auth';
2
+ import { TypedEventEmitter, User } from '@imtbl/auth';
3
3
  import { JsonRpcError } from './zkEvm/JsonRpcError';
4
4
  export declare enum EvmChain {
5
5
  ZKEVM = "zkevm",
@@ -15,12 +15,12 @@ export interface WalletSigner {
15
15
  /** Sign a message (EIP-191 personal_sign) */
16
16
  signMessage(message: string | Uint8Array): Promise<`0x${string}`>;
17
17
  }
18
- export type { User, UserProfile, UserZkEvm, DirectLoginMethod, AuthEventMap, } from '@imtbl/auth';
18
+ export type { User, UserProfile, UserZkEvm, DirectLoginMethod, } from '@imtbl/auth';
19
19
  export { isUserZkEvm } from '@imtbl/auth';
20
20
  export type { RollupType } from '@imtbl/auth';
21
- export { AuthEvents } from '@imtbl/auth';
22
21
  export declare enum WalletEvents {
23
- ACCOUNTS_REQUESTED = "accountsRequested"
22
+ ACCOUNTS_REQUESTED = "accountsRequested",
23
+ LOGGED_OUT = "loggedOut"
24
24
  }
25
25
  export type AccountsRequestedEvent = {
26
26
  sessionActivityApiUrl: string;
@@ -29,9 +29,11 @@ export type AccountsRequestedEvent = {
29
29
  passportClient: string;
30
30
  flow?: Flow;
31
31
  };
32
- export interface PassportEventMap extends AuthEventMap {
32
+ export interface WalletEventMap extends Record<string, any> {
33
33
  [WalletEvents.ACCOUNTS_REQUESTED]: [AccountsRequestedEvent];
34
+ [WalletEvents.LOGGED_OUT]: [];
34
35
  }
36
+ export type PassportEventMap = WalletEventMap;
35
37
  /**
36
38
  * EIP-1193 Provider Interface
37
39
  * Standard Ethereum provider interface for all chain types
@@ -182,16 +184,44 @@ export interface PopupOverlayOptions {
182
184
  /** Disable the blocked popup overlay */
183
185
  disableBlockedPopupOverlay?: boolean;
184
186
  }
187
+ /**
188
+ * Function type for getting the current user.
189
+ * Used as an alternative to passing an Auth instance.
190
+ * This function should return fresh tokens from the session manager.
191
+ *
192
+ * @param forceRefresh - When true, the auth layer should trigger a server-side
193
+ * token refresh to get updated claims (e.g., after zkEVM registration).
194
+ * This ensures the returned user has the latest data from the identity provider.
195
+ */
196
+ export type GetUserFunction = (forceRefresh?: boolean) => Promise<User | null>;
185
197
  /**
186
198
  * Options for connecting a wallet via connectWallet()
187
199
  * High-level configuration that gets transformed into internal WalletConfiguration
188
200
  */
189
201
  export interface ConnectWalletOptions {
190
202
  /**
191
- * Auth instance. Optional if omitted, a default Auth instance
192
- * configured with Immutable hosted defaults will be created.
203
+ * Function that returns the current user with fresh tokens.
204
+ * This is the primary way to provide authentication to the wallet.
205
+ *
206
+ * For NextAuth integration:
207
+ * @example
208
+ * ```typescript
209
+ * import { connectWallet } from '@imtbl/wallet';
210
+ * import { useImmutableSession } from '@imtbl/auth-next-client';
211
+ *
212
+ * const { getUser } = useImmutableSession();
213
+ * const provider = await connectWallet({ getUser });
214
+ * ```
215
+ *
216
+ * If not provided, a default implementation using @imtbl/auth will be created.
217
+ */
218
+ getUser?: GetUserFunction;
219
+ /**
220
+ * Client ID for Immutable authentication.
221
+ * Required when getUser is not provided (for default auth).
222
+ * Also used for session activity tracking.
193
223
  */
194
- auth?: Auth;
224
+ clientId?: string;
195
225
  /**
196
226
  * Chain configurations (supports multi-chain)
197
227
  * Defaults to [IMMUTABLE_ZKEVM_TESTNET_CHAIN, IMMUTABLE_ZKEVM_MAINNET_CHAIN] if not provided
@@ -217,5 +247,5 @@ export interface ConnectWalletOptions {
217
247
  /**
218
248
  * @internal - Only used by Passport for internal event communication
219
249
  */
220
- passportEventEmitter?: TypedEventEmitter<PassportEventMap>;
250
+ passportEventEmitter?: TypedEventEmitter<WalletEventMap>;
221
251
  }
@@ -1,11 +1,11 @@
1
1
  import type { PublicClient, Hex } from 'viem';
2
- import { Auth } from '@imtbl/auth';
3
2
  import { WalletConfiguration } from '../config';
4
3
  import { FeeOption, RelayerTransaction, TypedDataPayload } from './types';
4
+ import type { GetUserFunction } from '../types';
5
5
  export type RelayerClientInput = {
6
6
  config: WalletConfiguration;
7
7
  rpcProvider: PublicClient;
8
- auth: Auth;
8
+ getUser: GetUserFunction;
9
9
  };
10
10
  type EthSendTransactionRequest = {
11
11
  method: 'eth_sendTransaction';
@@ -47,9 +47,13 @@ export type RelayerTransactionRequest = EthSendTransactionRequest | ImGetTransac
47
47
  export declare class RelayerClient {
48
48
  private readonly config;
49
49
  private readonly rpcProvider;
50
- private readonly auth;
51
- constructor({ config, rpcProvider, auth }: RelayerClientInput);
50
+ private readonly getUser;
51
+ constructor({ config, rpcProvider, getUser, }: RelayerClientInput);
52
52
  private static getResponsePreview;
53
+ /**
54
+ * Get zkEvm user using getUser function.
55
+ */
56
+ private getUserZkEvm;
53
57
  private postToRelayer;
54
58
  getPreferredFeeTokenSymbol(): string;
55
59
  ethSendTransaction(to: string, data: Hex | string): Promise<string>;
@@ -1,14 +1,17 @@
1
1
  import { MultiRollupApiClients } from '@imtbl/generated-clients';
2
2
  import { Flow } from '@imtbl/metrics';
3
3
  import type { PublicClient } from 'viem';
4
- import { Auth } from '@imtbl/auth';
5
- import type { WalletSigner } from '../../types';
4
+ import type { WalletSigner, GetUserFunction } from '../../types';
6
5
  export type RegisterZkEvmUserInput = {
7
- auth: Auth;
6
+ /**
7
+ * Function to get fresh user tokens. Used for triggering background refresh after registration.
8
+ * If not provided, no background refresh is performed.
9
+ */
10
+ getUser?: GetUserFunction;
8
11
  ethSigner: WalletSigner;
9
12
  multiRollupApiClients: MultiRollupApiClients;
10
13
  accessToken: string;
11
14
  rpcProvider: PublicClient;
12
15
  flow: Flow;
13
16
  };
14
- export declare function registerZkEvmUser({ auth, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterZkEvmUserInput): Promise<string>;
17
+ export declare function registerZkEvmUser({ getUser, ethSigner, multiRollupApiClients, accessToken, rpcProvider, flow, }: RegisterZkEvmUserInput): Promise<string>;
@@ -1,14 +1,22 @@
1
1
  import { MultiRollupApiClients } from '@imtbl/generated-clients';
2
2
  import { Provider, RequestArguments } from './types';
3
- import { Auth, TypedEventEmitter } from '@imtbl/auth';
3
+ import { TypedEventEmitter } from '@imtbl/auth';
4
4
  import { WalletConfiguration } from '../config';
5
- import { PassportEventMap, User, WalletSigner } from '../types';
5
+ import { WalletEventMap, User, WalletSigner, GetUserFunction } from '../types';
6
6
  import GuardianClient from '../guardian';
7
7
  export type ZkEvmProviderInput = {
8
- auth: Auth;
8
+ /**
9
+ * Function that returns the current user with fresh tokens.
10
+ * This is the primary way to provide authentication to the wallet.
11
+ */
12
+ getUser: GetUserFunction;
13
+ /**
14
+ * Client ID for session activity tracking.
15
+ */
16
+ clientId: string;
9
17
  config: WalletConfiguration;
10
18
  multiRollupApiClients: MultiRollupApiClients;
11
- passportEventEmitter: TypedEventEmitter<PassportEventMap>;
19
+ walletEventEmitter: TypedEventEmitter<WalletEventMap>;
12
20
  guardianClient: GuardianClient;
13
21
  ethSigner: WalletSigner;
14
22
  user: User | null;
@@ -17,7 +25,7 @@ export type ZkEvmProviderInput = {
17
25
  export declare class ZkEvmProvider implements Provider {
18
26
  #private;
19
27
  readonly isPassport: boolean;
20
- constructor({ auth, config, multiRollupApiClients, passportEventEmitter, guardianClient, ethSigner, user, sessionActivityApiUrl, }: ZkEvmProviderInput);
28
+ constructor({ getUser, clientId, config, multiRollupApiClients, walletEventEmitter, guardianClient, ethSigner, user, sessionActivityApiUrl, }: ZkEvmProviderInput);
21
29
  request(request: RequestArguments): Promise<any>;
22
30
  on(event: string, listener: (...args: any[]) => void): void;
23
31
  removeListener(event: string, listener: (...args: any[]) => void): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imtbl/wallet",
3
- "version": "2.12.6",
3
+ "version": "2.12.7-alpha.1",
4
4
  "description": "Wallet SDK for Immutable",
5
5
  "author": "Immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
@@ -25,9 +25,9 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@imtbl/auth": "2.12.6",
29
- "@imtbl/generated-clients": "2.12.6",
30
- "@imtbl/metrics": "2.12.6",
28
+ "@imtbl/auth": "2.12.7-alpha.1",
29
+ "@imtbl/generated-clients": "2.12.7-alpha.1",
30
+ "@imtbl/metrics": "2.12.7-alpha.1",
31
31
  "viem": "~2.18.0"
32
32
  },
33
33
  "devDependencies": {
@@ -35,12 +35,12 @@
35
35
  "@0xsequence/wallet-wdk": "3.0.0-beta.10",
36
36
  "@0xsequence/wallet-core": "3.0.0-beta.10",
37
37
  "@0xsequence/wallet-primitives": "3.0.0-beta.10",
38
- "@swc/core": "^1.3.36",
38
+ "@swc/core": "^1.4.2",
39
39
  "@swc/jest": "^0.2.37",
40
40
  "@types/jest": "^29.5.12",
41
- "@types/node": "^18.14.2",
41
+ "@types/node": "^22.10.7",
42
42
  "@jest/test-sequencer": "^29.7.0",
43
- "jest": "^29.4.3",
43
+ "jest": "^29.7.0",
44
44
  "jest-environment-jsdom": "^29.4.3",
45
45
  "ox": "^0.9.17",
46
46
  "ts-node": "^10.9.1",
@@ -9,6 +9,7 @@ jest.mock('@imtbl/auth', () => {
9
9
  },
10
10
  }),
11
11
  getUser: jest.fn().mockResolvedValue({ profile: { sub: 'user' } }),
12
+ getUserOrLogin: jest.fn().mockResolvedValue({ profile: { sub: 'user' }, accessToken: 'token' }),
12
13
  }));
13
14
 
14
15
  const TypedEventEmitter = jest.fn().mockImplementation(() => ({
@@ -79,20 +80,13 @@ const arbitrumChain = {
79
80
  relayerUrl: 'https://next-arbitrum-one-relayer.sequence.app',
80
81
  apiUrl: 'https://api.immutable.com',
81
82
  name: 'Arbitrum One',
83
+ sequenceIdentityInstrumentEndpoint: 'https://sequence.immutable.com',
82
84
  };
83
85
 
84
- const createAuthStub = () => ({
85
- getConfig: jest.fn().mockReturnValue({
86
- authenticationDomain: 'https://auth.immutable.com',
87
- passportDomain: 'https://passport.immutable.com',
88
- oidcConfiguration: {
89
- clientId: 'client',
90
- redirectUri: 'https://redirect',
91
- },
92
- }),
93
- getUser: jest.fn().mockResolvedValue({ profile: { sub: 'user' } }),
94
- loginCallback: jest.fn(),
95
- eventEmitter: { emit: jest.fn(), on: jest.fn() },
86
+ // Create a mock getUser function for tests
87
+ const createGetUserMock = () => jest.fn().mockResolvedValue({
88
+ profile: { sub: 'user' },
89
+ accessToken: 'token',
96
90
  });
97
91
 
98
92
  describe('connectWallet', () => {
@@ -101,9 +95,9 @@ describe('connectWallet', () => {
101
95
  });
102
96
 
103
97
  it('announces provider by default', async () => {
104
- const auth = createAuthStub();
98
+ const getUser = createGetUserMock();
105
99
 
106
- const provider = await connectWallet({ auth, chains: [zkEvmChain] });
100
+ const provider = await connectWallet({ getUser, chains: [zkEvmChain] });
107
101
 
108
102
  expect(ZkEvmProvider).toHaveBeenCalled();
109
103
  expect(announceProvider).toHaveBeenCalledWith({
@@ -113,25 +107,25 @@ describe('connectWallet', () => {
113
107
  });
114
108
 
115
109
  it('does not announce provider when disabled', async () => {
116
- const auth = createAuthStub();
110
+ const getUser = createGetUserMock();
117
111
 
118
- await connectWallet({ auth, chains: [zkEvmChain], announceProvider: false });
112
+ await connectWallet({ getUser, chains: [zkEvmChain], announceProvider: false });
119
113
 
120
114
  expect(announceProvider).not.toHaveBeenCalled();
121
115
  });
122
116
 
123
117
  describe('provider selection', () => {
124
118
  it('uses ZkEvmProvider for zkEVM chain (by chainId)', async () => {
125
- const auth = createAuthStub();
119
+ const getUser = createGetUserMock();
126
120
 
127
- await connectWallet({ auth, chains: [zkEvmChain] });
121
+ await connectWallet({ getUser, chains: [zkEvmChain] });
128
122
 
129
123
  expect(ZkEvmProvider).toHaveBeenCalled();
130
124
  expect(SequenceProvider).not.toHaveBeenCalled();
131
125
  });
132
126
 
133
127
  it('uses ZkEvmProvider for zkEVM devnet chain', async () => {
134
- const auth = createAuthStub();
128
+ const getUser = createGetUserMock();
135
129
  const devChain = {
136
130
  chainId: 15003, // zkEVM devnet chainId
137
131
  rpcUrl: 'https://rpc.dev.immutable.com',
@@ -142,16 +136,16 @@ describe('connectWallet', () => {
142
136
  magicProviderId: 'provider-123',
143
137
  };
144
138
 
145
- await connectWallet({ auth, chains: [devChain] });
139
+ await connectWallet({ getUser, chains: [devChain] });
146
140
 
147
141
  expect(ZkEvmProvider).toHaveBeenCalled();
148
142
  expect(SequenceProvider).not.toHaveBeenCalled();
149
143
  });
150
144
 
151
145
  it('uses SequenceProvider for non-zkEVM chain (Arbitrum)', async () => {
152
- const auth = createAuthStub();
146
+ const getUser = createGetUserMock();
153
147
 
154
- await connectWallet({ auth, chains: [arbitrumChain] });
148
+ await connectWallet({ getUser, chains: [arbitrumChain] });
155
149
 
156
150
  expect(SequenceProvider).toHaveBeenCalled();
157
151
  expect(ZkEvmProvider).not.toHaveBeenCalled();