@0xsequence/marketplace-sdk 0.5.6 → 0.5.7

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 (118) hide show
  1. package/dist/{chunk-J6F5QOW5.js → chunk-3OU7BADC.js} +9 -75
  2. package/dist/chunk-3OU7BADC.js.map +1 -0
  3. package/dist/{chunk-Y75XGZOB.js → chunk-5O3ZAEEX.js} +4 -2
  4. package/dist/chunk-5O3ZAEEX.js.map +1 -0
  5. package/dist/{chunk-4YR6AIXG.js → chunk-G2T7HCWE.js} +5 -7
  6. package/dist/chunk-G2T7HCWE.js.map +1 -0
  7. package/dist/chunk-GFADBQPX.js +2 -0
  8. package/dist/chunk-GFADBQPX.js.map +1 -0
  9. package/dist/{chunk-E2V2BMF6.js → chunk-L2K4DBH2.js} +152 -89
  10. package/dist/chunk-L2K4DBH2.js.map +1 -0
  11. package/dist/{chunk-7C7ADZ2H.js → chunk-OMCWTRBR.js} +9 -42
  12. package/dist/chunk-OMCWTRBR.js.map +1 -0
  13. package/dist/{chunk-7FN62HOP.js → chunk-UMYRZJVY.js} +11 -3
  14. package/dist/chunk-UMYRZJVY.js.map +1 -0
  15. package/dist/{chunk-UZIAX32Y.js → chunk-Y56IIYDF.js} +6 -4
  16. package/dist/{chunk-UZIAX32Y.js.map → chunk-Y56IIYDF.js.map} +1 -1
  17. package/dist/{chunk-AIGFG26L.js → chunk-YA3DWLDC.js} +32 -28
  18. package/dist/chunk-YA3DWLDC.js.map +1 -0
  19. package/dist/{chunk-RIGIV5XT.js → chunk-YYBU45PK.js} +10 -4
  20. package/dist/chunk-YYBU45PK.js.map +1 -0
  21. package/dist/{create-config-CtFGrwXc.d.ts → create-config-CILyA_Hy.d.ts} +1 -1
  22. package/dist/index.css +12 -6
  23. package/dist/index.d.ts +6 -5
  24. package/dist/index.js +13 -10
  25. package/dist/react/_internal/api/index.d.ts +2 -2
  26. package/dist/react/_internal/databeat/index.css.map +1 -1
  27. package/dist/react/_internal/databeat/index.js +7 -7
  28. package/dist/react/_internal/index.d.ts +4 -4
  29. package/dist/react/_internal/index.js +1 -1
  30. package/dist/react/_internal/wagmi/index.d.ts +2 -2
  31. package/dist/react/_internal/wagmi/index.js +1 -1
  32. package/dist/react/hooks/index.css.map +1 -1
  33. package/dist/react/hooks/index.d.ts +8 -15
  34. package/dist/react/hooks/index.js +6 -6
  35. package/dist/react/index.css +12 -6
  36. package/dist/react/index.css.map +1 -1
  37. package/dist/react/index.d.ts +4 -4
  38. package/dist/react/index.js +11 -10
  39. package/dist/react/ssr/index.d.ts +1 -0
  40. package/dist/react/ssr/index.js +10 -2
  41. package/dist/react/ssr/index.js.map +1 -1
  42. package/dist/react/ui/components/collectible-card/index.css +12 -6
  43. package/dist/react/ui/components/collectible-card/index.css.map +1 -1
  44. package/dist/react/ui/components/collectible-card/index.d.ts +2 -2
  45. package/dist/react/ui/components/collectible-card/index.js +11 -10
  46. package/dist/react/ui/icons/index.css.map +1 -1
  47. package/dist/react/ui/index.css +12 -6
  48. package/dist/react/ui/index.css.map +1 -1
  49. package/dist/react/ui/index.d.ts +2 -2
  50. package/dist/react/ui/index.js +11 -10
  51. package/dist/react/ui/modals/_internal/components/actionModal/index.css.map +1 -1
  52. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +2 -2
  53. package/dist/react/ui/modals/_internal/components/actionModal/index.js +7 -7
  54. package/dist/react/ui/styles/index.css.map +1 -1
  55. package/dist/{sdk-config-xWkdBdrL.d.ts → sdk-config-Bs3H_le_.d.ts} +1 -0
  56. package/dist/{services-Cled3TJr.d.ts → services-C3lzi1sL.d.ts} +1 -1
  57. package/dist/styles/index.css +12 -6
  58. package/dist/styles/index.css.map +1 -1
  59. package/dist/styles/index.d.ts +3 -2
  60. package/dist/styles/index.js +4 -2
  61. package/dist/types/index.d.ts +1 -1
  62. package/dist/types/index.js +1 -1
  63. package/dist/{types-C4oGsbnK.d.ts → types-BVD42zE_.d.ts} +1 -1
  64. package/dist/utils/abi/index.js +5 -5
  65. package/dist/utils/index.d.ts +5 -6
  66. package/dist/utils/index.js +9 -9
  67. package/package.json +14 -14
  68. package/src/consts.ts +2 -0
  69. package/src/react/_internal/databeat/index.ts +11 -3
  70. package/src/react/_internal/wagmi/create-config.ts +11 -2
  71. package/src/react/_internal/wallet/__tests__/wallet.test.ts +343 -0
  72. package/src/react/_internal/wallet/useWallet.ts +22 -15
  73. package/src/react/_internal/wallet/wallet.ts +11 -9
  74. package/src/react/hooks/__tests__/useBalanceOfCollectible.test.tsx +6 -14
  75. package/src/react/hooks/__tests__/useCancelOrder.test.tsx +51 -154
  76. package/src/react/hooks/__tests__/useCancelTransactionSteps.test.tsx +21 -19
  77. package/src/react/hooks/__tests__/useCollectionBalanceDetails.test.tsx +5 -14
  78. package/src/react/hooks/__tests__/useCollectionDetailsPolling.test.tsx +5 -10
  79. package/src/react/hooks/__tests__/useCurrencyBalance.test.tsx +69 -80
  80. package/src/react/hooks/__tests__/useGenerateCancelTransaction.test.tsx +12 -67
  81. package/src/react/hooks/__tests__/useGenerateListingTransaction.test.tsx +7 -17
  82. package/src/react/hooks/__tests__/useGenerateOfferTransaction.test.tsx +7 -16
  83. package/src/react/hooks/__tests__/useGenerateSellTransaction.test.tsx +8 -17
  84. package/src/react/hooks/__tests__/useListBalances.test.tsx +3 -8
  85. package/src/react/hooks/__tests__/useListCollectibleActivities.test.tsx +5 -10
  86. package/src/react/hooks/__tests__/useListCollectionActivities.test.tsx +6 -11
  87. package/src/react/hooks/__tests__/useListCollections.test.tsx +5 -13
  88. package/src/react/hooks/__tests__/useMarketplaceConfig.test.tsx +5 -13
  89. package/src/react/hooks/__tests__/useRoyaltyPercentage.test.tsx +46 -78
  90. package/src/react/hooks/options/__mocks__/marketplaceConfig.msw.ts +9 -4
  91. package/src/react/hooks/useCurrencyBalance.tsx +4 -5
  92. package/src/react/hooks/useRoyaltyPercentage.tsx +16 -8
  93. package/src/react/ssr/__tests__/create-ssr-client.test.ts +118 -0
  94. package/src/react/ui/components/collectible-card/CollectibleCard.tsx +25 -6
  95. package/src/react/ui/components/collectible-card/Footer.tsx +46 -7
  96. package/src/react/ui/components/collectible-card/styles.css.ts +26 -2
  97. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +10 -28
  98. package/src/react/ui/modals/BuyModal/hooks/__tests__/useLoadData.test.tsx +9 -36
  99. package/src/react/ui/modals/BuyModal/modals/Modal1155.tsx +16 -5
  100. package/src/react/ui/modals/CreateListingModal/Modal.tsx +3 -2
  101. package/src/react/ui/modals/SellModal/Modal.tsx +1 -0
  102. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +8 -7
  103. package/src/types/sdk-config.ts +1 -0
  104. package/src/utils/index.ts +0 -1
  105. package/src/utils/price.ts +11 -0
  106. package/tsconfig.tsbuildinfo +1 -1
  107. package/dist/chunk-4YR6AIXG.js.map +0 -1
  108. package/dist/chunk-7C7ADZ2H.js.map +0 -1
  109. package/dist/chunk-7FN62HOP.js.map +0 -1
  110. package/dist/chunk-AIGFG26L.js.map +0 -1
  111. package/dist/chunk-E2V2BMF6.js.map +0 -1
  112. package/dist/chunk-J6F5QOW5.js.map +0 -1
  113. package/dist/chunk-RIGIV5XT.js.map +0 -1
  114. package/dist/chunk-Y75XGZOB.js.map +0 -1
  115. package/src/react/_internal/test/mocks/publicClient.ts +0 -39
  116. package/src/react/_internal/test/mocks/wagmi.ts +0 -61
  117. package/src/utils/__tests__/get-public-rpc-client.test.ts +0 -111
  118. package/src/utils/get-public-rpc-client.ts +0 -41
