chore(#2618): rename fields in ledger entry query (#2658) (#2660)

Co-authored-by: macqbat <maciek@vegaprotocol.io>
This commit is contained in:
m.ray 2023-01-18 08:14:06 -05:00 committed by GitHub
parent 89d0723eb3
commit fbdcd04096
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 218 additions and 138 deletions

View File

@ -21,10 +21,12 @@ describe('Portfolio page', { tags: '@smoke' }, () => {
'Receiver', 'Receiver',
'Account type', 'Account type',
'Market', 'Market',
'Transfer Type', 'Transfer type',
'Quantity', 'Quantity',
'Asset', 'Asset',
'Vega Time', 'Sender account balance',
'Receiver account balance',
'Vega time',
]; ];
cy.getByTestId('tab-ledger-entries').within(($headers) => { cy.getByTestId('tab-ledger-entries').within(($headers) => {
cy.wrap($headers) cy.wrap($headers)
@ -41,9 +43,9 @@ describe('Portfolio page', { tags: '@smoke' }, () => {
it('account filters should be callable', () => { it('account filters should be callable', () => {
cy.visit('/#/portfolio'); cy.visit('/#/portfolio');
cy.getByTestId('"Ledger entries"').click(); cy.getByTestId('"Ledger entries"').click();
cy.get('[role="columnheader"][col-id="senderAccountType"]').realHover(); cy.get('[role="columnheader"][col-id="fromAccountType"]').realHover();
cy.get( cy.get(
'[role="columnheader"][col-id="senderAccountType"] .ag-header-cell-menu-button' '[role="columnheader"][col-id="fromAccountType"] .ag-header-cell-menu-button'
).click(); ).click();
cy.get('fieldset.ag-simple-filter-body-wrapper') cy.get('fieldset.ag-simple-filter-body-wrapper')
.should('be.visible') .should('be.visible')

View File

@ -3,31 +3,30 @@ fragment LedgerEntry on AggregatedLedgerEntry {
quantity quantity
assetId assetId
transferType transferType
receiverAccountType toAccountType
receiverMarketId toAccountMarketId
receiverPartyId toAccountPartyId
senderAccountType toAccountBalance
senderMarketId fromAccountType
senderPartyId fromAccountMarketId
fromAccountPartyId
fromAccountBalance
} }
query LedgerEntries( query LedgerEntries(
$partyId: ID! $partyId: ID!
$pagination: Pagination $pagination: Pagination
$dateRange: DateRange $dateRange: DateRange
$senderAccountType: [AccountType!] $fromAccountType: [AccountType!]
$receiverAccountType: [AccountType!] $toAccountType: [AccountType!]
) { ) {
ledgerEntries( ledgerEntries(
filter: { filter: {
SenderAccountFilter: { FromAccountFilter: {
partyIds: [$partyId] partyIds: [$partyId]
accountTypes: $senderAccountType accountTypes: $fromAccountType
}
ReceiverAccountFilter: {
partyIds: [$partyId]
accountTypes: $receiverAccountType
} }
ToAccountFilter: { partyIds: [$partyId], accountTypes: $toAccountType }
} }
pagination: $pagination pagination: $pagination
dateRange: $dateRange dateRange: $dateRange

View File

@ -3,18 +3,18 @@ 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 LedgerEntryFragment = { __typename?: 'AggregatedLedgerEntry', vegaTime: any, quantity: string, assetId?: string | null, transferType?: Types.TransferType | null, receiverAccountType?: Types.AccountType | null, receiverMarketId?: string | null, receiverPartyId?: string | null, senderAccountType?: Types.AccountType | null, senderMarketId?: string | null, senderPartyId?: string | null }; export type LedgerEntryFragment = { __typename?: 'AggregatedLedgerEntry', vegaTime: any, quantity: string, assetId?: string | null, transferType?: Types.TransferType | null, toAccountType?: Types.AccountType | null, toAccountMarketId?: string | null, toAccountPartyId?: string | null, toAccountBalance: string, fromAccountType?: Types.AccountType | null, fromAccountMarketId?: string | null, fromAccountPartyId?: string | null, fromAccountBalance: string };
export type LedgerEntriesQueryVariables = Types.Exact<{ export type LedgerEntriesQueryVariables = Types.Exact<{
partyId: Types.Scalars['ID']; partyId: Types.Scalars['ID'];
pagination?: Types.InputMaybe<Types.Pagination>; pagination?: Types.InputMaybe<Types.Pagination>;
dateRange?: Types.InputMaybe<Types.DateRange>; dateRange?: Types.InputMaybe<Types.DateRange>;
senderAccountType?: Types.InputMaybe<Array<Types.AccountType> | Types.AccountType>; fromAccountType?: Types.InputMaybe<Array<Types.AccountType> | Types.AccountType>;
receiverAccountType?: Types.InputMaybe<Array<Types.AccountType> | Types.AccountType>; toAccountType?: Types.InputMaybe<Array<Types.AccountType> | Types.AccountType>;
}>; }>;
export type LedgerEntriesQuery = { __typename?: 'Query', ledgerEntries: { __typename?: 'AggregatedLedgerEntriesConnection', edges: Array<{ __typename?: 'AggregatedLedgerEntriesEdge', node: { __typename?: 'AggregatedLedgerEntry', vegaTime: any, quantity: string, assetId?: string | null, transferType?: Types.TransferType | null, receiverAccountType?: Types.AccountType | null, receiverMarketId?: string | null, receiverPartyId?: string | null, senderAccountType?: Types.AccountType | null, senderMarketId?: string | null, senderPartyId?: string | null } } | null>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } }; export type LedgerEntriesQuery = { __typename?: 'Query', ledgerEntries: { __typename?: 'AggregatedLedgerEntriesConnection', edges: Array<{ __typename?: 'AggregatedLedgerEntriesEdge', node: { __typename?: 'AggregatedLedgerEntry', vegaTime: any, quantity: string, assetId?: string | null, transferType?: Types.TransferType | null, toAccountType?: Types.AccountType | null, toAccountMarketId?: string | null, toAccountPartyId?: string | null, toAccountBalance: string, fromAccountType?: Types.AccountType | null, fromAccountMarketId?: string | null, fromAccountPartyId?: string | null, fromAccountBalance: string } } | null>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } };
export const LedgerEntryFragmentDoc = gql` export const LedgerEntryFragmentDoc = gql`
fragment LedgerEntry on AggregatedLedgerEntry { fragment LedgerEntry on AggregatedLedgerEntry {
@ -22,18 +22,20 @@ export const LedgerEntryFragmentDoc = gql`
quantity quantity
assetId assetId
transferType transferType
receiverAccountType toAccountType
receiverMarketId toAccountMarketId
receiverPartyId toAccountPartyId
senderAccountType toAccountBalance
senderMarketId fromAccountType
senderPartyId fromAccountMarketId
fromAccountPartyId
fromAccountBalance
} }
`; `;
export const LedgerEntriesDocument = gql` export const LedgerEntriesDocument = gql`
query LedgerEntries($partyId: ID!, $pagination: Pagination, $dateRange: DateRange, $senderAccountType: [AccountType!], $receiverAccountType: [AccountType!]) { query LedgerEntries($partyId: ID!, $pagination: Pagination, $dateRange: DateRange, $fromAccountType: [AccountType!], $toAccountType: [AccountType!]) {
ledgerEntries( ledgerEntries(
filter: {SenderAccountFilter: {partyIds: [$partyId], accountTypes: $senderAccountType}, ReceiverAccountFilter: {partyIds: [$partyId], accountTypes: $receiverAccountType}} filter: {FromAccountFilter: {partyIds: [$partyId], accountTypes: $fromAccountType}, ToAccountFilter: {partyIds: [$partyId], accountTypes: $toAccountType}}
pagination: $pagination pagination: $pagination
dateRange: $dateRange dateRange: $dateRange
) { ) {
@ -67,8 +69,8 @@ export const LedgerEntriesDocument = gql`
* partyId: // value for 'partyId' * partyId: // value for 'partyId'
* pagination: // value for 'pagination' * pagination: // value for 'pagination'
* dateRange: // value for 'dateRange' * dateRange: // value for 'dateRange'
* senderAccountType: // value for 'senderAccountType' * fromAccountType: // value for 'fromAccountType'
* receiverAccountType: // value for 'receiverAccountType' * toAccountType: // value for 'toAccountType'
* }, * },
* }); * });
*/ */

View File

@ -123,10 +123,10 @@ export const ledgerEntriesProvider = makeDerivedDataProvider<
const entry = edge?.node; const entry = edge?.node;
const asset = assets.find((asset: Asset) => asset.id === entry.assetId); const asset = assets.find((asset: Asset) => asset.id === entry.assetId);
const marketSender = markets.find( const marketSender = markets.find(
(market: Market) => market.id === entry.senderMarketId (market: Market) => market.id === entry.fromAccountMarketId
); );
const marketReceiver = markets.find( const marketReceiver = markets.find(
(market: Market) => market.id === entry.receiverMarketId (market: Market) => market.id === entry.toAccountMarketId
); );
return { node: { ...entry, asset, marketSender, marketReceiver } }; return { node: { ...entry, asset, marketSender, marketReceiver } };
}); });
@ -151,8 +151,8 @@ export const useLedgerEntriesDataProvider = ({
() => ({ () => ({
partyId, partyId,
dateRange: filter?.vegaTime?.value, dateRange: filter?.vegaTime?.value,
senderAccountType: filter?.senderAccountType?.value ?? null, fromAccountType: filter?.fromAccountType?.value ?? null,
receiverAccountType: filter?.receiverAccountType?.value ?? null, toAccountType: filter?.toAccountType?.value ?? null,
}), }),
[partyId, filter] [partyId, filter]
); );

View File

@ -37,41 +37,47 @@ const ledgerEntries: LedgerEntryFragment[] = [
quantity: '0', quantity: '0',
assetId: 'asset-id', assetId: 'asset-id',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: 'market-1', toAccountMarketId: 'market-1',
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: 'market-0', fromAccountMarketId: 'market-0',
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669221452175594000', vegaTime: '1669221452175594000',
quantity: '0', quantity: '0',
assetId: 'asset-id-2', assetId: 'asset-id-2',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: 'market-0', toAccountMarketId: 'market-0',
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: 'market-2', fromAccountMarketId: 'market-2',
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209347054198000', vegaTime: '1669209347054198000',
quantity: '0', quantity: '0',
assetId: 'asset-id', assetId: 'asset-id',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: 'market-3', toAccountMarketId: 'market-3',
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: 'market-2', fromAccountMarketId: 'market-2',
senderPartyId: 'sender party id', fromAccountPartyId: 'sender party id',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209345512806000', vegaTime: '1669209345512806000',
@ -79,6 +85,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: 'asset-id', assetId: 'asset-id',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209316163397000', vegaTime: '1669209316163397000',
@ -86,6 +94,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: 'asset-id-2', assetId: 'asset-id-2',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209299051286000', vegaTime: '1669209299051286000',
@ -93,6 +103,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: 'asset-id-2', assetId: 'asset-id-2',
transferType: Schema.TransferType.TRANSFER_TYPE_MTM_WIN, transferType: Schema.TransferType.TRANSFER_TYPE_MTM_WIN,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209151328614000', vegaTime: '1669209151328614000',
@ -100,6 +112,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209117655380000', vegaTime: '1669209117655380000',
@ -107,6 +121,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209082788024000', vegaTime: '1669209082788024000',
@ -114,6 +130,8 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', assetId: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c',
transferType: Schema.TransferType.TRANSFER_TYPE_MTM_WIN, transferType: Schema.TransferType.TRANSFER_TYPE_MTM_WIN,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '1669209076546363000', vegaTime: '1669209076546363000',
@ -121,22 +139,26 @@ const ledgerEntries: LedgerEntryFragment[] = [
assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad', assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_HIGH,
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '2022-11-24T13:36:42.13989Z', vegaTime: '2022-11-24T13:36:42.13989Z',
quantity: '9078407730948615', quantity: '9078407730948615',
assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad', assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_LOW, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_LOW,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: toAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_MARGIN, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_MARGIN,
senderMarketId: fromAccountMarketId:
'0942d767cb2cb5a795e14216e8e53c2b6f75e46dc1732c5aeda8a5aba4ad193d', '0942d767cb2cb5a795e14216e8e53c2b6f75e46dc1732c5aeda8a5aba4ad193d',
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
@ -144,16 +166,18 @@ const ledgerEntries: LedgerEntryFragment[] = [
quantity: '263142253070974', quantity: '263142253070974',
assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad', assetId: 'cee709223217281d7893b650850ae8ee8a18b7539b5658f9b4cc24de95dd18ad',
transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_LOW, transferType: Schema.TransferType.TRANSFER_TYPE_MARGIN_LOW,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: toAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_MARGIN, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_MARGIN,
senderMarketId: fromAccountMarketId:
'0942d767cb2cb5a795e14216e8e53c2b6f75e46dc1732c5aeda8a5aba4ad193d', '0942d767cb2cb5a795e14216e8e53c2b6f75e46dc1732c5aeda8a5aba4ad193d',
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
@ -161,55 +185,63 @@ const ledgerEntries: LedgerEntryFragment[] = [
quantity: '1000000000', quantity: '1000000000',
assetId: '4e4e80abff30cab933b8c4ac6befc618372eb76b2cbddc337eff0b4a3a4d25b8', assetId: '4e4e80abff30cab933b8c4ac6befc618372eb76b2cbddc337eff0b4a3a4d25b8',
transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT, transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: null, fromAccountMarketId: null,
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '2022-11-24T12:39:11.516154Z', vegaTime: '2022-11-24T12:39:11.516154Z',
quantity: '1000000000000', quantity: '1000000000000',
assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d', assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d',
transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT, transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: null, fromAccountMarketId: null,
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '2022-11-24T12:37:26.832226Z', vegaTime: '2022-11-24T12:37:26.832226Z',
quantity: '10000000000000000000000', quantity: '10000000000000000000000',
assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d', assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d',
transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT, transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: null, fromAccountMarketId: null,
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
{ {
vegaTime: '2022-11-24T12:24:52.844901Z', vegaTime: '2022-11-24T12:24:52.844901Z',
quantity: '49390000000000000000000', quantity: '49390000000000000000000',
assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d', assetId: 'c9fe6fc24fce121b2cc72680543a886055abb560043fda394ba5376203b7527d',
transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT, transferType: Schema.TransferType.TRANSFER_TYPE_DEPOSIT,
receiverAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL, toAccountType: Schema.AccountType.ACCOUNT_TYPE_EXTERNAL,
receiverMarketId: null, toAccountMarketId: null,
receiverPartyId: 'network', toAccountPartyId: 'network',
senderAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL, fromAccountType: Schema.AccountType.ACCOUNT_TYPE_GENERAL,
senderMarketId: null, fromAccountMarketId: null,
senderPartyId: fromAccountPartyId:
'2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1', '2e1ef32e5804e14232406aebaad719087d326afa5c648b7824d0823d8a46c8d1',
__typename: 'AggregatedLedgerEntry', __typename: 'AggregatedLedgerEntry',
toAccountBalance: '0',
fromAccountBalance: '0',
}, },
]; ];

View File

@ -12,8 +12,8 @@ export interface Filter {
vegaTime?: { vegaTime?: {
value: Schema.DateRange; value: Schema.DateRange;
}; };
senderAccountType?: { value: Types.AccountType[] }; fromAccountType?: { value: Types.AccountType[] };
receiverAccountType?: { value: Types.AccountType[] }; toAccountType?: { value: Types.AccountType[] };
} }
type LedgerManagerProps = { partyId: string }; type LedgerManagerProps = { partyId: string };

View File

@ -57,10 +57,10 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
> >
<AgGridColumn <AgGridColumn
headerName={t('Sender')} headerName={t('Sender')}
field="senderPartyId" field="fromAccountPartyId"
cellRenderer={({ cellRenderer={({
value, value,
}: VegaValueFormatterParams<LedgerEntry, 'senderPartyId'>) => }: VegaValueFormatterParams<LedgerEntry, 'fromAccountPartyId'>) =>
truncateByChars(value || '') truncateByChars(value || '')
} }
/> />
@ -70,10 +70,10 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
filterParams={{ filterParams={{
set: AccountTypeMapping, set: AccountTypeMapping,
}} }}
field="senderAccountType" field="fromAccountType"
cellRenderer={({ cellRenderer={({
value, value,
}: VegaValueFormatterParams<LedgerEntry, 'senderAccountType'>) => }: VegaValueFormatterParams<LedgerEntry, 'fromAccountType'>) =>
value ? AccountTypeMapping[value] : '-' value ? AccountTypeMapping[value] : '-'
} }
/> />
@ -89,10 +89,10 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
/> />
<AgGridColumn <AgGridColumn
headerName={t('Receiver')} headerName={t('Receiver')}
field="receiverPartyId" field="toAccountPartyId"
cellRenderer={({ cellRenderer={({
value, value,
}: VegaValueFormatterParams<LedgerEntry, 'receiverPartyId'>) => }: VegaValueFormatterParams<LedgerEntry, 'toAccountPartyId'>) =>
truncateByChars(value || '') truncateByChars(value || '')
} }
/> />
@ -102,10 +102,10 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
filterParams={{ filterParams={{
set: AccountTypeMapping, set: AccountTypeMapping,
}} }}
field="receiverAccountType" field="toAccountType"
cellRenderer={({ cellRenderer={({
value, value,
}: VegaValueFormatterParams<LedgerEntry, 'receiverAccountType'>) => }: VegaValueFormatterParams<LedgerEntry, 'toAccountType'>) =>
value ? AccountTypeMapping[value] : '-' value ? AccountTypeMapping[value] : '-'
} }
/> />
@ -120,7 +120,7 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
>) => value || '-'} >) => value || '-'}
/> />
<AgGridColumn <AgGridColumn
headerName={t('Transfer Type')} headerName={t('Transfer type')}
field="transferType" field="transferType"
tooltipField="transferType" tooltipField="transferType"
valueFormatter={({ valueFormatter={({
@ -158,7 +158,43 @@ export const LedgerTable = forwardRef<AgGridReact, LedgerEntryProps>(
} }
/> />
<AgGridColumn <AgGridColumn
headerName={t('Vega Time')} headerName={t('Sender account balance')}
field="fromAccountBalance"
valueFormatter={({
value,
data,
}: VegaValueFormatterParams<LedgerEntry, 'fromAccountBalance'>) => {
const marketDecimalPlaces = data?.marketSender?.decimalPlaces;
const assetDecimalPlaces = data?.asset?.decimals || 0;
return value
? addDecimalsFormatNumber(
value,
assetDecimalPlaces,
marketDecimalPlaces
)
: value;
}}
/>
<AgGridColumn
headerName={t('Receiver account balance')}
field="toAccountBalance"
valueFormatter={({
value,
data,
}: VegaValueFormatterParams<LedgerEntry, 'toAccountBalance'>) => {
const marketDecimalPlaces = data?.marketReceiver?.decimalPlaces;
const assetDecimalPlaces = data?.asset?.decimals || 0;
return value
? addDecimalsFormatNumber(
value,
assetDecimalPlaces,
marketDecimalPlaces
)
: value;
}}
/>
<AgGridColumn
headerName={t('Vega time')}
field="vegaTime" field="vegaTime"
valueFormatter={({ valueFormatter={({
value, value,

View File

@ -66,13 +66,6 @@ export type AccountEvent = {
type: AccountType; type: AccountType;
}; };
export enum AccountField {
AccountType = 'AccountType',
AssetId = 'AssetId',
MarketId = 'MarketId',
PartyId = 'PartyId'
}
/** Filter input for historical balance queries */ /** Filter input for historical balance queries */
export type AccountFilter = { export type AccountFilter = {
accountTypes?: InputMaybe<Array<AccountType>>; accountTypes?: InputMaybe<Array<AccountType>>;
@ -193,20 +186,24 @@ export type AggregatedLedgerEntry = {
__typename?: 'AggregatedLedgerEntry'; __typename?: 'AggregatedLedgerEntry';
/** Asset identifier, if query was grouped by asset - else null */ /** Asset identifier, if query was grouped by asset - else null */
assetId?: Maybe<Scalars['ID']>; assetId?: Maybe<Scalars['ID']>;
/** Sender account balance after the transfer */
fromAccountBalance: Scalars['String'];
/** Market identifier, if query was grouped by sender market - else null */
fromAccountMarketId?: Maybe<Scalars['ID']>;
/** Party identifier, if query was grouped by sender party - else null */
fromAccountPartyId?: Maybe<Scalars['ID']>;
/** Account type, if query was grouped by sender account type - else null */
fromAccountType?: Maybe<AccountType>;
/** Net amount of ledger entries for the accounts specified in the filter at this time */ /** Net amount of ledger entries for the accounts specified in the filter at this time */
quantity: Scalars['String']; quantity: Scalars['String'];
/** Account type, if query was grouped by receiver account type - else null */ /** Receiver account balance after the transfer */
receiverAccountType?: Maybe<AccountType>; toAccountBalance: Scalars['String'];
/** Market identifier, if query was grouped by receiver market - else null */ /** Market identifier, if query was grouped by receiver market - else null */
receiverMarketId?: Maybe<Scalars['ID']>; toAccountMarketId?: Maybe<Scalars['ID']>;
/** Party identifier, if query was grouped by receiver party - else null */ /** Party identifier, if query was grouped by receiver party - else null */
receiverPartyId?: Maybe<Scalars['ID']>; toAccountPartyId?: Maybe<Scalars['ID']>;
/** Account type, if query was grouped by sender account type - else null */ /** Account type, if query was grouped by receiver account type - else null */
senderAccountType?: Maybe<AccountType>; toAccountType?: Maybe<AccountType>;
/** Market identifier, if query was grouped by sender market - else null */
senderMarketId?: Maybe<Scalars['ID']>;
/** Party identifier, if query was grouped by sender party - else null */
senderPartyId?: Maybe<Scalars['ID']>;
/** Type of the transfer for this ledger entry */ /** Type of the transfer for this ledger entry */
transferType?: Maybe<TransferType>; transferType?: Maybe<TransferType>;
/** RFC3339Nano time from at which this ledger entries records were relevant */ /** RFC3339Nano time from at which this ledger entries records were relevant */
@ -256,6 +253,7 @@ export type AssetEdge = {
/** One of the possible asset sources */ /** One of the possible asset sources */
export type AssetSource = BuiltinAsset | ERC20; export type AssetSource = BuiltinAsset | ERC20;
/** Status of an asset that has been proposed to be added to the network */
export enum AssetStatus { export enum AssetStatus {
/** Asset can be used on the Vega network */ /** Asset can be used on the Vega network */
STATUS_ENABLED = 'STATUS_ENABLED', STATUS_ENABLED = 'STATUS_ENABLED',
@ -311,6 +309,7 @@ export type AuctionEvent = {
trigger: AuctionTrigger; trigger: AuctionTrigger;
}; };
/** Describes the trigger for an auction */
export enum AuctionTrigger { export enum AuctionTrigger {
/** Auction because market has a frequent batch auction trading mode */ /** Auction because market has a frequent batch auction trading mode */
AUCTION_TRIGGER_BATCH = 'AUCTION_TRIGGER_BATCH', AUCTION_TRIGGER_BATCH = 'AUCTION_TRIGGER_BATCH',
@ -343,6 +342,7 @@ export type BusEvent = {
type: BusEventType; type: BusEventType;
}; };
/** Event types */
export enum BusEventType { export enum BusEventType {
/** An account has been updated */ /** An account has been updated */
Account = 'Account', Account = 'Account',
@ -594,13 +594,13 @@ export type DataSourceSpecConfigurationTime = {
conditions: Array<Maybe<Condition>>; conditions: Array<Maybe<Condition>>;
}; };
/** Status describe the status of the data spec */ /** Describes the status of the data spec */
export enum DataSourceSpecStatus { export enum DataSourceSpecStatus {
/** describes an active data spec. */ /** Describes an active data spec */
STATUS_ACTIVE = 'STATUS_ACTIVE', STATUS_ACTIVE = 'STATUS_ACTIVE',
/** /**
* describes a data spec that is not listening to data * Describes a data spec that is not listening to data
* anymore. * anymore
*/ */
STATUS_DEACTIVATED = 'STATUS_DEACTIVATED' STATUS_DEACTIVATED = 'STATUS_DEACTIVATED'
} }
@ -1115,7 +1115,7 @@ export type Instrument = {
__typename?: 'Instrument'; __typename?: 'Instrument';
/** A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ /** A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */
code: Scalars['String']; code: Scalars['String'];
/** Uniquely identify an instrument across all instruments available on Vega (string) */ /** Uniquely identifies an instrument across all instruments available on Vega (string) */
id: Scalars['ID']; id: Scalars['ID'];
/** Metadata for this instrument */ /** Metadata for this instrument */
metadata: InstrumentMetadata; metadata: InstrumentMetadata;
@ -1193,18 +1193,23 @@ export type KeyRotationEdge = {
export type LedgerEntry = { export type LedgerEntry = {
__typename?: 'LedgerEntry'; __typename?: 'LedgerEntry';
/** Account from which the asset was taken */
accountFromId: AccountDetails;
/** Account to which the balance was transferred */
accountToId: AccountDetails;
/** The amount transferred */ /** The amount transferred */
amount: Scalars['String']; amount: Scalars['String'];
/** Sender account balance after the transfer */
fromAccountBalance: Scalars['String'];
/** Account from which the asset was taken */
fromAccountId: AccountDetails;
/** RFC3339Nano time at which the transfer was made */ /** RFC3339Nano time at which the transfer was made */
timestamp: Scalars['Timestamp']; timestamp: Scalars['Timestamp'];
/** Receiver account balance after the transfer */
toAccountBalance: Scalars['String'];
/** Account to which the balance was transferred */
toAccountId: AccountDetails;
/** Type of ledger entry */ /** Type of ledger entry */
type: TransferType; type: TransferType;
}; };
/** Type of transfer between accounts */
export enum LedgerEntryField { export enum LedgerEntryField {
TransferType = 'TransferType' TransferType = 'TransferType'
} }
@ -1212,8 +1217,8 @@ export enum LedgerEntryField {
/** Filter for historical entry ledger queries */ /** Filter for historical entry ledger queries */
export type LedgerEntryFilter = { export type LedgerEntryFilter = {
CloseOnAccountFilters?: InputMaybe<Scalars['Boolean']>; CloseOnAccountFilters?: InputMaybe<Scalars['Boolean']>;
ReceiverAccountFilter?: InputMaybe<AccountFilter>; FromAccountFilter?: InputMaybe<AccountFilter>;
SenderAccountFilter?: InputMaybe<AccountFilter>; ToAccountFilter?: InputMaybe<AccountFilter>;
TransferTypes?: InputMaybe<Array<InputMaybe<TransferType>>>; TransferTypes?: InputMaybe<Array<InputMaybe<TransferType>>>;
}; };
@ -1788,7 +1793,7 @@ export enum MarketTradingMode {
TRADING_MODE_OPENING_AUCTION = 'TRADING_MODE_OPENING_AUCTION' TRADING_MODE_OPENING_AUCTION = 'TRADING_MODE_OPENING_AUCTION'
} }
/** Information about whether proposals are enabled, if the markets are still bootstrapping etc.. */ /** Information about whether proposals are enabled, if the markets are still bootstrapping, etc.. */
export type NetworkLimits = { export type NetworkLimits = {
__typename?: 'NetworkLimits'; __typename?: 'NetworkLimits';
/** How many blocks before the chain comes out of bootstrap mode */ /** How many blocks before the chain comes out of bootstrap mode */
@ -1984,7 +1989,7 @@ export type NodeSignatureEdge = {
node: NodeSignature; node: NodeSignature;
}; };
/** Represents the type signature provided by a node */ /** Represents the type of signature provided by a node */
export enum NodeSignatureKind { export enum NodeSignatureKind {
/** A signature for proposing a new asset into the network */ /** A signature for proposing a new asset into the network */
NODE_SIGNATURE_KIND_ASSET_NEW = 'NODE_SIGNATURE_KIND_ASSET_NEW', NODE_SIGNATURE_KIND_ASSET_NEW = 'NODE_SIGNATURE_KIND_ASSET_NEW',
@ -2179,7 +2184,7 @@ export type OracleDataEdge = {
export type OracleSpec = { export type OracleSpec = {
__typename?: 'OracleSpec'; __typename?: 'OracleSpec';
/** Data list all the oracle data broadcast to this spec */ /** Data lists all the oracle data broadcast to this spec */
dataConnection: OracleDataConnection; dataConnection: OracleDataConnection;
dataSourceSpec: ExternalDataSourceSpec; dataSourceSpec: ExternalDataSourceSpec;
}; };
@ -2423,6 +2428,7 @@ export enum OrderTimeInForce {
TIME_IN_FORCE_IOC = 'TIME_IN_FORCE_IOC' TIME_IN_FORCE_IOC = 'TIME_IN_FORCE_IOC'
} }
/** Types of orders */
export enum OrderType { export enum OrderType {
/** Order that uses a pre-specified price to buy or sell */ /** Order that uses a pre-specified price to buy or sell */
TYPE_LIMIT = 'TYPE_LIMIT', TYPE_LIMIT = 'TYPE_LIMIT',
@ -2430,7 +2436,7 @@ export enum OrderType {
TYPE_MARKET = 'TYPE_MARKET', TYPE_MARKET = 'TYPE_MARKET',
/** /**
* Used for distressed parties, an order placed by the network to close out distressed parties * Used for distressed parties, an order placed by the network to close out distressed parties
* similar to Market order, only no party is attached to the order. * similar to market order, only no party is attached to the order.
*/ */
TYPE_NETWORK = 'TYPE_NETWORK' TYPE_NETWORK = 'TYPE_NETWORK'
} }
@ -4314,6 +4320,7 @@ export enum TransferStatus {
STATUS_STOPPED = 'STATUS_STOPPED' STATUS_STOPPED = 'STATUS_STOPPED'
} }
/** Types that describe why a transfer has been made */
export enum TransferType { export enum TransferType {
/** Bond returned to general account after liquidity commitment was reduced */ /** Bond returned to general account after liquidity commitment was reduced */
TRANSFER_TYPE_BOND_HIGH = 'TRANSFER_TYPE_BOND_HIGH', TRANSFER_TYPE_BOND_HIGH = 'TRANSFER_TYPE_BOND_HIGH',
@ -4446,10 +4453,11 @@ export type UpdateNetworkParameter = {
networkParameter: NetworkParameter; networkParameter: NetworkParameter;
}; };
/** Status of a validator node */
export enum ValidatorStatus { export enum ValidatorStatus {
/** The node is a candidate to become a Tendermint validator if a slot is made available */ /** The node is a candidate to become a Tendermint validator if a slot is made available */
VALIDATOR_NODE_STATUS_ERSATZ = 'VALIDATOR_NODE_STATUS_ERSATZ', VALIDATOR_NODE_STATUS_ERSATZ = 'VALIDATOR_NODE_STATUS_ERSATZ',
/** The node is pending to be promoted to Ersatz */ /** The node is pending promotion to ersatz (standby), if a slot is available and if the node fulfils the requirements */
VALIDATOR_NODE_STATUS_PENDING = 'VALIDATOR_NODE_STATUS_PENDING', VALIDATOR_NODE_STATUS_PENDING = 'VALIDATOR_NODE_STATUS_PENDING',
/** The node is taking part in Tendermint consensus */ /** The node is taking part in Tendermint consensus */
VALIDATOR_NODE_STATUS_TENDERMINT = 'VALIDATOR_NODE_STATUS_TENDERMINT' VALIDATOR_NODE_STATUS_TENDERMINT = 'VALIDATOR_NODE_STATUS_TENDERMINT'
@ -4491,10 +4499,11 @@ export type VoteEdge = {
node: Vote; node: Vote;
}; };
/** Whether a governance vote is yes or no */
export enum VoteValue { export enum VoteValue {
/** No reject a proposal */ /** No votes against a proposal */
VALUE_NO = 'VALUE_NO', VALUE_NO = 'VALUE_NO',
/** Yes accept a proposal */ /** Yes votes for a proposal */
VALUE_YES = 'VALUE_YES' VALUE_YES = 'VALUE_YES'
} }