SDK
Add locks, tranche locks, vesting and gas drops to your own app, launchpad or bot. TypeScript, built on viem, MIT licensed.
Install
npm
npm install @elyport/sdk viemThe source lives in the sdk folder on GitHub. Package page: npmjs.com/package/@elyport/sdk. It ships the Elysium chain, the contract addresses and the ABIs, so there is nothing to configure.
Set up
TypeScript
import { createWalletClient, custom } from "viem";
import { createElyport, elysium } from "@elyport/sdk";
const walletClient = createWalletClient({ chain: elysium, transport: custom(window.ethereum), account });
const ely = createElyport({ walletClient });Only reading? Call createElyport() with no options and it uses the public Elysium RPC.
Lock and tranches
Locks
// One date. Approves first if needed and pays the fee for you.
const hash = await ely.locks.create({
token: lpToken,
amount: parseUnits("1000", 18),
unlockAt: new Date("2027-01-01"),
isLP: true,
});
const [lockId] = ely.locks.idsFromReceipt(await ely.wait(hash));
// 25% every quarter, one transaction
await ely.locks.createTranches({
token,
tranches: [3, 6, 9, 12].map((m) => ({ amount: parseUnits("250000", 18), unlockAt: new Date(Date.UTC(2027, m - 1, 1)) })),
});Vesting
Vesting
await ely.vesting.create({
token,
recipients: [
{ address: alice, amount: parseUnits("500000", 18) },
{ address: bob, amount: parseUnits("250000", 18) },
],
start: new Date(),
cliff: 90 * 86_400, // seconds
duration: 360 * 86_400, // seconds
release: "monthly", // or "linear"
cancellable: true,
});
const amount = await ely.vesting.claimable(7n);
await ely.vesting.claim(7n);Gas Drop
Drops
await ely.drop.native([{ address: bob, amount: parseUnits("0.05", 18) }]);
await ely.drop.token(token, recipients); // up to 500 per callReference
| Area | Methods |
|---|---|
| locks | create, createTranches, extend, topUp, transfer, withdraw, get, count, idsByToken, idsByOwner, idsFromReceipt |
| vesting | create, claim, cancel, transfer, get, claimable, vestedAt, count, idsByToken, idsByRecipient, idsByCreator, idsFromReceipt |
| drop | native, token |
| fees | lock, vesting, drop (holder discount applied) |
| other | wait, addresses, chain, publicClient |
The package also exports createElyportApi() for the public API, widgetUrls() for widgets, the raw ABIs, ELYPORT_ADDRESSES and LIMITS.