@0xsequence/wallet-wdk 3.0.0-beta.17 → 3.0.0-beta.19

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 (79) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +4 -0
  3. package/.turbo/turbo-typecheck.log +4 -0
  4. package/CHANGELOG.md +24 -0
  5. package/dist/dbs/auth-commitments.d.ts.map +1 -1
  6. package/dist/dbs/auth-keys.d.ts.map +1 -1
  7. package/dist/dbs/messages.d.ts.map +1 -1
  8. package/dist/dbs/passkey-credentials.d.ts.map +1 -1
  9. package/dist/dbs/recovery.d.ts.map +1 -1
  10. package/dist/dbs/signatures.d.ts.map +1 -1
  11. package/dist/dbs/transactions.d.ts.map +1 -1
  12. package/dist/dbs/wallets.d.ts.map +1 -1
  13. package/dist/identity/signer.d.ts +1 -1
  14. package/dist/identity/signer.d.ts.map +1 -1
  15. package/dist/sequence/handlers/devices.d.ts +1 -1
  16. package/dist/sequence/handlers/devices.d.ts.map +1 -1
  17. package/dist/sequence/handlers/devices.js +1 -1
  18. package/dist/sequence/handlers/guard.d.ts +1 -1
  19. package/dist/sequence/handlers/guard.d.ts.map +1 -1
  20. package/dist/sequence/handlers/guard.js +22 -19
  21. package/dist/sequence/handlers/identity.d.ts.map +1 -1
  22. package/dist/sequence/handlers/mnemonic.d.ts.map +1 -1
  23. package/dist/sequence/handlers/mnemonic.js +21 -18
  24. package/dist/sequence/handlers/otp.d.ts.map +1 -1
  25. package/dist/sequence/handlers/otp.js +2 -1
  26. package/dist/sequence/handlers/passkeys.d.ts +1 -1
  27. package/dist/sequence/handlers/passkeys.d.ts.map +1 -1
  28. package/dist/sequence/handlers/passkeys.js +1 -1
  29. package/dist/sequence/handlers/recovery.js +1 -1
  30. package/dist/sequence/manager.d.ts +2 -0
  31. package/dist/sequence/manager.d.ts.map +1 -1
  32. package/dist/sequence/manager.js +2 -1
  33. package/dist/sequence/messages.js +1 -1
  34. package/dist/sequence/recovery.d.ts +2 -0
  35. package/dist/sequence/recovery.d.ts.map +1 -1
  36. package/dist/sequence/recovery.js +75 -14
  37. package/dist/sequence/signers.d.ts.map +1 -1
  38. package/dist/sequence/signers.js +3 -1
  39. package/dist/sequence/transactions.js +1 -1
  40. package/dist/sequence/wallets.d.ts +1 -1
  41. package/dist/sequence/wallets.d.ts.map +1 -1
  42. package/dist/sequence/wallets.js +17 -18
  43. package/eslint.config.js +12 -0
  44. package/package.json +15 -13
  45. package/src/dbs/auth-commitments.ts +1 -1
  46. package/src/dbs/auth-keys.ts +1 -1
  47. package/src/dbs/messages.ts +1 -1
  48. package/src/dbs/passkey-credentials.ts +1 -1
  49. package/src/dbs/recovery.ts +1 -1
  50. package/src/dbs/signatures.ts +1 -1
  51. package/src/dbs/transactions.ts +1 -1
  52. package/src/dbs/wallets.ts +1 -1
  53. package/src/identity/signer.ts +3 -3
  54. package/src/sequence/handlers/authcode-pkce.ts +1 -1
  55. package/src/sequence/handlers/devices.ts +1 -1
  56. package/src/sequence/handlers/guard.ts +6 -4
  57. package/src/sequence/handlers/identity.ts +1 -1
  58. package/src/sequence/handlers/mnemonic.ts +5 -3
  59. package/src/sequence/handlers/otp.ts +2 -1
  60. package/src/sequence/handlers/passkeys.ts +1 -1
  61. package/src/sequence/handlers/recovery.ts +1 -1
  62. package/src/sequence/manager.ts +3 -1
  63. package/src/sequence/messages.ts +1 -1
  64. package/src/sequence/recovery.ts +157 -52
  65. package/src/sequence/signers.ts +3 -1
  66. package/src/sequence/transactions.ts +1 -1
  67. package/src/sequence/wallets.ts +19 -20
  68. package/test/authcode-pkce.test.ts +2 -3
  69. package/test/authcode.test.ts +6 -8
  70. package/test/constants.ts +4 -2
  71. package/test/guard.test.ts +5 -5
  72. package/test/identity-signer.test.ts +1 -1
  73. package/test/otp.test.ts +1 -1
  74. package/test/passkeys.test.ts +1 -1
  75. package/test/recovery.test.ts +3 -3
  76. package/test/sessions.test.ts +1 -1
  77. package/test/{test-ssr-safety.mjs → test-ssr-safety.js} +143 -137
  78. package/test/transactions.test.ts +3 -3
  79. package/test/wallets.test.ts +5 -5
