-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add contract signature examples (#1602)
- Loading branch information
1 parent
20b6575
commit e63b001
Showing
7 changed files
with
3,368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cache/ |
17 changes: 17 additions & 0 deletions
17
packages/hub-nodejs/examples/contract-signatures/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Working with EIP-712 signatures | ||
|
||
This example app demonstrates how to create and use EIP-712 signatures to sponsor onchain transactions on behalf of users. | ||
|
||
Every onchain action in the Farcaster protocol can be performed by a third party on behalf of the end user by collecting a typed signature and providing it to the Farcaster smart contracts. This makes it possible to pay gas and sponsor onchain transactions for your users without asking them to pay a fee or send a transaction from their wallet. | ||
|
||
The structured format of EIP-712 signatures makes them more secure for the end user and easier for wallets to parse, but they can be difficult to construct and work with as an application developer. This demo app shows how to call every signature based function in the Farcaster contracts, including registering an account, transferring an fid, and adding/removing signer keys. | ||
|
||
This example uses [Hardhat](https://hardhat.org/) to run a local node that simulates OP Mainnet, where the Farcaster contracts are deployed. | ||
|
||
### Run locally | ||
|
||
1. Clone the repo locally | ||
2. Navigate to this folder with `cd packages/hub-nodejs/examples/make-cast` | ||
3. Run `yarn install` to install dependencies | ||
4. Run `yarn chain:start` to start Hardhat | ||
5. Run `yarn start` |
11 changes: 11 additions & 0 deletions
11
packages/hub-nodejs/examples/contract-signatures/hardhat.config.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** @type import('hardhat/config').HardhatUserConfig */ | ||
module.exports = { | ||
networks: { | ||
hardhat: { | ||
chainId: 10, | ||
forking: { | ||
url: "https://mainnet.optimism.io", | ||
}, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.