-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: order processor ui * updates * Update src/pages/processor.tsx * fix sidebar * update order card * restructure apis * add cocos indexer to env * fix timeago * order pages * hooks * order details modal * order processor table * update fetching orders * remove link to the extrinsic id * show not processed orders only * disable pages under secondary market on kusama * center account links in purchase history table * purchase type * update parachain table * fix contributed amount * fix sidebar responsive * fix: relay token for order rewards * fix order id --------- Co-authored-by: Sergej Sakac <[email protected]> Co-authored-by: cuteolaf <[email protected]>
- Loading branch information
1 parent
7b32fac
commit e9a80cb
Showing
28 changed files
with
822 additions
and
233 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { fetchGraphql } from '@/utils/fetchGraphql'; | ||
|
||
import { API_CORETIME_DICT } from '@/consts'; | ||
import { Address, ApiResponse, NetworkType } from '@/models'; | ||
|
||
export const fetchAccountExtrinsics = async ( | ||
network: NetworkType, | ||
address: Address, | ||
after: string | null, | ||
orderBy = 'BLOCK_HEIGHT_DESC' | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
extrinsics( | ||
after: ${after} | ||
filter: {signer: {equalTo: "${address}"}} | ||
orderBy: ${orderBy} | ||
) { | ||
nodes { | ||
id | ||
module | ||
call | ||
blockHeight | ||
success | ||
timestamp | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
totalCount | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_DICT[network], query); | ||
}; |
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,148 +1,3 @@ | ||
import { API_CORETIME_DICT, API_CORETIME_INDEXER } from '@/consts'; | ||
import { Address, ApiResponse, NetworkType } from '@/models'; | ||
|
||
import { fetchGraphql } from '../utils/fetchGraphql'; | ||
|
||
export const fetchBurnInfo = async ( | ||
network: NetworkType | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
stats { | ||
nodes { | ||
id | ||
saleCycle | ||
totalBurn | ||
} | ||
} | ||
sales( | ||
orderBy: HEIGHT_DESC, | ||
first: 2 | ||
) { | ||
nodes { | ||
burn | ||
} | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_INDEXER[network], query); | ||
}; | ||
|
||
export const fetchPurchaseHistoryData = async ( | ||
network: NetworkType, | ||
regionBegin: number, | ||
after: string | null, | ||
orderBy = 'HEIGHT_DESC' | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
purchases( | ||
after: ${after} | ||
filter: {begin: {equalTo: ${regionBegin}}} | ||
orderBy: ${orderBy} | ||
) { | ||
nodes { | ||
account | ||
core | ||
extrinsicId | ||
height | ||
price | ||
purchaseType | ||
timestamp | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
totalCount | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_INDEXER[network], query); | ||
}; | ||
|
||
export const fetchSaleDetailsData = async ( | ||
network: NetworkType, | ||
saleCycle: number, | ||
after: string | null, | ||
orderBy = 'HEIGHT_DESC' | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
purchases( | ||
filter: {saleCycle: {equalTo: ${saleCycle}}} | ||
after: ${after ? `"${after}"` : null} | ||
orderBy: ${orderBy} | ||
) { | ||
nodes { | ||
account | ||
core | ||
extrinsicId | ||
height | ||
price | ||
purchaseType | ||
timestamp | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
totalCount | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_INDEXER[network], query); | ||
}; | ||
|
||
export const fetchSalesHistoryData = async ( | ||
network: NetworkType, | ||
after: string | null | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
sales( | ||
after: ${after}, | ||
orderBy: SALE_CYCLE_DESC | ||
) { | ||
nodes { | ||
saleCycle | ||
regionBegin | ||
regionEnd | ||
height | ||
saleEnd | ||
timestamp | ||
tsSaleEnd | ||
startPrice | ||
endPrice | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_INDEXER[network], query); | ||
}; | ||
|
||
export const fetchAccountExtrinsics = async ( | ||
network: NetworkType, | ||
address: Address, | ||
after: string | null, | ||
orderBy = 'BLOCK_HEIGHT_DESC' | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
extrinsics( | ||
after: ${after} | ||
filter: {signer: {equalTo: "${address}"}} | ||
orderBy: ${orderBy} | ||
) { | ||
nodes { | ||
id | ||
module | ||
call | ||
blockHeight | ||
success | ||
timestamp | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
totalCount | ||
} | ||
}`; | ||
return fetchGraphql(API_CORETIME_DICT[network], query); | ||
}; | ||
export * from './accounts'; | ||
export * from './orders'; | ||
export * from './sales'; |
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,77 @@ | ||
import { fetchGraphql } from '@/utils/fetchGraphql'; | ||
|
||
import { API_COCOS_INDEXER } from '@/consts'; | ||
import { Address, ApiResponse } from '@/models'; | ||
|
||
export const fetchContribution = async ( | ||
orderId: number, | ||
address: Address | undefined, | ||
after: string | null | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
orderContributions( | ||
after: ${after} | ||
filter: {orderId: {equalTo: ${orderId}}, account: {equalTo: "${address}"}} | ||
) { | ||
nodes { | ||
amount | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
}`; | ||
return fetchGraphql(API_COCOS_INDEXER, query); | ||
}; | ||
|
||
export const fetchOrders = async ( | ||
after: string | null | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
orders(after: ${after}) { | ||
nodes { | ||
orderId | ||
begin | ||
end | ||
creator | ||
exist | ||
coreOccupancy | ||
contribution | ||
paraId | ||
processed | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
}`; | ||
return fetchGraphql(API_COCOS_INDEXER, query); | ||
}; | ||
|
||
export const fetchProcessedOrders = async ( | ||
after: string | null, | ||
order = 'ORDER_ID_ASC' | ||
): Promise<ApiResponse> => { | ||
const query = `{ | ||
processedOrders(after: ${after}, orderBy: ${order}) { | ||
nodes { | ||
orderId | ||
height | ||
extrinsicId | ||
timestamp | ||
begin | ||
core | ||
mask | ||
seller | ||
reward | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
}`; | ||
return fetchGraphql(API_COCOS_INDEXER, query); | ||
}; |
Oops, something went wrong.