@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.
Files changed (39) hide show
  1. package/README.md +1 -31
  2. package/dist/browser/index.js +30 -204
  3. package/dist/node/index.cjs +55 -244
  4. package/dist/node/index.js +29 -203
  5. package/dist/types/confirmation/confirmation.d.ts +1 -1
  6. package/dist/types/connectWallet.d.ts +3 -2
  7. package/dist/types/constants.d.ts +0 -9
  8. package/dist/types/index.d.ts +2 -4
  9. package/dist/types/{network/presets.d.ts → presets.d.ts} +1 -55
  10. package/dist/types/types.d.ts +0 -12
  11. package/dist/types/zkEvm/types.d.ts +10 -3
  12. package/package.json +4 -9
  13. package/src/confirmation/confirmation.ts +4 -14
  14. package/src/connectWallet.test.ts +1 -34
  15. package/src/connectWallet.ts +40 -81
  16. package/src/constants.ts +0 -13
  17. package/src/guardian/index.ts +0 -2
  18. package/src/index.ts +2 -18
  19. package/src/presets.ts +92 -0
  20. package/src/types.ts +0 -16
  21. package/src/zkEvm/types.ts +10 -4
  22. package/dist/types/network/chainRegistry.d.ts +0 -13
  23. package/dist/types/sequence/sequenceProvider.d.ts +0 -21
  24. package/dist/types/sequence/signer/identityInstrumentSigner.d.ts +0 -15
  25. package/dist/types/sequence/signer/index.d.ts +0 -21
  26. package/dist/types/sequence/signer/privateKeySigner.d.ts +0 -15
  27. package/dist/types/sequence/signer/types.d.ts +0 -14
  28. package/dist/types/sequence/user/index.d.ts +0 -2
  29. package/dist/types/sequence/user/registerUser.d.ts +0 -18
  30. package/src/network/chainRegistry.test.ts +0 -64
  31. package/src/network/chainRegistry.ts +0 -74
  32. package/src/network/presets.ts +0 -185
  33. package/src/sequence/sequenceProvider.ts +0 -284
  34. package/src/sequence/signer/identityInstrumentSigner.ts +0 -195
  35. package/src/sequence/signer/index.ts +0 -41
  36. package/src/sequence/signer/privateKeySigner.ts +0 -112
  37. package/src/sequence/signer/types.ts +0 -24
  38. package/src/sequence/user/index.ts +0 -2
  39. package/src/sequence/user/registerUser.ts +0 -101
