-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Getter functions of SDK (#833)
* add data model for statistics data * add getter function for escrow and statistics * update gql queries for typescript and python sdk * fix storage client related issues
- Loading branch information
Showing
32 changed files
with
1,948 additions
and
285 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,64 @@ | ||
import datetime | ||
from web3 import Web3 | ||
|
||
from human_protocol_sdk.escrow import EscrowClient, EscrowFilter, Status | ||
from human_protocol_sdk.statistics import StatisticsClient, StatisticsParam | ||
|
||
if __name__ == "__main__": | ||
alchemy_url = ( | ||
"https://polygon-mumbai.g.alchemy.com/v2/lnog1fIT7pvL4_o3lkcosQ7PL08ed3nX" | ||
) | ||
w3 = Web3(Web3.HTTPProvider(alchemy_url)) | ||
|
||
escrow_client = EscrowClient(w3) | ||
|
||
print( | ||
escrow_client.get_escrows( | ||
EscrowFilter( | ||
status=Status.Pending, | ||
date_from=datetime.datetime(2023, 5, 8), | ||
date_to=datetime.datetime(2023, 6, 8), | ||
) | ||
) | ||
) | ||
|
||
statistics_client = StatisticsClient(w3) | ||
|
||
print(statistics_client.get_escrow_statistics()) | ||
print( | ||
statistics_client.get_escrow_statistics( | ||
StatisticsParam( | ||
date_from=datetime.datetime(2023, 5, 8), | ||
date_to=datetime.datetime(2023, 6, 8), | ||
) | ||
) | ||
) | ||
|
||
print(statistics_client.get_worker_statistics()) | ||
print( | ||
statistics_client.get_worker_statistics( | ||
StatisticsParam( | ||
date_from=datetime.datetime(2023, 5, 8), | ||
date_to=datetime.datetime(2023, 6, 8), | ||
) | ||
) | ||
) | ||
|
||
print(statistics_client.get_payment_statistics()) | ||
print( | ||
statistics_client.get_payment_statistics( | ||
StatisticsParam( | ||
date_from=datetime.datetime(2023, 5, 8), | ||
date_to=datetime.datetime(2023, 6, 8), | ||
) | ||
) | ||
) | ||
print(statistics_client.get_hmt_statistics()) | ||
print( | ||
statistics_client.get_hmt_statistics( | ||
StatisticsParam( | ||
date_from=datetime.datetime(2023, 5, 8), | ||
date_to=datetime.datetime(2023, 6, 8), | ||
) | ||
) | ||
) |
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
9 changes: 2 additions & 7 deletions
9
packages/sdk/python/human-protocol-sdk/human_protocol_sdk/encryption.py
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
Oops, something went wrong.
8e27a4b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
job-launcher-server – ./packages/apps/job-launcher/server
job-launcher-server-nine.vercel.app
job-launcher-server-humanprotocol.vercel.app
job-launcher-server-git-develop-humanprotocol.vercel.app