fix(liquidity): use LiquidityProvision id (#4191)
This commit is contained in:
parent
484d7888cf
commit
77a391448b
@ -1,6 +1,7 @@
|
|||||||
# Liquidity Provisions
|
# Liquidity Provisions
|
||||||
|
|
||||||
fragment LiquidityProvisionFields on LiquidityProvision {
|
fragment LiquidityProvisionFields on LiquidityProvision {
|
||||||
|
id
|
||||||
party {
|
party {
|
||||||
id
|
id
|
||||||
accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) {
|
accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) {
|
||||||
|
@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
export type LiquidityProvisionFieldsFragment = { __typename?: 'LiquidityProvision', createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } };
|
export type LiquidityProvisionFieldsFragment = { __typename?: 'LiquidityProvision', id?: string | null, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } };
|
||||||
|
|
||||||
export type LiquidityProvisionsQueryVariables = Types.Exact<{
|
export type LiquidityProvisionsQueryVariables = Types.Exact<{
|
||||||
marketId: Types.Scalars['ID'];
|
marketId: Types.Scalars['ID'];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type LiquidityProvisionsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', liquidityProvisionsConnection?: { __typename?: 'LiquidityProvisionsConnection', edges?: Array<{ __typename?: 'LiquidityProvisionsEdge', node: { __typename?: 'LiquidityProvision', createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } } } | null> | null } | null } | null };
|
export type LiquidityProvisionsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', liquidityProvisionsConnection?: { __typename?: 'LiquidityProvisionsConnection', edges?: Array<{ __typename?: 'LiquidityProvisionsEdge', node: { __typename?: 'LiquidityProvision', id?: string | null, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } } } | null> | null } | null } | null };
|
||||||
|
|
||||||
export type LiquidityProvisionsUpdateSubscriptionVariables = Types.Exact<{
|
export type LiquidityProvisionsUpdateSubscriptionVariables = Types.Exact<{
|
||||||
partyId?: Types.InputMaybe<Types.Scalars['ID']>;
|
partyId?: Types.InputMaybe<Types.Scalars['ID']>;
|
||||||
@ -31,6 +31,7 @@ export type LiquidityProviderFeeShareQuery = { __typename?: 'Query', market?: {
|
|||||||
|
|
||||||
export const LiquidityProvisionFieldsFragmentDoc = gql`
|
export const LiquidityProvisionFieldsFragmentDoc = gql`
|
||||||
fragment LiquidityProvisionFields on LiquidityProvision {
|
fragment LiquidityProvisionFields on LiquidityProvision {
|
||||||
|
id
|
||||||
party {
|
party {
|
||||||
id
|
id
|
||||||
accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) {
|
accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) {
|
||||||
|
@ -38,8 +38,7 @@ export const liquidityProvisionsDataProvider = makeDataProvider<
|
|||||||
) => {
|
) => {
|
||||||
return produce(data || [], (draft) => {
|
return produce(data || [], (draft) => {
|
||||||
deltas?.forEach((delta) => {
|
deltas?.forEach((delta) => {
|
||||||
const id = delta.id;
|
const index = draft.findIndex((a) => delta.id === a.id);
|
||||||
const index = draft.findIndex((a) => delta.id === id);
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
draft[index].commitmentAmount = delta.commitmentAmount;
|
draft[index].commitmentAmount = delta.commitmentAmount;
|
||||||
draft[index].fee = delta.fee;
|
draft[index].fee = delta.fee;
|
||||||
@ -47,6 +46,7 @@ export const liquidityProvisionsDataProvider = makeDataProvider<
|
|||||||
draft[index].status = delta.status;
|
draft[index].status = delta.status;
|
||||||
} else {
|
} else {
|
||||||
draft.unshift({
|
draft.unshift({
|
||||||
|
id: delta.id,
|
||||||
commitmentAmount: delta.commitmentAmount,
|
commitmentAmount: delta.commitmentAmount,
|
||||||
fee: delta.fee,
|
fee: delta.fee,
|
||||||
status: delta.status,
|
status: delta.status,
|
||||||
|
@ -188,7 +188,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
|||||||
<AgGrid
|
<AgGrid
|
||||||
style={{ width: '100%', height: '100%' }}
|
style={{ width: '100%', height: '100%' }}
|
||||||
overlayNoRowsTemplate={t('No liquidity provisions')}
|
overlayNoRowsTemplate={t('No liquidity provisions')}
|
||||||
getRowId={({ data }) => `${data.party.id}-${data.status}`}
|
getRowId={({ data }) => data.id}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
tooltipShowDelay={500}
|
tooltipShowDelay={500}
|
||||||
defaultColDef={{
|
defaultColDef={{
|
||||||
@ -200,7 +200,7 @@ export const LiquidityTable = forwardRef<AgGridReact, LiquidityTableProps>(
|
|||||||
storeKey="liquidityProvisionTable"
|
storeKey="liquidityProvisionTable"
|
||||||
{...props}
|
{...props}
|
||||||
columnDefs={colDefs}
|
columnDefs={colDefs}
|
||||||
></AgGrid>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user