Gully Core

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.

ExportWhat it does
gullycoreTransportA viem transport over every probed public endpoint for the chain, your own GULLYCORE_RPC_ first, with failover and cooldown.
resolveEndpointsThe ordered RPC list for a chain, private endpoints first.
chainByIdName, EIP-1153 support and endpoints for a chain id.
CHAIN_RPCSEvery chain the SDK can reach, keyed by name. A chain here is reachable, not necessarily deployed to.
readContractBlockNumberThe 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.

ExportWhat it does
GULLYCORE_DEPLOYMENTSEvery Gully Core contract on every chain, read back on chain before it was written here.
GULLYCORE_CHAIN_IDSThe chains with a deployment, ascending.
isGullyCoreChainIdWhether the address book has the chain.
getDeploymentOne chain’s record, or undefined.
requireDeploymentOne chain’s record; throws when the chain is not in the book.
requireContractOne address; throws when it is null on that chain.
requireLaunchpadV2The launch kit’s whole contract group, or a throw if any part is missing.
launchpadV2GenerationsThe current kit generation and every earlier one still served. Readers iterate these.
tokenBySymbolA token the book carries, with decimals read from its contract.

Launches

Launches

Import from @gullylabs/core-sdk/launchpad.

ExportWhat it does
readKitV2LimitsEvery limit a launch must respect: the kit’s, the guards’, the lockers’ and a tenant’s.
buildLaunchV2Predicts the token, validates every parameter and encodes createLaunch. Returns { to, data, value, token, issues }.
validateLaunchParamsV2Every objection to a launch, cheapest first. Never throws.
encodeCreateLaunchV2createLaunch calldata, encoding only.
predictLaunchTokenCheckedThe token address, computed on chain and off chain; returned only when both agree.
buildLaunchAndBuyV2Create a launch and make the creator’s first buy in one transaction.
readKitV2LaunchesEvery launch through a kit, newest first, with each leg’s live fee and phase.
readKitV2LaunchesAcrossThe same across kit generations.
readKitV2EarningsWhat an account can claim as creator, integrator or protocol.
guardGenerationOfWhich launch-guard generation a pool’s hook is, from its permission bitmap.
decodeSwapNotFilledDecodes the guard’s refusal of a partial fill: { expected, traded, guard }.
PRESETThe 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.

ExportWhat it does
readPadsEvery Launchpad and DEX a factory created, with owner, terms and brand.
readPadOne site.
readPadsAcrossSites across factory generations.
buildCreatePadcreatePad calldata with the site fee as value.
predictPadAddressThe address a site will have, the same on every chain for the same creator and salt.
readPadFactoryFeeThe site fee in force, its cap and any scheduled change.
validatePadBrandChecks a brand before it is written on chain.
encodePadMetadataURIThe brand as the on-chain metadata string; decodePadMetadataURI reads it back.
PAD_THEME_NAMESThe theme packs a site may name. New ones are appended, never renamed.

Market data

Market data

Import from @gullylabs/core-sdk.

ExportWhat it does
readPoolTradesSwaps from the pool manager’s logs, as buys and sells of the base token. Prices are in the quote currency, never USD.
withTimestampsAdds each trade’s block time.
buildCandlesOHLC candles from trades.
marketStatsVolume, trade count and change over a window.
readSpotPriceThe pool’s price now, from getSlot0 or the active bin.
readHoldersHolders from Transfer logs; the Vault appears as the holder it is.
readPoolDirectoryEvery pool on both managers, with full keys, from Initialize logs.

Locks, drops, splits and multisend

Locks

Import from @gullylabs/core-sdk/lock.

ExportWhat it does
buildTokenLockLock or vest a token or the native coin.
cliffLinearScheduleA cliff then a straight line. timeLockSchedule(unlockAt) is the one-step form.
buildClaimTokenLockThe beneficiary claims what has vested.
readTokenLockDirectoryEvery token lock, grouped by currency.
buildLockPositionTime-lock a CL position NFT.
readFeeGateA utility’s fee in force, cap, notice and pending change.
feeSafeValueThe 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.

ExportWhat it does
buildDropTreeThe Merkle tree, root and proofs for a list.
buildCreateDropCreate and fund a drop.
buildClaimDropClaim one entry.
parseRecipientsCsvAddresses and exact amounts from CSV; every problem reported by line.
planMultisendBatches of at most 1,000 with the approval and fee each needs.
readHolderSnapshotA token’s holders at a block, for a holder airdrop.

Team splits

Import from @gullylabs/core-sdk/split.

ExportWhat it does
validateSplitDraftChecks names, payees and weights before anything is sent.
readSplitFactoryTermsCreation fee and protocol share in force.
buildCreateSplitCreate a split.
readSplitPayees, weights and share of one split.
buildCollectAndReleaseAllCollect what a split is owed and pay every payee, in one call.

Routing

Routing

Import from @gullylabs/core-sdk/router.

ExportWhat it does
GullyCoreRouterClientA client for the router API: quote, swap, simulate, sources, feeConfig.
swapKindFromCalldataWhich router a calldata targets.

More modules

Prices

Import from @gullylabs/core-sdk/price.

ExportWhat it does
resolveNativeUsdThe native coin in USD from Chainlink on chain, with its feed and age; { ok: false } when no source answers.
marketCapFromOpeningPriceMarket cap from an opening price; openingPriceFromMarketCap is the inverse.
DEFAULT_OPENING_MARKET_CAP_USDThe wizard’s default opening market cap: $3,500.

Wrong or missing? Tell us at @Gully_Labs.