Skip to content

Commit bf2209b

Browse files
Khizr97claudesvenvoskamp0xmkh
authored
fix: consolidated bug fixes batch (#5646)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Sven <38101365+svenvoskamp@users.noreply.github.com> Co-authored-by: Sven <fr.sven.fr@gmail.com> Co-authored-by: 0xmkh <mago.khamidov@gmail.com>
1 parent cc75433 commit bf2209b

30 files changed

Lines changed: 275 additions & 122 deletions

File tree

.size-limit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default [
2121
{
2222
name: '@reown/appkit/react',
2323
path: 'packages/appkit/dist/esm/exports/react.js',
24-
limit: '235 KB', // Current: ~222 KB (5% buffer)
24+
limit: '236 KB', // Current: ~235 KB
2525
gzip: true
2626
},
2727
{

apps/laboratory/tests/shared/validators/ModalValidator.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,22 @@ export class ModalValidator {
310310

311311
async expectOpenButton({ disabled }: { disabled: boolean }) {
312312
const secondaryButton = this.page.getByTestId('w3m-connecting-widget-secondary-button')
313-
if (disabled) {
314-
await expect(secondaryButton).toHaveAttribute('disabled')
315-
} else {
316-
await expect(secondaryButton).not.toHaveAttribute('disabled')
317-
}
313+
314+
await expect
315+
.poll(
316+
() =>
317+
secondaryButton.evaluate((el: Element) => {
318+
const btn = el.shadowRoot?.querySelector('button') as HTMLButtonElement | null
319+
if (btn) {
320+
return btn.disabled
321+
}
322+
const attr = el.getAttribute('disabled')
323+
324+
return attr !== null && attr !== 'false'
325+
}),
326+
{ timeout: 60000 }
327+
)
328+
.toBe(disabled)
318329
}
319330

320331
async expectTryAgainButton() {

packages/adapters/bitcoin/src/connectors/BitcoinWalletConnectConnector.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ export class BitcoinWalletConnectConnector
7777

7878
public async getAccountAddresses(): Promise<BitcoinConnector.AccountAddress[]> {
7979
this.checkIfMethodIsSupported('getAccountAddresses')
80+
const account = this.getAccount(true)
8081

8182
const addresses = await this.internalRequest({
8283
method: 'getAccountAddresses',
83-
params: undefined
84+
params: { account }
8485
})
8586

8687
return addresses.map(address => ({ address, purpose: AddressPurpose.Payment }))
@@ -119,7 +120,7 @@ export class BitcoinWalletConnectConnector
119120
}
120121

121122
public setDefaultChain(chainId: string) {
122-
this.provider.setDefaultChain(chainId)
123+
this.provider?.setDefaultChain(chainId)
123124
}
124125

125126
// -- Private ------------------------------------------ //
@@ -210,6 +211,11 @@ export namespace WalletConnectProvider {
210211
memo?: string
211212
}
212213

214+
export type WCGetAccountAddressesParams = {
215+
account: string
216+
intentions?: string[]
217+
}
218+
213219
export type WCGetAccountAddressesResponse = {
214220
address: string
215221
publicKey: Uint8Array
@@ -240,7 +246,7 @@ export namespace WalletConnectProvider {
240246
export type RequestMethods = {
241247
signMessage: Request<WCSignMessageParams, WCSignMessageResponse>
242248
sendTransfer: Request<WCSendTransferParams, WCSendTransferResponse>
243-
getAccountAddresses: Request<undefined, string[]>
249+
getAccountAddresses: Request<WCGetAccountAddressesParams, string[]>
244250
signPsbt: Request<WCSignPSBTParams, WCSignPSBTResponse>
245251
}
246252

packages/adapters/bitcoin/tests/utils/WalletConnectProvider.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ describe('LeatherConnector', () => {
197197
describe('getAccountAddresses', () => {
198198
beforeEach(() => {
199199
universalProvider.session = mockUniversalProvider.mockSession()
200+
vi.spyOn(ChainController, 'getAccountData').mockReturnValue({
201+
caipAddress: `${bitcoin.caipNetworkId}:address`,
202+
address: 'address'
203+
} as unknown as AccountState)
200204
})
201205

202206
it('should get the account addresses and parse response', async () => {
@@ -208,7 +212,7 @@ describe('LeatherConnector', () => {
208212
expect(requestSpy).toHaveBeenCalledWith(
209213
{
210214
method: 'getAccountAddresses',
211-
params: undefined
215+
params: { account: 'address' }
212216
},
213217
bitcoin.caipNetworkId
214218
)

packages/adapters/solana/src/providers/SolanaWalletConnectProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class SolanaWalletConnectProvider
232232
}
233233

234234
public setDefaultChain(chainId: string) {
235-
this.provider.setDefaultChain(chainId)
235+
this.provider?.setDefaultChain(chainId)
236236
}
237237

238238
// -- Private ------------------------------------------ //

packages/adapters/ton/src/connectors/TonWalletConnectConnector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class TonWalletConnectConnector
113113
}
114114

115115
public setDefaultChain(chainId: string) {
116-
this.provider.setDefaultChain(chainId)
116+
this.provider?.setDefaultChain(chainId)
117117
}
118118

119119
// -- Internals ----------------------------------------------------- //

packages/adapters/tron/src/connectors/TronWalletConnectConnector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class TronWalletConnectConnector
168168
}
169169

170170
public setDefaultChain(chainId: string) {
171-
this.provider.setDefaultChain(chainId)
171+
this.provider?.setDefaultChain(chainId)
172172
}
173173

174174
// -- Internals ----------------------------------------------------- //

packages/adapters/wagmi/src/client.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,14 @@ export class WagmiAdapter extends AdapterBlueprint {
10861086
}
10871087

10881088
private toChecksummedAddress(address: string) {
1089-
return checksumAddress(address.toLowerCase() as `0x${string}`)
1089+
if (!address) {
1090+
return address as `0x${string}`
1091+
}
1092+
1093+
try {
1094+
return checksumAddress(address.toLowerCase() as `0x${string}`)
1095+
} catch {
1096+
return address as `0x${string}`
1097+
}
10901098
}
10911099
}

packages/appkit/src/client/appkit-base-client.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,10 +1277,10 @@ export abstract class AppKitBaseClient {
12771277
address,
12781278
chainId: syncAccountChainId,
12791279
chainNamespace
1280-
})
1280+
}).catch(() => null)
12811281
} else if (!isActiveChain && syncAccountChainId) {
12821282
this.syncAccountInfo(address, syncAccountChainId, chainNamespace)
1283-
this.syncBalance({ address, chainId: syncAccountChainId, chainNamespace })
1283+
this.syncBalance({ address, chainId: syncAccountChainId, chainNamespace }).catch(() => null)
12841284
} else {
12851285
this.syncAccountInfo(address, chainId, chainNamespace)
12861286
}
@@ -1667,7 +1667,7 @@ export abstract class AppKitBaseClient {
16671667
address,
16681668
chainId,
16691669
chainNamespace
1670-
})
1670+
}).catch(() => null)
16711671
}
16721672
}
16731673

@@ -2132,6 +2132,15 @@ export abstract class AppKitBaseClient {
21322132
chain: ChainNamespace,
21332133
shouldRefresh = false
21342134
) => {
2135+
if (caipAddress !== null) {
2136+
const parts = caipAddress.split(':')
2137+
if (parts.length !== 3 || parts.some(p => !p)) {
2138+
console.warn(`[AppKit] setCaipAddress: invalid CAIP-10 address rejected: "${caipAddress}"`)
2139+
2140+
return
2141+
}
2142+
}
2143+
21352144
ChainController.setAccountProp('caipAddress', caipAddress, chain, shouldRefresh)
21362145
ChainController.setAccountProp(
21372146
'address',

packages/appkit/src/universal-adapter/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class UniversalAdapter extends AdapterBlueprint {
264264
}
265265
}
266266
}
267-
connector.provider.setDefaultChain(caipNetwork.caipNetworkId)
267+
connector.provider?.setDefaultChain(caipNetwork.caipNetworkId)
268268
}
269269

270270
public getWalletConnectProvider() {

0 commit comments

Comments
 (0)