- Notifications
You must be signed in to change notification settings - Fork0
Rust utilities for the ethereum attestation service.
License
NotificationsYou must be signed in to change notification settings
brech1/eas-rs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Rust utilities for the ethereum attestation service.
eas-contracts
: Foundry generated bindings for the current version of the EAS contracts.src
: EAS-RS library.
Add this to your crate dependencies:
eas-rs = { git = "https://github.com/brech1/eas-rs" }
Then you can import:
use eas::{ eas::*, eas_contracts::{ eas::AttestedFilter, value_resolver::{Attestation,AttestationRequest,AttestationRequestData},}, schema_registry::SchemaRegistryContract,};
You should then instantiate a local signer with a wallet:
let wallet =MnemonicBuilder::<English>::default().phrase(mnemonic).build();let signer =SignerMiddleware::new(provider, wallet.with_chain_id(CHAIN_ID));
You can then attest:
let eas =Eas::new( signer.clone(),Some(Address::from_str(EAS_CONTRACT_ADDRESS).unwrap()),);let att_data:Bytes =Bytes::from(data_bytes);let att_object =AttestationRequestData{recipient:Address::zero(),expiration_time:0,revocable:false,ref_uid:[0u8;32],data: att_data,value:U256::zero(),};let att =AttestationRequest{schema:SCHEMA_ID,data: att_object,};eas.attest(att).await.unwrap();
Keep in mind the above snippets are just illustrative, for a full implementation you should check outthis example project which includes:
- Deploying on a local testnet.
- Submitting schema.
- Attesting.
- Fetching attestations with filter.
Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.