- {#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/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,
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}
- {formatTimestampSecondsAsLocal(BigInt(item.timestamp_added))}
+ {formatTimestampSecondsAsLocal(BigInt(item.timestampAdded))}
{item.inputs?.map((t) => t.token.symbol)}
diff --git a/tauri-app/src/lib/components/tables/OrdersListTable.test.ts b/tauri-app/src/lib/components/tables/OrdersListTable.test.ts
index e961da912..aea2b491d 100644
--- a/tauri-app/src/lib/components/tables/OrdersListTable.test.ts
+++ b/tauri-app/src/lib/components/tables/OrdersListTable.test.ts
@@ -6,6 +6,7 @@ import { mockIPC } from '@tauri-apps/api/mocks';
import { goto } from '$app/navigation';
import { handleOrderRemoveModal } from '$lib/services/modal';
import { formatTimestampSecondsAsLocal } from '$lib/utils/time';
+import type { Order } from '$lib/typeshare/subgraphTypes';
const { mockWalletAddressMatchesOrBlankStore } = await vi.hoisted(
() => import('$lib/mocks/wallets'),
@@ -44,53 +45,82 @@ vi.mock('$app/navigation', () => ({
goto: vi.fn(),
}));
-const mockOrders = [
+const mockOrders: Order[] = [
{
id: 'order1',
- order_hash: 'order1',
- active: true,
+ orderHash: 'order1',
+ orderBytes: '0x00',
+ addEvents: [],
+ active: false,
owner: '0xOwner1',
- timestamp_added: '1625247600',
- inputs: [{ token: { symbol: 'ETH' } }],
- outputs: [{ token: { symbol: 'USDC' } }],
+ timestampAdded: '1625247300',
+ inputs: [
+ {
+ id: '0x00',
+ owner: '0x00',
+ vaultId: '0x00',
+ balance: '100',
+ orderbook: { id: '0x00' },
+ ordersAsInput: [],
+ ordersAsOutput: [],
+ balanceChanges: [],
+ token: { id: '0x00', address: '0x00', symbol: 'ETH' },
+ },
+ ],
+ outputs: [
+ {
+ id: '0x00',
+ owner: '0x00',
+ vaultId: '0x00',
+ balance: '100',
+ orderbook: { id: '0x00' },
+ ordersAsInput: [],
+ ordersAsOutput: [],
+ balanceChanges: [],
+ token: { id: '0x00', address: '0x00', symbol: 'USDC' },
+ },
+ ],
orderbook: { id: '0x00' },
},
{
id: 'order2',
- order_hash: 'order2',
- active: false,
+ orderHash: 'order2',
+ orderBytes: '0x00',
+ addEvents: [],
+ active: true,
owner: '0xOwner2',
- timestamp_added: '1625347600',
- inputs: [{ token: { symbol: 'BTC' } }],
- outputs: [{ token: { symbol: 'DAI' } }],
+ timestampAdded: '1625247600',
+ inputs: [
+ {
+ id: '0x00',
+ owner: '0x00',
+ vaultId: '0x00',
+ balance: '100',
+ orderbook: { id: '0x00' },
+ ordersAsInput: [],
+ ordersAsOutput: [],
+ balanceChanges: [],
+ token: { id: '0x00', address: '0x00', symbol: 'USDT' },
+ },
+ ],
+ outputs: [
+ {
+ id: '0x00',
+ owner: '0x00',
+ vaultId: '0x00',
+ balance: '100',
+ orderbook: { id: '0x00' },
+ ordersAsInput: [],
+ ordersAsOutput: [],
+ balanceChanges: [],
+ token: { id: '0x00', address: '0x00', symbol: 'DAI' },
+ },
+ ],
orderbook: { id: '0x00' },
},
];
test('renders the orders list table with correct data', async () => {
- const mockOrders = [
- {
- id: 'order1',
- order_hash: 'order1',
- active: false,
- owner: '0xOwner1',
- timestamp_added: '1625247600',
- inputs: [{ token: { symbol: 'ETH' } }],
- outputs: [{ token: { symbol: 'USDC' } }],
- orderbook: { id: '0x00' },
- },
- {
- id: 'order2',
- order_hash: 'order2',
- active: true,
- owner: '0xOwner2',
- timestamp_added: '1625247400',
- inputs: [{ token: { symbol: 'USDT' } }],
- outputs: [{ token: { symbol: 'DAI' } }],
- orderbook: { id: '0x00' },
- },
- ];
-
const queryClient = new QueryClient();
mockIPC((cmd) => {
@@ -131,10 +161,10 @@ test('renders the orders list table with correct data', async () => {
'0xOwn...wner2',
);
expect((await screen.findAllByTestId('orderListRowLastAdded'))[0]).toHaveTextContent(
- formatTimestampSecondsAsLocal(BigInt(mockOrders[0].timestamp_added)),
+ formatTimestampSecondsAsLocal(BigInt(mockOrders[0].timestampAdded)),
);
expect((await screen.findAllByTestId('orderListRowLastAdded'))[1]).toHaveTextContent(
- formatTimestampSecondsAsLocal(BigInt(mockOrders[1].timestamp_added)),
+ formatTimestampSecondsAsLocal(BigInt(mockOrders[1].timestampAdded)),
);
expect((await screen.findAllByTestId('orderListRowInputs'))[0]).toHaveTextContent('ETH');
expect((await screen.findAllByTestId('orderListRowInputs'))[1]).toHaveTextContent('USDT');
@@ -182,9 +212,12 @@ test('clicking a row links to the order detail page', async () => {
test('does not show the dropdown menu if the wallet address does not match', async () => {
const queryClient = new QueryClient();
+ const modifiedMockOrders = [...mockOrders];
+ modifiedMockOrders[0].active = true;
+
mockIPC((cmd) => {
if (cmd === 'orders_list') {
- return mockOrders;
+ return modifiedMockOrders;
}
});
@@ -206,9 +239,12 @@ test('clicking the remove option in the dropdown menu opens the remove modal', a
mockWalletAddressMatchesOrBlankStore.set(() => true);
+ const modifiedMockOrders = [...mockOrders];
+ modifiedMockOrders[0].active = true;
+
mockIPC((cmd) => {
if (cmd === 'orders_list') {
- return mockOrders;
+ return modifiedMockOrders;
}
});
diff --git a/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.svelte b/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.svelte
index 114202a8e..31c56b239 100644
--- a/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.svelte
+++ b/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.svelte
@@ -62,11 +62,11 @@
{item.vault.token.symbol}
- {formatUnits(BigInt(item.new_vault_balance), Number(item.vault.token.decimals ?? 0))}
+ {formatUnits(BigInt(item.newVaultBalance), Number(item.vault.token.decimals ?? 0))}
{item.vault.token.symbol}
- {item.__typename}
+ {item.typename}
diff --git a/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.test.ts b/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.test.ts
index 6771f90be..532fb7c2e 100644
--- a/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.test.ts
+++ b/tauri-app/src/lib/components/tables/VaultBalanceChangesTable.test.ts
@@ -29,10 +29,10 @@ test('renders the vault list table with correct data', 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: {
@@ -48,17 +48,17 @@ test('renders the vault list table with correct data', async () => {
id: 'tx1',
from: '0xUser1',
timestamp: '0',
- block_number: '0',
+ blockNumber: '0',
},
orderbook: {
id: '0x00',
},
},
{
- __typename: 'TradeVaultBalanceChange',
+ typename: 'TradeVaultBalanceChange',
amount: '1500',
- old_vault_balance: '4000',
- new_vault_balance: '2500',
+ oldVaultBalance: '4000',
+ newVaultBalance: '2500',
vault: {
id: 'vault2',
token: {
@@ -74,17 +74,17 @@ test('renders the vault list table with correct data', async () => {
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: {
@@ -100,7 +100,7 @@ test('renders the vault list table with correct data', async () => {
id: 'tx3',
from: '0xUser3',
timestamp: '0',
- block_number: '0',
+ blockNumber: '0',
},
orderbook: {
id: '0x00',
@@ -130,10 +130,10 @@ test('it shows the correct data in the table', 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: {
@@ -149,7 +149,7 @@ test('it shows the correct data in the table', async () => {
id: 'tx1',
from: '0xUser1',
timestamp: '0',
- block_number: '0',
+ blockNumber: '0',
},
orderbook: {
id: '0x00',
diff --git a/tauri-app/src/lib/components/tables/VaultListTable.svelte b/tauri-app/src/lib/components/tables/VaultListTable.svelte
index a8fccc4ed..6fa406ed0 100644
--- a/tauri-app/src/lib/components/tables/VaultListTable.svelte
+++ b/tauri-app/src/lib/components/tables/VaultListTable.svelte
@@ -74,7 +74,7 @@
{bigintStringToHex(item.vault_id)}{bigintStringToHex(item.vaultId)}
- {#if item.orders_as_input.length > 0}
+ {#if item.ordersAsInput.length > 0}
- {#each item.orders_as_input.slice(0, 3) as order}
+ {#each item.ordersAsInput.slice(0, 3) as order}
{/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',
},