Skip to content

Commit

Permalink
[SDK] fix: Force pre-EIP1559 transactions on Homeverse chains (#6332)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges authored Feb 25, 2025
1 parent 150a90c commit 28df6f7
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-planets-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Force pre-eip1559 tx on Homeverse mainnet/testnet
2 changes: 2 additions & 0 deletions apps/dashboard/src/components/buttons/MismatchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const GAS_FREE_CHAINS = [
300, // zksync sepolia
7225878, // Saakuru Mainnet
247253, // Saakuru Testnet
19011, // Homeverse Mainnet
40875, // Homeverse Testnet
];

function useIsNetworkMismatch(txChainId: number) {
Expand Down
9 changes: 8 additions & 1 deletion apps/login/src/api/login/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ import "server-only";
import type { InAppWalletAuth } from "thirdweb/wallets";
import type { Permission } from "../../components/permission-card";

export async function getLoginConfig(clientId: string) {
export async function getLoginConfig(clientId: string): Promise<LoginConfig> {
if (clientId === "demo") {
return DEMO_ENVIRONMENT;
}
// temporary manual config
if (clientId === "b24106adfb2ec212e6ec4d3b2e04db9e") {
return {
...DEFAULT_CONFIG,
sessionKeySignerAddress: "0xb89e32a18350d6df5bf0b89a227E098013C4Fa72",
};
}
// TODO: implement fetch for config from API server
return DEFAULT_CONFIG;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/thirdweb/src/auth/verify-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ export async function verifyEip1271Signature({
contract,
});
return result === EIP_1271_MAGIC_VALUE;
} catch {
} catch (err) {
console.error("Error verifying EIP-1271 signature", err);
return false;
}
}
4 changes: 3 additions & 1 deletion packages/thirdweb/src/gas/fee-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const FORCE_GAS_PRICE_CHAIN_IDS = [
1942999413, // Humanity Testnet
1952959480, // Lumia Testnet
994873017, // Lumia Mainnet
19011, // Homeverse Mainnet
40875, // Homeverse Testnet
];

/**
Expand Down Expand Up @@ -89,7 +91,7 @@ export async function getGasOverridesForTransaction(
}

// return as is
if (defaultGasOverrides.gasPrice) {
if (defaultGasOverrides.gasPrice !== undefined) {
return defaultGasOverrides;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { currencies, getCurrencyMeta, usdCurrency } from "./currencies.js";

describe("Currency Utilities", () => {
it("should have correct number of currencies", () => {
expect(currencies.length).toBe(5);
expect(currencies.length).toBe(7);
});

it("should have USD as the first currency", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function estimateGasCost(
transaction.chain,
);
const gasPrice = fees.maxFeePerGas || fees.gasPrice;
if (!gasPrice) {
if (gasPrice === undefined) {
throw new Error(
`Unable to determine gas price for chain ${transaction.chain.id}`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
smartAccount,
accountContract,
});
await new Promise((resolve) => setTimeout(resolve, 1000)); // pause for a second to prevent race condition
await new Promise((resolve) => setTimeout(resolve, 3000)); // pause for a second to prevent race condition

const signature = await smartAccount.signMessage({
message: "hello world",
Expand Down

0 comments on commit 28df6f7

Please sign in to comment.