Skip to content

Commit 74bf278

Browse files
tusharshah21joelamouche
authored andcommitted
feat: change attestation justification from bytes32 to bytes for unlimited length
1 parent c245ad5 commit 74bf278

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

frontend/src/hooks/attestations/use-create-attestation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function useCreateAttestation() {
6969
);
7070
}
7171
isBusyRef.current = true;
72-
// Convert strings to bytes32
72+
// Convert strings to bytes
7373
const badgeNameBytes = stringToBytes32(badgeName);
7474
const justificationBytes = stringToBytes(justification);
7575

the-guild-smart-contracts/INTEGRATION.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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`.
44

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

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

3636
export const schemaEncoder = new SchemaEncoder(
37-
'bytes32 badgeName, bytes32 justification'
37+
'bytes32 badgeName, bytes justification'
3838
);
3939

4040
export function encodeBadgeData(
@@ -43,7 +43,7 @@ export function encodeBadgeData(
4343
) {
4444
return schemaEncoder.encodeData([
4545
{ name: 'badgeName', value: badgeName, type: 'bytes32' },
46-
{ name: 'justification', value: justification, type: 'bytes32' },
46+
{ name: 'justification', value: justification, type: 'bytes' },
4747
]);
4848
}
4949
```
@@ -198,8 +198,8 @@ export async function getAttestation(uid: `0x${string}`) {
198198
## Tips
199199

200200
- Replace `SCHEMA_ID` with the actual schema id you register in EAS.
201-
- Keep the schema definition exactly as specified: `bytes32 badgeName, bytes32 justification`.
202-
- 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.
201+
- Keep the schema definition exactly as specified: `bytes32 badgeName, bytes justification`.
202+
- 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.
203203

204204
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)
205205

the-guild-smart-contracts/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Community members can vote on badge relevancy to filter spam and promote the mos
1313
### Attestations
1414
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).
1515

16-
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.
16+
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.
1717

1818
### Integration
1919
For detailed frontend integration instructions, see [INTEGRATION.md](./INTEGRATION.md).

0 commit comments

Comments
 (0)