From 62e2c404db091024f18987909446089bc89ab020 Mon Sep 17 00:00:00 2001 From: broody Date: Sun, 24 Sep 2023 19:07:50 -0700 Subject: [PATCH] fix(web): set maxFee 0 workaround for invalid sig --- src/hooks/dojo/index.tsx | 22 +++++++++++++--------- src/hooks/useBurner.tsx | 27 +++++++++++++++++---------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/hooks/dojo/index.tsx b/src/hooks/dojo/index.tsx index 31e9094..ddd0c6b 100644 --- a/src/hooks/dojo/index.tsx +++ b/src/hooks/dojo/index.tsx @@ -62,15 +62,19 @@ export function DojoProvider({ setError(undefined); return account - .execute({ - contractAddress: WORLD_ADDRESS, - entrypoint: "execute", - calldata: CallData.compile([ - shortString.encodeShortString(systemName), - params.length, - ...params, - ]), - }) + .execute( + { + contractAddress: WORLD_ADDRESS, + entrypoint: "execute", + calldata: CallData.compile([ + shortString.encodeShortString(systemName), + params.length, + ...params, + ]), + }, + undefined, + { maxFee: 0 }, + ) .then(async ({ transaction_hash }) => { await account.waitForTransaction(transaction_hash, { retryInterval: 1000, diff --git a/src/hooks/useBurner.tsx b/src/hooks/useBurner.tsx index 8b9574a..e6872bb 100644 --- a/src/hooks/useBurner.tsx +++ b/src/hooks/useBurner.tsx @@ -105,11 +105,14 @@ export const useBurner = () => { // deploy burner const burner = new Account(provider, address, privateKey); - const { transaction_hash: deployTx } = await burner.deployAccount({ - classHash: process.env.NEXT_PUBLIC_ACCOUNT_CLASS_HASH!, - constructorCalldata: CallData.compile({ publicKey }), - addressSalt: publicKey, - }); + const { transaction_hash: deployTx } = await burner.deployAccount( + { + classHash: process.env.NEXT_PUBLIC_ACCOUNT_CLASS_HASH!, + constructorCalldata: CallData.compile({ publicKey }), + addressSalt: publicKey, + }, + { maxFee: 0 }, + ); // save burner let storage = Storage.get("burners") || {}; @@ -141,11 +144,15 @@ export const useBurner = () => { }; const prefundAccount = async (address: string, account: Account) => { - const { transaction_hash } = await account.execute({ - contractAddress: ETH_CONTRACT_ADDRESS, - entrypoint: "transfer", - calldata: CallData.compile([address, PREFUND_AMOUNT, "0x0"]), - }); + const { transaction_hash } = await account.execute( + { + contractAddress: ETH_CONTRACT_ADDRESS, + entrypoint: "transfer", + calldata: CallData.compile([address, PREFUND_AMOUNT, "0x0"]), + }, + undefined, + { maxFee: 0 }, + ); return await account.waitForTransaction(transaction_hash, { retryInterval: 1000,