@meshconnect/uwc-injected-connector 0.23.2 → 0.23.3

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 (55) hide show
  1. package/dist/eip6963-discovery.d.ts.map +1 -1
  2. package/dist/eip6963-discovery.js +5 -10
  3. package/dist/eip6963-discovery.js.map +1 -1
  4. package/dist/injected-connector.d.ts.map +1 -1
  5. package/dist/injected-connector.js.map +1 -1
  6. package/dist/legacy-injected-solana-adapter.d.ts.map +1 -1
  7. package/dist/legacy-injected-solana-adapter.js.map +1 -1
  8. package/dist/services/bitcoin/bitcoin-wallet-service.d.ts.map +1 -1
  9. package/dist/services/bitcoin/bitcoin-wallet-service.js.map +1 -1
  10. package/dist/services/connection-manager.d.ts.map +1 -1
  11. package/dist/services/connection-manager.js.map +1 -1
  12. package/dist/services/ethereum/ethereum-transaction-builder.d.ts.map +1 -1
  13. package/dist/services/ethereum/ethereum-transaction-service.d.ts.map +1 -1
  14. package/dist/services/ethereum/ethereum-wallet-service.d.ts.map +1 -1
  15. package/dist/services/signature-service.d.ts.map +1 -1
  16. package/dist/services/signature-service.js +1 -2
  17. package/dist/services/signature-service.js.map +1 -1
  18. package/dist/services/solana/solana-transaction-builder.d.ts.map +1 -1
  19. package/dist/services/solana/solana-transaction-service.d.ts.map +1 -1
  20. package/dist/services/solana/solana-transaction-service.js.map +1 -1
  21. package/dist/services/solana/solana-wallet-service.d.ts.map +1 -1
  22. package/dist/services/solana/solana-wallet-service.js.map +1 -1
  23. package/dist/services/storage-service.d.ts.map +1 -1
  24. package/dist/services/ton/ton-transaction-builder.d.ts.map +1 -1
  25. package/dist/services/ton/ton-transaction-service.d.ts.map +1 -1
  26. package/dist/services/ton/ton-wallet-service.d.ts.map +1 -1
  27. package/dist/services/ton/ton-wallet-service.js.map +1 -1
  28. package/dist/services/transaction-service.d.ts.map +1 -1
  29. package/dist/services/transaction-service.js.map +1 -1
  30. package/dist/services/tron/tron-transaction-builder.d.ts.map +1 -1
  31. package/dist/services/tron/tron-transaction-service.d.ts.map +1 -1
  32. package/dist/services/tron/tron-wallet-service.d.ts.map +1 -1
  33. package/dist/services/tron/tron-wallet-service.js.map +1 -1
  34. package/dist/ton-discovery.d.ts.map +1 -1
  35. package/dist/ton-discovery.js +3 -6
  36. package/dist/ton-discovery.js.map +1 -1
  37. package/dist/tron-discovery.d.ts.map +1 -1
  38. package/dist/tron-discovery.js +3 -6
  39. package/dist/tron-discovery.js.map +1 -1
  40. package/dist/wallet-standard-discovery.d.ts.map +1 -1
  41. package/dist/wallet-standard-discovery.js +8 -16
  42. package/dist/wallet-standard-discovery.js.map +1 -1
  43. package/package.json +10 -10
  44. package/src/eip6963-discovery.ts +5 -10
  45. package/src/injected-connector.test.ts +270 -180
  46. package/src/injected-connector.ts +20 -7
  47. package/src/legacy-injected-solana-adapter.test.ts +39 -26
  48. package/src/legacy-injected-solana-adapter.ts +2 -1
  49. package/src/services/connection-manager.ts +12 -6
  50. package/src/services/signature-service.ts +1 -2
  51. package/src/services/ton/ton-wallet-service.ts +2 -1
  52. package/src/signSolanaTransactionBytes.test.ts +3 -2
  53. package/src/ton-discovery.ts +3 -6
  54. package/src/tron-discovery.ts +3 -6
  55. package/src/wallet-standard-discovery.ts +8 -16
