Want peanut links that dont look like peanut links? Totally possible!
We are an open, permissionless protocol!
If you wish to create a claim link with a custom domain (e.g. walnut.xyz/claim), follow the steps below:
1. Setting the Base URL
To specify your custom domain: pass in a
baseUrl
to the SDK's createLink
function within linkDetails
. The baseUrl
will be the base URL of the claim link. For example, if you want to use the domain walnut.xyz
, pass in https://www.walnut.xyz
as the baseUrl
.If you pass in
walnut.xyz
as your baseUrl
, the generated link will be in the format walnut.xyz?c=1...
instead of walnut.xyz/claim?c=1...
. We recommend adding a subpage (e.g., /claim
) after your baseUrl
to make the link more intuitive, but this step is optional.2. Updating the App
For React Native, iOS or Androids, see below:
iOS:
- Open your project in Xcode.
- Navigate to the "Associated Domains" section.
- Add your new base URL to the list of associated domains.
Android:
- Open your
androidManifest.xml
file.
- Add your new base URL to the appropriate section.
- Create new intent filters associated with the base URL.
apple-app-site-association (AASA) and assetLinks.json files:
The
AASA
and assetLinks.json
files do not require updates since the androidManifest
and the associated domains in Xcode have already been updated. You do, however, need to serve them on your custom domain (e.g walnut.xyz) if you want other mobile apps to resolve your domain. If you decide to use the files we provide, all mobile apps registered with Peanut Protocol will be able to resolve your links.Follow these steps to fetch the two files dynamically from the peanut api:
- Fetch the AASA and
assetLinks.json
file from the Peanut API to serve them dynamically to the corresponding URL.
- Make an API call to https://api.peanut.to/assetLinks.json and https://api.peanut.to/apple-app-site-association to retrieve these files.
For UI implementation examples, refer to the Peanut UI repository at https://github.com/peanutprotocol/peanut-ui.
3. Setting Up a Fallback Website
If a user clicks on your custom link but hasn't installed your app, you should provide a fallback web page. This ensures the user can still claim their link or receive necessary information.
For a seamless experience, you can embed the
peanut-claim-component
on your fallback site. Refer to the documentation on embedding an iframe for step-by-step instructions.