Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function useCreateAttestation() {
);
}
isBusyRef.current = true;
// Convert strings to bytes32
// Convert strings to bytes
const badgeNameBytes = stringToBytes32(badgeName);
const justificationBytes = stringToBytes(justification);

Expand Down
10 changes: 5 additions & 5 deletions the-guild-smart-contracts/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This guide shows how to create on-chain attestations of TheGuild badges from a frontend using the EAS SDK, following the schema described in `README.md`.

- Schema: `bytes32 badgeName, bytes32 justification`
- Schema: `bytes32 badgeName, bytes justification`
- Hardcoded schema id for now: set `SCHEMA_ID` to a placeholder and replace later

References:
Expand Down Expand Up @@ -34,7 +34,7 @@ export const SCHEMA_ID =
import { SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';

export const schemaEncoder = new SchemaEncoder(
'bytes32 badgeName, bytes32 justification'
'bytes32 badgeName, bytes justification'
);

export function encodeBadgeData(
Expand All @@ -43,7 +43,7 @@ export function encodeBadgeData(
) {
return schemaEncoder.encodeData([
{ name: 'badgeName', value: badgeName, type: 'bytes32' },
{ name: 'justification', value: justification, type: 'bytes32' },
{ name: 'justification', value: justification, type: 'bytes' },
]);
}
```
Expand Down Expand Up @@ -198,8 +198,8 @@ export async function getAttestation(uid: `0x${string}`) {
## Tips

- Replace `SCHEMA_ID` with the actual schema id you register in EAS.
- Keep the schema definition exactly as specified: `bytes32 badgeName, bytes32 justification`.
- If you prefer using viems clients directly, you can still obtain an `ethers` Signer (as shown) solely for interacting with EAS SDK per its docs.
- Keep the schema definition exactly as specified: `bytes32 badgeName, bytes justification`.
- If you prefer using viem's clients directly, you can still obtain an `ethers` Signer (as shown) solely for interacting with EAS SDK per its docs.

Links: [EAS SDK attestations](https://docs.attest.org/docs/developer-tools/eas-sdk#creating-onchain-attestations), [EAS + wagmi](https://docs.attest.org/docs/developer-tools/sdk-wagmi)

Expand Down
2 changes: 1 addition & 1 deletion the-guild-smart-contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Community members can vote on badge relevancy to filter spam and promote the mos
### Attestations
Then, we let users create an attestation of a badge to another user. The attestation can contain an optional justification (link to a project, or text explanation).

To do this, we can just use EAS' already deployed contracts. First we will register our schema (using their sdk or their UI): "bytes32 badgeName, bytes32 justification". Then, in the front end, we can use their sdk to create attestation from one user to another, referencing our schema id, the unique badge name, and a justification. We can also use EAS Resolver contract to prevent duplicate badges and reward attestations with Activity Token.
To do this, we can just use EAS' already deployed contracts. First we will register our schema (using their sdk or their UI): "bytes32 badgeName, bytes justification". Then, in the front end, we can use their sdk to create attestation from one user to another, referencing our schema id, the unique badge name, and a justification. We can also use EAS Resolver contract to prevent duplicate badges and reward attestations with Activity Token.

### Integration
For detailed frontend integration instructions, see [INTEGRATION.md](./INTEGRATION.md).
Expand Down
Loading