Skip to content

Commit

Permalink
Execute prompt uses webauthn insteaf of session (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
broody authored Jul 11, 2024
1 parent bac1979 commit b8f25fc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions packages/keychain/src/components/Execute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { Policies } from "Policies";
import { Fees } from "./Fees";
import { ExecuteCtx } from "utils/connection";
import { TransferAmountExceedsBalance } from "errors";
import { ESTIMATE_FEE_MULTIPLIER } from "utils/connection/execute";
import { ETH_MIN_PREFUND } from "utils/token";
import { num } from "starknet";

export const CONTRACT_ETH =
"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";
Expand Down Expand Up @@ -112,20 +113,14 @@ export function Execute() {

const onSubmit = useCallback(async () => {
setLoading(true);
const session = controller.session(ctx.origin);

const { overall_fee } = await account.cartridge.estimateInvokeFee(
calls,
session,
ESTIMATE_FEE_MULTIPLIER,
);

// TODO: calculate webauthn validation cost separately
const maxFee = num.toHex(ctx.transactionsDetail?.maxFee || ETH_MIN_PREFUND);
const { transaction_hash } = await account.execute(
calls,
{
maxFee: overall_fee,
maxFee,
},
session,
);
ctx.resolve({
transaction_hash,
Expand Down

0 comments on commit b8f25fc

Please sign in to comment.