@@ -0,0 +1,343 @@
1
+ import {
2
+ type Account,
3
+ type Address,
4
+ type Chain,
5
+ type PublicClient,
6
+ type WalletClient,
7
+ hexToBigInt,
8
+ } from 'viem';
9
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
10
+ import type { Connector } from 'wagmi';
11
+ import type { SdkConfig } from '../../../../types';
12
+ import {
13
+ ChainSwitchError,
14
+ TransactionExecutionError,
15
+ TransactionSignatureError,
16
+ UserRejectedRequestError,
17
+ } from '../../../../utils/_internal/error/transaction';
18
+ import { StepType, WalletKind } from '../../api';
19
+ import { mockIndexerHandler } from '../../api/__mocks__/indexer.msw';
20
+ import { mockMetadataHandler } from '../../api/__mocks__/metadata.msw';
21
+ import { server } from '../../test/setup';
22
+ import type { SignatureStep, TransactionStep } from '../../utils';
23
+ import { wallet } from '../wallet';
24
+
25
+ describe('wallet', () => {
26
+ const mockChains = [
27
+ { id: 1, name: 'Ethereum' },
28
+ { id: 137, name: 'Polygon' },
29
+ ] as unknown as readonly [Chain, ...Chain[]];
30
+
31
+ const mockAddress = '0x1234567890123456789012345678901234567890' as Address;
32
+ const mockAccount: Account = {
33
+ address: mockAddress,
34
+ type: 'json-rpc',
35
+ };
36
+
37
+ const mockConnector = {
38
+ id: 'sequence',
39
+ name: 'Sequence',
40
+ type: 'injected',
41
+ connect: vi.fn(),
42
+ disconnect: vi.fn(),
43
+ getAccount: vi.fn(),
44
+ getAccounts: vi.fn(),
45
+ getChainId: vi.fn(),
46
+ getProvider: vi.fn(),
47
+ isAuthorized: vi.fn(),
48
+ onAccountsChanged: vi.fn(),
49
+ onChainChanged: vi.fn(),
50
+ onDisconnect: vi.fn(),
51
+ } as unknown as Connector;
52
+
53
+ const mockTransport = {
54
+ key: 'mock',
55
+ name: 'Mock Transport',
56
+ request: vi.fn(),
57
+ type: 'mock',
58
+ };
59
+
60
+ const mockWalletClient = {
61
+ account: mockAccount,
62
+ transport: mockTransport,
63
+ type: 'walletClient',
64
+ chain: mockChains[0],
65
+ uid: 'test-uid',
66
+ key: 'mock',
67
+ name: 'Mock Wallet',
68
+ cacheTime: 0,
69
+ pollingInterval: 0,
70
+ request: vi.fn(),
71
+ extend: vi.fn(),
72
+ getChainId: vi.fn().mockResolvedValue(1),
73
+ getAddresses: vi.fn().mockResolvedValue([mockAddress]),
74
+ switchChain: vi.fn(),
75
+ signMessage: vi.fn(),
76
+ signTypedData: vi.fn(),
77
+ sendTransaction: vi.fn(),
78
+ signTransaction: vi.fn(),
79
+ addChain: vi.fn(),
80
+ deployContract: vi.fn(),
81
+ getPermissions: vi.fn(),
82
+ requestAddresses: vi.fn(),
83
+ requestPermissions: vi.fn(),
84
+ watchAsset: vi.fn(),
85
+ writeContract: vi.fn(),
86
+ prepareTransactionRequest: vi.fn(),
87
+ sendRawTransaction: vi.fn(),
88
+ } as unknown as WalletClient & { account: Account };
89
+
90
+ const mockSdkConfig: SdkConfig = {
91
+ projectAccessKey: 'test-key',
92
+ projectId: 'test-project',
93
+ };
94
+
95
+ const mockPublicClient = {
96
+ readContract: vi.fn(),
97
+ } as unknown as PublicClient;
98
+
99
+ let walletInstance: ReturnType<typeof wallet>;
100
+
101
+ beforeEach(() => {
102
+ walletInstance = wallet({
103
+ wallet: mockWalletClient,
104
+ chains: mockChains,
105
+ connector: mockConnector,
106
+ sdkConfig: mockSdkConfig,
107
+ publicClient: mockPublicClient,
108
+ });
109
+ });
110
+
111
+ describe('initialization', () => {
112
+ it('should create wallet instance with correct properties', () => {
113
+ expect(walletInstance.transport).toBeDefined();
114
+ expect(walletInstance.isWaaS).toBe(false);
115
+ expect(walletInstance.walletKind).toBe(WalletKind.sequence);
116
+ });
117
+ });
118
+
119
+ describe('address', () => {
120
+ it('should return wallet address', async () => {
121
+ const address = await walletInstance.address();
122
+ expect(address).toBe(mockAddress);
123
+ });
124
+ });
125
+
126
+ describe('switchChain', () => {
127
+ it('should switch chain successfully', async () => {
128
+ await walletInstance.switchChain(137);
129
+ expect(mockWalletClient.switchChain).toHaveBeenCalledWith({ id: 137 });
130
+ });
131
+
132
+ it('should throw ChainSwitchError on unsupported chain switch', async () => {
133
+ vi.mocked(mockWalletClient.switchChain).mockRejectedValueOnce({
134
+ name: 'SwitchChainNotSupportedError',
135
+ });
136
+ await expect(walletInstance.switchChain(137)).rejects.toThrow(
137
+ ChainSwitchError,
138
+ );
139
+ });
140
+
141
+ it('should throw UserRejectedRequestError when user rejects chain switch', async () => {
142
+ vi.mocked(mockWalletClient.switchChain).mockRejectedValueOnce({
143
+ name: 'UserRejectedRequestError',
144
+ });
145
+ await expect(walletInstance.switchChain(137)).rejects.toThrow(
146
+ UserRejectedRequestError,
147
+ );
148
+ });
149
+ });
150
+
151
+ describe('handleSignMessageStep', () => {
152
+ const mockSignatureStep: SignatureStep = {
153
+ id: StepType.signEIP191,
154
+ data: '0xmessage',
155
+ to: '0x456' as Address,
156
+ value: '0x0',
157
+ price: '0x0',
158
+ post: {
159
+ endpoint: '/api/test',
160
+ method: 'POST',
161
+ body: {},
162
+ },
163
+ };
164
+
165
+ it('should handle EIP-191 signature', async () => {
166
+ // Add MSW handler for any API calls that might happen during signing
167
+ server.use(
168
+ mockIndexerHandler('GetTokenBalances', {
169
+ page: { page: 1, pageSize: 10, more: false },
170
+ balances: [],
171
+ }),
172
+ );
173
+
174
+ const mockSignature = '0xsignature';
175
+ vi.mocked(mockWalletClient.signMessage).mockResolvedValueOnce(
176
+ mockSignature,
177
+ );
178
+
179
+ const result =
180
+ await walletInstance.handleSignMessageStep(mockSignatureStep);
181
+
182
+ expect(result).toBe(mockSignature);
183
+ expect(mockWalletClient.signMessage).toHaveBeenCalled();
184
+ });
185
+
186
+ it('should handle EIP-712 signature', async () => {
187
+ const mockEip712Step: SignatureStep & {
188
+ signature: NonNullable<SignatureStep['signature']>;
189
+ } = {
190
+ id: StepType.signEIP712,
191
+ data: '0x',
192
+ to: '0x456' as Address,
193
+ price: '0x0',
194
+ value: '0x0',
195
+ post: {
196
+ endpoint: '/api/test',
197
+ method: 'POST',
198
+ body: {},
199
+ },
200
+ signature: {
201
+ domain: {
202
+ name: 'Test Domain',
203
+ version: '1',
204
+ chainId: 1,
205
+ verifyingContract: '0x123' as Address,
206
+ },
207
+ types: {},
208
+ primaryType: 'Mail',
209
+ value: {},
210
+ },
211
+ };
212
+
213
+ // Add specific handler for EIP-712 signing
214
+ server.use(
215
+ mockMetadataHandler('GetContractInfo', {
216
+ contractInfo: {
217
+ address: mockEip712Step.signature.domain.verifyingContract,
218
+ chainId: mockEip712Step.signature.domain.chainId,
219
+ name: mockEip712Step.signature.domain.name,
220
+ type: 'ERC721',
221
+ },
222
+ }),
223
+ );
224
+
225
+ const mockSignature = '0xsignature';
226
+ vi.mocked(mockWalletClient.signTypedData).mockResolvedValueOnce(
227
+ mockSignature,
228
+ );
229
+
230
+ const result = await walletInstance.handleSignMessageStep(mockEip712Step);
231
+
232
+ expect(result).toBe(mockSignature);
233
+ expect(mockWalletClient.signTypedData).toHaveBeenCalled();
234
+ });
235
+
236
+ it('should throw TransactionSignatureError on signature failure', async () => {
237
+ vi.mocked(mockWalletClient.signMessage).mockRejectedValueOnce(
238
+ new Error('Signature failed'),
239
+ );
240
+
241
+ await expect(
242
+ walletInstance.handleSignMessageStep(mockSignatureStep),
243
+ ).rejects.toThrow(TransactionSignatureError);
244
+ });
245
+ });
246
+
247
+ describe('handleSendTransactionStep', () => {
248
+ const mockTxStep: TransactionStep = {
249
+ id: StepType.buy,
250
+ to: '0x456' as Address,
251
+ value: '0x0',
252
+ data: '0x',
253
+ price: '0x0',
254
+ };
255
+
256
+ it('should send transaction successfully', async () => {
257
+ // Add MSW handler for transaction-related API calls
258
+ server.use(
259
+ mockIndexerHandler('FetchTransactionReceipt', {
260
+ receipt: {
261
+ txnHash: '0xtxhash',
262
+ txnStatus: 'SUCCESSFUL',
263
+ },
264
+ }),
265
+ );
266
+
267
+ const mockTxHash = '0xtxhash';
268
+ vi.mocked(mockWalletClient.sendTransaction).mockResolvedValueOnce(
269
+ mockTxHash,
270
+ );
271
+
272
+ const result = await walletInstance.handleSendTransactionStep(
273
+ 1,
274
+ mockTxStep,
275
+ );
276
+
277
+ expect(result).toBe(mockTxHash);
278
+ expect(mockWalletClient.sendTransaction).toHaveBeenCalledWith(
279
+ expect.objectContaining({
280
+ to: mockTxStep.to,
281
+ value: hexToBigInt('0x0'),
282
+ }),
283
+ );
284
+ });
285
+
286
+ it('should throw TransactionExecutionError on transaction failure', async () => {
287
+ vi.mocked(mockWalletClient.sendTransaction).mockRejectedValueOnce(
288
+ new Error('Transaction failed'),
289
+ );
290
+
291
+ await expect(
292
+ walletInstance.handleSendTransactionStep(1, mockTxStep),
293
+ ).rejects.toThrow(TransactionExecutionError);
294
+ });
295
+
296
+ it('should handle transaction with contract interaction', async () => {
297
+ const mockContractTxStep: TransactionStep = {
298
+ id: StepType.buy,
299
+ to: '0x456' as Address,
300
+ price: '0x0',
301
+ value: '0x0',
302
+ data: '0x123456', // Mock contract interaction data
303
+ };
304
+
305
+ // Add handlers for contract-related API calls
306
+ server.use(
307
+ mockIndexerHandler('FetchTransactionReceipt', {
308
+ receipt: {
309
+ txnHash: '0xtxhash',
310
+ txnStatus: 'SUCCESSFUL',
311
+ logs: [],
312
+ },
313
+ }),
314
+ mockMetadataHandler('GetContractInfo', {
315
+ contractInfo: {
316
+ address: mockContractTxStep.to,
317
+ chainId: 1,
318
+ name: 'Test Contract',
319
+ type: 'ERC721',
320
+ },
321
+ }),
322
+ );
323
+
324
+ const mockTxHash = '0xtxhash';
325
+ vi.mocked(mockWalletClient.sendTransaction).mockResolvedValueOnce(
326
+ mockTxHash,
327
+ );
328
+
329
+ const result = await walletInstance.handleSendTransactionStep(
330
+ 1,
331
+ mockContractTxStep,
332
+ );
333
+
334
+ expect(result).toBe(mockTxHash);
335
+ expect(mockWalletClient.sendTransaction).toHaveBeenCalledWith(
336
+ expect.objectContaining({
337
+ to: mockContractTxStep.to,
338
+ data: mockContractTxStep.data,
339
+ }),
340
+ );
341
+ });
342
+ });
343
+ });
@@ -1,7 +1,13 @@
1
- import { useAccount, useChainId, useSwitchChain, useWalletClient } from 'wagmi';
2
- import { useQuery } from '@tanstack/react-query';
3
- import { wallet, type WalletInstance } from './wallet';
1
+ import { skipToken, useQuery } from '@tanstack/react-query';
2
+ import {
3
+ useAccount,
4
+ useChainId,
5
+ usePublicClient,
6
+ useSwitchChain,
7
+ useWalletClient,
8
+ } from 'wagmi';
4
9
  import { useConfig } from '../../hooks';
