Skip to content

Commit

Permalink
fix(web): set maxFee 0 workaround for invalid sig
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Sep 25, 2023
1 parent 0bd0173 commit 62e2c40
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
22 changes: 13 additions & 9 deletions src/hooks/dojo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
27 changes: 17 additions & 10 deletions src/hooks/useBurner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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") || {};
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 62e2c40

Please sign in to comment.