-
Notifications
You must be signed in to change notification settings - Fork 17
add graphql data provider for data query #1038
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
Merged
Merged
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
858110f
adjust docker tag for tee-dev
Kailai-Wang 6924130
Merge branch 'dev' into tee-dev
Kailai-Wang 2a3269b
Merge branch 'dev' into tee-dev
Kailai-Wang 6a38e62
use integritee/pallets master branch
Kailai-Wang 69a45a8
Merge remote-tracking branch 'origin/dev' into tee-dev
e22fc37
Merge remote-tracking branch 'origin/dev' into tee-dev
ce0c5c9
Merge branch 'dev' into tee-dev
Kailai-Wang 25e4b11
add teeracle to tee-dev
Kailai-Wang 848c967
Merge branch 'dev' into tee-dev
Kailai-Wang a5258b3
Merge remote-tracking branch 'origin/dev' into tee-dev
9d9fb38
Merge remote-tracking branch 'origin/dev' into tee-dev
0d1d828
switch to sdk-v0.9.0-polkadot-v0.9.26 as release branch
Kailai-Wang 79c9a25
Merge branch 'tee-dev' of github.com:litentry/litentry-parachain into…
a7d1c94
Merge remote-tracking branch 'origin/dev' into tee-dev
8b35b6f
add back the dummy method for testing purpose
c35e460
fix make clippy
3d3958d
Merge branch 'dev' into tee-dev
Kailai-Wang a81ccc6
small cleanup
Kailai-Wang 5902a19
add back teeracle
Kailai-Wang a8a2475
Merge branch 'dev' into tee-dev
Kailai-Wang 2a9cbb8
Merge branch 'dev' into tee-dev
Kailai-Wang d621d1d
use specific branch of tee-primitives (todo:revert it)
Kailai-Wang 3031343
correctify branch for tee-primitives
Kailai-Wang 0804daa
Merge branch 'dev' into tee-dev
Kailai-Wang 3740e49
temporarily use TEE pallets master branch
Kailai-Wang b3d10d2
add EnsureOrigin impl and tests
Kailai-Wang 3fd9578
its better to place it in runtime_common
Kailai-Wang f77fc8b
Merge branch '895-use-real-enclave-signer' into tee-dev
Kailai-Wang fd4d119
Merge branch 'dev' into tee-dev
Kailai-Wang 32766da
remove the dummy extrinsic (used for testing previous)
784cc04
rename ruleset -> assertion
c45e714
update renaming
fc63594
revert balance type
3049ef8
according to upstream, update pallets branch to 'develop'
968c4c3
fix build error
4890717
add rococo docker file
59b698f
Cherry-Pick: 47386434
Kailai-Wang c76adde
Update tee-dev branch into polkadot v0.9.29 (#971)
BillyWooo 469f769
add BUILDKIT explicitly
b6dda59
Merge tee worker repo (#987)
Kailai-Wang ae6d19b
add graphql data provider for data query
BillyWooo f85a91b
Switch to local dependencies (#1037)
Kailai-Wang c3e869e
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo 09784f1
Try to fix the docker image pushing (#1040)
Kailai-Wang 0b1d286
remove unneeded CI steps (#1049)
Kailai-Wang 5041960
tee-worker ts-tests (#1039)
0xverin 90f237b
add multiconfig for launch workers with local development / staging e…
BillyWooo 084dbf3
Ts tests (#1053)
0xverin 4435974
add comment
BillyWooo 1c6980e
Add more testcases for IMP mock (#1057)
Kailai-Wang c485920
982 renaming issue (#1052)
BillyWooo 18825b6
Merge branch 'tee-dev' into 1000_muti_config_to_launch_workers
4fd2ace
Merge branch 'tee-dev' into graphql_data_provider
jingleizhang 74965e6
Merge branch '1000_muti_config_to_launch_workers' of github.com:liten…
BillyWooo 8d833d4
move hardcode const to input parameter
BillyWooo e6f4808
make clippy happy
BillyWooo d4a9f58
link web3 and verify web3 (#1072)
0xverin b734572
Emit new challenge code for each `create_identity` (#1074)
Kailai-Wang 2574c9d
Merge branch 'tee-dev' into 1000_muti_config_to_launch_workers
jingleizhang cc55ce7
Return encrypted IDGraph when changed (#1080)
Kailai-Wang 0fb10bf
Merge remote-tracking branch 'origin/tee-dev' into 1000_muti_config_t…
BillyWooo d5ac04d
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo ead95ac
Tee worker polkadot v0.9.32 (#1093)
BillyWooo e578eea
Merge remote-tracking branch 'origin/dev' into tee-dev
BillyWooo 6305908
update tee worker ci
BillyWooo a3057c6
Merge remote-tracking branch 'origin/tee-dev' into 1000_muti_config_t…
BillyWooo 4269556
Merge remote-tracking branch 'origin/dev' into 1000_muti_config_to_la…
BillyWooo 5337481
refactor terminal parameter into json config file
BillyWooo ef81204
update dependency version
BillyWooo 0b563c4
Merge remote-tracking branch 'origin/tee-dev' into graphql_data_provider
BillyWooo 2a195c6
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo c68d91e
rm not used files
BillyWooo 87b931a
Merge branch '1000_muti_config_to_launch_workers' into graphql_data_p…
BillyWooo 6b55eba
cargo update & update global variable
BillyWooo 08d15bf
fix path
BillyWooo 89a3455
Merge branch '1000_muti_config_to_launch_workers' into graphql_data_p…
BillyWooo b4d8c88
refactor code with new graphql API example
BillyWooo e3b9555
Merge branch 'dev' into graphql_data_provider
BillyWooo dfc5456
merge assertion4 and assertion12: both query LIT; cleanup code;
BillyWooo c2a2ed9
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo 309fa79
Merge branch 'dev' into graphql_data_provider
jingleizhang 6b2f46c
Merge branch 'dev' into graphql_data_provider
Kailai-Wang 4067bb0
Merge branch 'dev' into graphql_data_provider
Kailai-Wang 7e87940
Merge remote-tracking branch 'origin/dev' into graphql_data_provider
BillyWooo ec5aa92
update based on PR comments
BillyWooo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,99 @@ | ||
| // Copyright 2020-2022 Litentry Technologies GmbH. | ||
| // This file is part of Litentry. | ||
| // | ||
| // Litentry is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // Litentry is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with Litentry. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| #[cfg(all(feature = "std", feature = "sgx"))] | ||
| compile_error!("feature \"std\" and feature \"sgx\" cannot be enabled at the same time"); | ||
|
|
||
| #[cfg(all(not(feature = "std"), feature = "sgx"))] | ||
| extern crate sgx_tstd as std; | ||
|
|
||
| use crate::{Error, Result}; | ||
| use std::{ | ||
| str::from_utf8, | ||
| string::{String, ToString}, | ||
| vec, | ||
| vec::Vec, | ||
| }; | ||
|
|
||
| use lc_stf_task_sender::MaxIdentityLength; | ||
| use litentry_primitives::{ | ||
| EvmNetwork, Identity, IdentityHandle, IdentityWebType, SubstrateNetwork, Web3Network, | ||
| }; | ||
| use sp_runtime::BoundedVec; | ||
|
|
||
| use lc_data_providers::graphql::{ | ||
| GraphQLClient, VerifiedCredentialsIsHodlerIn, VerifiedCredentialsNetwork, | ||
| }; | ||
|
|
||
| // ERC20 LIT token address | ||
| const LIT_TOKEN_ADDRESS: &str = "0xb59490aB09A0f526Cc7305822aC65f2Ab12f9723"; | ||
|
|
||
| pub fn build( | ||
| identities: BoundedVec<Identity, MaxIdentityLength>, | ||
| from_date: String, | ||
| min_balance: f64, | ||
| ) -> Result<()> { | ||
| let mut client = GraphQLClient::new(); | ||
|
|
||
| for identity in identities { | ||
| let mut network = VerifiedCredentialsNetwork::Polkadot; | ||
| if let IdentityWebType::Web3(web3_type) = identity.web_type { | ||
| match web3_type { | ||
| Web3Network::Substrate(SubstrateNetwork::Litentry) => | ||
| network = VerifiedCredentialsNetwork::Litentry, | ||
| Web3Network::Substrate(SubstrateNetwork::Litmus) => | ||
| network = VerifiedCredentialsNetwork::Litmus, | ||
| Web3Network::Evm(EvmNetwork::Ethereum) => | ||
| network = VerifiedCredentialsNetwork::Ethereum, | ||
| _ => (), | ||
| } | ||
| }; | ||
|
|
||
| if network == VerifiedCredentialsNetwork::Litentry | ||
| || network == VerifiedCredentialsNetwork::Litmus | ||
| || network == VerifiedCredentialsNetwork::Ethereum | ||
| { | ||
| let mut addresses: Vec<String> = vec![]; | ||
| match identity.handle { | ||
| IdentityHandle::Address20(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| IdentityHandle::Address32(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| IdentityHandle::String(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| } | ||
| let mut tmp_token_addr = String::from(""); | ||
| if network == VerifiedCredentialsNetwork::Ethereum { | ||
| tmp_token_addr = LIT_TOKEN_ADDRESS.to_string(); | ||
| } | ||
| let credentials = VerifiedCredentialsIsHodlerIn { | ||
| addresses, | ||
| from_date: from_date.clone(), | ||
| network, | ||
| token_address: tmp_token_addr, | ||
| min_balance, | ||
| }; | ||
| let is_hodler_out = client.check_verified_credentials_is_hodler(credentials); | ||
| if let Ok(_hodler_out) = is_hodler_out { | ||
BillyWooo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // TODO: generate VC | ||
|
|
||
| return Ok(()) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Err(Error::Assertion4Error("no valid response".to_string())) | ||
| } | ||
This file contains hidden or 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,78 @@ | ||
| // Copyright 2020-2022 Litentry Technologies GmbH. | ||
| // This file is part of Litentry. | ||
| // | ||
| // Litentry is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // Litentry is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with Litentry. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| #[cfg(all(feature = "std", feature = "sgx"))] | ||
| compile_error!("feature \"std\" and feature \"sgx\" cannot be enabled at the same time"); | ||
|
|
||
| #[cfg(all(not(feature = "std"), feature = "sgx"))] | ||
| extern crate sgx_tstd as std; | ||
|
|
||
| use crate::{Error, Result}; | ||
| use std::{ | ||
| str::from_utf8, | ||
| string::{String, ToString}, | ||
| vec, | ||
| vec::Vec, | ||
| }; | ||
|
|
||
| use lc_stf_task_sender::MaxIdentityLength; | ||
| use litentry_primitives::{ | ||
| Identity, IdentityHandle, IdentityWebType, SubstrateNetwork, Web3Network, | ||
| }; | ||
| use sp_runtime::BoundedVec; | ||
|
|
||
| use lc_data_providers::graphql::{ | ||
| GraphQLClient, VerifiedCredentialsIsHodlerIn, VerifiedCredentialsNetwork, | ||
| }; | ||
|
|
||
| pub fn build( | ||
| identities: BoundedVec<Identity, MaxIdentityLength>, | ||
| from_date: String, | ||
| min_balance: f64, | ||
| ) -> Result<()> { | ||
| let mut client = GraphQLClient::new(); | ||
|
|
||
| for identity in identities { | ||
| if let IdentityWebType::Web3(Web3Network::Substrate(SubstrateNetwork::Polkadot)) = | ||
| identity.web_type | ||
| { | ||
| let mut addresses: Vec<String> = vec![]; | ||
| match identity.handle { | ||
| IdentityHandle::Address20(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| IdentityHandle::Address32(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| IdentityHandle::String(addr) => | ||
| addresses.push(from_utf8(&addr).unwrap().to_string()), | ||
| } | ||
| let credentials = VerifiedCredentialsIsHodlerIn { | ||
| addresses, | ||
| from_date: from_date.clone(), | ||
| network: VerifiedCredentialsNetwork::Polkadot, | ||
| token_address: String::from(""), | ||
Kailai-Wang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| min_balance, | ||
| }; | ||
| let is_hodler_out = client.check_verified_credentials_is_hodler(credentials); | ||
| if let Ok(_hodler_out) = is_hodler_out { | ||
| // TODO: generate VC | ||
|
|
||
| return Ok(()) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Err(Error::Assertion7Error("no valid response".to_string())) | ||
| } | ||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.