File tree Expand file tree Collapse file tree 4 files changed +274
-61
lines changed Expand file tree Collapse file tree 4 files changed +274
-61
lines changed Original file line number Diff line number Diff line change 66
77/coverage /lcov-report
88/coverage /coverage-summary.json
9- /coverage /lcov.info
9+ /coverage /lcov.info
10+ ** /* .DS_Store
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ export class LightBridgeGraphQLService extends GraphQLService {
2121 toBlock ?: string | number ,
2222 minDepositId ?: string | number ,
2323 contract ?: string ,
24+ orderBy ?: string ,
25+ orderDirection ?: 'asc' | 'desc' ,
26+ first ?: number
2427 ) : Promise < LightBridgeAssetReceivedEvent [ ] > {
2528 // contract: in the graph it is case insensitive and nocase only exists in Goldsky
2629 const query = gql ( `query Teleportation(
@@ -42,6 +45,9 @@ export class LightBridgeGraphQLService extends GraphQLService {
4245 ${ targetChainId ? `{ toChainId: $targetChainId },` : '' }
4346 ${ contract ? `{ contract: $contract }` : '' }
4447 ]}
48+ ${ orderBy ? `orderBy: ${ orderBy } ` : '' }
49+ ${ orderDirection ? `orderDirection: ${ orderDirection } ` : '' }
50+ ${ first ? `first: ${ first } ` : '' }
4551 ) {
4652 token
4753 sourceChainId
Original file line number Diff line number Diff line change 11import { lightBridgeGraphQLService } from "../../src" ;
22
33describe ( 'LightBridge Integration Test' , function ( ) {
4+ it ( 'should query AssetReceivedEvent with sorting parameters' , async ( ) => {
5+ const res = await lightBridgeGraphQLService . queryAssetReceivedEvent (
6+ 288 ,
7+ null ,
8+ null ,
9+ null ,
10+ null ,
11+ null ,
12+ null ,
13+ 'depositId' ,
14+ 'asc' ,
15+ 100
16+ ) ;
17+
18+ expect ( res [ 0 ] . block_number ) . toBeDefined ( ) ;
19+ expect ( res [ 0 ] . token ) . toBeDefined ( ) ;
20+ expect ( res [ 0 ] . sourceChainId ) . toBeDefined ( ) ;
21+ expect ( res [ 0 ] . toChainId ) . toBeDefined ( ) ;
22+ expect ( res [ 0 ] . depositId ) . toBeDefined ( ) ;
23+ expect ( res [ 0 ] . emitter ) . toBeDefined ( ) ;
24+ expect ( res [ 0 ] . amount ) . toBeDefined ( ) ;
25+ expect ( res [ 0 ] . transactionHash_ ) . toBeDefined ( ) ;
26+ expect ( res [ 0 ] . block_number ) . toBeDefined ( ) ;
27+ expect ( res [ 0 ] . timestamp_ ) . toBeDefined ( ) ;
28+
29+ expect ( res . length ) . toBeLessThanOrEqual ( 100 ) ;
30+
31+ if ( res . length > 1 ) {
32+ expect ( Number ( res [ 0 ] . depositId ) ) . toBeLessThanOrEqual ( Number ( res [ 1 ] . depositId ) ) ;
33+ }
34+ } ) ;
435 it ( 'should query AssetReceivedEvent' , async ( ) => {
536 const res = await lightBridgeGraphQLService . queryAssetReceivedEvent ( 288 ) ;
637 expect ( res [ 0 ] . block_number ) . toBeDefined ( ) ;
You can’t perform that action at this time.
0 commit comments