Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Contract instances timestamp ordering in accounts page #563

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#563](https://github.com/alleslabs/celatone-frontend/pull/563) Order by contract latest history timestamp in account contract instances
- [#560](https://github.com/alleslabs/celatone-frontend/pull/560) Fix pool type alignment in pool card

## v1.2.0
Expand Down
6 changes: 3 additions & 3 deletions src/lib/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const documents = {
types.GetMigrationHistoriesByContractAddressDocument,
"\n query getMigrationHistoriesCountByContractAddress($contractAddress: String!) {\n contract_histories_aggregate(\n where: { contract: { address: { _eq: $contractAddress } } }\n ) {\n aggregate {\n count\n }\n }\n }\n":
types.GetMigrationHistoriesCountByContractAddressDocument,
"\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n":
"\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: {\n contract_histories_aggregate: { max: { block_height: desc } }\n }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n":
types.GetContractListByWalletAddressPaginationDocument,
"\n query getContractListByAdminPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { account: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n":
types.GetContractListByAdminPaginationDocument,
Expand Down Expand Up @@ -171,8 +171,8 @@ export function graphql(
source: "\n query getMigrationHistoriesCountByContractAddress($contractAddress: String!) {\n contract_histories_aggregate(\n where: { contract: { address: { _eq: $contractAddress } } }\n ) {\n aggregate {\n count\n }\n }\n }\n"
): typeof documents["\n query getMigrationHistoriesCountByContractAddress($contractAddress: String!) {\n contract_histories_aggregate(\n where: { contract: { address: { _eq: $contractAddress } } }\n ) {\n aggregate {\n count\n }\n }\n }\n"];
export function graphql(
source: "\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"
): typeof documents["\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"];
source: "\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: {\n contract_histories_aggregate: { max: { block_height: desc } }\n }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"
): typeof documents["\n query getContractListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { accountByInitBy: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: {\n contract_histories_aggregate: { max: { block_height: desc } }\n }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"];
export function graphql(
source: "\n query getContractListByAdminPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { account: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"
): typeof documents["\n query getContractListByAdminPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contracts(\n where: { account: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { transaction: { block: { timestamp: desc } } }\n ) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n account {\n address\n }\n }\n contract_histories(order_by: { block: { timestamp: desc } }, limit: 1) {\n block {\n timestamp\n }\n account {\n address\n }\n remark\n }\n }\n }\n"];
Expand Down
79 changes: 76 additions & 3 deletions src/lib/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10554,6 +10554,11 @@ export type Transactions = {
is_ibc: Scalars["Boolean"];
is_instantiate: Scalars["Boolean"];
is_migrate: Scalars["Boolean"];
is_move_execute: Scalars["Boolean"];
is_move_execute_event: Scalars["Boolean"];
is_move_publish: Scalars["Boolean"];
is_move_script: Scalars["Boolean"];
is_move_upgrade: Scalars["Boolean"];
is_send: Scalars["Boolean"];
is_store_code: Scalars["Boolean"];
is_update_admin: Scalars["Boolean"];
Expand Down Expand Up @@ -10830,6 +10835,11 @@ export type Transactions_Bool_Exp = {
is_ibc?: InputMaybe<Boolean_Comparison_Exp>;
is_instantiate?: InputMaybe<Boolean_Comparison_Exp>;
is_migrate?: InputMaybe<Boolean_Comparison_Exp>;
is_move_execute?: InputMaybe<Boolean_Comparison_Exp>;
is_move_execute_event?: InputMaybe<Boolean_Comparison_Exp>;
is_move_publish?: InputMaybe<Boolean_Comparison_Exp>;
is_move_script?: InputMaybe<Boolean_Comparison_Exp>;
is_move_upgrade?: InputMaybe<Boolean_Comparison_Exp>;
is_send?: InputMaybe<Boolean_Comparison_Exp>;
is_store_code?: InputMaybe<Boolean_Comparison_Exp>;
is_update_admin?: InputMaybe<Boolean_Comparison_Exp>;
Expand Down Expand Up @@ -10882,6 +10892,11 @@ export type Transactions_Insert_Input = {
is_ibc?: InputMaybe<Scalars["Boolean"]>;
is_instantiate?: InputMaybe<Scalars["Boolean"]>;
is_migrate?: InputMaybe<Scalars["Boolean"]>;
is_move_execute?: InputMaybe<Scalars["Boolean"]>;
is_move_execute_event?: InputMaybe<Scalars["Boolean"]>;
is_move_publish?: InputMaybe<Scalars["Boolean"]>;
is_move_script?: InputMaybe<Scalars["Boolean"]>;
is_move_upgrade?: InputMaybe<Scalars["Boolean"]>;
is_send?: InputMaybe<Scalars["Boolean"]>;
is_store_code?: InputMaybe<Scalars["Boolean"]>;
is_update_admin?: InputMaybe<Scalars["Boolean"]>;
Expand Down Expand Up @@ -10987,6 +11002,11 @@ export type Transactions_Order_By = {
is_ibc?: InputMaybe<Order_By>;
is_instantiate?: InputMaybe<Order_By>;
is_migrate?: InputMaybe<Order_By>;
is_move_execute?: InputMaybe<Order_By>;
is_move_execute_event?: InputMaybe<Order_By>;
is_move_publish?: InputMaybe<Order_By>;
is_move_script?: InputMaybe<Order_By>;
is_move_upgrade?: InputMaybe<Order_By>;
is_send?: InputMaybe<Order_By>;
is_store_code?: InputMaybe<Order_By>;
is_update_admin?: InputMaybe<Order_By>;
Expand Down Expand Up @@ -11032,6 +11052,16 @@ export enum Transactions_Select_Column {
/** column name */
IsMigrate = "is_migrate",
/** column name */
IsMoveExecute = "is_move_execute",
/** column name */
IsMoveExecuteEvent = "is_move_execute_event",
/** column name */
IsMovePublish = "is_move_publish",
/** column name */
IsMoveScript = "is_move_script",
/** column name */
IsMoveUpgrade = "is_move_upgrade",
/** column name */
IsSend = "is_send",
/** column name */
IsStoreCode = "is_store_code",
Expand Down Expand Up @@ -11060,6 +11090,16 @@ export enum Transactions_Select_Column_Transactions_Aggregate_Bool_Exp_Bool_And_
/** column name */
IsMigrate = "is_migrate",
/** column name */
IsMoveExecute = "is_move_execute",
/** column name */
IsMoveExecuteEvent = "is_move_execute_event",
/** column name */
IsMovePublish = "is_move_publish",
/** column name */
IsMoveScript = "is_move_script",
/** column name */
IsMoveUpgrade = "is_move_upgrade",
/** column name */
IsSend = "is_send",
/** column name */
IsStoreCode = "is_store_code",
Expand All @@ -11082,6 +11122,16 @@ export enum Transactions_Select_Column_Transactions_Aggregate_Bool_Exp_Bool_Or_A
/** column name */
IsMigrate = "is_migrate",
/** column name */
IsMoveExecute = "is_move_execute",
/** column name */
IsMoveExecuteEvent = "is_move_execute_event",
/** column name */
IsMovePublish = "is_move_publish",
/** column name */
IsMoveScript = "is_move_script",
/** column name */
IsMoveUpgrade = "is_move_upgrade",
/** column name */
IsSend = "is_send",
/** column name */
IsStoreCode = "is_store_code",
Expand All @@ -11105,6 +11155,11 @@ export type Transactions_Set_Input = {
is_ibc?: InputMaybe<Scalars["Boolean"]>;
is_instantiate?: InputMaybe<Scalars["Boolean"]>;
is_migrate?: InputMaybe<Scalars["Boolean"]>;
is_move_execute?: InputMaybe<Scalars["Boolean"]>;
is_move_execute_event?: InputMaybe<Scalars["Boolean"]>;
is_move_publish?: InputMaybe<Scalars["Boolean"]>;
is_move_script?: InputMaybe<Scalars["Boolean"]>;
is_move_upgrade?: InputMaybe<Scalars["Boolean"]>;
is_send?: InputMaybe<Scalars["Boolean"]>;
is_store_code?: InputMaybe<Scalars["Boolean"]>;
is_update_admin?: InputMaybe<Scalars["Boolean"]>;
Expand Down Expand Up @@ -11193,6 +11248,11 @@ export type Transactions_Stream_Cursor_Value_Input = {
is_ibc?: InputMaybe<Scalars["Boolean"]>;
is_instantiate?: InputMaybe<Scalars["Boolean"]>;
is_migrate?: InputMaybe<Scalars["Boolean"]>;
is_move_execute?: InputMaybe<Scalars["Boolean"]>;
is_move_execute_event?: InputMaybe<Scalars["Boolean"]>;
is_move_publish?: InputMaybe<Scalars["Boolean"]>;
is_move_script?: InputMaybe<Scalars["Boolean"]>;
is_move_upgrade?: InputMaybe<Scalars["Boolean"]>;
is_send?: InputMaybe<Scalars["Boolean"]>;
is_store_code?: InputMaybe<Scalars["Boolean"]>;
is_update_admin?: InputMaybe<Scalars["Boolean"]>;
Expand Down Expand Up @@ -11248,6 +11308,16 @@ export enum Transactions_Update_Column {
/** column name */
IsMigrate = "is_migrate",
/** column name */
IsMoveExecute = "is_move_execute",
/** column name */
IsMoveExecuteEvent = "is_move_execute_event",
/** column name */
IsMovePublish = "is_move_publish",
/** column name */
IsMoveScript = "is_move_script",
/** column name */
IsMoveUpgrade = "is_move_upgrade",
/** column name */
IsSend = "is_send",
/** column name */
IsStoreCode = "is_store_code",
Expand Down Expand Up @@ -15679,19 +15749,22 @@ export const GetContractListByWalletAddressPaginationDocument = {
fields: [
{
kind: "ObjectField",
name: { kind: "Name", value: "transaction" },
name: {
kind: "Name",
value: "contract_histories_aggregate",
},
value: {
kind: "ObjectValue",
fields: [
{
kind: "ObjectField",
name: { kind: "Name", value: "block" },
name: { kind: "Name", value: "max" },
value: {
kind: "ObjectValue",
fields: [
{
kind: "ObjectField",
name: { kind: "Name", value: "timestamp" },
name: { kind: "Name", value: "block_height" },
value: { kind: "EnumValue", value: "desc" },
},
],
Expand Down
4 changes: 3 additions & 1 deletion src/lib/query/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ export const getContractListByWalletAddressPagination = graphql(`
where: { accountByInitBy: { address: { _eq: $walletAddress } } }
limit: $pageSize
offset: $offset
order_by: { transaction: { block: { timestamp: desc } } }
order_by: {
contract_histories_aggregate: { max: { block_height: desc } }
}
) {
address
label
Expand Down
Loading