A package to retrieve the passport address with specified namespace + identifier and activate Passports within a Domain.
To install the package, run the following command:
npm install @underdog-protocol/passport
or with Yarn:
yarn add @underdog-protocol/passport
Basic examples of how to use the @underdog-protocol/passport
package
import { getPassportAddress } from "@underdog-protocol/passport";
const seeds = {
identifier: "your@email.com", // required
namespace: "underdog", // optional
};
const address = getPassportAddress(seeds);
console.log(address);
import { Keypair, Transaction } from "@solana/web3.js";
import { activatePassportInstruction } from "@underdog-protocol/passport";
const seeds = {
identifier: "your@email.com", // required
namespace: "underdog", // optional
};
// Keypair for your Domain authority
const domainAuthority = Keypair.generate();
// User's wallet needs to sign the transaction
const passportAuthority = Keypair.generate();
const instruction = activatePassportInstruction(
seeds,
domainAuthority.publicKey,
passportAuthority.publicKey
);
new Transaction().add(instruction);
seeds
: An object containing the following properties:identifier
(required): The identifier for the passport address (i.e. email, Reddit username, Twitter handle).namespace
(optional): The namespace for the address (e.g. Solarplex, Sporting, Sphere). It can default to process.env.NEXT_PUBLIC_NAMESPACE for Next.js projects, process.env.NAMESPACE, or you can override it each time. If not provided, it will default to "public".
NEXT_PUBLIC_NAMESPACE
: Set this environment variable in Next.js projects to specify the default namespace.NAMESPACE
: Alternatively, set this environment variable to specify the default namespace.
For any issues, questions, or suggestions, please open an issue in the GitHub repository.