Skip to content

Commit

Permalink
Merge pull request #144 from rainlanguage/2024-01-29-chore-hardcoded-…
Browse files Browse the repository at this point in the history
…gas-placeholder

chore(tauri/ui): pull out hardcoded gas fee placeholder into constant
  • Loading branch information
thedavidmeister authored Jan 30, 2024
2 parents b66cf31 + 54208f6 commit c63ebd0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions tauri-app/src/lib/utils/gas.ts
Original file line number Diff line number Diff line change
@@ -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';
5 changes: 3 additions & 2 deletions tauri-app/src/lib/utils/orderRemove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions tauri-app/src/lib/utils/vaultDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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,
}
});
}
5 changes: 3 additions & 2 deletions tauri-app/src/lib/utils/vaultWithdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand All @@ -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,
}
});
}

0 comments on commit c63ebd0

Please sign in to comment.