10
+ import { type WalletInstance, wallet } from './wallet';
5
11
 
6
12
  type UseWalletReturn = {
7
13
  wallet: WalletInstance | null | undefined;
@@ -16,22 +22,23 @@ export const useWallet = (): UseWalletReturn => {
16
22
  const { connector, isConnected, isConnecting } = useAccount();
17
23
  const sdkConfig = useConfig();
18
24
  const chainId = useChainId();
25
+ const publicClient = usePublicClient();
19
26
 
20
27
  const { data, isLoading, isError } = useQuery({
21
28
  queryKey: ['wallet', chainId, connector?.uid],
22
- queryFn: () => {
23
- if (!walletClient || !connector || !isConnected) {
24
- return null;
25
- }
26
- return wallet({
27
- wallet: walletClient,
28
- chains,
29
- connector,
30
- sdkConfig,
31
- });
32
- },
29
+ queryFn:
30
+ walletClient && connector && isConnected && publicClient
31
+ ? () => {
32
+ return wallet({
33
+ wallet: walletClient,
34
+ chains,
35
+ connector,
36
+ sdkConfig,
37
+ publicClient,
38
+ });
39
+ }
40
+ : skipToken,
33
41
  staleTime: Number.POSITIVE_INFINITY,
34
- enabled: Boolean(walletClient && connector && isConnected),
35
42
  });
36
43
 
37
44
  return {
@@ -1,8 +1,10 @@
1
+ import type { TransactionReceipt } from '@0xsequence/indexer';
1
2
  import {
2
3
  type Account,
3
4
  type Address,
4
5
  type Chain,
5
6
  type Hex,
7
+ type PublicClient,
6
8
  TransactionReceiptNotFoundError,
7
9
  type TypedDataDomain,
8
10
  type WalletClient as ViemWalletClient,
@@ -15,7 +17,12 @@ import {
15
17
  } from 'viem';
16
18
  import type { Connector } from 'wagmi';
17
19
  import type { SwitchChainErrorType } from 'wagmi/actions';
18
- import { ERC1155_ABI, getPublicRpcClient } from '../../../utils';
20
+ import {
21
+ SEQUENCE_MARKET_V1_ADDRESS,
22
+ SEQUENCE_MARKET_V2_ADDRESS,
23
+ } from '../../../consts';
24
+ import type { SdkConfig } from '../../../types';
25
+ import { ERC1155_ABI } from '../../../utils';
19
26
  import {
20
27
  ChainSwitchError,
21
28
  TransactionConfirmationError,
@@ -23,15 +30,9 @@ import {
23
30
  TransactionSignatureError,
24
31
  UserRejectedRequestError,
25
32
  } from '../../../utils/_internal/error/transaction';
26
- import { getIndexerClient, StepType, WalletKind } from '../api';
33
+ import { StepType, WalletKind, getIndexerClient } from '../api';
27
34
  import { createLogger } from '../logger';
28
35
  import type { SignatureStep, TransactionStep } from '../utils';
29
- import {
30
- SEQUENCE_MARKET_V1_ADDRESS,
31
- SEQUENCE_MARKET_V2_ADDRESS,
32
- } from '../../../consts';
33
- import type { SdkConfig } from '../../../types';
34
- import type { TransactionReceipt } from '@0xsequence/indexer';
35
36
 
36
37
  interface WalletClient extends Omit<ViemWalletClient, 'account'> {
37
38
  account: Account;
@@ -65,11 +66,13 @@ export const wallet = ({
65
66
  chains,
66
67
  connector,
67
68
  sdkConfig,
69
+ publicClient,
68
70
  }: {
69
71
  wallet: WalletClient;
70
72
  chains: readonly [Chain, ...Chain[]];
71
73
  connector: Connector;
72
74
  sdkConfig: SdkConfig;
75
+ publicClient: PublicClient;
73
76
  }): WalletInstance => {
74
77
  const logger = createLogger('Wallet');
75
78
 
@@ -202,7 +205,6 @@ export const wallet = ({
202
205
  contractAddress: Address;
203
206
  spender: Address | 'sequenceMarketV1' | 'sequenceMarketV2';
204
207
  }) => {
205
- const publicClient = getPublicRpcClient(await wallet.getChainId());
206
208
  const walletAddress = await walletInstance.address();
207
209
  const spenderAddress =
208
210
  spender === 'sequenceMarketV1'
@@ -1,21 +1,13 @@
1
- import { describe, expect, it, beforeEach, vi } from 'vitest';
2
- import { renderHook, waitFor } from '../../_internal/test-utils';
3
- import { useBalanceOfCollectible } from '../useBalanceOfCollectible';
4
- import {
5
- mockTokenBalance,
6
- enableDebug,
7
- } from '../../_internal/api/__mocks__/indexer.msw';
8
- import { zeroAddress } from 'viem';
9
- import { server } from '../../_internal/test/setup';
10
1
  import { http, HttpResponse } from 'msw';
2
+ import { zeroAddress } from 'viem';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { mockTokenBalance } from '../../_internal/api/__mocks__/indexer.msw';
11
5
  import { mockIndexerEndpoint } from '../../_internal/api/__mocks__/indexer.msw';
6
+ import { renderHook, waitFor } from '../../_internal/test-utils';
7
+ import { server } from '../../_internal/test/setup';
8
+ import { useBalanceOfCollectible } from '../useBalanceOfCollectible';
12
9
 
13
10
  describe('useBalanceOfCollectible', () => {
14
- beforeEach(() => {
15
- vi.clearAllMocks();
16
- enableDebug();
17
- });
18
-
19
11
  const defaultArgs = {
20
12
  collectionAddress: zeroAddress,
21
13
  collectableId: '1',