-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sdkcore updates new fields and entities changes (#837)
* Revert "Revert "Sdkcore updates new fields and entities changes (#834)" (#836)" This reverts commit f8cb3ec. * require test-subgraph-on-previous-sdk-versions add test-subgraph-on-previous-sdk-versions to needs before publish-npm-packages job is run * remove test-subgraph-on-previous-sdk-versions job from ci.canary Co-authored-by: 0xdavinchee <0xdavinchee@gmail.com>
- Loading branch information
1 parent
6bb1513
commit d9c12aa
Showing
7 changed files
with
570 additions
and
11 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
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
90 changes: 90 additions & 0 deletions
90
packages/sdk-core/src/subgraph/entities/accountTokenSnapshotLog/accountTokenSnapshotLog.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,90 @@ | ||
import { | ||
Address, | ||
BigNumber, | ||
BlockNumber, | ||
SubgraphId, | ||
Timestamp, | ||
} from "../../mappedSubgraphTypes"; | ||
import { | ||
AccountTokenSnapshotLog_Filter, | ||
AccountTokenSnapshotLog_OrderBy, | ||
} from "../../schema.generated"; | ||
import { | ||
RelevantAddressesIntermediate, | ||
SubgraphListQuery, | ||
SubgraphQueryHandler, | ||
} from "../../subgraphQueryHandler"; | ||
|
||
import { | ||
AccountTokenSnapshotLogsDocument, | ||
AccountTokenSnapshotLogsQuery, | ||
AccountTokenSnapshotLogsQueryVariables, | ||
} from "./accountTokenSnapshotLogs.generated"; | ||
|
||
export interface AccountTokenSnapshotLog { | ||
id: SubgraphId; | ||
transactionHash: string; | ||
order: number; | ||
logIndex: number; | ||
timestamp: Timestamp; | ||
blockNumber: BlockNumber; | ||
balance: BigNumber; | ||
maybeCriticalAtTimestamp: BigNumber; | ||
totalAmountStreamed: BigNumber; | ||
totalAmountTransferred: BigNumber; | ||
totalApprovedSubscriptions: number; | ||
totalDeposit: BigNumber; | ||
totalInflowRate: BigNumber; | ||
totalNetFlowRate: BigNumber; | ||
totalNumberOfActiveStreams: number; | ||
totalNumberOfClosedStreams: number; | ||
totalSubscriptionsWithUnits: number; | ||
totalOutflowRate: BigNumber; | ||
triggeredByEventName: string; | ||
account: Address; | ||
token: Address; | ||
tokenSymbol: string; | ||
} | ||
|
||
export type AccountTokenSnapshotLogListQuery = SubgraphListQuery< | ||
AccountTokenSnapshotLog_Filter, | ||
AccountTokenSnapshotLog_OrderBy | ||
>; | ||
|
||
export class AccountTokenSnapshotLogQueryHandler extends SubgraphQueryHandler< | ||
AccountTokenSnapshotLog, | ||
AccountTokenSnapshotLogListQuery, | ||
AccountTokenSnapshotLogsQuery, | ||
AccountTokenSnapshotLogsQueryVariables | ||
> { | ||
getAddressFieldKeysFromFilter = (): { | ||
accountKeys: (keyof AccountTokenSnapshotLog_Filter)[]; | ||
tokenKeys: (keyof AccountTokenSnapshotLog_Filter)[]; | ||
} => ({ | ||
accountKeys: ["account"], | ||
tokenKeys: ["token"], | ||
}); | ||
|
||
getRelevantAddressesFromResultCore = ( | ||
result: AccountTokenSnapshotLog | ||
): RelevantAddressesIntermediate => ({ | ||
tokens: [result.token], | ||
accounts: [result.account], | ||
}); | ||
|
||
mapFromSubgraphResponse = ( | ||
response: AccountTokenSnapshotLogsQuery | ||
): AccountTokenSnapshotLog[] => | ||
response.accountTokenSnapshotLogs.map((x) => ({ | ||
...x, | ||
account: x.account.id, | ||
token: x.token.id, | ||
tokenSymbol: x.token.symbol, | ||
blockNumber: Number(x.blockNumber), | ||
timestamp: Number(x.timestamp), | ||
order: Number(x.order), | ||
logIndex: Number(x.logIndex), | ||
})); | ||
|
||
requestDocument = AccountTokenSnapshotLogsDocument; | ||
} |
37 changes: 37 additions & 0 deletions
37
...s/sdk-core/src/subgraph/entities/accountTokenSnapshotLog/accountTokenSnapshotLogs.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,37 @@ | ||
query accountTokenSnapshotLogs($first: Int = 10, $skip: Int = 0, $orderBy: AccountTokenSnapshotLog_orderBy = id, $orderDirection: OrderDirection = asc, $where: AccountTokenSnapshotLog_filter = {}, $block: Block_height) { | ||
accountTokenSnapshotLogs( | ||
first: $first | ||
skip: $skip | ||
orderBy: $orderBy | ||
orderDirection: $orderDirection | ||
where: $where | ||
block: $block | ||
) { | ||
id | ||
order | ||
logIndex | ||
timestamp | ||
blockNumber | ||
balance | ||
maybeCriticalAtTimestamp | ||
totalAmountStreamed | ||
totalAmountTransferred | ||
totalApprovedSubscriptions | ||
totalDeposit | ||
totalInflowRate | ||
totalNetFlowRate | ||
totalNumberOfActiveStreams | ||
totalNumberOfClosedStreams | ||
totalSubscriptionsWithUnits | ||
totalOutflowRate | ||
transactionHash | ||
triggeredByEventName | ||
account { | ||
id | ||
} | ||
token { | ||
id | ||
symbol | ||
} | ||
} | ||
} |
Oops, something went wrong.