From d5e5f2486fc640beca952b9ae6923fdf6cbf9dbd Mon Sep 17 00:00:00 2001 From: highonhopium Date: Thu, 5 Sep 2024 20:14:12 +0100 Subject: [PATCH 1/3] camel casing subgraph types --- crates/subgraph/src/types/common.rs | 9 + .../src/lib/components/ButtonVaultLink.svelte | 4 +- .../charts/VaultBalanceChart.svelte | 2 +- .../charts/VaultBalanceChart.test.ts | 38 ++-- .../lib/components/detail/OrderDetail.svelte | 4 +- .../lib/components/detail/OrderDetail.test.ts | 2 +- .../lib/components/detail/VaultDetail.svelte | 14 +- .../lib/components/detail/VaultDetail.test.ts | 48 ++--- .../tables/OrderTradesListTable.svelte | 30 +-- .../tables/OrderTradesListTable.test.ts | 72 +++---- .../components/tables/OrdersListTable.svelte | 4 +- .../components/tables/OrdersListTable.test.ts | 112 ++++++---- .../tables/VaultBalanceChangesTable.svelte | 4 +- .../tables/VaultBalanceChangesTable.test.ts | 32 +-- .../components/tables/VaultListTable.svelte | 18 +- .../components/tables/VaultListTable.test.ts | 46 ++-- tauri-app/src/lib/queries/orderDetail.ts | 26 +-- tauri-app/src/lib/queries/orderQuote.ts | 55 +---- .../lib/queries/vaultBalanceChangesList.ts | 24 +-- tauri-app/src/lib/queries/vaultDetail.ts | 8 +- .../src/lib/services/historicalOrderCharts.ts | 202 +++++++++--------- tauri-app/src/lib/utils/vault.ts | 8 +- 22 files changed, 384 insertions(+), 378 deletions(-) diff --git a/crates/subgraph/src/types/common.rs b/crates/subgraph/src/types/common.rs index c110c6f63..b10494466 100644 --- a/crates/subgraph/src/types/common.rs +++ b/crates/subgraph/src/types/common.rs @@ -34,6 +34,7 @@ pub type RainMetaV1 = Bytes; #[derive(cynic::QueryFragment, Debug, Serialize, Clone)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Order { pub id: Bytes, pub order_bytes: Bytes, @@ -50,6 +51,7 @@ pub struct Order { #[derive(cynic::QueryFragment, Debug, Serialize, Clone)] #[cynic(graphql_type = "Order")] +#[serde(rename_all = "camelCase")] #[typeshare] pub struct OrderAsIO { pub id: Bytes, @@ -59,6 +61,7 @@ pub struct OrderAsIO { #[derive(cynic::QueryFragment, Debug, Serialize, Clone)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Vault { pub id: Bytes, pub owner: Bytes, @@ -82,6 +85,7 @@ pub struct VaultBalanceChangeVault { #[derive(cynic::QueryFragment, Debug, Clone, Serialize)] #[cynic(graphql_type = "VaultBalanceChange")] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct VaultBalanceChangeUnwrapped { pub __typename: String, pub amount: BigInt, @@ -106,6 +110,7 @@ pub enum VaultBalanceChange { #[derive(cynic::QueryFragment, Debug, Clone, Serialize)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Deposit { pub id: Bytes, pub __typename: String, @@ -120,6 +125,7 @@ pub struct Deposit { #[derive(cynic::QueryFragment, Debug, Clone, Serialize)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Withdrawal { pub id: Bytes, pub __typename: String, @@ -134,6 +140,7 @@ pub struct Withdrawal { #[derive(cynic::QueryFragment, Debug, Clone, Serialize)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct TradeVaultBalanceChange { pub id: Bytes, pub __typename: String, @@ -155,6 +162,7 @@ pub struct TradeEvent { #[derive(cynic::QueryFragment, Debug, Clone, Serialize)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Trade { pub id: Bytes, pub trade_event: TradeEvent, @@ -178,6 +186,7 @@ pub struct Erc20 { #[derive(cynic::QueryFragment, Debug, Serialize, Clone)] #[typeshare] +#[serde(rename_all = "camelCase")] pub struct Transaction { pub id: Bytes, pub from: Bytes, diff --git a/tauri-app/src/lib/components/ButtonVaultLink.svelte b/tauri-app/src/lib/components/ButtonVaultLink.svelte index 1d1addbda..68a639ea0 100644 --- a/tauri-app/src/lib/components/ButtonVaultLink.svelte +++ b/tauri-app/src/lib/components/ButtonVaultLink.svelte @@ -9,7 +9,7 @@
goto(`/vaults/${tokenVault.id}`)} >
@@ -19,7 +19,7 @@
ID - {bigintStringToHex(tokenVault.vault_id)} + {bigintStringToHex(tokenVault.vaultId)}
diff --git a/tauri-app/src/lib/components/charts/VaultBalanceChart.svelte b/tauri-app/src/lib/components/charts/VaultBalanceChart.svelte index 9ac7f3207..e1b00d396 100644 --- a/tauri-app/src/lib/components/charts/VaultBalanceChart.svelte +++ b/tauri-app/src/lib/components/charts/VaultBalanceChart.svelte @@ -26,7 +26,7 @@ {query} timeTransform={(d) => timestampSecondsToUTCTimestamp(BigInt(d.timestamp))} valueTransform={(d) => - bigintToFloat(BigInt(d.new_vault_balance), Number(vault.token.decimals ?? 0))} + bigintToFloat(BigInt(d.newVaultBalance), Number(vault.token.decimals ?? 0))} emptyMessage="No deposits or withdrawals found" /> {/if} diff --git a/tauri-app/src/lib/components/charts/VaultBalanceChart.test.ts b/tauri-app/src/lib/components/charts/VaultBalanceChart.test.ts index b80a06902..ed061f468 100644 --- a/tauri-app/src/lib/components/charts/VaultBalanceChart.test.ts +++ b/tauri-app/src/lib/components/charts/VaultBalanceChart.test.ts @@ -48,10 +48,10 @@ vi.mock('lightweight-charts', async () => { const mockVaultBalanceChangeUnwrappeds: VaultBalanceChangeUnwrapped[] = [ { - __typename: 'Withdrawal', + typename: 'Withdrawal', amount: '1000', - old_vault_balance: '5000', - new_vault_balance: '4000', + oldVaultBalance: '5000', + newVaultBalance: '4000', vault: { id: 'vault1', token: { @@ -67,17 +67,17 @@ const mockVaultBalanceChangeUnwrappeds: VaultBalanceChangeUnwrapped[] = [ id: 'tx1', from: '0xUser1', timestamp: '0', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '0x00', }, }, { - __typename: 'TradeVaultBalanceChangeUnwrapped', + typename: 'TradeVaultBalanceChangeUnwrapped', amount: '1500', - old_vault_balance: '4000', - new_vault_balance: '2500', + oldVaultBalance: '4000', + newVaultBalance: '2500', vault: { id: 'vault2', token: { @@ -93,17 +93,17 @@ const mockVaultBalanceChangeUnwrappeds: VaultBalanceChangeUnwrapped[] = [ id: 'tx2', from: '0xUser2', timestamp: '0', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '0x00', }, }, { - __typename: 'Deposit', + typename: 'Deposit', amount: '2000', - old_vault_balance: '2500', - new_vault_balance: '4500', + oldVaultBalance: '2500', + newVaultBalance: '4500', vault: { id: 'vault3', token: { @@ -119,7 +119,7 @@ const mockVaultBalanceChangeUnwrappeds: VaultBalanceChangeUnwrapped[] = [ id: 'tx3', from: '0xUser3', timestamp: '0', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '0x00', @@ -129,7 +129,7 @@ const mockVaultBalanceChangeUnwrappeds: VaultBalanceChangeUnwrapped[] = [ const mockVault: Vault = { id: 'vault1', - vault_id: 'vault1', + vaultId: 'vault1', token: { id: 'token1', address: '0xTokenAddress1', @@ -138,9 +138,9 @@ const mockVault: Vault = { decimals: '18', }, owner: '0xOwnerAddress', - orders_as_output: [], - orders_as_input: [], - balance_changes: [], + ordersAsInput: [], + ordersAsOutput: [], + balanceChanges: [], balance: '1000000000000000000', orderbook: { id: '0x00', @@ -171,15 +171,15 @@ test('renders the chart with correct data and transformations', async () => { await waitFor(() => { expect(setDataMock).toHaveBeenCalledWith([ { - value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[0].new_vault_balance), 18), + value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[0].newVaultBalance), 18), time: timestampSecondsToUTCTimestamp(BigInt(mockVaultBalanceChangeUnwrappeds[0].timestamp)), }, { - value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[1].new_vault_balance), 18), + value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[1].newVaultBalance), 18), time: timestampSecondsToUTCTimestamp(BigInt(mockVaultBalanceChangeUnwrappeds[1].timestamp)), }, { - value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[2].new_vault_balance), 18), + value: bigintToFloat(BigInt(mockVaultBalanceChangeUnwrappeds[2].newVaultBalance), 18), time: timestampSecondsToUTCTimestamp(BigInt(mockVaultBalanceChangeUnwrappeds[2].timestamp)), }, ]); diff --git a/tauri-app/src/lib/components/detail/OrderDetail.svelte b/tauri-app/src/lib/components/detail/OrderDetail.svelte index dc4dcdef8..775b4795e 100644 --- a/tauri-app/src/lib/components/detail/OrderDetail.svelte +++ b/tauri-app/src/lib/components/detail/OrderDetail.svelte @@ -34,7 +34,7 @@
Order - +
@@ -61,7 +61,7 @@ Created - {formatTimestampSecondsAsLocal(BigInt(data.order.timestamp_added))} + {formatTimestampSecondsAsLocal(BigInt(data.order.timestampAdded))} diff --git a/tauri-app/src/lib/components/detail/OrderDetail.test.ts b/tauri-app/src/lib/components/detail/OrderDetail.test.ts index 6898bad36..fad7724dd 100644 --- a/tauri-app/src/lib/components/detail/OrderDetail.test.ts +++ b/tauri-app/src/lib/components/detail/OrderDetail.test.ts @@ -117,7 +117,7 @@ test('shows the correct data when the query returns data', async () => { expect(screen.getByText('0x1111111111111111111111111111111111111111')).toBeInTheDocument(); expect(screen.getByText('Created')).toBeInTheDocument(); expect( - screen.getByText(formatTimestampSecondsAsLocal(BigInt(mockData.order.timestamp_added))), + screen.getByText(formatTimestampSecondsAsLocal(BigInt(mockData.order.timestampAdded))), ).toBeInTheDocument(); // Adjust this to match your date formatting }); }); diff --git a/tauri-app/src/lib/components/detail/VaultDetail.svelte b/tauri-app/src/lib/components/detail/VaultDetail.svelte index 8baaec58a..dec268257 100644 --- a/tauri-app/src/lib/components/detail/VaultDetail.svelte +++ b/tauri-app/src/lib/components/detail/VaultDetail.svelte @@ -56,7 +56,7 @@ Vault ID - {bigintStringToHex(data.vault_id)} + {bigintStringToHex(data.vaultId)} @@ -92,8 +92,8 @@ Orders as input

- {#if data.orders_as_input && data.orders_as_input.length > 0} - {#each data.orders_as_input as order} + {#if data.ordersAsInput && data.ordersAsInput.length > 0} + {#each data.ordersAsInput as order} {/each} {:else} @@ -115,8 +115,8 @@ Orders as output

- {#if data.orders_as_output && data.orders_as_output.length > 0} - {#each data.orders_as_output as order} + {#if data.ordersAsOutput && data.ordersAsOutput.length > 0} + {#each data.ordersAsOutput as order} {/each} {:else} diff --git a/tauri-app/src/lib/components/detail/VaultDetail.test.ts b/tauri-app/src/lib/components/detail/VaultDetail.test.ts index ad8a72747..1e06cdbb0 100644 --- a/tauri-app/src/lib/components/detail/VaultDetail.test.ts +++ b/tauri-app/src/lib/components/detail/VaultDetail.test.ts @@ -95,7 +95,7 @@ test('shows the correct empty message when the query returns no data', async () test('shows the correct data when the query returns data', async () => { const mockData: Vault = { id: '1', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '0x456', @@ -105,9 +105,9 @@ test('shows the correct data when the query returns data', async () => { decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], - balance_changes: [], + ordersAsInput: [], + ordersAsOutput: [], + balanceChanges: [], orderbook: { id: '0x00', }, @@ -143,7 +143,7 @@ test('shows the correct data when the query returns data', async () => { test('shows the correct data when the query returns data with orders', async () => { const mockData: Vault = { id: '1', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '0x456', @@ -153,31 +153,31 @@ test('shows the correct data when the query returns data with orders', async () decimals: '6', }, balance: '100000000000', - orders_as_input: [ + ordersAsInput: [ { id: '1', - order_hash: '0x123', + orderHash: '0x123', active: true, }, { id: '2', - order_hash: '0x456', + orderHash: '0x456', active: false, }, ], - orders_as_output: [ + ordersAsOutput: [ { id: '3', - order_hash: '0x789', + orderHash: '0x789', active: true, }, { id: '4', - order_hash: '0xabc', + orderHash: '0xabc', active: false, }, ], - balance_changes: [], + balanceChanges: [], orderbook: { id: '0x00', }, @@ -221,7 +221,7 @@ test('shows the correct data when the query returns data with orders', async () test('orders link to the correct order', async () => { const mockData: Vault = { id: '1', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '0x456', @@ -231,31 +231,31 @@ test('orders link to the correct order', async () => { decimals: '6', }, balance: '100000000000', - orders_as_input: [ + ordersAsInput: [ { id: '1', - order_hash: '0x123', + orderHash: '0x123', active: true, }, { id: '2', - order_hash: '0x456', + orderHash: '0x456', active: false, }, ], - orders_as_output: [ + ordersAsOutput: [ { id: '3', - order_hash: '0x789', + orderHash: '0x789', active: true, }, { id: '4', - order_hash: '0xabc', + orderHash: '0xabc', active: false, }, ], - balance_changes: [], + balanceChanges: [], orderbook: { id: '0x00', }, @@ -301,7 +301,7 @@ test('orders link to the correct order', async () => { test('shows deposit and withdraw buttons if owner wallet matches, opens correct modals', async () => { const mockData: Vault = { id: '1', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '0x456', @@ -311,9 +311,9 @@ test('shows deposit and withdraw buttons if owner wallet matches, opens correct decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], - balance_changes: [], + ordersAsInput: [], + ordersAsOutput: [], + balanceChanges: [], orderbook: { id: '0x00', }, diff --git a/tauri-app/src/lib/components/tables/OrderTradesListTable.svelte b/tauri-app/src/lib/components/tables/OrderTradesListTable.svelte index 71bf570ef..cdff3ad42 100644 --- a/tauri-app/src/lib/components/tables/OrderTradesListTable.svelte +++ b/tauri-app/src/lib/components/tables/OrderTradesListTable.svelte @@ -45,49 +45,49 @@ {formatTimestampSecondsAsLocal(BigInt(item.timestamp))} - + - + {formatUnits( - BigInt(item.input_vault_balance_change.amount), - Number(item.input_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.inputVaultBalanceChange.amount), + Number(item.inputVaultBalanceChange.vault.token.decimals ?? 0), )} - {item.input_vault_balance_change.vault.token.symbol} + {item.inputVaultBalanceChange.vault.token.symbol} {formatUnits( - BigInt(item.output_vault_balance_change.amount), - Number(item.output_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.outputVaultBalanceChange.amount), + Number(item.outputVaultBalanceChange.vault.token.decimals ?? 0), )} - {item.output_vault_balance_change.vault.token.symbol} + {item.outputVaultBalanceChange.vault.token.symbol} {Math.abs( Number( formatUnits( - BigInt(item.input_vault_balance_change.amount), - Number(item.input_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.inputVaultBalanceChange.amount), + Number(item.inputVaultBalanceChange.vault.token.decimals ?? 0), ), ) / Number( formatUnits( - BigInt(item.output_vault_balance_change.amount), - Number(item.output_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.outputVaultBalanceChange.amount), + Number(item.outputVaultBalanceChange.vault.token.decimals ?? 0), ), ), )} - {item.input_vault_balance_change.vault.token.symbol}/{item.output_vault_balance_change.vault - .token.symbol} + {item.inputVaultBalanceChange.vault.token.symbol}/{item.outputVaultBalanceChange.vault.token + .symbol} {/each} - {#if item.orders_as_input.length > 3}...{/if} + {#if item.ordersAsInput.length > 3}...{/if}

{/if} - {#if item.orders_as_output.length > 0} + {#if item.ordersAsOutput.length > 0}
- {#each item.orders_as_output.slice(0, 3) as order} + {#each item.ordersAsOutput.slice(0, 3) as order} {/each} - {#if item.orders_as_output.length > 3}...{/if} + {#if item.ordersAsOutput.length > 3}...{/if}
{/if}
diff --git a/tauri-app/src/lib/components/tables/VaultListTable.test.ts b/tauri-app/src/lib/components/tables/VaultListTable.test.ts index a7499c160..b12345d89 100644 --- a/tauri-app/src/lib/components/tables/VaultListTable.test.ts +++ b/tauri-app/src/lib/components/tables/VaultListTable.test.ts @@ -10,6 +10,7 @@ import { handleDepositModal, handleWithdrawModal, } from '$lib/services/modal'; +import type { Vault } from '$lib/typeshare/subgraphTypes'; const { mockWalletAddressMatchesOrBlankStore } = await vi.hoisted( () => import('$lib/mocks/wallets'), @@ -58,7 +59,7 @@ test('renders the vault list table with correct data', async () => { return [ { id: '1', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -68,8 +69,8 @@ test('renders the vault list table with correct data', async () => { decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], + ordersAsInput: [], + ordersAsOutput: [], orderbook: { id: '0x00' }, }, ]; @@ -120,7 +121,7 @@ test('clicking a row links to the vault detail page', async () => { return [ { id: '0xabc', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -130,11 +131,12 @@ test('clicking a row links to the vault detail page', async () => { decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], + ordersAsInput: [], + ordersAsOutput: [], orderbook: { id: '0x00' }, + balanceChanges: [], }, - ]; + ] as Vault[]; } }); @@ -186,7 +188,7 @@ test('shows an ellipsis if there is more than three orders as input or output', return [ { id: '0xabc', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -196,13 +198,13 @@ test('shows an ellipsis if there is more than three orders as input or output', decimals: '6', }, balance: '100000000000', - orders_as_input: [ + ordersAsInput: [ { id: '1', order_id: '0x123', amount: '100000000000' }, { id: '2', order_id: '0x456', amount: '100000000000' }, { id: '3', order_id: '0x789', amount: '100000000000' }, { id: '4', order_id: '0xabc', amount: '100000000000' }, ], - orders_as_output: [ + ordersAsOutput: [ { id: '1', order_id: '0x123', amount: '100000000000' }, { id: '2', order_id: '0x456', amount: '100000000000' }, { id: '3', order_id: '0x789', amount: '100000000000' }, @@ -232,7 +234,7 @@ test('clicking on an order links to the order detail page', async () => { return [ { id: '0xabc', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -242,8 +244,8 @@ test('clicking on an order links to the order detail page', async () => { decimals: '6', }, balance: '100000000000', - orders_as_input: [{ id: '0x123', order_id: '0x123', amount: '100000000000' }], - orders_as_output: [{ id: '0x456', order_id: '0x456', amount: '100000000000' }], + ordersAsInput: [{ id: '0x123', order_id: '0x123', amount: '100000000000' }], + ordersAsOutput: [{ id: '0x456', order_id: '0x456', amount: '100000000000' }], orderbook: { id: '0x00' }, }, ]; @@ -273,7 +275,7 @@ test('doesnt show the row dropdown menu if the wallet address does not match', a return [ { id: '0xabc', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -283,11 +285,12 @@ test('doesnt show the row dropdown menu if the wallet address does not match', a decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], + ordersAsInput: [], + ordersAsOutput: [], orderbook: { id: '0x00' }, + balanceChanges: [], }, - ]; + ] as Vault[]; } }); @@ -307,9 +310,9 @@ test('doesnt show the row dropdown menu if the wallet address does not match', a test('clicking the deposit option in the row dropdown menu opens the deposit modal', async () => { const queryClient = new QueryClient(); - const vault = { + const vault: Vault = { id: '0xabc', - vault_id: '0xabc', + vaultId: '0xabc', owner: '0x123', token: { id: '1', @@ -319,9 +322,10 @@ test('clicking the deposit option in the row dropdown menu opens the deposit mod decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], + ordersAsInput: [], + ordersAsOutput: [], orderbook: { id: '0x00' }, + balanceChanges: [], }; mockIPC((cmd) => { diff --git a/tauri-app/src/lib/queries/orderDetail.ts b/tauri-app/src/lib/queries/orderDetail.ts index d25077a5b..fa6816a49 100644 --- a/tauri-app/src/lib/queries/orderDetail.ts +++ b/tauri-app/src/lib/queries/orderDetail.ts @@ -22,8 +22,8 @@ export const orderDetail = async (id: string, url: string | undefined) => { export const mockOrderDetailsExtended: OrderDetailExtended = { order: { id: 'order1', - order_bytes: '0x123456', - order_hash: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef', + orderBytes: '0x123456', + orderHash: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef', owner: '0x1111111111111111111111111111111111111111', outputs: [ { @@ -36,12 +36,12 @@ export const mockOrderDetailsExtended: OrderDetailExtended = { decimals: '18', }, balance: '1000', - vault_id: '0x1111111111111111111111111111111111111111111111111111111111111111', + vaultId: '0x1111111111111111111111111111111111111111111111111111111111111111', orderbook: { id: '0x1111111111111111111111111111111111111111' }, owner: '0x1111111111111111111111111111111111111111', - orders_as_output: [], - orders_as_input: [], - balance_changes: [], + ordersAsOutput: [], + ordersAsInput: [], + balanceChanges: [], }, ], inputs: [ @@ -55,27 +55,27 @@ export const mockOrderDetailsExtended: OrderDetailExtended = { decimals: '18', }, balance: '500', - vault_id: '0x2222222222222222222222222222222222222222222222222222222222222222', + vaultId: '0x2222222222222222222222222222222222222222222222222222222222222222', orderbook: { id: '0x1111111111111111111111111111111111111111' }, owner: '0x1111111111111111111111111111111111111111', - orders_as_output: [], - orders_as_input: [], - balance_changes: [], + ordersAsOutput: [], + ordersAsInput: [], + balanceChanges: [], }, ], active: true, - add_events: [ + addEvents: [ { transaction: { id: '0x2222222222222222222222222222222222222222222222222222222222222222', from: '0x1111111111111111111111111111111111111111', - block_number: '12345', + blockNumber: '12345', timestamp: '1620000000', }, }, ], meta: 'metadata1', - timestamp_added: '1620000000', + timestampAdded: '1620000000', orderbook: { id: '0x00', }, diff --git a/tauri-app/src/lib/queries/orderQuote.ts b/tauri-app/src/lib/queries/orderQuote.ts index ea42f4986..41a3acb0e 100644 --- a/tauri-app/src/lib/queries/orderQuote.ts +++ b/tauri-app/src/lib/queries/orderQuote.ts @@ -7,55 +7,12 @@ import type { Hex } from 'viem'; import { mockIPC } from '@tauri-apps/api/mocks'; import type { RainEvalResultsTable } from '$lib/typeshare/config'; -const formatOrder = (order: Order) => ({ - ...order, - orderBytes: order.order_bytes, - orderHash: order.order_hash, - outputs: order.outputs.map((output) => ({ - ...output, - vaultId: output.vault_id, - })), - inputs: order.inputs.map((input) => ({ - ...input, - vaultId: input.vault_id, - })), - addEvents: order.add_events.map((event) => ({ - ...event, - transaction: { - ...event.transaction, - blockNumber: event.transaction.block_number, - }, - })), - timestampAdded: order.timestamp_added, -}); - export async function batchOrderQuotes( orders: Order[], blockNumber?: number, ): Promise { - const formattedOrders = orders.map((order) => ({ - ...order, - orderBytes: order.order_bytes, - orderHash: order.order_hash, - outputs: order.outputs.map((output) => ({ - ...output, - vaultId: output.vault_id, - })), - inputs: order.inputs.map((input) => ({ - ...input, - vaultId: input.vault_id, - })), - addEvents: order.add_events.map((event) => ({ - ...event, - transaction: { - ...event.transaction, - blockNumber: event.transaction.block_number, - }, - })), - timestampAdded: order.timestamp_added, - })); return invoke('batch_order_quotes', { - orders: formattedOrders, + orders, blockNumber, rpcUrl: get(rpcUrl), }); @@ -69,7 +26,7 @@ export async function debugOrderQuote( rpcUrl: string, ) { return await invoke('debug_order_quote', { - order: formatOrder(order), + order, inputIoIndex: inputIOIndex, outputIoIndex: outputIOIndex, orderbook, @@ -96,14 +53,14 @@ if (import.meta.vitest) { { id: '1', orderbook: { id: '0x00' }, - order_bytes: '0x123', - order_hash: '0x123', + orderBytes: '0x123', + orderHash: '0x123', owner: '0x123', outputs: [], inputs: [], active: true, - add_events: [], - timestamp_added: '123', + addEvents: [], + timestampAdded: '123', }, 0, 0, diff --git a/tauri-app/src/lib/queries/vaultBalanceChangesList.ts b/tauri-app/src/lib/queries/vaultBalanceChangesList.ts index 0bd7ed751..64590a595 100644 --- a/tauri-app/src/lib/queries/vaultBalanceChangesList.ts +++ b/tauri-app/src/lib/queries/vaultBalanceChangesList.ts @@ -36,10 +36,10 @@ if (import.meta.vitest) { it('uses the vault_balance_changes_list command correctly', async () => { const mockVaultBalanceChanges: VaultBalanceChangeUnwrapped[] = [ { - __typename: 'Withdrawal', + typename: 'Withdrawal', amount: '1000', - old_vault_balance: '5000', - new_vault_balance: '4000', + oldVaultBalance: '5000', + newVaultBalance: '4000', vault: { id: 'vault1', token: { @@ -54,7 +54,7 @@ if (import.meta.vitest) { transaction: { id: 'tx1', from: '0xUser1', - block_number: '0', + blockNumber: '0', timestamp: '0', }, orderbook: { @@ -62,10 +62,10 @@ if (import.meta.vitest) { }, }, { - __typename: 'TradeVaultBalanceChange', + typename: 'TradeVaultBalanceChange', amount: '1500', - old_vault_balance: '4000', - new_vault_balance: '2500', + oldVaultBalance: '4000', + newVaultBalance: '2500', vault: { id: 'vault2', token: { @@ -80,7 +80,7 @@ if (import.meta.vitest) { transaction: { id: 'tx2', from: '0xUser2', - block_number: '0', + blockNumber: '0', timestamp: '0', }, orderbook: { @@ -88,10 +88,10 @@ if (import.meta.vitest) { }, }, { - __typename: 'Deposit', + typename: 'Deposit', amount: '2000', - old_vault_balance: '2500', - new_vault_balance: '4500', + oldVaultBalance: '2500', + newVaultBalance: '4500', vault: { id: 'vault3', token: { @@ -106,7 +106,7 @@ if (import.meta.vitest) { transaction: { id: 'tx3', from: '0xUser3', - block_number: '0', + blockNumber: '0', timestamp: '0', }, orderbook: { diff --git a/tauri-app/src/lib/queries/vaultDetail.ts b/tauri-app/src/lib/queries/vaultDetail.ts index 72e31580a..ac5081a7c 100644 --- a/tauri-app/src/lib/queries/vaultDetail.ts +++ b/tauri-app/src/lib/queries/vaultDetail.ts @@ -25,7 +25,7 @@ if (import.meta.vitest) { it('uses the vault_detail command correctly', async () => { const mockData: Vault = { id: '1', - vault_id: '1', + vaultId: '1', owner: '0x123', token: { id: '1', @@ -35,9 +35,9 @@ if (import.meta.vitest) { decimals: '6', }, balance: '100000000000', - orders_as_input: [], - orders_as_output: [], - balance_changes: [], + ordersAsInput: [], + ordersAsOutput: [], + balanceChanges: [], orderbook: { id: '0x00', }, diff --git a/tauri-app/src/lib/services/historicalOrderCharts.ts b/tauri-app/src/lib/services/historicalOrderCharts.ts index 115b6ff31..3a3fe8959 100644 --- a/tauri-app/src/lib/services/historicalOrderCharts.ts +++ b/tauri-app/src/lib/services/historicalOrderCharts.ts @@ -11,20 +11,20 @@ export function prepareHistoricalOrderChartData(takeOrderEntities: Trade[], colo value: Math.abs( Number( formatUnits( - BigInt(d.input_vault_balance_change.amount), - Number(d.input_vault_balance_change.vault.token.decimals ?? 0), + BigInt(d.inputVaultBalanceChange.amount), + Number(d.inputVaultBalanceChange.vault.token.decimals ?? 0), ), ) / Number( formatUnits( - BigInt(d.output_vault_balance_change.amount), - Number(d.output_vault_balance_change.vault.token.decimals ?? 0), + BigInt(d.outputVaultBalanceChange.amount), + Number(d.outputVaultBalanceChange.vault.token.decimals ?? 0), ), ), ), time: timestampSecondsToUTCTimestamp(BigInt(d.timestamp)), color: colorTheme == 'dark' ? '#5178FF' : '#4E4AF6', - outputAmount: +d.output_vault_balance_change.amount, + outputAmount: +d.outputVaultBalanceChange.amount, })); // if we have multiple object in the array with the same timestamp, we need to merge them @@ -62,16 +62,16 @@ if (import.meta.vitest) { { id: '1', timestamp: '1632000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '100', vault: { id: '1', @@ -84,34 +84,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1632000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1632000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -124,15 +124,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, @@ -143,16 +143,16 @@ if (import.meta.vitest) { { id: '2', timestamp: '1631000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1631000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '100', vault: { id: '1', @@ -165,34 +165,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1631000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1631000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -205,15 +205,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, @@ -224,16 +224,16 @@ if (import.meta.vitest) { { id: '3', timestamp: '1630000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1630000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '100', vault: { id: '1', @@ -246,34 +246,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1630000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1630000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -286,15 +286,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, @@ -325,16 +325,16 @@ if (import.meta.vitest) { { id: '1', timestamp: '1632000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '100', vault: { id: '1', @@ -347,34 +347,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1632000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1632000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -387,15 +387,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, @@ -406,16 +406,16 @@ if (import.meta.vitest) { { id: '2', timestamp: '1632000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '200', vault: { id: '1', @@ -428,34 +428,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1632000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1632000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -468,15 +468,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, @@ -487,16 +487,16 @@ if (import.meta.vitest) { { id: '3', timestamp: '1632000000', - trade_event: { + tradeEvent: { sender: 'sender_address', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, }, - output_vault_balance_change: { + outputVaultBalanceChange: { amount: '400', vault: { id: '1', @@ -509,34 +509,34 @@ if (import.meta.vitest) { }, }, id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, order: { id: 'order_id', - order_hash: 'order_hash', - timestamp_added: '1632000000', - order_bytes: '0x123456', + orderHash: 'orderHash', + timestampAdded: '1632000000', + orderBytes: '0x123456', owner: '0x1111111111111111111111111111111111111111', outputs: [], inputs: [], active: true, - add_events: [], + addEvents: [], meta: 'metadata1', orderbook: { id: '0x00', }, }, - input_vault_balance_change: { + inputVaultBalanceChange: { vault: { id: '1', token: { @@ -549,15 +549,15 @@ if (import.meta.vitest) { }, amount: '50', id: '1', - __typename: 'Withdraw', - new_vault_balance: '0', - old_vault_balance: '0', + typename: 'Withdraw', + newVaultBalance: '0', + oldVaultBalance: '0', timestamp: '0', transaction: { id: 'transaction_id', from: 'sender_address', timestamp: '1632000000', - block_number: '0', + blockNumber: '0', }, orderbook: { id: '1' }, }, diff --git a/tauri-app/src/lib/utils/vault.ts b/tauri-app/src/lib/utils/vault.ts index 1ab64e8ae..fa570136d 100644 --- a/tauri-app/src/lib/utils/vault.ts +++ b/tauri-app/src/lib/utils/vault.ts @@ -17,11 +17,11 @@ if (import.meta.vitest) { decimals: '18', address: '0x00', }, - vault_id: '1', + vaultId: '1', owner: '0x00', - orders_as_input: [], - orders_as_output: [], - balance_changes: [], + ordersAsInput: [], + ordersAsOutput: [], + balanceChanges: [], orderbook: { id: '0x00', }, From 79f48300a107ed6d5da1f599d49b0f62cbd6cf08 Mon Sep 17 00:00:00 2001 From: highonhopium Date: Thu, 5 Sep 2024 20:41:36 +0100 Subject: [PATCH 2/3] case --- crates/subgraph/src/types/common.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/subgraph/src/types/common.rs b/crates/subgraph/src/types/common.rs index b10494466..f3252ca4f 100644 --- a/crates/subgraph/src/types/common.rs +++ b/crates/subgraph/src/types/common.rs @@ -99,6 +99,7 @@ pub struct VaultBalanceChangeUnwrapped { #[derive(cynic::InlineFragments, Debug, Clone, Serialize)] #[serde(tag = "__typename", content = "data")] +#[serde(rename_all = "camelCase")] #[typeshare] pub enum VaultBalanceChange { Withdrawal(Withdrawal), From a292841a275e0c1e48759ee77dd3bd38215710cd Mon Sep 17 00:00:00 2001 From: highonhopium Date: Thu, 5 Sep 2024 21:08:20 +0100 Subject: [PATCH 3/3] check --- .../src/lib/components/ButtonVaultLink.svelte | 2 +- .../lib/components/ModalVaultDeposit.svelte | 8 +++--- .../lib/components/ModalVaultWithdraw.svelte | 6 ++-- .../src/lib/components/TakeOrdersTable.svelte | 28 +++++++++---------- .../components/modal/ModalQuoteDebug.test.ts | 8 +++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tauri-app/src/lib/components/ButtonVaultLink.svelte b/tauri-app/src/lib/components/ButtonVaultLink.svelte index 68a639ea0..aa4c7faf9 100644 --- a/tauri-app/src/lib/components/ButtonVaultLink.svelte +++ b/tauri-app/src/lib/components/ButtonVaultLink.svelte @@ -9,7 +9,7 @@
goto(`/vaults/${tokenVault.id}`)} >
diff --git a/tauri-app/src/lib/components/ModalVaultDeposit.svelte b/tauri-app/src/lib/components/ModalVaultDeposit.svelte index 0865be508..444c0e830 100644 --- a/tauri-app/src/lib/components/ModalVaultDeposit.svelte +++ b/tauri-app/src/lib/components/ModalVaultDeposit.svelte @@ -32,7 +32,7 @@ async function executeLedger() { isSubmitting = true; try { - await vaultDeposit(BigInt(vault.vault_id), vault.token.id, amount); + await vaultDeposit(BigInt(vault.vaultId), vault.token.id, amount); } catch (e) { reportErrorToSentry(e); } @@ -47,7 +47,7 @@ const allowance = await checkAllowance(vault.token.id, $orderbookAddress); if (allowance.lt(amount)) { const approveCalldata = (await vaultDepositApproveCalldata( - BigInt(vault.vault_id), + BigInt(vault.vaultId), vault.token.id, amount, allowance.toBigInt(), @@ -58,7 +58,7 @@ } const depositCalldata = (await vaultDepositCalldata( - BigInt(vault.vault_id), + BigInt(vault.vaultId), vault.token.id, amount, )) as Uint8Array; @@ -81,7 +81,7 @@ Vault ID

- {bigintStringToHex(vault.vault_id)} + {bigintStringToHex(vault.vaultId)}

diff --git a/tauri-app/src/lib/components/ModalVaultWithdraw.svelte b/tauri-app/src/lib/components/ModalVaultWithdraw.svelte index c779c5a85..df1362f98 100644 --- a/tauri-app/src/lib/components/ModalVaultWithdraw.svelte +++ b/tauri-app/src/lib/components/ModalVaultWithdraw.svelte @@ -31,7 +31,7 @@ async function executeLedger() { isSubmitting = true; try { - await vaultWithdraw(BigInt(vault.vault_id), vault.token.id, amount); + await vaultWithdraw(BigInt(vault.vaultId), vault.token.id, amount); } catch (e) { reportErrorToSentry(e); } @@ -43,7 +43,7 @@ isSubmitting = true; try { const calldata = (await vaultWithdrawCalldata( - BigInt(vault.vault_id), + BigInt(vault.vaultId), vault.token.id, amount, )) as Uint8Array; @@ -72,7 +72,7 @@ Vault ID

- {bigintStringToHex(vault.vault_id)} + {bigintStringToHex(vault.vaultId)}

diff --git a/tauri-app/src/lib/components/TakeOrdersTable.svelte b/tauri-app/src/lib/components/TakeOrdersTable.svelte index 3ce8271c1..a07316ef4 100644 --- a/tauri-app/src/lib/components/TakeOrdersTable.svelte +++ b/tauri-app/src/lib/components/TakeOrdersTable.svelte @@ -26,42 +26,42 @@ {formatTimestampSecondsAsLocal(BigInt(item.timestamp))} - + - + {formatUnits( - BigInt(item.input_vault_balance_change.amount), - Number(item.input_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.inputVaultBalanceChange.amount), + Number(item.inputVaultBalanceChange.vault.token.decimals ?? 0), )} - {item.input_vault_balance_change.vault.token.symbol} + {item.inputVaultBalanceChange.vault.token.symbol} {formatUnits( - BigInt(item.output_vault_balance_change.amount), - Number(item.output_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.outputVaultBalanceChange.amount), + Number(item.outputVaultBalanceChange.vault.token.decimals ?? 0), )} - {item.output_vault_balance_change.vault.token.symbol} + {item.outputVaultBalanceChange.vault.token.symbol} {Math.abs( Number( formatUnits( - BigInt(item.input_vault_balance_change.amount), - Number(item.input_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.inputVaultBalanceChange.amount), + Number(item.inputVaultBalanceChange.vault.token.decimals ?? 0), ), ) / Number( formatUnits( - BigInt(item.output_vault_balance_change.amount), - Number(item.output_vault_balance_change.vault.token.decimals ?? 0), + BigInt(item.outputVaultBalanceChange.amount), + Number(item.outputVaultBalanceChange.vault.token.decimals ?? 0), ), ), )} - {item.input_vault_balance_change.vault.token.symbol}/{item.output_vault_balance_change.vault - .token.symbol} + {item.inputVaultBalanceChange.vault.token.symbol}/{item.outputVaultBalanceChange.vault.token + .symbol} diff --git a/tauri-app/src/lib/components/modal/ModalQuoteDebug.test.ts b/tauri-app/src/lib/components/modal/ModalQuoteDebug.test.ts index 8a171b775..df9febd45 100644 --- a/tauri-app/src/lib/components/modal/ModalQuoteDebug.test.ts +++ b/tauri-app/src/lib/components/modal/ModalQuoteDebug.test.ts @@ -23,14 +23,14 @@ test('renders table with the correct data', async () => { order: { id: '1', orderbook: { id: '0x00' }, - order_bytes: '0x123', - order_hash: '0x123', + orderBytes: '0x123', + orderHash: '0x123', owner: '0x123', outputs: [], inputs: [], active: true, - add_events: [], - timestamp_added: '123', + addEvents: [], + timestampAdded: '123', }, rpcUrl: 'https://rpc-url.com', inputIOIndex: 0,