@@ -1,284 +0,0 @@
1
- import {
2
- createPublicClient,
3
- http,
4
- toHex,
5
- type PublicClient,
6
- } from 'viem';
7
- import { MultiRollupApiClients } from '@imtbl/generated-clients';
8
- import { TypedEventEmitter, User } from '@imtbl/auth';
9
- import { trackFlow, trackError, identify } from '@imtbl/metrics';
10
- import {
11
- Provider,
12
- ProviderEvent,
13
- ProviderEventMap,
14
- RequestArguments,
15
- ChainConfig,
16
- EvmChain,
17
- GetUserFunction,
18
- } from '../types';
19
- import { JsonRpcError, ProviderErrorCode, RpcErrorCode } from '../zkEvm/JsonRpcError';
20
- import GuardianClient from '../guardian';
21
- import { SequenceSigner } from './signer';
22
- import { registerUser } from './user';
23
- import { getEvmChainFromChainId } from '../network/chainRegistry';
24
-
25
- export type SequenceProviderInput = {
26
- getUser: GetUserFunction;
27
- chainConfig: ChainConfig;
28
- multiRollupApiClients: MultiRollupApiClients;
29
- guardianClient: GuardianClient;
30
- ethSigner: SequenceSigner;
31
- passportEventEmitter: TypedEventEmitter<ProviderEventMap>;
32
- };
33
-
34
- /** Non-zkEVM chain type */
35
- type SequenceChain = Exclude<EvmChain, EvmChain.ZKEVM>;
36
-
37
- /**
38
- * Check if user is registered for a non-zkEVM chain.
39
- * The chain data is stored as user[chainName] (e.g., user.arbitrum_one).
40
- */
41
- function isUserRegisteredForChain(user: User, chain: SequenceChain): boolean {
42
- return chain in user && !!(user as any)[chain]?.ethAddress;
43
- }
44
-
45
- /**
46
- * Get the user's eth address for a non-zkEVM chain.
47
- */
48
- function getUserChainAddress(user: User, chain: SequenceChain): string | undefined {
49
- const chainData = (user as any)[chain];
50
- return chainData?.ethAddress;
51
- }
52
-
53
- export class SequenceProvider implements Provider {
54
- readonly #getUser: GetUserFunction;
55
-
56
- readonly #chainConfig: ChainConfig;
57
-
58
- readonly #multiRollupApiClients: MultiRollupApiClients;
59
-
60
- readonly #rpcProvider: PublicClient;
61
-
62
- readonly #providerEventEmitter: TypedEventEmitter<ProviderEventMap>;
63
-
64
- readonly #guardianClient: GuardianClient;
65
-
66
- readonly #ethSigner: SequenceSigner;
67
-
68
- readonly #evmChain: SequenceChain;
69
-
70
- public readonly isPassport: boolean = true;
71
-
72
- constructor({
73
- getUser,
74
- chainConfig,
75
- multiRollupApiClients,
76
- guardianClient,
77
- ethSigner,
78
- passportEventEmitter,
79
- }: SequenceProviderInput) {
80
- // Validate this is not a zkEVM chain
81
- const evmChain = getEvmChainFromChainId(chainConfig.chainId);
82
- if (evmChain === EvmChain.ZKEVM) {
83
- throw new Error('SequenceProvider cannot be used for zkEVM chains. Use ZkEvmProvider instead.');
84
- }
85
- this.#evmChain = evmChain;
86
-
87
- this.#getUser = getUser;
88
- this.#chainConfig = chainConfig;
89
- this.#multiRollupApiClients = multiRollupApiClients;
90
- this.#guardianClient = guardianClient;
91
- this.#ethSigner = ethSigner;
92
- this.#providerEventEmitter = passportEventEmitter;
93
-
94
- // Create PublicClient for reading from the chain using viem
95
- this.#rpcProvider = createPublicClient({
96
- transport: http(this.#chainConfig.rpcUrl),
97
- });
98
- }
99
-
100
- /**
101
- * Get the user's address for this chain if already registered.
102
- */
103
- async #getChainAddress(): Promise<string | undefined> {
104
- const user = await this.#getUser();
105
- if (user && isUserRegisteredForChain(user, this.#evmChain)) {
106
- return getUserChainAddress(user, this.#evmChain);
107
- }
108
- return undefined;
109
- }
110
-
111
- async #performRequest(request: RequestArguments): Promise<any> {
112
- switch (request.method) {
113
- case 'eth_requestAccounts': {
114
- // Check if already registered
115
- const existingAddress = await this.#getChainAddress();
116
- if (existingAddress) return [existingAddress];
117
-
118
- const flow = trackFlow('passport', 'ethRequestAccounts');
119
-
120
- try {
121
- const user = await this.#getUser();
122
- flow.addEvent('endGetUser');
123
-
124
- if (!user) {
125
- throw new JsonRpcError(
126
- RpcErrorCode.INTERNAL_ERROR,
127
- 'User not authenticated',
128
- );
129
- }
130
-
131
- let userEthAddress: string | undefined;
132
-
133
- if (!isUserRegisteredForChain(user, this.#evmChain)) {
134
- flow.addEvent('startUserRegistration');
135
-
136
- userEthAddress = await registerUser({
137
- getUser: this.#getUser,
138
- ethSigner: this.#ethSigner,
139
- multiRollupApiClients: this.#multiRollupApiClients,
140
- accessToken: user.accessToken,
141
- rpcProvider: this.#rpcProvider,
142
- flow,
143
- });
144
- flow.addEvent('endUserRegistration');
145
- } else {
146
- userEthAddress = getUserChainAddress(user, this.#evmChain);
147
- }
148
-
149
- if (!userEthAddress) {
150
- throw new JsonRpcError(
151
- RpcErrorCode.INTERNAL_ERROR,
152
- 'Failed to get user address after registration',
153
- );
154
- }
155
-
156
- this.#providerEventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [
157
- userEthAddress,
158
- ]);
159
- identify({
160
- passportId: user.profile.sub,
161
- });
162
- return [userEthAddress];
163
- } catch (error) {
164
- if (error instanceof Error) {
165
- trackError('passport', 'ethRequestAccounts', error, { flowId: flow.details.flowId });
166
- } else {
167
- flow.addEvent('errored');
168
- }
169
- throw error;
170
- } finally {
171
- flow.addEvent('End');
172
- }
173
- }
174
-
175
- case 'eth_accounts': {
176
- const address = await this.#getChainAddress();
177
- return address ? [address] : [];
178
- }
179
-
180
- // TODO: Implement eth_sendTransaction
181
- case 'eth_sendTransaction': {
182
- throw new JsonRpcError(
183
- ProviderErrorCode.UNSUPPORTED_METHOD,
184
- 'eth_sendTransaction not yet implemented for this chain',
185
- );
186
- }
187
-
188
- // TODO: Implement personal_sign
189
- case 'personal_sign': {
190
- throw new JsonRpcError(
191
- ProviderErrorCode.UNSUPPORTED_METHOD,
192
- 'personal_sign not yet implemented for this chain',
193
- );
194
- }
195
-
196
- // TODO: Implement eth_signTypedData
197
- case 'eth_signTypedData':
198
- case 'eth_signTypedData_v4': {
199
- throw new JsonRpcError(
200
- ProviderErrorCode.UNSUPPORTED_METHOD,
201
- 'eth_signTypedData not yet implemented for this chain',
202
- );
203
- }
204
-
205
- case 'eth_chainId': {
206
- const chainId = await this.#rpcProvider.getChainId();
207
- return toHex(chainId);
208
- }
209
-
210
- // Pass through methods
211
- case 'eth_getBalance':
212
- case 'eth_getCode':
213
- case 'eth_getTransactionCount': {
214
- const [address, blockNumber] = request.params || [];
215
- return this.#rpcProvider.request({
216
- method: request.method as any,
217
- params: [address, blockNumber || 'latest'],
218
- });
219
- }
220
-
221
- case 'eth_getStorageAt': {
222
- const [address, storageSlot, blockNumber] = request.params || [];
223
- return this.#rpcProvider.request({
224
- method: 'eth_getStorageAt',
225
- params: [address, storageSlot, blockNumber || 'latest'],
226
- });
227
- }
228
-
229
- case 'eth_call':
230
- case 'eth_estimateGas': {
231
- const [transaction, blockNumber] = request.params || [];
232
- return this.#rpcProvider.request({
233
- method: request.method as any,
234
- params: [transaction, blockNumber || 'latest'],
235
- });
236
- }
237
-
238
- case 'eth_gasPrice':
239
- case 'eth_blockNumber':
240
- case 'eth_getBlockByHash':
241
- case 'eth_getBlockByNumber':
242
- case 'eth_getTransactionByHash':
243
- case 'eth_getTransactionReceipt': {
244
- return this.#rpcProvider.request({
245
- method: request.method as any,
246
- params: (request.params || []) as any,
247
- });
248
- }
249
-
250
- default: {
251
- throw new JsonRpcError(
252
- ProviderErrorCode.UNSUPPORTED_METHOD,
253
- 'Method not supported',
254
- );
255
- }
256
- }
257
- }
258
-
259
- public async request(request: RequestArguments): Promise<any> {
260
- try {
261
- return this.#performRequest(request);
262
- } catch (error: unknown) {
263
- if (error instanceof JsonRpcError) {
264
- throw error;
265
- }
266
- if (error instanceof Error) {
267
- throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, error.message);
268
- }
269
-
270
- throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Internal error');
271
- }
272
- }
273
-
274
- public on(event: string, listener: (...args: any[]) => void): void {
275
- this.#providerEventEmitter.on(event, listener);
276
- }
277
-
278
- public removeListener(
279
- event: string,
280
- listener: (...args: any[]) => void,
281
- ): void {
282
- this.#providerEventEmitter.removeListener(event, listener);
283
- }
284
- }
@@ -1,195 +0,0 @@
1
- import { hashMessage, toHex, concat } from 'viem';
2
- import { Identity } from '@0xsequence/wallet-wdk';
3
- import { IdentityInstrument, IdTokenChallenge } from '@0xsequence/identity-instrument';
4
- import { WalletError, WalletErrorType } from '../../errors';
5
- import { User, decodeJwtPayload } from '@imtbl/auth';
6
- import { Hex, Address } from 'ox';
7
- import {
8
- Payload,
9
- Signature as SequenceSignature,
10
- } from '@0xsequence/wallet-primitives';
11
- import { SequenceSigner } from './types';
12
- import { GetUserFunction } from '../../types';
13
-
14
- interface IdTokenPayload {
15
- iss: string;
16
- aud: string;
17
- sub: string;
18
- }
19
-
20
- interface AuthKey {
21
- address: string;
22
- privateKey: CryptoKey;
23
- identitySigner: string;
24
- expiresAt: Date;
25
- }
26
-
27
- interface UserWallet {
28
- userIdentifier: string;
29
- signerAddress: string;
30
- authKey: AuthKey;
31
- identityInstrument: IdentityInstrument;
32
- }
33
-
34
- export interface IdentityInstrumentSignerConfig {
35
- /** Sequence Identity Instrument endpoint URL */
36
- identityInstrumentEndpoint: string;
37
- }
38
-
39
- export class IdentityInstrumentSigner implements SequenceSigner {
40
- readonly #getUser: GetUserFunction;
41
-
42
- readonly #config: IdentityInstrumentSignerConfig;
43
-
44
- #userWallet: UserWallet | null = null;
45
-
46
- #createWalletPromise: Promise<UserWallet> | null = null;
47
-
48
- constructor(getUser: GetUserFunction, config: IdentityInstrumentSignerConfig) {
49
- this.#getUser = getUser;
50
- this.#config = config;
51
- }
52
-
53
- async #getUserOrThrow(): Promise<User> {
54
- const user = await this.#getUser();
55
- if (!user) {
56
- throw new WalletError(
57
- 'User not authenticated',
58
- WalletErrorType.NOT_LOGGED_IN_ERROR,
59
- );
60
- }
61
- return user;
62
- }
63
-
64
- async #getUserWallet(): Promise<UserWallet> {
65
- let userWallet = this.#userWallet;
66
- if (!userWallet) {
67
- userWallet = await this.#createWallet();
68
- }
69
-
70
- const user = await this.#getUserOrThrow();
71
- if (user.profile.sub !== userWallet.userIdentifier) {
72
- userWallet = await this.#createWallet(user);
73
- }
74
-
75
- return userWallet;
76
- }
77
-
78
- async #createWallet(user?: User): Promise<UserWallet> {
79
- if (this.#createWalletPromise) return this.#createWalletPromise;
80
-
81
- this.#createWalletPromise = (async () => {
82
- try {
83
- this.#userWallet = null;
84
- // Force refresh to get latest user data including idToken
85
- await this.#getUser(true);
86
-
87
- const authenticatedUser = user || await this.#getUserOrThrow();
88
-
89
- if (!authenticatedUser.idToken) {
90
- throw new WalletError(
91
- 'User idToken not available',
92
- WalletErrorType.NOT_LOGGED_IN_ERROR,
93
- );
94
- }
95
-
96
- const { idToken } = authenticatedUser;
97
- const decoded = decodeJwtPayload<IdTokenPayload>(idToken);
98
- const issuer = decoded.iss;
99
- const audience = decoded.aud;
100
-
101
- const keyPair = await window.crypto.subtle.generateKey(
102
- { name: 'ECDSA', namedCurve: 'P-256' },
103
- false,
104
- ['sign', 'verify'],
105
- );
106
-
107
- const publicKey = await window.crypto.subtle.exportKey('raw', keyPair.publicKey);
108
- const authKey: AuthKey = {
109
- address: Hex.fromBytes(new Uint8Array(publicKey)),
110
- privateKey: keyPair.privateKey,
111
- identitySigner: '',
112
- expiresAt: new Date(Date.now() + 3600000),
113
- };
114
-
115
- const identityInstrument = new IdentityInstrument(
116
- this.#config.identityInstrumentEndpoint,
117
- '@14:test',
118
- );
119
- const challenge = new IdTokenChallenge(issuer, audience, idToken);
120
-
121
- await identityInstrument.commitVerifier(
122
- Identity.toIdentityAuthKey(authKey),
123
- challenge,
124
- );
125
-
126
- const result = await identityInstrument.completeAuth(
127
- Identity.toIdentityAuthKey(authKey),
128
- challenge,
129
- );
130
-
131
- const signerAddress = result.signer.address;
132
- authKey.identitySigner = signerAddress;
133
-
134
- this.#userWallet = {
135
- userIdentifier: authenticatedUser.profile.sub,
136
- signerAddress,
137
- authKey,
138
- identityInstrument,
139
- };
140
-
141
- return this.#userWallet;
142
- } catch (error) {
143
- const errorMessage = `Identity Instrument: Failed to create signer: ${(error as Error).message}`;
144
- throw new WalletError(errorMessage, WalletErrorType.WALLET_CONNECTION_ERROR);
145
- } finally {
146
- this.#createWalletPromise = null;
147
- }
148
- })();
149
-
150
- return this.#createWalletPromise;
151
- }
152
-
153
- async getAddress(): Promise<string> {
154
- const wallet = await this.#getUserWallet();
155
- return wallet.signerAddress;
156
- }
157
-
158
- async signPayload(
159
- walletAddress: Address.Address,
160
- chainId: number,
161
- payload: Payload.Parented,
162
- ): Promise<SequenceSignature.SignatureOfSignerLeaf> {
163
- const wallet = await this.#getUserWallet();
164
-
165
- const signer = new Identity.IdentitySigner(
166
- wallet.identityInstrument,
167
- wallet.authKey,
168
- );
169
-
170
- return signer.sign(walletAddress, chainId, payload);
171
- }
172
-
173
- async signMessage(message: string | Uint8Array): Promise<string> {
174
- const wallet = await this.#getUserWallet();
175
-
176
- const signer = new Identity.IdentitySigner(
177
- wallet.identityInstrument,
178
- wallet.authKey,
179
- );
180
-
181
- const messageBytes = typeof message === 'string'
182
- ? new TextEncoder().encode(message)
183
- : message;
184
- const digest = hashMessage({ raw: messageBytes });
185
-
186
- const signature = await signer.signDigest(Hex.toBytes(digest));
187
-
188
- // Format signature: r (32 bytes) + s (32 bytes) + v (1 byte)
189
- const r = toHex(signature.r, { size: 32 });
190
- const s = toHex(signature.s, { size: 32 });
191
- const v = toHex(signature.yParity + 27, { size: 1 });
192
-
193
- return concat([r, s, v]);
194
- }
195
- }
@@ -1,41 +0,0 @@
1
- import { SequenceSigner } from './types';
2
- import { IdentityInstrumentSigner } from './identityInstrumentSigner';
3
- import { PrivateKeySigner } from './privateKeySigner';
4
- import { GetUserFunction } from '../../types';
5
-
6
- export type { SequenceSigner } from './types';
7
- export { IdentityInstrumentSigner } from './identityInstrumentSigner';
8
- export type { IdentityInstrumentSignerConfig } from './identityInstrumentSigner';
9
- export { PrivateKeySigner } from './privateKeySigner';
10
-
11
- export interface CreateSequenceSignerConfig {
12
- /** Identity Instrument endpoint (required for prod/sandbox) */
13
- identityInstrumentEndpoint?: string;
14
- /** Whether this is a dev environment (uses PrivateKeySigner instead of IdentityInstrumentSigner) */
15
- isDevEnvironment?: boolean;
16
- }
17
-
18
- /**
19
- * Create the appropriate signer based on environment.
20
- * - Dev environment (behind VPN): uses PrivateKeySigner
21
- * - Prod/Sandbox: uses IdentityInstrumentSigner
22
- *
23
- * @param getUser - Function to get the current user
24
- * @param config - Signer configuration
25
- */
26
- export function createSequenceSigner(
27
- getUser: GetUserFunction,
28
- config: CreateSequenceSignerConfig = {},
29
- ): SequenceSigner {
30
- if (config.isDevEnvironment) {
31
- return new PrivateKeySigner(getUser);
32
- }
33
-
34
- if (!config.identityInstrumentEndpoint) {
35
- throw new Error('identityInstrumentEndpoint is required for non-dev environments');
36
- }
37
-
38
- return new IdentityInstrumentSigner(getUser, {
39
- identityInstrumentEndpoint: config.identityInstrumentEndpoint,
40
- });
41
- }
@@ -1,112 +0,0 @@
1
- import { keccak256, toBytes } from 'viem';
2
- import { privateKeyToAccount } from 'viem/accounts';
3
- import { WalletError, WalletErrorType } from '../../errors';
4
- import { User } from '@imtbl/auth';
5
- import { Signers } from '@0xsequence/wallet-core';
6
- import {
7
- Payload,
8
- Signature as SequenceSignature,
9
- } from '@0xsequence/wallet-primitives';
10
- import { SequenceSigner } from './types';
11
- import { Address } from 'ox';
12
- import { GetUserFunction } from '../../types';
13
-
14
- interface PrivateKeyWallet {
15
- userIdentifier: string;
16
- signerAddress: string;
17
- signer: Signers.Pk.Pk;
18
- privateKey: `0x${string}`;
19
- }
20
-
21
- /**
22
- * Private key signer for dev environments (behind VPN).
23
- * Uses a deterministic private key derived from the user's sub.
24
- */
25
- export class PrivateKeySigner implements SequenceSigner {
26
- readonly #getUser: GetUserFunction;
27
-
28
- #privateKeyWallet: PrivateKeyWallet | null = null;
29
-
30
- #createWalletPromise: Promise<PrivateKeyWallet> | null = null;
31
-
32
- constructor(getUser: GetUserFunction) {
33
- this.#getUser = getUser;
34
- }
35
-
36
- async #getUserOrThrow(): Promise<User> {
37
- const user = await this.#getUser();
38
- if (!user) {
39
- throw new WalletError('User not authenticated', WalletErrorType.NOT_LOGGED_IN_ERROR);
40
- }
41
- return user;
42
- }
43
-
44
- async #getWalletInstance(): Promise<PrivateKeyWallet> {
45
- let privateKeyWallet = this.#privateKeyWallet;
46
- if (!privateKeyWallet) {
47
- privateKeyWallet = await this.#createWallet();
48
- }
49
-
50
- const user = await this.#getUserOrThrow();
51
- if (user.profile.sub !== privateKeyWallet.userIdentifier) {
52
- privateKeyWallet = await this.#createWallet(user);
53
- }
54
-
55
- return privateKeyWallet;
56
- }
57
-
58
- async #createWallet(user?: User): Promise<PrivateKeyWallet> {
59
- if (this.#createWalletPromise) return this.#createWalletPromise;
60
-
61
- this.#createWalletPromise = (async () => {
62
- try {
63
- this.#privateKeyWallet = null;
64
- const authenticatedUser = user || (await this.#getUserOrThrow());
65
-
66
- const privateKeyHash = keccak256(toBytes(`${authenticatedUser.profile.sub}-sequence`));
67
- const signer = new Signers.Pk.Pk(privateKeyHash);
68
- const signerAddress = signer.address;
69
-
70
- this.#privateKeyWallet = {
71
- userIdentifier: authenticatedUser.profile.sub,
72
- signerAddress,
73
- signer,
74
- privateKey: privateKeyHash,
75
- };
76
-
77
- return this.#privateKeyWallet;
78
- } catch (error) {
79
- const errorMessage = `Failed to create private key wallet: ${(error as Error).message}`;
80
- throw new WalletError(errorMessage, WalletErrorType.WALLET_CONNECTION_ERROR);
81
- } finally {
82
- this.#createWalletPromise = null;
83
- }
84
- })();
85
-
86
- return this.#createWalletPromise;
87
- }
88
-
89
- async getAddress(): Promise<string> {
90
- const wallet = await this.#getWalletInstance();
91
- return wallet.signerAddress;
92
- }
93
-
94
- async signPayload(
95
- walletAddress: Address.Address,
96
- chainId: number,
97
- payload: Payload.Parented,
98
- ): Promise<SequenceSignature.SignatureOfSignerLeaf> {
99
- const pkWallet = await this.#getWalletInstance();
100
- return pkWallet.signer.sign(walletAddress, chainId, payload);
101
- }
102
-
103
- async signMessage(message: string | Uint8Array): Promise<string> {
104
- const pkWallet = await this.#getWalletInstance();
105
-
106
- // Use viem's account to sign
107
- const account = privateKeyToAccount(pkWallet.privateKey);
108
- const messageToSign = typeof message === 'string' ? message : { raw: message };
109
-
110
- return await account.signMessage({ message: messageToSign });
111
- }
112
- }
@@ -1,24 +0,0 @@
1
- import { Address } from 'ox';
2
- import {
3
- Payload,
4
- Signature as SequenceSignature,
5
- } from '@0xsequence/wallet-primitives';
6
-
7
- /**
8
- * Signer interface for Sequence wallet operations.
9
- * Used by non-zkEVM chains (e.g., Arbitrum).
10
- */
11
- export interface SequenceSigner {
12
- /** Get the signer's address */
13
- getAddress(): Promise<string>;
14
-
15
- /** Sign a Sequence payload (for transactions) */
16
- signPayload(
17
- walletAddress: Address.Address,
18
- chainId: number,
19
- payload: Payload.Parented,
20
- ): Promise<SequenceSignature.SignatureOfSignerLeaf>;
21
-
22
- /** Sign a message (EIP-191 personal_sign) */
23
- signMessage(message: string | Uint8Array): Promise<string>;
24
- }
@@ -1,2 +0,0 @@
1
- export { registerUser } from './registerUser';
2
- export type { RegisterUserInput } from './registerUser';