Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
Wazzymandias committed Feb 1, 2024
1 parent 2f67f6b commit 0b5b0a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
9 changes: 9 additions & 0 deletions .changeset/itchy-llamas-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@farcaster/hub-nodejs": minor
"@farcaster/hub-web": minor
"@farcaster/replicator": minor
"@farcaster/core": minor
"@farcaster/hubble": minor
---

Add Solana verification support
20 changes: 9 additions & 11 deletions apps/hubble/src/rpc/test/verificationService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,28 @@ describe("getVerification", () => {
await engine.mergeOnChainEvent(storageEvent);
});

test.only("solana-succeeds", async () => {
const r = await engine.mergeMessage(solVerificationAdd);
expect(r.isOk()).toBeTruthy();
test.only("succeeds", async () => {
const solanaMerge = await engine.mergeMessage(solVerificationAdd);
expect(solanaMerge.isOk()).toBeTruthy();

const result = await client.getVerification(
const solanaResult = await client.getVerification(
VerificationRequest.create({
fid,
address: solVerificationAdd.data.verificationAddAddressBody.address ?? new Uint8Array(),
}),
);
expect(Message.toJSON(result._unsafeUnwrap())).toEqual(Message.toJSON(solVerificationAdd));
});
expect(Message.toJSON(solanaResult._unsafeUnwrap())).toEqual(Message.toJSON(solVerificationAdd));

test("ethereum-succeeds", async () => {
const r = await engine.mergeMessage(ethVerificationAdd);
expect(r.isOk()).toBeTruthy();
const ethereumMerge = await engine.mergeMessage(ethVerificationAdd);
expect(ethereumMerge.isOk()).toBeTruthy();

const result = await client.getVerification(
const ethereumResult = await client.getVerification(
VerificationRequest.create({
fid,
address: ethVerificationAdd.data.verificationAddAddressBody.address ?? new Uint8Array(),
}),
);
expect(Message.toJSON(result._unsafeUnwrap())).toEqual(Message.toJSON(ethVerificationAdd));
expect(Message.toJSON(ethereumResult._unsafeUnwrap())).toEqual(Message.toJSON(ethVerificationAdd));
});

test("solana fails if verification is missing", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ export const validateVerificationAddSolAddressBody = (
}

if (body.addressVerificationSignature.length !== 64) {
return err(new HubError("bad_request.validation_failure", "addressVerificationSignature > 256 bytes"));
return err(new HubError("bad_request.validation_failure", "addressVerificationSignature != 64 bytes"));

Check warning on line 713 in packages/core/src/validations.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/validations.ts#L713

Added line #L713 was not covered by tests
}

return ok(body);

Check warning on line 716 in packages/core/src/validations.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/validations.ts#L716

Added line #L716 was not covered by tests
Expand Down

0 comments on commit 0b5b0a5

Please sign in to comment.