@@ -28,10 +28,12 @@ vi.mock('@meshconnect/uwc-bridge-child', async importOriginal => ({
28
28
  // routing` describe blocks below — the mocked service classes are the same
29
29
  // regardless of which stream is under test.
30
30
  const getMocks = async () => {
31
- const { EthereumWalletService } =
32
- await import('./services/ethereum/ethereum-wallet-service')
33
- const { SolanaWalletService } =
34
- await import('./services/solana/solana-wallet-service')
31
+ const { EthereumWalletService } = await import(
32
+ './services/ethereum/ethereum-wallet-service'
33
+ )
34
+ const { SolanaWalletService } = await import(
35
+ './services/solana/solana-wallet-service'
36
+ )
35
37
  return {
36
38
  ethService: vi.mocked(EthereumWalletService).mock.results[0].value,
37
39
  solService: vi.mocked(SolanaWalletService).mock.results[0].value
@@ -95,16 +97,20 @@ describe('InjectedConnector', () => {
95
97
  })
96
98
 
97
99
  it('should initialize all services', async () => {
98
- const { EthereumWalletService } =
99
- await import('./services/ethereum/ethereum-wallet-service')
100
- const { SolanaWalletService } =
101
- await import('./services/solana/solana-wallet-service')
100
+ const { EthereumWalletService } = await import(
101
+ './services/ethereum/ethereum-wallet-service'
102
+ )
103
+ const { SolanaWalletService } = await import(
104
+ './services/solana/solana-wallet-service'
105
+ )
102
106
  const { StorageService } = await import('./services/storage-service')
103
- const { ConnectionManager } =
104
- await import('./services/connection-manager')
107
+ const { ConnectionManager } = await import(
108
+ './services/connection-manager'
109
+ )
105
110
  const { SignatureService } = await import('./services/signature-service')
106
- const { TransactionService } =
107
- await import('./services/transaction-service')
111
+ const { TransactionService } = await import(
112
+ './services/transaction-service'
113
+ )
108
114
 
109
115
  new InjectedConnector()
110
116
 
@@ -119,8 +125,9 @@ describe('InjectedConnector', () => {
119
125
 
120
126
  describe('constructor options wiring', () => {
121
127
  it('defaults every option when constructed with no arguments', async () => {
122
- const { TransactionService } =
123
- await import('./services/transaction-service')
128
+ const { TransactionService } = await import(
129
+ './services/transaction-service'
130
+ )
124
131
  const { TronConnector } = await import('@meshconnect/uwc-tron-connector')
125
132
  const { BridgeChild } = await import('@meshconnect/uwc-bridge-child')
126
133
 
@@ -136,8 +143,9 @@ describe('InjectedConnector', () => {
136
143
  })
137
144
 
138
145
  it('routes networkRpcMap to the TransactionService', async () => {
139
- const { TransactionService } =
140
- await import('./services/transaction-service')
146
+ const { TransactionService } = await import(
147
+ './services/transaction-service'
148
+ )
141
149
  const networkRpcMap = { 'eip155:1': 'https://rpc.example.com' }
142
150
 
143
151
  new InjectedConnector({ networkRpcMap })
@@ -167,8 +175,9 @@ describe('InjectedConnector', () => {
167
175
  })
168
176
 
169
177
  it('threads usingIntegratedBrowser + a deduping failure sink into Solana discovery', async () => {
170
- const { SolanaWalletService } =
171
- await import('./services/solana/solana-wallet-service')
178
+ const { SolanaWalletService } = await import(
179
+ './services/solana/solana-wallet-service'
180
+ )
172
181
  const onLegacyDiscoveryFailure = vi.fn()
173
182
  const expectedWallets = [{ id: 'coinbase' }] as never
174
183
 
@@ -202,8 +211,9 @@ describe('InjectedConnector', () => {
202
211
  })
203
212
 
204
213
  it('defaults Solana discovery to the extension flow (usingIntegratedBrowser false, no failure sink)', async () => {
205
- const { SolanaWalletService } =
206
- await import('./services/solana/solana-wallet-service')
214
+ const { SolanaWalletService } = await import(
215
+ './services/solana/solana-wallet-service'
216
+ )
207
217
 
208
218
  const c = new InjectedConnector()
209
219
  const solService = vi
@@ -223,8 +233,9 @@ describe('InjectedConnector', () => {
223
233
 
224
234
  describe('getAvailableWallets', () => {
225
235
  it('should return Ethereum wallets for eip155 namespace', async () => {
226
- const { EthereumWalletService } =
227
- await import('./services/ethereum/ethereum-wallet-service')
236
+ const { EthereumWalletService } = await import(
237
+ './services/ethereum/ethereum-wallet-service'
238
+ )
228
239
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
229
240
  .value
230
241
 
@@ -251,8 +262,9 @@ describe('InjectedConnector', () => {
251
262
  })
252
263
 
253
264
  it('should re-fetch Ethereum wallets if none detected', async () => {
254
- const { EthereumWalletService } =
255
- await import('./services/ethereum/ethereum-wallet-service')
265
+ const { EthereumWalletService } = await import(
266
+ './services/ethereum/ethereum-wallet-service'
267
+ )
256
268
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
257
269
  .value
258
270
 
@@ -277,8 +289,9 @@ describe('InjectedConnector', () => {
277
289
  })
278
290
 
279
291
  it('should return Solana wallets for solana namespace', async () => {
280
- const { SolanaWalletService } =
281
- await import('./services/solana/solana-wallet-service')
292
+ const { SolanaWalletService } = await import(
293
+ './services/solana/solana-wallet-service'
294
+ )
282
295
  const mockSolService =
283
296
  vi.mocked(SolanaWalletService).mock.results[0].value
284
297
 
@@ -311,8 +324,9 @@ describe('InjectedConnector', () => {
311
324
 
312
325
  describe('connect', () => {
313
326
  it('should return existing connection if already connected', async () => {
314
- const { ConnectionManager } =
315
- await import('./services/connection-manager')
327
+ const { ConnectionManager } = await import(
328
+ './services/connection-manager'
329
+ )
316
330
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
317
331
 
318
332
  mockConnManager.checkExistingConnections.mockResolvedValue({
@@ -336,8 +350,9 @@ describe('InjectedConnector', () => {
336
350
  })
337
351
 
338
352
  it('should connect to Ethereum wallet if not already connected', async () => {
339
- const { ConnectionManager } =
340
- await import('./services/connection-manager')
353
+ const { ConnectionManager } = await import(
354
+ './services/connection-manager'
355
+ )
341
356
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
342
357
 
343
358
  mockConnManager.checkExistingConnections.mockResolvedValue({
@@ -384,8 +399,9 @@ describe('InjectedConnector', () => {
384
399
  // Build an InjectedConnector wired with the Tron connector + networks, and
385
400
  // return the stubbed TronConnector instance so the test can assert on it.
386
401
  const buildWithTron = async (tronConnect: ReturnType<typeof vi.fn>) => {
387
- const { TronConnector } =
388
- await import('@meshconnect/uwc-tron-connector')
402
+ const { TronConnector } = await import(
403
+ '@meshconnect/uwc-tron-connector'
404
+ )
389
405
  // Must be constructable (`new TronConnector(...)`), so use a function,
390
406
  // not an arrow.
391
407
  vi.mocked(TronConnector).mockImplementation(function () {
@@ -395,8 +411,9 @@ describe('InjectedConnector', () => {
395
411
  tronConnectorConfig: { enabledWallets: ['trust'] } as never,
396
412
  networks: [mockNetwork, tronNetwork]
397
413
  })
398
- const { ConnectionManager } =
399
- await import('./services/connection-manager')
414
+ const { ConnectionManager } = await import(
415
+ './services/connection-manager'
416
+ )
400
417
  const connManager = vi
401
418
  .mocked(ConnectionManager)
402
419
  .mock.results.at(-1)!.value
@@ -420,8 +437,9 @@ describe('InjectedConnector', () => {
420
437
  try {
421
438
  const tronConnect = vi.fn().mockReturnValue(new Promise(() => {}))
422
439
  const onConnectStep = vi.fn()
423
- const { TronConnector } =
424
- await import('@meshconnect/uwc-tron-connector')
440
+ const { TronConnector } = await import(
441
+ '@meshconnect/uwc-tron-connector'
442
+ )
425
443
  vi.mocked(TronConnector).mockImplementation(function () {
426
444
  return { connect: tronConnect } as never
427
445
  } as never)
@@ -431,8 +449,9 @@ describe('InjectedConnector', () => {
431
449
  secondaryGatherTimeoutMs: 1000,
432
450
  onConnectStep
433
451
  })
434
- const { ConnectionManager } =
435
- await import('./services/connection-manager')
452
+ const { ConnectionManager } = await import(
453
+ './services/connection-manager'
454
+ )
436
455
  const connManager = vi
437
456
  .mocked(ConnectionManager)
438
457
  .mock.results.at(-1)!.value
@@ -470,8 +489,9 @@ describe('InjectedConnector', () => {
470
489
 
471
490
  it('reports a REJECTED Tron gather as failed, not ok', async () => {
472
491
  const onConnectStep = vi.fn()
473
- const { TronConnector } =
474
- await import('@meshconnect/uwc-tron-connector')
492
+ const { TronConnector } = await import(
493
+ '@meshconnect/uwc-tron-connector'
494
+ )
475
495
  vi.mocked(TronConnector).mockImplementation(function () {
476
496
  return {
477
497
  connect: vi.fn().mockRejectedValue(new Error('User rejected'))
@@ -482,8 +502,9 @@ describe('InjectedConnector', () => {
482
502
  networks: [mockNetwork, tronNetwork],
483
503
  onConnectStep
484
504
  })
485
- const { ConnectionManager } =
486
- await import('./services/connection-manager')
505
+ const { ConnectionManager } = await import(
506
+ './services/connection-manager'
507
+ )
487
508
  const connManager = vi
488
509
  .mocked(ConnectionManager)
489
510
  .mock.results.at(-1)!.value
@@ -510,8 +531,9 @@ describe('InjectedConnector', () => {
510
531
  })
511
532
 
512
533
  it('routes a tron session to tronConnector.onAccountsChanged', async () => {
513
- const { TronConnector } =
514
- await import('@meshconnect/uwc-tron-connector')
534
+ const { TronConnector } = await import(
535
+ '@meshconnect/uwc-tron-connector'
536
+ )
515
537
  const onAccountsChangedFn = vi.fn().mockReturnValue(vi.fn())
516
538
  vi.mocked(TronConnector).mockImplementation(function () {
517
539
  return { onAccountsChanged: onAccountsChangedFn } as never
@@ -606,8 +628,9 @@ describe('InjectedConnector', () => {
606
628
  })
607
629
 
608
630
  it('should connect to Solana wallet for solana namespace', async () => {
609
- const { ConnectionManager } =
610
- await import('./services/connection-manager')
631
+ const { ConnectionManager } = await import(
632
+ './services/connection-manager'
633
+ )
611
634
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
612
635
 
613
636
  const solanaNetwork: Network = {
@@ -649,8 +672,9 @@ describe('InjectedConnector', () => {
649
672
  })
650
673
 
651
674
  it('should connect to Tron wallet for tron namespace', async () => {
652
- const { ConnectionManager } =
653
- await import('./services/connection-manager')
675
+ const { ConnectionManager } = await import(
676
+ './services/connection-manager'
677
+ )
654
678
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
655
679
 
656
680
  const tronNetwork: Network = {
@@ -692,8 +716,9 @@ describe('InjectedConnector', () => {
692
716
  })
693
717
 
694
718
  it('should throw error for unsupported namespace', async () => {
695
- const { ConnectionManager } =
696
- await import('./services/connection-manager')
719
+ const { ConnectionManager } = await import(
720
+ './services/connection-manager'
721
+ )
697
722
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
698
723
 
699
724
  const unsupportedNetwork: Network = {
@@ -725,8 +750,9 @@ describe('InjectedConnector', () => {
725
750
 
726
751
  describe('switchNetwork', () => {
727
752
  it('should delegate to connection manager', async () => {
728
- const { ConnectionManager } =
729
- await import('./services/connection-manager')
753
+ const { ConnectionManager } = await import(
754
+ './services/connection-manager'
755
+ )
730
756
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
731
757
 
732
758
  const expectedResult = {
@@ -752,8 +778,9 @@ describe('InjectedConnector', () => {
752
778
 
753
779
  describe('disconnect', () => {
754
780
  it('should delegate to connection manager', async () => {
755
- const { ConnectionManager } =
756
- await import('./services/connection-manager')
781
+ const { ConnectionManager } = await import(
782
+ './services/connection-manager'
783
+ )
757
784
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
758
785
 
759
786
  await connector.disconnect()
@@ -764,8 +791,9 @@ describe('InjectedConnector', () => {
764
791
 
765
792
  describe('getLiveAccount', () => {
766
793
  it('routes eip155 to ethereumService.getLiveAccount()', async () => {
767
- const { EthereumWalletService } =
768
- await import('./services/ethereum/ethereum-wallet-service')
794
+ const { EthereumWalletService } = await import(
795
+ './services/ethereum/ethereum-wallet-service'
796
+ )
769
797
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]!
770
798
  .value
771
799
  mockEthService.getLiveAccount.mockResolvedValue('0xLiveEth')
@@ -776,8 +804,9 @@ describe('InjectedConnector', () => {
776
804
  })
777
805
 
778
806
  it('routes solana to solanaService.getLiveAccount()', async () => {
779
- const { SolanaWalletService } =
780
- await import('./services/solana/solana-wallet-service')
807
+ const { SolanaWalletService } = await import(
808
+ './services/solana/solana-wallet-service'
809
+ )
781
810
  const mockSolService =
782
811
  vi.mocked(SolanaWalletService).mock.results[0]!.value
783
812
  mockSolService.getLiveAccount.mockResolvedValue('SoLaNaLiveAddr')
@@ -788,8 +817,9 @@ describe('InjectedConnector', () => {
788
817
  })
789
818
 
790
819
  it('falls back to tronService.getLiveAccount() when no tronConnector is configured', async () => {
791
- const { TronWalletService } =
792
- await import('./services/tron/tron-wallet-service')
820
+ const { TronWalletService } = await import(
821
+ './services/tron/tron-wallet-service'
822
+ )
793
823
  const mockTronService =
794
824
  vi.mocked(TronWalletService).mock.results[0]!.value
795
825
  mockTronService.getLiveAccount.mockResolvedValue('TFallbackTronAddr')
@@ -819,8 +849,9 @@ describe('InjectedConnector', () => {
819
849
  })
820
850
 
821
851
  it('returns tonService.getAccount() for tvm (sync, normalized to null)', async () => {
822
- const { TonWalletService } =
823
- await import('./services/ton/ton-wallet-service')
852
+ const { TonWalletService } = await import(
853
+ './services/ton/ton-wallet-service'
854
+ )
824
855
  const mockTonService = vi.mocked(TonWalletService).mock.results[0]!.value
825
856
  mockTonService.getAccount.mockReturnValue('EQLiveTonAddr')
826
857
 
@@ -830,8 +861,9 @@ describe('InjectedConnector', () => {
830
861
  })
831
862
 
832
863
  it('normalizes an undefined tvm account to null', async () => {
833
- const { TonWalletService } =
834
- await import('./services/ton/ton-wallet-service')
864
+ const { TonWalletService } = await import(
865
+ './services/ton/ton-wallet-service'
866
+ )
835
867
  const mockTonService = vi.mocked(TonWalletService).mock.results[0]!.value
836
868
  mockTonService.getAccount.mockReturnValue(undefined as never)
837
869
 
@@ -847,8 +879,9 @@ describe('InjectedConnector', () => {
847
879
  })
848
880
 
849
881
  it('never throws: returns null when the underlying service throws', async () => {
850
- const { EthereumWalletService } =
851
- await import('./services/ethereum/ethereum-wallet-service')
882
+ const { EthereumWalletService } = await import(
883
+ './services/ethereum/ethereum-wallet-service'
884
+ )
852
885
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]!
853
886
  .value
854
887
  mockEthService.getLiveAccount.mockRejectedValue(new Error('boom'))
@@ -873,8 +906,9 @@ describe('InjectedConnector', () => {
873
906
  })
874
907
 
875
908
  it('should throw error if no active network connection', async () => {
876
- const { ConnectionManager } =
877
- await import('./services/connection-manager')
909
+ const { ConnectionManager } = await import(
910
+ './services/connection-manager'
911
+ )
878
912
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
879
913
 
880
914
  mockConnManager.getCurrentNetworkId.mockReturnValue(null)
@@ -885,10 +919,12 @@ describe('InjectedConnector', () => {
885
919
  })
886
920
 
887
921
  it('should sign Ethereum message successfully', async () => {
888
- const { ConnectionManager } =
889
- await import('./services/connection-manager')
890
- const { EthereumWalletService } =
891
- await import('./services/ethereum/ethereum-wallet-service')
922
+ const { ConnectionManager } = await import(
923
+ './services/connection-manager'
924
+ )
925
+ const { EthereumWalletService } = await import(
926
+ './services/ethereum/ethereum-wallet-service'
927
+ )
892
928
  const { SignatureService } = await import('./services/signature-service')
893
929
 
894
930
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -924,10 +960,12 @@ describe('InjectedConnector', () => {
924
960
  })
925
961
 
926
962
  it('claims the LIVE eip155 signer address at sign time (post-switch), not the connect-time cache', async () => {
927
- const { ConnectionManager } =
928
- await import('./services/connection-manager')
929
- const { EthereumWalletService } =
930
- await import('./services/ethereum/ethereum-wallet-service')
963
+ const { ConnectionManager } = await import(
964
+ './services/connection-manager'
965
+ )
966
+ const { EthereumWalletService } = await import(
967
+ './services/ethereum/ethereum-wallet-service'
968
+ )
931
969
  const { SignatureService } = await import('./services/signature-service')
932
970
 
933
971
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -961,10 +999,12 @@ describe('InjectedConnector', () => {
961
999
  })
962
1000
 
963
1001
  it('should throw error if no Ethereum address for signing', async () => {
964
- const { ConnectionManager } =
965
- await import('./services/connection-manager')
966
- const { EthereumWalletService } =
967
- await import('./services/ethereum/ethereum-wallet-service')
1002
+ const { ConnectionManager } = await import(
1003
+ './services/connection-manager'
1004
+ )
1005
+ const { EthereumWalletService } = await import(
1006
+ './services/ethereum/ethereum-wallet-service'
1007
+ )
968
1008
 
969
1009
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
970
1010
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
@@ -983,10 +1023,12 @@ describe('InjectedConnector', () => {
983
1023
  })
984
1024
 
985
1025
  it('should throw error if no connected Ethereum provider', async () => {
986
- const { ConnectionManager } =
987
- await import('./services/connection-manager')
988
- const { EthereumWalletService } =
989
- await import('./services/ethereum/ethereum-wallet-service')
1026
+ const { ConnectionManager } = await import(
1027
+ './services/connection-manager'
1028
+ )
1029
+ const { EthereumWalletService } = await import(
1030
+ './services/ethereum/ethereum-wallet-service'
1031
+ )
990
1032
 
991
1033
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
992
1034
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
@@ -1002,10 +1044,12 @@ describe('InjectedConnector', () => {
1002
1044
  })
1003
1045
 
1004
1046
  it('should sign Solana message successfully', async () => {
1005
- const { ConnectionManager } =
1006
- await import('./services/connection-manager')
1007
- const { SolanaWalletService } =
1008
- await import('./services/solana/solana-wallet-service')
1047
+ const { ConnectionManager } = await import(
1048
+ './services/connection-manager'
1049
+ )
1050
+ const { SolanaWalletService } = await import(
1051
+ './services/solana/solana-wallet-service'
1052
+ )
1009
1053
  const { SignatureService } = await import('./services/signature-service')
1010
1054
 
1011
1055
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -1040,10 +1084,12 @@ describe('InjectedConnector', () => {
1040
1084
  })
1041
1085
 
1042
1086
  it('claims the LIVE solana signer address at sign time (post-switch), not the connect-time cache', async () => {
1043
- const { ConnectionManager } =
1044
- await import('./services/connection-manager')
1045
- const { SolanaWalletService } =
1046
- await import('./services/solana/solana-wallet-service')
1087
+ const { ConnectionManager } = await import(
1088
+ './services/connection-manager'
1089
+ )
1090
+ const { SolanaWalletService } = await import(
1091
+ './services/solana/solana-wallet-service'
1092
+ )
1047
1093
  const { SignatureService } = await import('./services/signature-service')
1048
1094
 
1049
1095
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -1070,10 +1116,12 @@ describe('InjectedConnector', () => {
1070
1116
  })
1071
1117
 
1072
1118
  it('throws for solana when the live adapter exposes no signer address (never claims empty)', async () => {
1073
- const { ConnectionManager } =
1074
- await import('./services/connection-manager')
1075
- const { SolanaWalletService } =
1076
- await import('./services/solana/solana-wallet-service')
1119
+ const { ConnectionManager } = await import(
1120
+ './services/connection-manager'
1121
+ )
1122
+ const { SolanaWalletService } = await import(
1123
+ './services/solana/solana-wallet-service'
1124
+ )
1077
1125
 
1078
1126
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1079
1127
  const mockSolService =
@@ -1092,10 +1140,12 @@ describe('InjectedConnector', () => {
1092
1140
  })
1093
1141
 
1094
1142
  it('should throw error if no connected Solana adapter and the rebuild fails', async () => {
1095
- const { ConnectionManager } =
1096
- await import('./services/connection-manager')
1097
- const { SolanaWalletService } =
1098
- await import('./services/solana/solana-wallet-service')
1143
+ const { ConnectionManager } = await import(
1144
+ './services/connection-manager'
1145
+ )
1146
+ const { SolanaWalletService } = await import(
1147
+ './services/solana/solana-wallet-service'
1148
+ )
1099
1149
 
1100
1150
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1101
1151
  const mockSolService =
@@ -1111,10 +1161,12 @@ describe('InjectedConnector', () => {
1111
1161
  })
1112
1162
 
1113
1163
  it('re-binds the Solana adapter at sign time when it was cleared by a re-auth teardown (Phantom account-switch regression)', async () => {
1114
- const { ConnectionManager } =
1115
- await import('./services/connection-manager')
1116
- const { SolanaWalletService } =
1117
- await import('./services/solana/solana-wallet-service')
1164
+ const { ConnectionManager } = await import(
1165
+ './services/connection-manager'
1166
+ )
1167
+ const { SolanaWalletService } = await import(
1168
+ './services/solana/solana-wallet-service'
1169
+ )
1118
1170
  const { SignatureService } = await import('./services/signature-service')
1119
1171
 
1120
1172
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -1146,10 +1198,12 @@ describe('InjectedConnector', () => {
1146
1198
  })
1147
1199
 
1148
1200
  it('claims the LIVE tron signer address as of sign completion, not a pre-sign read (closes the TOCTOU window)', async () => {
1149
- const { ConnectionManager } =
1150
- await import('./services/connection-manager')
1151
- const { TronWalletService } =
1152
- await import('./services/tron/tron-wallet-service')
1201
+ const { ConnectionManager } = await import(
1202
+ './services/connection-manager'
1203
+ )
1204
+ const { TronWalletService } = await import(
1205
+ './services/tron/tron-wallet-service'
1206
+ )
1153
1207
  const { SignatureService } = await import('./services/signature-service')
1154
1208
 
1155
1209
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -1187,10 +1241,12 @@ describe('InjectedConnector', () => {
1187
1241
  })
1188
1242
 
1189
1243
  it('throws for tron when the live provider exposes no signer address (never claims empty)', async () => {
1190
- const { ConnectionManager } =
1191
- await import('./services/connection-manager')
1192
- const { TronWalletService } =
1193
- await import('./services/tron/tron-wallet-service')
1244
+ const { ConnectionManager } = await import(
1245
+ './services/connection-manager'
1246
+ )
1247
+ const { TronWalletService } = await import(
1248
+ './services/tron/tron-wallet-service'
1249
+ )
1194
1250
 
1195
1251
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1196
1252
  const mockTronService = vi.mocked(TronWalletService).mock.results[0].value
@@ -1208,10 +1264,12 @@ describe('InjectedConnector', () => {
1208
1264
  })
1209
1265
 
1210
1266
  it('should sign a TON (tvm) message and return the ton service address', async () => {
1211
- const { ConnectionManager } =
1212
- await import('./services/connection-manager')
1213
- const { TonWalletService } =
1214
- await import('./services/ton/ton-wallet-service')
1267
+ const { ConnectionManager } = await import(
1268
+ './services/connection-manager'
1269
+ )
1270
+ const { TonWalletService } = await import(
1271
+ './services/ton/ton-wallet-service'
1272
+ )
1215
1273
 
1216
1274
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1217
1275
  const mockTonService = vi.mocked(TonWalletService).mock.results[0].value
@@ -1247,10 +1305,12 @@ describe('InjectedConnector', () => {
1247
1305
  })
1248
1306
 
1249
1307
  it('claims the LIVE tvm signer address at sign time (post-switch), not a stale one', async () => {
1250
- const { ConnectionManager } =
1251
- await import('./services/connection-manager')
1252
- const { TonWalletService } =
1253
- await import('./services/ton/ton-wallet-service')
1308
+ const { ConnectionManager } = await import(
1309
+ './services/connection-manager'
1310
+ )
1311
+ const { TonWalletService } = await import(
1312
+ './services/ton/ton-wallet-service'
1313
+ )
1254
1314
 
1255
1315
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1256
1316
  const mockTonService = vi.mocked(TonWalletService).mock.results[0].value
@@ -1277,10 +1337,12 @@ describe('InjectedConnector', () => {
1277
1337
  })
1278
1338
 
1279
1339
  it('throws for tvm when there is no active signer address (never claims empty)', async () => {
1280
- const { ConnectionManager } =
1281
- await import('./services/connection-manager')
1282
- const { TonWalletService } =
1283
- await import('./services/ton/ton-wallet-service')
1340
+ const { ConnectionManager } = await import(
1341
+ './services/connection-manager'
1342
+ )
1343
+ const { TonWalletService } = await import(
1344
+ './services/ton/ton-wallet-service'
1345
+ )
1284
1346
 
1285
1347
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1286
1348
  const mockTonService = vi.mocked(TonWalletService).mock.results[0].value
@@ -1294,8 +1356,9 @@ describe('InjectedConnector', () => {
1294
1356
  })
1295
1357
 
1296
1358
  it('should throw error for unsupported namespace', async () => {
1297
- const { ConnectionManager } =
1298
- await import('./services/connection-manager')
1359
+ const { ConnectionManager } = await import(
1360
+ './services/connection-manager'
1361
+ )
1299
1362
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1300
1363
 
1301
1364
  mockConnManager.getCurrentNetworkId.mockReturnValue('cosmos:hub')
@@ -1336,8 +1399,9 @@ describe('InjectedConnector', () => {
1336
1399
  }
1337
1400
 
1338
1401
  it('should throw error if no active network connection', async () => {
1339
- const { ConnectionManager } =
1340
- await import('./services/connection-manager')
1402
+ const { ConnectionManager } = await import(
1403
+ './services/connection-manager'
1404
+ )
1341
1405
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1342
1406
 
1343
1407
  mockConnManager.getCurrentNetworkId.mockReturnValue(null)
@@ -1348,8 +1412,9 @@ describe('InjectedConnector', () => {
1348
1412
  })
1349
1413
 
1350
1414
  it('should throw error for non-EVM (non-eip155) namespace', async () => {
1351
- const { ConnectionManager } =
1352
- await import('./services/connection-manager')
1415
+ const { ConnectionManager } = await import(
1416
+ './services/connection-manager'
1417
+ )
1353
1418
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1354
1419
 
1355
1420
  mockConnManager.getCurrentNetworkId.mockReturnValue('solana:mainnet')
@@ -1360,8 +1425,9 @@ describe('InjectedConnector', () => {
1360
1425
  })
1361
1426
 
1362
1427
  it('should throw error if no active wallet address', async () => {
1363
- const { ConnectionManager } =
1364
- await import('./services/connection-manager')
1428
+ const { ConnectionManager } = await import(
1429
+ './services/connection-manager'
1430
+ )
1365
1431
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1366
1432
 
1367
1433
  mockConnManager.getCurrentNetworkId.mockReturnValue('eip155:1')
@@ -1373,10 +1439,12 @@ describe('InjectedConnector', () => {
1373
1439
  })
1374
1440
 
1375
1441
  it('should throw error if no connected Ethereum provider', async () => {
1376
- const { ConnectionManager } =
1377
- await import('./services/connection-manager')
1378
- const { EthereumWalletService } =
1379
- await import('./services/ethereum/ethereum-wallet-service')
1442
+ const { ConnectionManager } = await import(
1443
+ './services/connection-manager'
1444
+ )
1445
+ const { EthereumWalletService } = await import(
1446
+ './services/ethereum/ethereum-wallet-service'
1447
+ )
1380
1448
 
1381
1449
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1382
1450
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
@@ -1392,10 +1460,12 @@ describe('InjectedConnector', () => {
1392
1460
  })
1393
1461
 
1394
1462
  it('should sign typed data and return the raw signature', async () => {
1395
- const { ConnectionManager } =
1396
- await import('./services/connection-manager')
1397
- const { EthereumWalletService } =
1398
- await import('./services/ethereum/ethereum-wallet-service')
1463
+ const { ConnectionManager } = await import(
1464
+ './services/connection-manager'
1465
+ )
1466
+ const { EthereumWalletService } = await import(
1467
+ './services/ethereum/ethereum-wallet-service'
1468
+ )
1399
1469
  const { SignatureService } = await import('./services/signature-service')
1400
1470
 
1401
1471
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
@@ -1436,8 +1506,9 @@ describe('InjectedConnector', () => {
1436
1506
  })
1437
1507
 
1438
1508
  it('should throw error if no active network connection', async () => {
1439
- const { ConnectionManager } =
1440
- await import('./services/connection-manager')
1509
+ const { ConnectionManager } = await import(
1510
+ './services/connection-manager'
1511
+ )
1441
1512
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1442
1513
 
1443
1514
  mockConnManager.getCurrentNetworkId.mockReturnValue(null)
@@ -1448,12 +1519,15 @@ describe('InjectedConnector', () => {
1448
1519
  })
1449
1520
 
1450
1521
  it('should send Ethereum transaction successfully', async () => {
1451
- const { ConnectionManager } =
1452
- await import('./services/connection-manager')
1453
- const { EthereumWalletService } =
1454
- await import('./services/ethereum/ethereum-wallet-service')
1455
- const { TransactionService } =
1456
- await import('./services/transaction-service')
1522
+ const { ConnectionManager } = await import(
1523
+ './services/connection-manager'
1524
+ )
1525
+ const { EthereumWalletService } = await import(
1526
+ './services/ethereum/ethereum-wallet-service'
1527
+ )
1528
+ const { TransactionService } = await import(
1529
+ './services/transaction-service'
1530
+ )
1457
1531
 
1458
1532
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1459
1533
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
@@ -1481,10 +1555,12 @@ describe('InjectedConnector', () => {
1481
1555
  })
1482
1556
 
1483
1557
  it('should throw error if no connected Ethereum provider', async () => {
1484
- const { ConnectionManager } =
1485
- await import('./services/connection-manager')
1486
- const { EthereumWalletService } =
1487
- await import('./services/ethereum/ethereum-wallet-service')
1558
+ const { ConnectionManager } = await import(
1559
+ './services/connection-manager'
1560
+ )
1561
+ const { EthereumWalletService } = await import(
1562
+ './services/ethereum/ethereum-wallet-service'
1563
+ )
1488
1564
 
1489
1565
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1490
1566
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
@@ -1499,12 +1575,15 @@ describe('InjectedConnector', () => {
1499
1575
  })
1500
1576
 
1501
1577
  it('should send Solana transaction successfully', async () => {
1502
- const { ConnectionManager } =
1503
- await import('./services/connection-manager')
1504
- const { SolanaWalletService } =
1505
- await import('./services/solana/solana-wallet-service')
1506
- const { TransactionService } =
1507
- await import('./services/transaction-service')
1578
+ const { ConnectionManager } = await import(
1579
+ './services/connection-manager'
1580
+ )
1581
+ const { SolanaWalletService } = await import(
1582
+ './services/solana/solana-wallet-service'
1583
+ )
1584
+ const { TransactionService } = await import(
1585
+ './services/transaction-service'
1586
+ )
1508
1587
 
1509
1588
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1510
1589
  const mockSolService =
@@ -1533,10 +1612,12 @@ describe('InjectedConnector', () => {
1533
1612
  })
1534
1613
 
1535
1614
  it('should throw error if no connected Solana adapter', async () => {
1536
- const { ConnectionManager } =
1537
- await import('./services/connection-manager')
1538
- const { SolanaWalletService } =
1539
- await import('./services/solana/solana-wallet-service')
1615
+ const { ConnectionManager } = await import(
1616
+ './services/connection-manager'
1617
+ )
1618
+ const { SolanaWalletService } = await import(
1619
+ './services/solana/solana-wallet-service'
1620
+ )
1540
1621
 
1541
1622
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1542
1623
  const mockSolService =
@@ -1551,8 +1632,9 @@ describe('InjectedConnector', () => {
1551
1632
  })
1552
1633
 
1553
1634
  it('should throw error for unsupported namespace', async () => {
1554
- const { ConnectionManager } =
1555
- await import('./services/connection-manager')
1635
+ const { ConnectionManager } = await import(
1636
+ './services/connection-manager'
1637
+ )
1556
1638
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1557
1639
 
1558
1640
  mockConnManager.getCurrentNetworkId.mockReturnValue('cosmos:hub')
@@ -1565,11 +1647,13 @@ describe('InjectedConnector', () => {
1565
1647
 
1566
1648
  describe('getWalletCapabilities', () => {
1567
1649
  it('should delegate to ethereum service for eip155 namespace', async () => {
1568
- const { ConnectionManager } =
1569
- await import('./services/connection-manager')
1650
+ const { ConnectionManager } = await import(
1651
+ './services/connection-manager'
1652
+ )
1570
1653
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1571
- const { EthereumWalletService } =
1572
- await import('./services/ethereum/ethereum-wallet-service')
1654
+ const { EthereumWalletService } = await import(
1655
+ './services/ethereum/ethereum-wallet-service'
1656
+ )
1573
1657
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
1574
1658
  .value
1575
1659
 
@@ -1595,11 +1679,13 @@ describe('InjectedConnector', () => {
1595
1679
  })
1596
1680
 
1597
1681
  it('should NOT call ethereum service for solana namespace', async () => {
1598
- const { ConnectionManager } =
1599
- await import('./services/connection-manager')
1682
+ const { ConnectionManager } = await import(
1683
+ './services/connection-manager'
1684
+ )
1600
1685
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1601
- const { EthereumWalletService } =
1602
- await import('./services/ethereum/ethereum-wallet-service')
1686
+ const { EthereumWalletService } = await import(
1687
+ './services/ethereum/ethereum-wallet-service'
1688
+ )
1603
1689
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
1604
1690
  .value
1605
1691
 
@@ -1617,11 +1703,13 @@ describe('InjectedConnector', () => {
1617
1703
  })
1618
1704
 
1619
1705
  it('should NOT call ethereum service for tron namespace', async () => {
1620
- const { ConnectionManager } =
1621
- await import('./services/connection-manager')
1706
+ const { ConnectionManager } = await import(
1707
+ './services/connection-manager'
1708
+ )
1622
1709
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1623
- const { EthereumWalletService } =
1624
- await import('./services/ethereum/ethereum-wallet-service')
1710
+ const { EthereumWalletService } = await import(
1711
+ './services/ethereum/ethereum-wallet-service'
1712
+ )
1625
1713
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
1626
1714
  .value
1627
1715
 
@@ -1636,11 +1724,13 @@ describe('InjectedConnector', () => {
1636
1724
  })
1637
1725
 
1638
1726
  it('should return empty when no active network', async () => {
1639
- const { ConnectionManager } =
1640
- await import('./services/connection-manager')
1727
+ const { ConnectionManager } = await import(
1728
+ './services/connection-manager'
1729
+ )
1641
1730
  const mockConnManager = vi.mocked(ConnectionManager).mock.results[0].value
1642
- const { EthereumWalletService } =
1643
- await import('./services/ethereum/ethereum-wallet-service')
1731
+ const { EthereumWalletService } = await import(
1732
+ './services/ethereum/ethereum-wallet-service'
1733
+ )
1644
1734
  const mockEthService = vi.mocked(EthereumWalletService).mock.results[0]
1645
1735
  .value
1646
1736