* fix(#2472): lp table supplied calculate bond account balance fixed * fix(#2472): unit tests in accounts-data-provider.spec.ts * fix(#2472): unit tests in accounts.mock.ts
This commit is contained in:
parent
2217925285
commit
61457bc24d
@ -31,5 +31,6 @@ subscription AccountEvents($partyId: ID) {
|
|||||||
balance
|
balance
|
||||||
assetId
|
assetId
|
||||||
marketId
|
marketId
|
||||||
|
partyId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
libs/accounts/src/lib/__generated__/Accounts.ts
generated
3
libs/accounts/src/lib/__generated__/Accounts.ts
generated
@ -17,7 +17,7 @@ export type AccountEventsSubscriptionVariables = Types.Exact<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: Array<{ __typename?: 'AccountUpdate', type: Types.AccountType, balance: string, assetId: string, marketId?: string | null }> };
|
export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: Array<{ __typename?: 'AccountUpdate', type: Types.AccountType, balance: string, assetId: string, marketId?: string | null, partyId: string }> };
|
||||||
|
|
||||||
export const AccountFieldsFragmentDoc = gql`
|
export const AccountFieldsFragmentDoc = gql`
|
||||||
fragment AccountFields on AccountBalance {
|
fragment AccountFields on AccountBalance {
|
||||||
@ -83,6 +83,7 @@ export const AccountEventsDocument = gql`
|
|||||||
balance
|
balance
|
||||||
assetId
|
assetId
|
||||||
marketId
|
marketId
|
||||||
|
partyId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -26,6 +26,7 @@ describe('getId', () => {
|
|||||||
balance: '1',
|
balance: '1',
|
||||||
assetId: 'assetId',
|
assetId: 'assetId',
|
||||||
marketId: '',
|
marketId: '',
|
||||||
|
partyId: '',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
@ -41,6 +42,7 @@ describe('getId', () => {
|
|||||||
balance: '1',
|
balance: '1',
|
||||||
assetId: 'assetId',
|
assetId: 'assetId',
|
||||||
marketId: 'testId',
|
marketId: 'testId',
|
||||||
|
partyId: 'partyId',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -66,6 +66,7 @@ const update = (
|
|||||||
balance: delta.balance,
|
balance: delta.balance,
|
||||||
market: delta.marketId ? { id: delta.marketId } : null,
|
market: delta.marketId ? { id: delta.marketId } : null,
|
||||||
asset: { id: delta.assetId },
|
asset: { id: delta.assetId },
|
||||||
|
party: { id: delta.partyId },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -182,6 +183,7 @@ export const accountsDataProvider = makeDerivedDataProvider<Account[], never>(
|
|||||||
if (asset) {
|
if (asset) {
|
||||||
return {
|
return {
|
||||||
...account,
|
...account,
|
||||||
|
partyId: account.party?.id,
|
||||||
asset: {
|
asset: {
|
||||||
...asset,
|
...asset,
|
||||||
},
|
},
|
||||||
|
@ -122,6 +122,7 @@ export const accountEventsSubscription = (
|
|||||||
balance: '100000000',
|
balance: '100000000',
|
||||||
assetId: 'asset-id',
|
assetId: 'asset-id',
|
||||||
marketId: null,
|
marketId: null,
|
||||||
|
partyId: 'vega-0',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -43,10 +43,10 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
|||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
return `${addDecimalsFormatNumber(value, assetDecimalPlaces ?? 0, 5)}`;
|
return `${addDecimalsFormatNumber(value, assetDecimalPlaces ?? 0, 5)}`;
|
||||||
};
|
};
|
||||||
const stakeToCcySiskasFormatter = ({ value }: ValueFormatterParams) => {
|
const stakeToCcyVolumeFormatter = ({ value }: ValueFormatterParams) => {
|
||||||
if (!value) return '-';
|
if (!value) return '-';
|
||||||
const newValue = new BigNumber(value)
|
const newValue = new BigNumber(value)
|
||||||
.times(stakeToCcySiskas ?? 1)
|
.times(Number(stakeToCcySiskas) || 1)
|
||||||
.toString();
|
.toString();
|
||||||
return `${addDecimalsFormatNumber(newValue, assetDecimalPlaces ?? 0, 5)}`;
|
return `${addDecimalsFormatNumber(newValue, assetDecimalPlaces ?? 0, 5)}`;
|
||||||
};
|
};
|
||||||
@ -121,7 +121,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
|||||||
headerTooltip={t(
|
headerTooltip={t(
|
||||||
`The liquidity provider's obligation to the market, calculated as the liquidity commitment amount multiplied by the value of the stake_to_ccy_siskas network parameter to convert into units of liquidity volume. The obligation can be met by a combination of LP orders and limit orders on the order book.`
|
`The liquidity provider's obligation to the market, calculated as the liquidity commitment amount multiplied by the value of the stake_to_ccy_siskas network parameter to convert into units of liquidity volume. The obligation can be met by a combination of LP orders and limit orders on the order book.`
|
||||||
)}
|
)}
|
||||||
valueFormatter={stakeToCcySiskasFormatter}
|
valueFormatter={stakeToCcyVolumeFormatter}
|
||||||
/>
|
/>
|
||||||
<AgGridColumn
|
<AgGridColumn
|
||||||
headerName={t('Supplied')}
|
headerName={t('Supplied')}
|
||||||
@ -130,7 +130,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
|||||||
)}
|
)}
|
||||||
field="balance"
|
field="balance"
|
||||||
type="rightAligned"
|
type="rightAligned"
|
||||||
valueFormatter={stakeToCcySiskasFormatter}
|
valueFormatter={stakeToCcyVolumeFormatter}
|
||||||
/>
|
/>
|
||||||
<AgGridColumn
|
<AgGridColumn
|
||||||
headerName={t('Status')}
|
headerName={t('Status')}
|
||||||
|
Loading…
Reference in New Issue
Block a user