Skip to content

Commit 500970e

Browse files
committed
[SDK] Fix: logout on iframe (#4809)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on fixing account logout functionality and updating error messages related to transaction limits across various tests in the `thirdweb` package. ### Detailed summary - Updated `logout` method in `iframe-auth.ts` to check for `AuthQuerier` before calling logout. - Changed expected address in `deploy-published.test.ts`. - Updated error messages from `TransactionError: Error - !Qty` to `DropClaimExceedLimit` in multiple test files for `erc20`, `erc721`, and `erc1155`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 9c58c08 commit 500970e

File tree

7 files changed

+29
-14
lines changed

7 files changed

+29
-14
lines changed

.changeset/quick-queens-love.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fixes account logout state

packages/thirdweb/src/extensions/erc1155/drop1155.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ describe.runIf(process.env.TW_SECRET_KEY)(
206206
}),
207207
}),
208208
).rejects.toThrowErrorMatchingInlineSnapshot(`
209-
[TransactionError: Error - !Qty
209+
[TransactionError: DropClaimExceedLimit - 0,1
210210
211211
contract: ${contract.address}
212-
chainId: 31337]
212+
chainId: ${contract.chain.id}]
213213
`);
214214
});
215215

@@ -247,7 +247,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
247247
}),
248248
}),
249249
).rejects.toThrowErrorMatchingInlineSnapshot(`
250-
[TransactionError: Error - !Qty
250+
[TransactionError: DropClaimExceedLimit - 1,2
251251
252252
contract: ${contract.address}
253253
chainId: ${contract.chain.id}]
@@ -378,7 +378,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
378378
account: TEST_ACCOUNT_D,
379379
}),
380380
).rejects.toThrowErrorMatchingInlineSnapshot(`
381-
[TransactionError: Error - !Qty
381+
[TransactionError: DropClaimExceedLimit - 1,2
382382
383383
contract: ${contract.address}
384384
chainId: ${contract.chain.id}]

packages/thirdweb/src/extensions/erc20/drop20.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ describe.runIf(process.env.TW_SECRET_KEY)(
212212
}),
213213
}),
214214
).rejects.toThrowErrorMatchingInlineSnapshot(`
215-
[TransactionError: Error - !Qty
215+
[TransactionError: DropClaimExceedLimit - 0,1000000000000000000
216216
217217
contract: ${contract.address}
218-
chainId: 31337]
218+
chainId: ${contract.chain.id}]
219219
`);
220220
});
221221

@@ -262,7 +262,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
262262
}),
263263
}),
264264
).rejects.toThrowErrorMatchingInlineSnapshot(`
265-
[TransactionError: Error - !Qty
265+
[TransactionError: DropClaimExceedLimit - 3000000000000000000,4000000000000000000
266266
267267
contract: ${contract.address}
268268
chainId: ${contract.chain.id}]
@@ -421,7 +421,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
421421
account: TEST_ACCOUNT_D,
422422
}),
423423
).rejects.toThrowErrorMatchingInlineSnapshot(`
424-
[TransactionError: Error - !Qty
424+
[TransactionError: DropClaimExceedLimit - 1,2
425425
426426
contract: ${contract.address}
427427
chainId: ${contract.chain.id}]

packages/thirdweb/src/extensions/erc721/drop721.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ describe.runIf(process.env.TW_SECRET_KEY)(
237237
}),
238238
}),
239239
).rejects.toThrowErrorMatchingInlineSnapshot(`
240-
[TransactionError: Error - !Qty
240+
[TransactionError: DropClaimExceedLimit - 0,1
241241
242242
contract: ${contract.address}
243-
chainId: 31337]
243+
chainId: ${contract.chain.id}]
244244
`);
245245
});
246246

@@ -279,7 +279,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
279279
}),
280280
}),
281281
).rejects.toThrowErrorMatchingInlineSnapshot(`
282-
[TransactionError: Error - !Qty
282+
[TransactionError: DropClaimExceedLimit - 3,4
283283
284284
contract: ${contract.address}
285285
chainId: ${contract.chain.id}]
@@ -405,7 +405,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
405405
account: TEST_ACCOUNT_D,
406406
}),
407407
).rejects.toThrowErrorMatchingInlineSnapshot(`
408-
[TransactionError: Error - !Qty
408+
[TransactionError: DropClaimExceedLimit - 1,2
409409
410410
contract: ${contract.address}
411411
chainId: ${contract.chain.id}]

packages/thirdweb/src/extensions/prebuilts/deploy-published.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
9393
},
9494
salt: "test",
9595
});
96-
expect(address).toBe("0x777151741260F8d4098dD492e45FdB536F442672");
96+
expect(address).toBe("0x9A18AD1DdCfA00009C2db7dc78a5746d85feF759");
9797
const isDeployed = await isContractDeployed({
9898
client: TEST_CLIENT,
9999
chain: ANVIL_CHAIN,

packages/thirdweb/src/react/web/ui/ConnectWallet/Details.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,10 @@ function InAppWalletUserInfo(props: {
10751075
const { data: walletInfo } = useWalletInfo(activeWallet?.id);
10761076
const isSmartWallet = hasSmartAccount(activeWallet);
10771077
const { data: walletName } = useQuery({
1078-
queryKey: [activeWallet?.id, "wallet-name"],
1078+
queryKey: [
1079+
"wallet-name",
1080+
{ walletId: activeWallet?.id, walletAddress: account?.address },
1081+
],
10791082
queryFn: async () => {
10801083
const lastAuthProvider = await getLastAuthProvider(webLocalStorage);
10811084
if (lastAuthProvider === "guest") {

packages/thirdweb/src/wallets/in-app/web/lib/auth/iframe-auth.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,13 @@ export class Auth {
321321
* @internal
322322
*/
323323
async logout(): Promise<LogoutReturnType> {
324+
if (this.AuthQuerier) {
325+
await this.AuthQuerier.call<LogoutReturnType>({
326+
procedureName: "logout",
327+
params: undefined,
328+
});
329+
}
330+
324331
const isRemoveAuthCookie = await this.localStorage.removeAuthCookie();
325332
const isRemoveUserId = await this.localStorage.removeWalletUserId();
326333

0 commit comments

Comments
 (0)