@gullylabs/chain
v0.3.1
Published
Official GullyChain integration SDK: chain objects, addresses, ABIs and typed helpers for the launchpad, Gully Swap, .gully names, passkey smart accounts, stablecoins, bridge, referrals, arcade, RWA rails, the indexer and safety APIs.
Maintainers
Readme
GullyChain SDK
The official integration SDK for GullyChain, Gully Labs' Arbitrum Orbit L3 (Nitro, gas in ETH, settles to Arbitrum). TypeScript, ESM + CJS, built on viem (the only runtime dependency, as a peer).
Chain ids, RPC endpoints, every deployed contract address and ABI, and typed helpers for everything that ships on top of
the chain: the launchpad, Gully Swap, .gully names, passkey smart accounts with sponsored gas, USDC.e, the
bridge, referrals, the arcade, the ERC-3643 RWA rails, the indexer and the HolderMaps / Gully Score safety API.
| Network | Chain id | RPC | Status |
|---|---|---|---|
| GullyChain Testnet | 485590 (0x768d6) | https://testnet-rpc.gullychain.xyz | live, settles to Arbitrum Sepolia |
| GullyChain mainnet | - | - | coming; gullychainMainnet is null until it launches |
Every chain in the registry is also served keyless (rate-limited) through Gully RPC at
https://rpc.gullyrpc.xyz/gullychain/evm/<chainId>; with a Gully RPC project key, use your own project path.
Docs for the chain itself: https://docs.gullychain.xyz. Explorer: https://testnet.gullyscan.xyz.
npm install @gullylabs/chain viemEvery Gully SDK in 5 minutes: https://docs.gullychain.xyz/sdks/ (also https://docs.gullylabs.xyz/integrate).
Quickstart
import { createPublicClient, http, parseEther, formatEther } from 'viem'
import { gullychainTestnet, testnet, launchpad, swap, names, indexer } from '@gullylabs/chain'
const client = createPublicClient({ chain: gullychainTestnet, transport: http() })
// Launchpad: what does 0.01 ETH buy right now?
const [token] = await launchpad.listTokens(client, { launchpad: testnet.launchpad.deployments[1].address })
const q = await launchpad.quoteBuy(client, token, parseEther('0.01'))
console.log(formatEther(q.tokensOut), 'tokens, fee', formatEther(q.fee))
// The call to send (from an EOA with viem's walletClient, or from a Gully account, see below)
const call = launchpad.buyCall(testnet.launchpad.deployments[1].address, token, parseEther('0.01'), swap.applySlippage(q.tokensOut, 100))
// .gully names
console.log(await names.resolveName(client, 'gully-test')) // address or null
console.log(await names.reverseName(client, '0x…')) // primary name, verified forward
// Indexer (no RPC needed)
const { tokens } = await indexer.indexer.tokens()Reading a Gully Core mainnet deployment (Base here) through Gully RPC:
import { createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
import { gullyCoreOn } from '@gullylabs/chain/addresses'
const core = gullyCoreOn(8453)!
const baseClient = createPublicClient({ chain: base, transport: http('https://rpc.gullyrpc.xyz/gullychain/evm/8453') })
const code = await baseClient.getCode({ address: core.contracts.vault })
console.log(Boolean(code)) // true: the Gully Core vault is deployed on BaseEvery write helper returns a Call ({ to, data, value }) instead of sending it, so the same code works with a browser
wallet (walletClient.sendTransaction(call)), a server key, or a passkey smart account (accounts.sendCalls(..., [call])).
Subpath imports keep bundles small: @gullylabs/chain/launchpad, /swap, /route, /names, /accounts,
/stablecoins, /bridge, /referrals, /arcade, /rwa, /indexer, /safety, /chains, /addresses, /abis.
Modules
| Module | What it covers | Docs |
|---|---|---|
| chains | gullychainTestnet viem chain (contracts map, explorer), parent chain, public service URLs, addChainParams | docs/chains.md |
| addresses | Typed, checksummed, versioned addresses generated from Gully deployment records (testnet.*) | docs/addresses.md |
| abis | Complete ABIs of every Gully contract (as const) + partial ABIs of WETH9, Uniswap v3, ENS, the bridge, Kernel | docs/addresses.md |
| launchpad | launch / buy / sell / graduate calls, on-chain and offline quotes (same integer maths as the contract), event decoding for v1.0, v2.0, v2.1 and both LP lockers | docs/launchpad.md |
| swap | GullySwapRouter + QuoterV2 with the 0.25% interface-fee maths (exact input and exact output), paths, pools, protocol fee | docs/swap.md |
| route | Gully Router V1: best route across Gully Swap pools (direct and multi-hop through WETH / USDC.e), gas-aware ranking, price impact, simulated GullySwapRouter calls | docs/route.md |
| names | .gully resolve / reverse (verified) / register, text records incl. gully.dm.price, profile records | docs/names.md |
| accounts | Kernel v3.3 passkey accounts: counterfactual address (offline CREATE2), session-key / guardian / device permission builders, viem SmartAccount, Gully bundler + paymaster sending, discovery | docs/accounts.md |
| stablecoins | USDC.e balances, transfers and 6-decimal formatting | docs/stablecoins.md |
| bridge | ETH / ERC-20 / USDC deposits from Arbitrum Sepolia (retryable fee estimate), withdrawals | docs/bridge.md |
| referrals | registry reads and calls, EIP-712 setReferrerFor, codes and links, Merkle rewards + epoch data | docs/referrals.md |
| arcade | seasons, leaderboards, pots, EIP-712 score proofs, submit / fund / claim, attestation-server client | docs/arcade.md |
| rwa | ERC-3643 eligibility checklist (ONCHAINID, claims, registry, country, frozen), NAV, demo desk | docs/rwa.md |
| indexer | typed REST client: tokens, token detail, candles, trades, holders, feed, names | docs/indexer.md |
| safety | HolderMaps top-10 share + Gully Score for chain gully, summarised into a level | docs/safety.md |
| clock | the block number contracts see on GullyChain (Ethereum Sepolia's, not eth_blockNumber): readContractClock, block/second conversion at the 12 s contract cadence | docs/cli.md |
| doctor | RPC health, contract clock, address-book code and wallet checks (runDoctor) | docs/cli.md |
| gullychain CLI | read-only: status, addresses, token, quote, name, safety, account, doctor | docs/cli.md |
API reference (typedoc): npm run docs writes docs/api/.
One chain list for every switcher
@gullylabs/chain/registry is the single list of chains Gully products run on or are planned for: id, name,
RPC (public and the Gully RPC path), explorer, native token, logo file, wrapped native,
and per product (Gully Multisig, Gully Core) its status and addresses. Every Gully app's chain switcher reads it.
import { chainsWith, safeAppChains, gullyChainById, addGullyChainParams } from '@gullylabs/chain/registry'
const inApp = safeAppChains() // what the hosted Gully Multisig app's switcher lists
const onChain = chainsWith('gullySafe') // Gully Multisig (Safe 1.4.1) contracts live on chain
const planned = chainsWith('gullyCore', ['planned']) // docs and admin pages
await wallet.request({ method: 'wallet_addEthereumChain', params: [addGullyChainParams(gullyChainById(6714)!)] })A chain is live only after its deployment is on chain and published in the Gully Core manifest
(https://gullycore.xyz/manifest.json); ready means rehearsed and waiting for the broadcast. Gully Multisig (named Gully Safe until 2026-11-05; the key stays gullySafe, the name to
show is productLabels.gullySafe) is live on Anubis (6714) since 2026-11-05 and served by the hosted app at
https://gullymultisig.xyz next to Gully Chain Testnet. On Anubis it uses Safe's canonical 1.4.1 addresses, and
the gas token gasDAI cannot be sent as a transaction value (nativeValueTransfers: false).
multisigAppUrl(chainId, safeAddress) builds a link into the app.
Gully Core addresses
Gully Core release 3 is live on Gully Chain Testnet (485590), Anubis (6714), Robinhood Chain (4663), Base (8453),
BNB Chain (56) and Kinetiq Elysium (99901). HyperEVM (999) is coming and has no addresses. gullyCore is generated
from the deployment records, and a test checks it against the public manifest (https://gullycore.xyz/manifest.json).
import { gullyCoreOn } from '@gullylabs/chain/addresses'
const core = gullyCoreOn(6714)
core?.contracts.launchpadKitV2
core?.contracts.multicall3 // Anubis: not the canonical Multicall3 addressFor builders on Gully Core, the full SDK is @gullylabs/core-sdk on npm (npm install @gullylabs/core-sdk viem, 0.3.1).
Passkey accounts in one screen
import { createWebAuthnCredential, toWebAuthnAccount } from 'viem/account-abstraction'
import { accounts } from '@gullylabs/chain'
const cred = await createWebAuthnCredential({ name: 'Gully' }) // one Face ID / fingerprint prompt
const { pub, idHash } = accounts.passkeyFromCredential(cred)
const key = { root: pub, rootIdHash: idHash }
const address = accounts.predictAccountAddress(key) // no RPC needed, matches KernelFactory.getAddress
const signer = { kind: 'passkey' as const, sign: accounts.webAuthnAssertionSigner(toWebAuthnAccount({ credential: cred })) }
const res = await accounts.sendCalls({ client, key, signer }, [call]) // sponsored by the Gully paymaster when allowed
console.log(res.txHash, res.sponsored)Session keys, extra devices and recovery guardians: docs/accounts.md.
Keeping addresses in sync
Addresses and ABIs are generated from Gully's deployment records, never typed by hand (npm run sync-addresses), and
tests/manifest-sync.test.ts checks every Gully Core address against https://gullycore.xyz/manifest.json
(MANIFEST_LIVE=1 reads the live file).
Development
npm ci
npm run typecheck
npm test # vitest unit tests: encoding parity, quote maths, name hashing, address derivation...
LIVE=1 npm run test:live # read-only tests against the public testnet (RPC, indexer, safety API)
npm run build # tsup: ESM + CJS + d.ts into dist/, plus the CLI
npm run docs # typedoc into docs/api/Publishing
Versions and CHANGELOG.md entries come from changesets. A release runs
npm ci && npm run typecheck && npm test && npm run build && npm publish --dry-run, then npm publish --access public.
Related
- Chain docs: https://docs.gullychain.xyz (network, contracts, bridging, stablecoins, accounts, names, launchpad)
- Token list: https://gullychain.xyz/tokenlist.json
gully-labs/sdk(@gullylabs/tracker,@gullylabs/widget,@gullylabs/holders): the Gully Labs website / HolderMaps SDK. Unrelated to this package; its holders client is the HolderMaps API thatsafetyhere reads for chaingully.
Licence
MIT. Contract ABIs are those of the deployed Gully contracts (MIT) and of third-party contracts under their own licences
(Uniswap v3, ENS, Arbitrum token bridge, ZeroDev Kernel, ERC-3643 T-REX / ONCHAINID, RedStone).
The clock and doctor modules are derived from DeepCore's SDK and CLI (MIT); their files keep
the MIT SPDX header and say which DeepCore file each came from.
The route module is derived from DeepCore Router V1 (packages/router-core, MIT); its files
keep the MIT SPDX header and say which DeepCore file each came from.
Testnet only: nothing here is an offer of securities or redeemable dollars; TEST-TBILL is a test asset.
