diff --git a/tauri-app/src/lib/utils/gas.ts b/tauri-app/src/lib/utils/gas.ts new file mode 100644 index 000000000..2db3ff442 --- /dev/null +++ b/tauri-app/src/lib/utils/gas.ts @@ -0,0 +1,3 @@ +// @todo replace this hardcoded value with dynamic fee estimation in rust +// see https://github.com/rainlanguage/rain.orderbook/issues/79 +export const MAX_FEE_PER_GAS_PLACEHOLDER = '400000000000'; \ No newline at end of file diff --git a/tauri-app/src/lib/utils/orderRemove.ts b/tauri-app/src/lib/utils/orderRemove.ts index 46562b336..10b67ef7a 100644 --- a/tauri-app/src/lib/utils/orderRemove.ts +++ b/tauri-app/src/lib/utils/orderRemove.ts @@ -2,6 +2,7 @@ import { get } from 'svelte/store'; import { invoke } from '@tauri-apps/api'; import { rpcUrl, orderbookAddress, walletDerivationIndex, subgraphUrl } from '../stores/settings'; import { chainId } from '$lib/stores/chain'; +import { MAX_FEE_PER_GAS_PLACEHOLDER } from './gas'; export async function orderRemove(id: string) { await invoke("order_remove", { @@ -11,8 +12,8 @@ export async function orderRemove(id: string) { orderbook_address: get(orderbookAddress), derivation_index: get(walletDerivationIndex), chain_id: get(chainId), - max_priority_fee_per_gas: '400000000000', - max_fee_per_gas: '400000000000', + max_priority_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, + max_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, }, subgraphArgs: { url: get(subgraphUrl) diff --git a/tauri-app/src/lib/utils/vaultDeposit.ts b/tauri-app/src/lib/utils/vaultDeposit.ts index 80792bd1f..a9d49d2d5 100644 --- a/tauri-app/src/lib/utils/vaultDeposit.ts +++ b/tauri-app/src/lib/utils/vaultDeposit.ts @@ -2,6 +2,7 @@ import { get } from 'svelte/store'; import { invoke } from '@tauri-apps/api'; import { rpcUrl, orderbookAddress, walletDerivationIndex } from '../stores/settings'; import { chainId } from '$lib/stores/chain'; +import { MAX_FEE_PER_GAS_PLACEHOLDER } from './gas'; export async function vaultDeposit(vaultId: bigint, token: string, amount: bigint) { await invoke("vault_deposit", { @@ -15,8 +16,8 @@ export async function vaultDeposit(vaultId: bigint, token: string, amount: bigin orderbook_address: get(orderbookAddress), derivation_index: get(walletDerivationIndex), chain_id: get(chainId), - max_priority_fee_per_gas: '400000000000', - max_fee_per_gas: '400000000000', + max_priority_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, + max_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, } }); } \ No newline at end of file diff --git a/tauri-app/src/lib/utils/vaultWithdraw.ts b/tauri-app/src/lib/utils/vaultWithdraw.ts index 5e1a0381e..f61623073 100644 --- a/tauri-app/src/lib/utils/vaultWithdraw.ts +++ b/tauri-app/src/lib/utils/vaultWithdraw.ts @@ -2,6 +2,7 @@ import { get } from 'svelte/store'; import { invoke } from '@tauri-apps/api'; import { rpcUrl, orderbookAddress, walletDerivationIndex } from '../stores/settings'; import { chainId } from '$lib/stores/chain'; +import { MAX_FEE_PER_GAS_PLACEHOLDER } from './gas'; export async function vaultWithdraw(vaultId: bigint, token: string, targetAmount: bigint) { await invoke("vault_withdraw", { @@ -15,8 +16,8 @@ export async function vaultWithdraw(vaultId: bigint, token: string, targetAmount orderbook_address: get(orderbookAddress), derivation_index: get(walletDerivationIndex), chain_id: get(chainId), - max_priority_fee_per_gas: '400000000000', - max_fee_per_gas: '400000000000', + max_priority_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, + max_fee_per_gas: MAX_FEE_PER_GAS_PLACEHOLDER, } }); } \ No newline at end of file