Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add change custody example #2506

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

horsefacts
Copy link
Contributor

@horsefacts horsefacts commented Jan 28, 2025

Why is this change needed?

Describe why this issue should be fixed and link to any relevant design docs, issues or other relevant items.

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review


PR-Codex overview

This PR introduces an example application for changing custody addresses in a blockchain context, utilizing hardhat for Ethereum development. It includes configuration files, TypeScript setup, and a README for local execution.

Detailed summary

  • Added .gitignore to exclude cache/.
  • Created hardhat.config.cjs for network configuration.
  • Introduced tsconfig.json for TypeScript compiler options.
  • Updated README.md with instructions on changing custody addresses.
  • Created package.json with dependencies and scripts for starting the app.
  • Implemented index.ts with functions for generating transfer signatures and simulating transfers.
  • Added yarn.lock to lock dependencies.

The following files were skipped due to too many changes: packages/hub-nodejs/examples/change-custody/yarn.lock

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Jan 28, 2025

⚠️ No Changeset found

Latest commit: efdd7a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 28, 2025 7:13pm

Copy link

@stas stas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for putting this together.

Left some minor suggestions on how to run this easier.


1. Clone the repo locally
2. Navigate to this folder with `cd packages/hub-nodejs/examples/change-custody`
3. Run `yarn install` to install dependencies
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Run `yarn install` to install dependencies
3. Edit the `index.ts` mnemonics
4. Start a Docker container `docker run --rm -v "$(pwd):/app" -w /app -it farcasterxyz/hubble bash`

1. Clone the repo locally
2. Navigate to this folder with `cd packages/hub-nodejs/examples/change-custody`
3. Run `yarn install` to install dependencies
4. Run `yarn start`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. Run `yarn start`
5. Run `yarn start`


const nonce = await readNonce(newAccount.address);
const deadline = getDeadline();
const newRecovery = WARPCAST_RECOVERY_PROXY;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const newRecovery = WARPCAST_RECOVERY_PROXY;
const newRecovery = WARPCAST_RECOVERY_PROXY;
const fid = await publicClient.readContract({
address: ID_REGISTRY_ADDRESS,
abi: idRegistryABI,
chain: optimism,
functionName: "idOf",
args: [oldAccount.address],
});

...ID_REGISTRY_EIP_712_TYPES,
primaryType: "TransferAndChangeRecovery",
message: {
fid: 864711n,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fid: 864711n,
fid,

});

// Uncomment if simulation succeeds to execute transfer.
// console.log("Sending transfer from old account to new account.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// console.log("Sending transfer from old account to new account.");
// console.log(`Transferring fid#${fid} from ${oldAccount.address} to ${newAccount.address}...`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants