Build
SDK reference
The Gully Core SDK is TypeScript, MIT licensed and written independently of the contracts, so building against Gully Core never means importing GPL code. It uses viem as its chain library.
Transaction builders return { to, data, value } and never send. Simulate those exact bytes, then send them. Every address comes from the SDK's address book, which is generated from the deployment records; a contract that is not on a chain is null there, never a placeholder.
Chains and transport
Chains and transport
Import from @gullylabs/core-sdk.
| Export | What it does |
|---|---|
gullycoreTransport | A viem transport over every probed public endpoint for the chain, your own GULLYCORE_RPC_ |
resolveEndpoints | The ordered RPC list for a chain, private endpoints first. |
chainById | Name, EIP-1153 support and endpoints for a chain id. |
CHAIN_RPCS | Every chain the SDK can reach, keyed by name. A chain here is reachable, not necessarily deployed to. |
readContractBlockNumber | The block number a contract sees. Compare it with block numbers stored in contracts, never eth_blockNumber. |
Address book
Address book
Import from @gullylabs/core-sdk.
| Export | What it does |
|---|---|
GULLYCORE_DEPLOYMENTS | Every Gully Core contract on every chain, read back on chain before it was written here. |
GULLYCORE_CHAIN_IDS | The chains with a deployment, ascending. |
isGullyCoreChainId | Whether the address book has the chain. |
getDeployment | One chain’s record, or undefined. |
requireDeployment | One chain’s record; throws when the chain is not in the book. |
requireContract | One address; throws when it is null on that chain. |
requireLaunchpadV2 | The launch kit’s whole contract group, or a throw if any part is missing. |
launchpadV2Generations | The current kit generation and every earlier one still served. Readers iterate these. |
tokenBySymbol | A token the book carries, with decimals read from its contract. |
Launches
Launches
Import from @gullylabs/core-sdk/launchpad.
| Export | What it does |
|---|---|
readKitV2Limits | Every limit a launch must respect: the kit’s, the guards’, the lockers’ and a tenant’s. |
buildLaunchV2 | Predicts the token, validates every parameter and encodes createLaunch. Returns { to, data, value, token, issues }. |
validateLaunchParamsV2 | Every objection to a launch, cheapest first. Never throws. |
encodeCreateLaunchV2 | createLaunch calldata, encoding only. |
predictLaunchTokenChecked | The token address, computed on chain and off chain; returned only when both agree. |
buildLaunchAndBuyV2 | Create a launch and make the creator’s first buy in one transaction. |
readKitV2Launches | Every launch through a kit, newest first, with each leg’s live fee and phase. |
readKitV2LaunchesAcross | The same across kit generations. |
readKitV2Earnings | What an account can claim as creator, integrator or protocol. |
guardGenerationOf | Which launch-guard generation a pool’s hook is, from its permission bitmap. |
decodeSwapNotFilled | Decodes the guard’s refusal of a partial fill: { expected, traded, guard }. |
PRESET | The launch presets by name. Custom is the zero value: never leave it unset by accident. |
Launchpads and DEXes
Launchpads and DEXes
Import from @gullylabs/core-sdk/launchpad.
| Export | What it does |
|---|---|
readPads | Every Launchpad and DEX a factory created, with owner, terms and brand. |
readPad | One site. |
readPadsAcross | Sites across factory generations. |
buildCreatePad | createPad calldata with the site fee as value. |
predictPadAddress | The address a site will have, the same on every chain for the same creator and salt. |
readPadFactoryFee | The site fee in force, its cap and any scheduled change. |
validatePadBrand | Checks a brand before it is written on chain. |
encodePadMetadataURI | The brand as the on-chain metadata string; decodePadMetadataURI reads it back. |
PAD_THEME_NAMES | The theme packs a site may name. New ones are appended, never renamed. |
Market data
Market data
Import from @gullylabs/core-sdk.
| Export | What it does |
|---|---|
readPoolTrades | Swaps from the pool manager’s logs, as buys and sells of the base token. Prices are in the quote currency, never USD. |
withTimestamps | Adds each trade’s block time. |
buildCandles | OHLC candles from trades. |
marketStats | Volume, trade count and change over a window. |
readSpotPrice | The pool’s price now, from getSlot0 or the active bin. |
readHolders | Holders from Transfer logs; the Vault appears as the holder it is. |
readPoolDirectory | Every pool on both managers, with full keys, from Initialize logs. |
Locks, drops, splits and multisend
Locks
Import from @gullylabs/core-sdk/lock.
| Export | What it does |
|---|---|
buildTokenLock | Lock or vest a token or the native coin. |
cliffLinearSchedule | A cliff then a straight line. timeLockSchedule(unlockAt) is the one-step form. |
buildClaimTokenLock | The beneficiary claims what has vested. |
readTokenLockDirectory | Every token lock, grouped by currency. |
buildLockPosition | Time-lock a CL position NFT. |
readFeeGate | A utility’s fee in force, cap, notice and pending change. |
feeSafeValue | The value to send so a scheduled fee change cannot revert the call (the surplus is refunded). |
Airdrops and multisend
Import from @gullylabs/core-sdk/drop.
| Export | What it does |
|---|---|
buildDropTree | The Merkle tree, root and proofs for a list. |
buildCreateDrop | Create and fund a drop. |
buildClaimDrop | Claim one entry. |
parseRecipientsCsv | Addresses and exact amounts from CSV; every problem reported by line. |
planMultisend | Batches of at most 1,000 with the approval and fee each needs. |
readHolderSnapshot | A token’s holders at a block, for a holder airdrop. |
Team splits
Import from @gullylabs/core-sdk/split.
| Export | What it does |
|---|---|
validateSplitDraft | Checks names, payees and weights before anything is sent. |
readSplitFactoryTerms | Creation fee and protocol share in force. |
buildCreateSplit | Create a split. |
readSplit | Payees, weights and share of one split. |
buildCollectAndReleaseAll | Collect what a split is owed and pay every payee, in one call. |
Routing
Routing
Import from @gullylabs/core-sdk/router.
| Export | What it does |
|---|---|
GullyCoreRouterClient | A client for the router API: quote, swap, simulate, sources, feeConfig. |
swapKindFromCalldata | Which router a calldata targets. |
More modules
Prices
Import from @gullylabs/core-sdk/price.
| Export | What it does |
|---|---|
resolveNativeUsd | The native coin in USD from Chainlink on chain, with its feed and age; { ok: false } when no source answers. |
marketCapFromOpeningPrice | Market cap from an opening price; openingPriceFromMarketCap is the inverse. |
DEFAULT_OPENING_MARKET_CAP_USD | The wizard’s default opening market cap: $3,500. |
Wrong or missing? Tell us at @Gully_Labs.