TypeScript SDK for Solana wallet-based lead and referral capture. Collect waitlist sign-ups with optional email, Telegram handle, and a cryptographic wallet signature — all wired to the Segmento backend.
| Package | Description |
|---|---|
@segmento/core |
API client, token validation, referral code extraction |
@segmento/lead |
Solana wallet signing |
@segmento/waitlist-ui |
Drop-in modal web component |
The fastest integration. One custom element handles wallet connect, message signing, and submission.
npm install @segmento/core @segmento/lead @segmento/waitlist-uiimport { SegmentoClient } from "@segmento/core";
import { defineSegmentoModal, SegmentoModal } from "@segmento/waitlist-ui";
// Initialise once — stored globally, no need to pass it to the modal
SegmentoClient.init("your_project_token");
// Register the custom element and set required fields
defineSegmentoModal({
emailRequired: true,
walletRequired: true,
});
// Create and open the modal — client and wallet connection are automatic
const modal = new SegmentoModal({
onSuccess: () => console.log("Lead submitted!"),
});
modal.open();All colors are optional — defaults work out of the box.
defineSegmentoModal({
bgColor: "#0c1117",
primaryColor: "#5ee9b5",
});Use @segmento/core and @segmento/lead directly if you want full control over the UI.
import { SegmentoClient, getReferralCode } from "@segmento/core";
import { signMessage } from "@segmento/lead";
SegmentoClient.init("your_project_token");
const client = SegmentoClient.getInstance();
// Sign with the user's wallet
const payload = await signMessage(wallet, client.projectName);
// Submit — project_id is injected automatically, referral_code read from ?ref= in the URL
await client.submitLead({
email: "user@example.com",
telegram: "@handle",
referral_code: getReferralCode() ?? "",
solana_wallet: {
wallet_address: payload.address,
message: payload.message,
signature: payload.signature,
timestamp: payload.ts,
},
});Referral codes are read automatically from the ?ref= query parameter.
See example/ for runnable demos:
- example/ui-package/ — modal web component
- example/custom-ui/ — low-level API with custom UI
pnpm example # serves both demos at http://localhost:3333pnpm install
pnpm build # build all packages
pnpm lint # type-check all packagesReleases use Changesets. Add a changeset for your changes, then merge the generated "Version Packages" PR to publish to npm.
pnpm changeset # describe your change
pnpm changeset version # bump versions (done by CI)Requires an NPM_TOKEN secret in the GitHub repository with write access to the @segmento npm organisation.