-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6583 from vegaprotocol/chore/release-v0.26.13
chore(trading,governance,explorer): release v0.26.13
- Loading branch information
Showing
137 changed files
with
3,202 additions
and
3,300 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
* @vegaprotocol/frontend | ||
apps/ @vegaprotocol/frontend-qa | ||
libs/ @vegaprotocol/frontend-qa | ||
*.graphql @vegaprotocol/core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
apps/explorer/src/app/routes/parties/id/components/PartyDepositsWithdrawals.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
fragment ExplorerPartyDepositFields on Deposit { | ||
id | ||
asset { | ||
id | ||
source { | ||
... on ERC20 { | ||
contractAddress | ||
chainId | ||
} | ||
} | ||
} | ||
amount | ||
createdTimestamp | ||
creditedTimestamp | ||
status | ||
txHash | ||
} | ||
|
||
fragment ExplorerPartyWithdrawalFields on Withdrawal { | ||
id | ||
createdTimestamp | ||
withdrawnTimestamp | ||
asset { | ||
id | ||
source { | ||
... on ERC20 { | ||
contractAddress | ||
chainId | ||
} | ||
} | ||
} | ||
amount | ||
status | ||
txHash | ||
details { | ||
... on Erc20WithdrawalDetails { | ||
receiverAddress | ||
} | ||
} | ||
} | ||
|
||
query ExplorerPartyDepositsWithdrawals($partyId: ID!, $first: Int = 3) { | ||
partiesConnection(id: $partyId) { | ||
edges { | ||
node { | ||
depositsConnection(pagination: { first: $first }) { | ||
edges { | ||
node { | ||
...ExplorerPartyDepositFields | ||
} | ||
} | ||
} | ||
withdrawalsConnection(pagination: { first: $first }) { | ||
edges { | ||
node { | ||
...ExplorerPartyWithdrawalFields | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
apps/explorer/src/app/routes/parties/id/components/__generated__/PartyDepositsWithdrawals.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
apps/explorer/src/app/routes/parties/id/components/lib/combine-deposits-withdrawals.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { getDepositWithdrawalStatusLabel } from '../party-deposits-withdrawals-status-icon'; | ||
import { isDepositStatus } from './combine-deposits-withdrawals'; | ||
import { DepositStatus, WithdrawalStatus } from '@vegaprotocol/types'; | ||
|
||
describe('isDepositStatus & getDepositWithdrawalStatusLabel', () => { | ||
it('Use deposit status label for open, regardless of type', () => { | ||
expect(isDepositStatus(DepositStatus['STATUS_OPEN'])).toBe(true); | ||
expect(isDepositStatus(WithdrawalStatus['STATUS_OPEN'])).toBe(true); | ||
expect( | ||
getDepositWithdrawalStatusLabel(DepositStatus['STATUS_OPEN']) | ||
).toEqual('Open'); | ||
expect( | ||
getDepositWithdrawalStatusLabel(WithdrawalStatus['STATUS_OPEN']) | ||
).toEqual('Open'); | ||
}); | ||
|
||
it('Use deposit status label for finalized, regardless of type (custom label - incomplete)', () => { | ||
expect(isDepositStatus(DepositStatus['STATUS_FINALIZED'])).toBe(true); | ||
expect(isDepositStatus(WithdrawalStatus['STATUS_FINALIZED'])).toBe(true); | ||
expect( | ||
getDepositWithdrawalStatusLabel(DepositStatus['STATUS_FINALIZED']) | ||
).toEqual('Incomplete'); | ||
expect( | ||
getDepositWithdrawalStatusLabel(WithdrawalStatus['STATUS_FINALIZED']) | ||
).toEqual('Incomplete'); | ||
}); | ||
|
||
it('Use deposit status label for finalized, regardless of type (custom label - complete)', () => { | ||
expect(isDepositStatus(DepositStatus['STATUS_FINALIZED'])).toBe(true); | ||
expect(isDepositStatus(WithdrawalStatus['STATUS_FINALIZED'])).toBe(true); | ||
expect( | ||
getDepositWithdrawalStatusLabel( | ||
DepositStatus['STATUS_FINALIZED'], | ||
'fake-tx-hash' | ||
) | ||
).toEqual('Complete'); | ||
expect( | ||
getDepositWithdrawalStatusLabel( | ||
WithdrawalStatus['STATUS_FINALIZED'], | ||
'fake-tx-hash' | ||
) | ||
).toEqual('Complete'); | ||
}); | ||
|
||
it('Use deposit status label for cancelled', () => { | ||
expect(isDepositStatus(DepositStatus['STATUS_CANCELLED'])).toBe(true); | ||
expect( | ||
getDepositWithdrawalStatusLabel(DepositStatus['STATUS_CANCELLED']) | ||
).toEqual('Cancelled'); | ||
}); | ||
|
||
it('Use deposit status label for duplicate', () => { | ||
expect(isDepositStatus(DepositStatus['STATUS_DUPLICATE_REJECTED'])).toBe( | ||
true | ||
); | ||
expect( | ||
getDepositWithdrawalStatusLabel( | ||
DepositStatus['STATUS_DUPLICATE_REJECTED'] | ||
) | ||
).toEqual('Duplicate rejected'); | ||
}); | ||
|
||
it('Use withdraw status label for rejected', () => { | ||
expect(isDepositStatus(WithdrawalStatus['STATUS_REJECTED'])).toBe(false); | ||
expect( | ||
getDepositWithdrawalStatusLabel(WithdrawalStatus['STATUS_REJECTED']) | ||
).toEqual('Rejected'); | ||
}); | ||
}); |
69 changes: 69 additions & 0 deletions
69
apps/explorer/src/app/routes/parties/id/components/lib/combine-deposits-withdrawals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { | ||
DepositStatusMapping, | ||
type DepositStatus, | ||
type WithdrawalStatus, | ||
} from '@vegaprotocol/types'; | ||
import type { | ||
ExplorerPartyDepositsWithdrawalsQuery, | ||
ExplorerPartyDepositFieldsFragment, | ||
ExplorerPartyWithdrawalFieldsFragment, | ||
} from '../__generated__/PartyDepositsWithdrawals'; | ||
|
||
export type DepositOrWithdrawal = | ||
| ExplorerPartyDepositFieldsFragment | ||
| ExplorerPartyWithdrawalFieldsFragment | ||
| undefined; | ||
|
||
/** | ||
* Deposits and Withdrawals are separate types in the array, but when rendering them we want both to appear | ||
* in the same list, in date order, and with only the properties we care about. This function does that. | ||
* | ||
* @param data GraphQL query result, presumably containing 0 or more deposits and 0 or more withdrawals | ||
* @param limit Integer (default 3) | ||
* @returns Array combined withdrawals and deposits, sorted and limited | ||
*/ | ||
export function combineDepositsWithdrawals( | ||
data: ExplorerPartyDepositsWithdrawalsQuery, | ||
limit: number = 3 | ||
): DepositOrWithdrawal[] { | ||
const transfers = | ||
data?.partiesConnection?.edges?.flatMap((edge) => { | ||
return edge.node.depositsConnection?.edges?.map((depositEdge) => { | ||
return depositEdge?.node; | ||
}); | ||
}) || []; | ||
|
||
const withdrawals = | ||
data?.partiesConnection?.edges?.flatMap((edge) => { | ||
return edge.node.withdrawalsConnection?.edges?.map((withdrawalEdge) => { | ||
return withdrawalEdge?.node; | ||
}); | ||
}) || []; | ||
|
||
// Combine deposits and withdrawals | ||
return ( | ||
[...transfers, ...withdrawals] | ||
// Filter out null values | ||
.filter(Boolean) | ||
// Order by creation of the initial transaction | ||
.sort((a, b) => { | ||
return b?.createdTimestamp.localeCompare(a?.createdTimestamp); | ||
}) | ||
// Limit to 3 by default (for the overview block), or the param limit | ||
.slice(0, limit) | ||
); | ||
} | ||
|
||
/** | ||
* Type narrowing for deposits/withdrawals, used only for labels. There are some | ||
* crossover statuses (FINALIZED, OPEN) but from a label point of view this is | ||
* adequate. | ||
* | ||
* @param status | ||
* @returns Boolean true if the provided object is a Deposit (i.e false is a Withdrawal) | ||
*/ | ||
export function isDepositStatus( | ||
status: DepositStatus | WithdrawalStatus | ||
): status is DepositStatus { | ||
return status in DepositStatusMapping; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.