pub struct AttestationDataBuilder {
pub recipient: Option<Address>,
pub expiration_time: Option<u64>,
pub revocable: bool,
pub ref_uid: Option<[u8; 32]>,
pub data: Option<Bytes>,
pub value: Option<U256>,
}
Fields§
§recipient: Option<Address>
§expiration_time: Option<u64>
§revocable: bool
§ref_uid: Option<[u8; 32]>
§data: Option<Bytes>
§value: Option<U256>
Implementations§
Source§impl AttestationDataBuilder
impl AttestationDataBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/schema.rs (line 40)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema = schema::SchemaBuilder::new()
22 .add("id", schema::Type::Address)
23 .add("voter_id", schema::Type::Address)
24 .add("vote_option", schema::Type::Int(32))
25 .build();
26
27 let tx = client.schema_registry.register(schema, None, true).await?;
28 let registered_schema = tx.await?;
29
30 println!("Schema ID: {:?}", registered_schema.schema_uid);
31
32 let naming_schema =
33 H256::from_str("0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc")?;
34
35 let data = &[
36 Token::FixedBytes(registered_schema.schema_uid.as_bytes().into()),
37 Token::String("enter schema name here".to_string()),
38 ];
39
40 let attestation_data = AttestationDataBuilder::new()
41 .revocable(true)
42 .data(data)
43 .build();
44
45 let attested = client.eas.attest(&naming_schema, attestation_data).await?;
46 let attested = attested.await?;
47
48 println!("Attestation ID: {:?}", attested);
49
50 Ok(())
51}
More examples
examples/attestation.rs (line 24)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema_id =
22 H256::from_str("0x0cf8b15034904dc56810da6237d220c345693077c4d42c53c45263649ed3b585")?;
23
24 let attestation_request = AttestationDataBuilder::new()
25 .revocable(true)
26 .data(&[
27 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
28 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
29 Token::Int(11.into()),
30 ])
31 .build();
32
33 // attest sends a transaction and returns a PendingTx that can be awaited
34 let tx = client.eas.attest(&schema_id, attestation_request).await?;
35 let attested = tx.await?;
36
37 println!("Attestation ID: {:?}", attested);
38
39 // timestamp send a transaction and returns a PendingTx that can be awaited
40 let tx = client.eas.timestamp(attested.uid).await?;
41 let timestamped = tx.await?;
42
43 println!("Timestamped: {:?}", timestamped);
44
45 // revoke send a transaction and returns a PendingTx that can be awaited
46 let revoked = client
47 .eas
48 .revoke(attested.schema, attested.uid, U256::default())
49 .await?;
50
51 let revoked = revoked.await?;
52
53 println!("Revoked: {:?}", revoked);
54
55 Ok(())
56}
pub fn recipient(self, recipient: Address) -> Self
pub fn expiration_time(self, expiration_time: u64) -> Self
Sourcepub fn revocable(self, revocable: bool) -> Self
pub fn revocable(self, revocable: bool) -> Self
Examples found in repository?
examples/schema.rs (line 41)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema = schema::SchemaBuilder::new()
22 .add("id", schema::Type::Address)
23 .add("voter_id", schema::Type::Address)
24 .add("vote_option", schema::Type::Int(32))
25 .build();
26
27 let tx = client.schema_registry.register(schema, None, true).await?;
28 let registered_schema = tx.await?;
29
30 println!("Schema ID: {:?}", registered_schema.schema_uid);
31
32 let naming_schema =
33 H256::from_str("0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc")?;
34
35 let data = &[
36 Token::FixedBytes(registered_schema.schema_uid.as_bytes().into()),
37 Token::String("enter schema name here".to_string()),
38 ];
39
40 let attestation_data = AttestationDataBuilder::new()
41 .revocable(true)
42 .data(data)
43 .build();
44
45 let attested = client.eas.attest(&naming_schema, attestation_data).await?;
46 let attested = attested.await?;
47
48 println!("Attestation ID: {:?}", attested);
49
50 Ok(())
51}
More examples
examples/attestation.rs (line 25)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema_id =
22 H256::from_str("0x0cf8b15034904dc56810da6237d220c345693077c4d42c53c45263649ed3b585")?;
23
24 let attestation_request = AttestationDataBuilder::new()
25 .revocable(true)
26 .data(&[
27 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
28 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
29 Token::Int(11.into()),
30 ])
31 .build();
32
33 // attest sends a transaction and returns a PendingTx that can be awaited
34 let tx = client.eas.attest(&schema_id, attestation_request).await?;
35 let attested = tx.await?;
36
37 println!("Attestation ID: {:?}", attested);
38
39 // timestamp send a transaction and returns a PendingTx that can be awaited
40 let tx = client.eas.timestamp(attested.uid).await?;
41 let timestamped = tx.await?;
42
43 println!("Timestamped: {:?}", timestamped);
44
45 // revoke send a transaction and returns a PendingTx that can be awaited
46 let revoked = client
47 .eas
48 .revoke(attested.schema, attested.uid, U256::default())
49 .await?;
50
51 let revoked = revoked.await?;
52
53 println!("Revoked: {:?}", revoked);
54
55 Ok(())
56}
pub fn ref_uid(self, ref_uid: [u8; 32]) -> Self
Sourcepub fn data(self, data: &[Token]) -> Self
pub fn data(self, data: &[Token]) -> Self
Examples found in repository?
examples/schema.rs (line 42)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema = schema::SchemaBuilder::new()
22 .add("id", schema::Type::Address)
23 .add("voter_id", schema::Type::Address)
24 .add("vote_option", schema::Type::Int(32))
25 .build();
26
27 let tx = client.schema_registry.register(schema, None, true).await?;
28 let registered_schema = tx.await?;
29
30 println!("Schema ID: {:?}", registered_schema.schema_uid);
31
32 let naming_schema =
33 H256::from_str("0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc")?;
34
35 let data = &[
36 Token::FixedBytes(registered_schema.schema_uid.as_bytes().into()),
37 Token::String("enter schema name here".to_string()),
38 ];
39
40 let attestation_data = AttestationDataBuilder::new()
41 .revocable(true)
42 .data(data)
43 .build();
44
45 let attested = client.eas.attest(&naming_schema, attestation_data).await?;
46 let attested = attested.await?;
47
48 println!("Attestation ID: {:?}", attested);
49
50 Ok(())
51}
More examples
examples/attestation.rs (lines 26-30)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema_id =
22 H256::from_str("0x0cf8b15034904dc56810da6237d220c345693077c4d42c53c45263649ed3b585")?;
23
24 let attestation_request = AttestationDataBuilder::new()
25 .revocable(true)
26 .data(&[
27 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
28 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
29 Token::Int(11.into()),
30 ])
31 .build();
32
33 // attest sends a transaction and returns a PendingTx that can be awaited
34 let tx = client.eas.attest(&schema_id, attestation_request).await?;
35 let attested = tx.await?;
36
37 println!("Attestation ID: {:?}", attested);
38
39 // timestamp send a transaction and returns a PendingTx that can be awaited
40 let tx = client.eas.timestamp(attested.uid).await?;
41 let timestamped = tx.await?;
42
43 println!("Timestamped: {:?}", timestamped);
44
45 // revoke send a transaction and returns a PendingTx that can be awaited
46 let revoked = client
47 .eas
48 .revoke(attested.schema, attested.uid, U256::default())
49 .await?;
50
51 let revoked = revoked.await?;
52
53 println!("Revoked: {:?}", revoked);
54
55 Ok(())
56}
pub fn value(self, value: U256) -> Self
Sourcepub fn build(self) -> AttestationData
pub fn build(self) -> AttestationData
Examples found in repository?
examples/schema.rs (line 43)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema = schema::SchemaBuilder::new()
22 .add("id", schema::Type::Address)
23 .add("voter_id", schema::Type::Address)
24 .add("vote_option", schema::Type::Int(32))
25 .build();
26
27 let tx = client.schema_registry.register(schema, None, true).await?;
28 let registered_schema = tx.await?;
29
30 println!("Schema ID: {:?}", registered_schema.schema_uid);
31
32 let naming_schema =
33 H256::from_str("0x44d562ac1d7cd77e232978687fea027ace48f719cf1d58c7888e509663bb87fc")?;
34
35 let data = &[
36 Token::FixedBytes(registered_schema.schema_uid.as_bytes().into()),
37 Token::String("enter schema name here".to_string()),
38 ];
39
40 let attestation_data = AttestationDataBuilder::new()
41 .revocable(true)
42 .data(data)
43 .build();
44
45 let attested = client.eas.attest(&naming_schema, attestation_data).await?;
46 let attested = attested.await?;
47
48 println!("Attestation ID: {:?}", attested);
49
50 Ok(())
51}
More examples
examples/attestation.rs (line 31)
15async fn main() -> Result<(), Box<dyn Error>> {
16 let singing_key = &hex::decode(SEPOLIA_PRIVATE_KEY_HEX)?;
17 let signing_key = SigningKey::from_slice(singing_key)?;
18 let contract_address = H160::from_str(SEPOLIA_CONTRACT_ADDRESS)?;
19 let client = client::Client::new(SEPOLIA_ENDPOINT, contract_address, None, signing_key).await?;
20
21 let schema_id =
22 H256::from_str("0x0cf8b15034904dc56810da6237d220c345693077c4d42c53c45263649ed3b585")?;
23
24 let attestation_request = AttestationDataBuilder::new()
25 .revocable(true)
26 .data(&[
27 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
28 Token::Address(H160::from_low_u64_be(0x1234567890abcdef)),
29 Token::Int(11.into()),
30 ])
31 .build();
32
33 // attest sends a transaction and returns a PendingTx that can be awaited
34 let tx = client.eas.attest(&schema_id, attestation_request).await?;
35 let attested = tx.await?;
36
37 println!("Attestation ID: {:?}", attested);
38
39 // timestamp send a transaction and returns a PendingTx that can be awaited
40 let tx = client.eas.timestamp(attested.uid).await?;
41 let timestamped = tx.await?;
42
43 println!("Timestamped: {:?}", timestamped);
44
45 // revoke send a transaction and returns a PendingTx that can be awaited
46 let revoked = client
47 .eas
48 .revoke(attested.schema, attested.uid, U256::default())
49 .await?;
50
51 let revoked = revoked.await?;
52
53 println!("Revoked: {:?}", revoked);
54
55 Ok(())
56}
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AttestationDataBuilder
impl RefUnwindSafe for AttestationDataBuilder
impl Send for AttestationDataBuilder
impl Sync for AttestationDataBuilder
impl Unpin for AttestationDataBuilder
impl UnwindSafe for AttestationDataBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.