@@ -1,12 +1,16 @@
1
1
  import { Envelope } from '@0xsequence/wallet-core'
2
2
  import { Config, Constants, Extensions, GenericTree, Payload } from '@0xsequence/wallet-primitives'
3
- import { Address, Hex, Provider, RpcTransport } from 'ox'
3
+ import { Abi, AbiFunction, Address, Hex, Provider, RpcTransport } from 'ox'
4
4
  import { MnemonicHandler } from './handlers/mnemonic.js'
5
5
  import { Shared } from './manager.js'
6
6
  import { Actions, Module } from './types/index.js'
7
7
  import { QueuedRecoveryPayload } from './types/recovery.js'
8
8
  import { Kinds, RecoverySigner } from './types/signer.js'
9
9
 
10
+ const AGGREGATE3 = Abi.from([
11
+ 'function aggregate3((address target, bool allowFailure, bytes callData)[] calls) external payable returns ((bool success, bytes returnData)[])',
12
+ ])[0]!
13
+
10
14
  export interface RecoveryInterface {
11
15
  /**
12
16
  * Retrieves the list of configured recovery signers for a given wallet.
@@ -514,9 +518,16 @@ export class Recovery implements RecoveryInterface {
514
518
  async fetchQueuedPayloads(wallet: Address.Address, chainId?: number): Promise<QueuedRecoveryPayload[]> {
515
519
  // Create providers for each network
516
520
  const providers = this.shared.sequence.networks
517
- .filter((network) => (chainId ? network.chainId === chainId : true))
521
+ .filter((network) =>
522
+ chainId
523
+ ? network.chainId === chainId
524
+ : !this.shared.sequence.defaultRecoverySettings.includeTestnets
525
+ ? network.type !== 'testnet'
526
+ : true,
527
+ )
518
528
  .map((network) => ({
519
529
  chainId: network.chainId,
530
+ multicall3Address: network.contracts?.multicall3,
520
531
  provider: Provider.from(RpcTransport.fromHttp(network.rpcUrl)),
521
532
  }))
522
533
 
@@ -526,73 +537,167 @@ export class Recovery implements RecoveryInterface {
526
537
  return []
527
538
  }
528
539
 
540
+ const recoveryExtension = this.shared.sequence.extensions.recovery
529
541
  const payloads: QueuedRecoveryPayload[] = []
530
542
 
531
- for (const signer of signers) {
532
- for (const { chainId, provider } of providers) {
543
+ await Promise.all(
544
+ providers.map(async ({ chainId, provider, multicall3Address }) => {
533
545
  try {
534
- const totalPayloads = await Extensions.Recovery.totalQueuedPayloads(
535
- provider,
536
- this.shared.sequence.extensions.recovery,
537
- wallet,
538
- signer.address,
539
- )
540
-
541
- for (let i = 0n; i < totalPayloads; i++) {
542
- const payloadHash = await Extensions.Recovery.queuedPayloadHashOf(
543
- provider,
544
- this.shared.sequence.extensions.recovery,
545
- wallet,
546
- signer.address,
547
- i,
548
- )
549
-
550
- const timestamp = await Extensions.Recovery.timestampForQueuedPayload(
546
+ let totalPayloadsBySigner: bigint[]
547
+
548
+ if (multicall3Address) {
549
+ try {
550
+ // Batch all totalQueuedPayloads calls for every signer into a single Multicall3 request.
551
+ // This reduces N signer calls per network down to 1 call per network.
552
+ totalPayloadsBySigner = await this.fetchTotalQueuedPayloadsBatched(
553
+ provider,
554
+ recoveryExtension,
555
+ wallet,
556
+ signers,
557
+ multicall3Address,
558
+ )
559
+ } catch (err) {
560
+ console.error(
561
+ `Recovery.fetchQueuedPayloads multicall3 failed for chainId ${chainId}, retrying with individual calls:`,
562
+ err,
563
+ )
564
+ totalPayloadsBySigner = await this.fetchTotalQueuedPayloadsFallback(
565
+ provider,
566
+ recoveryExtension,
567
+ wallet,
568
+ signers,
569
+ )
570
+ }
571
+ } else {
572
+ totalPayloadsBySigner = await this.fetchTotalQueuedPayloadsFallback(
551
573
  provider,
552
- this.shared.sequence.extensions.recovery,
574
+ recoveryExtension,
553
575
  wallet,
554
- signer.address,
555
- payloadHash,
576
+ signers,
556
577
  )
578
+ }
557
579
 
558
- const payload = await this.shared.sequence.stateProvider.getPayload(payloadHash)
580
+ for (let s = 0; s < signers.length; s++) {
581
+ const signer = signers[s]!
582
+ const totalPayloads = totalPayloadsBySigner[s]!
583
+ if (totalPayloads === 0n) continue
584
+
585
+ // Only make individual calls for the rare case where payloads actually exist
586
+ for (let i = 0n; i < totalPayloads; i++) {
587
+ const payloadHash = await Extensions.Recovery.queuedPayloadHashOf(
588
+ provider,
589
+ recoveryExtension,
590
+ wallet,
591
+ signer.address,
592
+ i,
593
+ )
594
+
595
+ const timestamp = await Extensions.Recovery.timestampForQueuedPayload(
596
+ provider,
597
+ recoveryExtension,
598
+ wallet,
599
+ signer.address,
600
+ payloadHash,
601
+ )
602
+
603
+ const payload = await this.shared.sequence.stateProvider.getPayload(payloadHash)
604
+
605
+ // If ready, we need to check if it was executed already
606
+ // for this, we check if the wallet nonce for the given space
607
+ // is greater than the nonce in the payload
608
+ if (timestamp < Date.now() / 1000 && payload && Payload.isCalls(payload.payload)) {
609
+ const nonce = await this.shared.modules.wallets.getNonce(chainId, wallet, payload.payload.space)
610
+ if (nonce > i) {
611
+ continue
612
+ }
613
+ }
559
614
 
560
- // If ready, we need to check if it was executed already
561
- // for this, we check if the wallet nonce for the given space
562
- // is greater than the nonce in the payload
563
- if (timestamp < Date.now() / 1000 && payload && Payload.isCalls(payload.payload)) {
564
- const nonce = await this.shared.modules.wallets.getNonce(chainId, wallet, payload.payload.space)
565
- if (nonce > i) {
566
- continue
615
+ // The id is the index + signer address + chainId + wallet address
616
+ const id = `${i}-${signer.address}-${chainId}-${wallet}`
617
+
618
+ const payloadEntry: QueuedRecoveryPayload = {
619
+ id,
620
+ index: i,
621
+ recoveryModule: recoveryExtension,
622
+ wallet: wallet,
623
+ signer: signer.address,
624
+ chainId,
625
+ startTimestamp: timestamp,
626
+ endTimestamp: timestamp + signer.requiredDeltaTime,
627
+ payloadHash,
628
+ payload: payload?.payload,
567
629
  }
568
- }
569
630
 
570
- // The id is the index + signer address + chainId + wallet address
571
- const id = `${i}-${signer.address}-${chainId}-${wallet}`
572
-
573
- // Create a new payload
574
- const payloadEntry: QueuedRecoveryPayload = {
575
- id,
576
- index: i,
577
- recoveryModule: this.shared.sequence.extensions.recovery,
578
- wallet: wallet,
579
- signer: signer.address,
580
- chainId,
581
- startTimestamp: timestamp,
582
- endTimestamp: timestamp + signer.requiredDeltaTime,
583
- payloadHash,
584
- payload: payload?.payload,
631
+ payloads.push(payloadEntry)
585
632
  }
586
-
587
- payloads.push(payloadEntry)
588
633
  }
589
634
  } catch (err) {
590
- console.error('Recovery.fetchQueuedPayloads error', err)
635
+ console.error(`Recovery.fetchQueuedPayloads error for chainId ${chainId}:`, err)
591
636
  }
637
+ }),
638
+ )
639
+
640
+ return payloads
641
+ }
642
+
643
+ private async fetchTotalQueuedPayloadsBatched(
644
+ provider: Provider.Provider,
645
+ recoveryExtension: Address.Address,
646
+ wallet: Address.Address,
647
+ signers: RecoverySigner[],
648
+ multicall3Address: Address.Address,
649
+ ): Promise<bigint[]> {
650
+ const calls = signers.map((signer) => ({
651
+ target: recoveryExtension,
652
+ allowFailure: true,
653
+ callData: AbiFunction.encodeData(Extensions.Recovery.TOTAL_QUEUED_PAYLOADS, [wallet, signer.address]),
654
+ }))
655
+
656
+ const response = await provider.request({
657
+ method: 'eth_call',
658
+ params: [
659
+ {
660
+ to: multicall3Address,
661
+ data: AbiFunction.encodeData(AGGREGATE3, [calls]),
662
+ },
663
+ 'latest',
664
+ ],
665
+ })
666
+
667
+ const results = AbiFunction.decodeResult(AGGREGATE3, response) as readonly {
668
+ success: boolean
669
+ returnData: Hex.Hex
670
+ }[]
671
+
672
+ return results.map((result) => {
673
+ if (!result.success || result.returnData === '0x') {
674
+ return 0n
592
675
  }
676
+ return Hex.toBigInt(result.returnData)
677
+ })
678
+ }
679
+
680
+ private fetchTotalQueuedPayloadsFallback = async (
681
+ provider: Provider.Provider,
682
+ recoveryExtension: Address.Address,
683
+ wallet: Address.Address,
684
+ signers: RecoverySigner[],
685
+ ): Promise<bigint[]> => {
686
+ const result: bigint[] = signers.map(() => 0n)
687
+
688
+ // Fallback to individual calls if the multicall3 call fails
689
+ for (let s = 0; s < signers.length; s++) {
690
+ const signer = signers[s]!
691
+ const totalPayloads = await Extensions.Recovery.totalQueuedPayloads(
692
+ provider,
693
+ recoveryExtension,
694
+ wallet,
695
+ signer.address,
696
+ )
697
+ result[s] = totalPayloads
593
698
  }
594
699
 
595
- return payloads
700
+ return result
596
701
  }
597
702
 
598
703
  async encodeRecoverySignature(imageHash: Hex.Hex, signer: Address.Address) {
@@ -81,7 +81,9 @@ export class Signers {
81
81
  if (isWitnessExtraSignerKind(message)) {
82
82
  return toKnownKind(message.signerKind)
83
83
  }
84
- } catch {}
84
+ } catch {
85
+ // ignore
86
+ }
85
87
 
86
88
  return undefined
87
89
  }
@@ -496,7 +496,7 @@ export class Transactions implements TransactionsInterface {
496
496
  let tx: Transaction | undefined
497
497
  try {
498
498
  tx = await this.get(transactionOrSignatureId)
499
- } catch (e) {
499
+ } catch {
500
500
  // If not found, it might be a signature ID
501
501
  const signature = await this.shared.modules.signatures.get(transactionOrSignatureId)
502
502
  if (!signature) {
@@ -1,17 +1,16 @@
1
1
  import { Wallet as CoreWallet, Envelope, Signers, State } from '@0xsequence/wallet-core'
2
- import { Config, Constants, GenericTree, Payload, SessionConfig } from '@0xsequence/wallet-primitives'
2
+ import { Config, Constants, Payload } from '@0xsequence/wallet-primitives'
3
3
  import { Address, Hex, Provider, RpcTransport } from 'ox'
4
4
  import { AuthCommitment } from '../dbs/auth-commitments.js'
5
5
  import { AuthCodeHandler } from './handlers/authcode.js'
6
6
  import { MnemonicHandler } from './handlers/mnemonic.js'
7
7
  import { OtpHandler } from './handlers/otp.js'
8
- import { ManagerOptionsDefaults, Shared } from './manager.js'
8
+ import { Shared } from './manager.js'
9
9
  import { Device } from './types/device.js'
10
10
  import { Action, Module } from './types/index.js'
11
11
  import { Kinds, SignerWithKind, WitnessExtraSignerKind } from './types/signer.js'
12
12
  import { Wallet, WalletSelectionUiHandler } from './types/wallet.js'
13
13
  import { PasskeysHandler } from './handlers/passkeys.js'
14
- import { GuardRole } from './guards.js'
15
14
  import type { PasskeySigner } from './passkeys-provider.js'
16
15
 
17
16
  export type StartSignUpWithRedirectArgs = {
@@ -418,17 +417,17 @@ function buildCappedTree(members: { address: Address.Address; imageHash?: Hex.He
418
417
  } as Config.NestedLeaf
419
418
  }
420
419
 
421
- function buildCappedTreeFromTopology(weight: bigint, topology: Config.Topology): Config.Topology {
422
- // We may optimize this for some topology types
423
- // but it is not worth it, because the topology
424
- // that we will use for prod won't be optimizable
425
- return {
426
- type: 'nested',
427
- weight: weight,
428
- threshold: weight,
429
- tree: topology,
430
- }
431
- }
420
+ // function buildCappedTreeFromTopology(weight: bigint, topology: Config.Topology): Config.Topology {
421
+ // // We may optimize this for some topology types
422
+ // // but it is not worth it, because the topology
423
+ // // that we will use for prod won't be optimizable
424
+ // return {
425
+ // type: 'nested',
426
+ // weight: weight,
427
+ // threshold: weight,
428
+ // tree: topology,
429
+ // }
430
+ // }
432
431
 
433
432
  function toConfig(
434
433
  checkpoint: bigint,
@@ -626,7 +625,7 @@ export class Wallets implements WalletsInterface {
626
625
  loginEmail?: string
627
626
  }> {
628
627
  switch (args.kind) {
629
- case 'passkey':
628
+ case 'passkey': {
630
629
  const passkeySigner = await this.shared.passkeyProvider.create(this.shared.sequence.extensions, {
631
630
  stateProvider: this.shared.sequence.stateProvider,
632
631
  credentialName: args.name,
@@ -639,8 +638,9 @@ export class Wallets implements WalletsInterface {
639
638
  signerKind: Kinds.LoginPasskey,
640
639
  },
641
640
  }
641
+ }
642
642
 
643
- case 'mnemonic':
643
+ case 'mnemonic': {
644
644
  const mnemonicSigner = MnemonicHandler.toSigner(args.mnemonic)
645
645
  if (!mnemonicSigner) {
646
646
  throw new Error('invalid-mnemonic')
@@ -654,6 +654,7 @@ export class Wallets implements WalletsInterface {
654
654
  signerKind: Kinds.LoginMnemonic,
655
655
  },
656
656
  }
657
+ }
657
658
 
658
659
  case 'email-otp': {
659
660
  const handler = this.shared.handlers.get(Kinds.LoginEmailOtp) as OtpHandler
@@ -835,7 +836,7 @@ export class Wallets implements WalletsInterface {
835
836
  const sessionsGuardTopology = args.noGuard ? undefined : this.shared.modules.guards.topology('sessions')
836
837
 
837
838
  // Add modules
838
- let modules: Module[] = []
839
+ const modules: Module[] = []
839
840
 
840
841
  if (!args.noSessionManager) {
841
842
  const identitySigners = [device.address]
@@ -1044,8 +1045,6 @@ export class Wallets implements WalletsInterface {
1044
1045
  })
1045
1046
 
1046
1047
  return requestId
1047
- } catch (error) {
1048
- throw error
1049
1048
  } finally {
1050
1049
  this.pendingMnemonicOrPasskeyLogin = undefined
1051
1050
  }
@@ -1235,7 +1234,7 @@ export class Wallets implements WalletsInterface {
1235
1234
  return requestId
1236
1235
  }
1237
1236
 
1238
- async completeLogout(requestId: string, options?: { skipValidateSave?: boolean }) {
1237
+ async completeLogout(requestId: string, _options?: { skipValidateSave?: boolean }) {
1239
1238
  const request = await this.shared.modules.signatures.get(requestId)
1240
1239
  const walletEntry = await this.shared.databases.manager.get(request.wallet)
1241
1240
  if (!walletEntry) {
@@ -1,5 +1,4 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { Address, Hex, Bytes } from 'ox'
3
2
  import * as Identity from '@0xsequence/identity-instrument'
4
3
  import { AuthCodePkceHandler } from '../src/sequence/handlers/authcode-pkce.js'
5
4
  import { Signatures } from '../src/sequence/signatures.js'
@@ -68,7 +67,7 @@ describe('AuthCodePkceHandler', () => {
68
67
  handler.setRedirectUri('https://example.com/auth/callback')
69
68
 
70
69
  // Mock inherited methods
71
- vi.spyOn(handler as any, 'nitroCommitVerifier').mockImplementation(async (challenge) => {
70
+ vi.spyOn(handler as any, 'nitroCommitVerifier').mockImplementation(async () => {
72
71
  return {
73
72
  verifier: 'mock-verifier-code',
74
73
  loginHint: 'user@example.com',
@@ -76,7 +75,7 @@ describe('AuthCodePkceHandler', () => {
76
75
  }
77
76
  })
78
77
 
79
- vi.spyOn(handler as any, 'nitroCompleteAuth').mockImplementation(async (challenge) => {
78
+ vi.spyOn(handler as any, 'nitroCompleteAuth').mockImplementation(async () => {
80
79
  return {
81
80
  signer: mockIdentitySigner,
82
81
  email: 'user@example.com',
@@ -1,5 +1,5 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { Address, Hex, Bytes } from 'ox'
2
+ import { Address, Hex } from 'ox'
3
3
  import { Network, Payload } from '@0xsequence/wallet-primitives'
4
4
  import { IdentityInstrument, IdentityType, KeyType, AuthCodeChallenge } from '@0xsequence/identity-instrument'
5
5
  import { AuthCodeHandler } from '../src/sequence/handlers/authcode.js'
@@ -45,8 +45,8 @@ class MockURLSearchParams {
45
45
  }
46
46
  }
47
47
 
48
- // @ts-ignore - Override global URLSearchParams for testing
49
- global.URLSearchParams = MockURLSearchParams as any
48
+ // Override global URLSearchParams for testing
49
+ globalThis.URLSearchParams = MockURLSearchParams as any
50
50
 
51
51
  // Mock dependencies with proper vi.fn() types
52
52
  const mockCommitVerifier = vi.fn()
@@ -285,8 +285,7 @@ describe('AuthCodeHandler', () => {
285
285
  })
286
286
 
287
287
  it('Should generate random state when not provided', async () => {
288
- const result = await authCodeHandler.commitAuth('/target', false)
289
-
288
+ await authCodeHandler.commitAuth('/target', false)
290
289
  const commitmentCall = mockAuthCommitmentsSet.mock.calls[0]![0]!
291
290
  expect(commitmentCall.id).toBeDefined()
292
291
  expect(typeof commitmentCall.id).toBe('string')
@@ -316,8 +315,7 @@ describe('AuthCodeHandler', () => {
316
315
  })
317
316
 
318
317
  it('Should create commitment without signer', async () => {
319
- const result = await authCodeHandler.commitAuth('/target', true)
320
-
318
+ await authCodeHandler.commitAuth('/target', true)
321
319
  const commitmentCall = mockAuthCommitmentsSet.mock.calls[0]![0]!
322
320
  expect(commitmentCall.signer).toBeUndefined()
323
321
  expect(commitmentCall.isSignUp).toBe(true)
@@ -329,7 +327,7 @@ describe('AuthCodeHandler', () => {
329
327
  describe('completeAuth()', () => {
330
328
  it('Should complete auth flow with code and return signer', async () => {
331
329
  const authCode = 'test-auth-code-123'
332
- const mockSigner = {} as IdentitySigner
330
+ // const mockSigner = {} as IdentitySigner
333
331
  const mockEmail = 'test@example.com'
334
332
 
335
333
  mockCommitVerifier.mockResolvedValueOnce(undefined)
package/test/constants.ts CHANGED
@@ -7,6 +7,7 @@ import { Relayer } from '@0xsequence/relayer'
7
7
  import * as Db from '../src/dbs/index.js'
8
8
  import { Network } from '@0xsequence/wallet-primitives'
9
9
 
10
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
10
11
  const envFile = process.env.CI ? '.env.test' : '.env.test.local'
11
12
  dotenvConfig({ path: envFile })
12
13
 
@@ -14,6 +15,7 @@ export const EMITTER_ADDRESS: Address.Address = '0xb7bE532959236170064cf099e1a33
14
15
  export const EMITTER_ABI = Abi.from(['function explicitEmit()', 'function implicitEmit()'])
15
16
 
16
17
  // Environment variables
18
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
17
19
  export const LOCAL_RPC_URL = process.env.LOCAL_RPC_URL || 'http://localhost:8545'
18
20
 
19
21
  let testIdCounter = 0
@@ -81,8 +83,8 @@ export function newRemoteManager(
81
83
  ? `_${remoteManagerOptions.tag}_testrun_${testIdCounter}`
82
84
  : `_testrun_${testIdCounter}`
83
85
 
84
- let relayers: Relayer.Relayer[] = []
85
- let bundlers: Bundler.Bundler[] = []
86
+ const relayers: Relayer.Relayer[] = []
87
+ const bundlers: Bundler.Bundler[] = []
86
88
 
87
89
  if (remoteManagerOptions.network.relayerPk) {
88
90
  const provider = Provider.from(RpcTransport.fromHttp(remoteManagerOptions.network.rpcUrl))
@@ -5,7 +5,7 @@ import { Address, Bytes, Hex, TypedData } from 'ox'
5
5
  import { Config, Constants, Network, Payload } from '@0xsequence/wallet-primitives'
6
6
  import { Kinds } from '../src/sequence/types/signer.js'
7
7
  import { newManager } from './constants.js'
8
- import { GuardRole, Guards } from '../src/sequence/guards.js'
8
+ import { Guards } from '../src/sequence/guards.js'
9
9
 
10
10
  // Mock fetch globally for guard API calls
11
11
  const mockFetch = vi.fn()
@@ -16,8 +16,8 @@ describe('GuardHandler', () => {
16
16
  let guards: Guards
17
17
  let testWallet: Address.Address
18
18
  let testPayload: Payload.Payload
19
- let testMessageDigest: Bytes.Bytes
20
- let testMessage: Hex.Hex
19
+ let _testMessageDigest: Bytes.Bytes
20
+ let _testMessage: Hex.Hex
21
21
 
22
22
  beforeEach(async () => {
23
23
  vi.clearAllMocks()
@@ -28,8 +28,8 @@ describe('GuardHandler', () => {
28
28
 
29
29
  testWallet = '0x1234567890123456789012345678901234567890' as Address.Address
30
30
  testPayload = Payload.fromMessage(Hex.fromString('Test message'))
31
- testMessage = TypedData.encode(Payload.toTyped(testWallet, Network.ChainId.ARBITRUM, testPayload))
32
- testMessageDigest = Payload.hash(testWallet, Network.ChainId.ARBITRUM, testPayload)
31
+ _testMessage = TypedData.encode(Payload.toTyped(testWallet, Network.ChainId.ARBITRUM, testPayload))
32
+ _testMessageDigest = Payload.hash(testWallet, Network.ChainId.ARBITRUM, testPayload)
33
33
  })
34
34
 
35
35
  afterEach(async () => {
@@ -1,5 +1,5 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, Mock, vi } from 'vitest'
2
- import { Address, Bytes, Hex } from 'ox'
2
+ import { Address, Hex } from 'ox'
3
3
  import { Network, Payload } from '@0xsequence/wallet-primitives'
4
4
  import { IdentityInstrument, KeyType } from '@0xsequence/identity-instrument'
5
5
  import { State } from '@0xsequence/wallet-core'
package/test/otp.test.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, Mock, vi } from 'vitest'
2
2
  import { Address, Hex } from 'ox'
3
3
  import { Network, Payload } from '@0xsequence/wallet-primitives'
4
- import { IdentityInstrument, IdentityType, KeyType, OtpChallenge } from '@0xsequence/identity-instrument'
4
+ import { IdentityInstrument, IdentityType, KeyType } from '@0xsequence/identity-instrument'
5
5
  import { OtpHandler, PromptOtpHandler } from '../src/sequence/handlers/otp.js'
6
6
  import { Signatures } from '../src/sequence/signatures.js'
7
7
  import * as Db from '../src/dbs/index.js'
@@ -1,7 +1,7 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2
2
  import { Address, Hex } from 'ox'
3
3
  import { Network, Payload } from '@0xsequence/wallet-primitives'
4
- import { Signers, State } from '@0xsequence/wallet-core'
4
+ import { State } from '@0xsequence/wallet-core'
5
5
  import { Extensions } from '@0xsequence/wallet-primitives'
6
6
  import { PasskeysHandler } from '../src/sequence/handlers/passkeys.js'
7
7
  import { Signatures } from '../src/sequence/signatures.js'
@@ -174,7 +174,7 @@ describe('Recovery', () => {
174
174
  const recoverySigner = request4.signers.find((s) => s.handler?.kind === 'recovery-extension')
175
175
  expect(recoverySigner).toBeDefined()
176
176
  expect(recoverySigner!.status).toBe('ready')
177
- 1
177
+
178
178
  // Handle the recovery signer
179
179
  const result4 = await (recoverySigner as SignerReady).handle()
180
180
  expect(result4).toBeDefined()
@@ -303,9 +303,9 @@ describe('Recovery', () => {
303
303
  })
304
304
 
305
305
  // Set up mnemonic handler and sign the payload
306
- let handledMnemonic2 = 0
306
+ let _handledMnemonic2 = 0
307
307
  const unregisterHandler = manager.registerMnemonicUI(async (respond) => {
308
- handledMnemonic2++
308
+ _handledMnemonic2++
309
309
  await respond(mnemonic2)
310
310
  })
311
311
 
@@ -358,7 +358,7 @@ for (const extension of ALL_EXTENSIONS) {
358
358
  throw new Error('Failed to create pk store')
359
359
  }
360
360
  // Create the initial permissions
361
- let explicitSession: ExplicitSession = {
361
+ const explicitSession: ExplicitSession = {
362
362
  type: 'explicit',
363
363
  sessionAddress: e.address,
364
364
  chainId,