Arcfolio$AFOL · on Arc[ Arc mainnet · chain 5042 ]
import { createArcfolio } from "@arcfolio/sdk";import { createWalletClient, custom } from "viem";const folio = createArcfolio({ apiUrl: "https://jellybelly.fun/api/v1" });// reads: no wallet, no RPCconst reserves = await folio.reserves(); // reserve vs supply, every stockconst quote = await folio.quote({ stock: "NVDA", side: "buy", amount: 1000 });// writes: a viem wallet on Arc (USDC is the native asset, nothing to approve)const wallet = createWalletClient({ transport: custom(window.ethereum) });const id = await folio.requestBuy({ stock: "NVDA", usdc: 1000 }, wallet);const order = await folio.waitForOrder(id); // filled in a few secondsconsole.log(order.amountOut, order.amountOutUnit); // "4.61…", "NVDA.afol"The package lives in this repo at packages/sdk and is typed end to end with viem. Every quote response also carries the raw call (contract, function, args, value), so any language can place the same order.
// ArcfolioHub on Arc: 0xHUB…await wallet.writeContract({ address: "0xHUB…", abi: arcfolioHubAbi, functionName: "requestBuy", args: ["0xNVDA…", parseUnits("4.5", 18)], // NVDA, at least 4.5 NVDA.afol value: parseEther("1000"), // 1,000 USDC});requestBuy(address underlying, uint256 minSharesOut) payableDeposit USDC (msg.value, 18 dp) for a stock. Returns the order id; the operator fills it.
requestSell(address underlying, uint256 sharesIn, uint256 minUsdcOut)Escrow STOCK.afol to redeem. USDC arrives when the operator fills it.
cancel(uint256 id)Yours to call after 30 minutes if an order is still pending. Everything comes back.
getOrder(uint256 id) · ordersOf(address) · pendingOrders()Read any order, a wallet’s history, or what is in flight.
supplyOf(address underlying) · allListings()Supply per stock and every STOCK.afol address.
previewBuyFee(uint256 usdcIn, address caller)The fee a deposit pays, including any integrator fee for caller.
Chain id, RPC and contract addresses on Arc
Supported stocks: underlying, STOCK.afol, FolioSwap pool, oracle price
Oracle prices (reserve venue) and reference prices
Proof of reserves: vault reserve and entitlement vs STOCK.afol supply on Arc
Execution quote plus the exact hub call to place the order
GET /api/v1/orders/{id}One hub order: status, fill, fee
GET /api/v1/orders?user=0x…A wallet’s last 50 orders
FolioSwap pools, FolioLend market, indices, oracle
POST /api/v1/keysIssue an API key: 600 req/min and metered usage (the infrastructure fee hook)
curl https://jellybelly.fun/api/v1/reservescurl "https://jellybelly.fun/api/v1/quote?stock=NVDA&side=buy&amount=1000"curl -X POST https://jellybelly.fun/api/v1/keys -d '{"name":"my protocol"}'Protocols that route their users through the hub can be registered as integrators. The hub then adds their tier on top of the 0.25% (capped at 1% in total) and keeps the accounting on-chain: integratorFeeBps(address). API keys are metered the same way. Nothing is billed during the MVP.