divy-sdk 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -54,10 +54,12 @@ console.log('harvested', harvestTx);
54
54
 
55
55
  ## Fee split
56
56
 
57
- Every trade pays a 1% curve fee. Pons keeps 30% of it. The rest forwards through your agent's
58
- split contract every harvest, no claim step: **60% to the agent's payout wallet, 30% to Pons,
59
- 10% to Divy.** Any creator tax you set (`creatorTaxBps`, up to `maxCreatorTaxBps`) goes to the
60
- agent on top of that, in full.
57
+ Every trade pays a 1% curve fee. Pons keeps 30% of it. The other 70%, plus any creator tax you
58
+ set (`creatorTaxBps`, up to `maxCreatorTaxBps`), lands in your agent's split contract. On every
59
+ harvest the split keeps `divyBps` (1428, so 14.28%) for Divy and sends the rest to the agent:
60
+ of the base fee that is 60% to the agent, 30% to Pons, 10% to Divy, and of the creator tax
61
+ 85.72% to the agent. Self-custody agents are paid at their own address. Hosted wallets are paid
62
+ at the hosted address and then swept to the `payout` you set. No claim step either way.
61
63
 
62
64
  ## API surface
63
65
 
package/dist/index.cjs CHANGED
@@ -175,7 +175,12 @@ function parseAgentLaunch(l) {
175
175
  pairToken: l.pairToken,
176
176
  graduated: l.graduated,
177
177
  launchedAt: l.launchedAt,
178
- recorded: l.recorded
178
+ recorded: l.recorded,
179
+ retention: l.retention ?? null,
180
+ retentionProvisional: l.retentionProvisional ?? false,
181
+ retentionPending: l.retentionPending ?? false,
182
+ earlyHolders: l.earlyHolders ?? null,
183
+ retained: l.retained ?? null
179
184
  };
180
185
  }
181
186
  function parseAgentRecord(j) {
@@ -183,7 +188,7 @@ function parseAgentRecord(j) {
183
188
  agent: j.agent,
184
189
  split: j.split,
185
190
  registered: j.registered,
186
- record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score },
191
+ record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score, graduationRate: j.record.graduationRate ?? j.record.score },
187
192
  fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },
188
193
  launches: j.launches.map(parseAgentLaunch),
189
194
  ...j.balanceEth !== void 0 ? { balanceEth: j.balanceEth } : {},
@@ -192,7 +197,16 @@ function parseAgentRecord(j) {
192
197
  };
193
198
  }
194
199
  function parseLeaderboard(j) {
195
- return j.map((r) => ({ agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score, feesEth: big(r.feesEth) }));
200
+ return j.map((r) => ({
201
+ agent: r.agent,
202
+ launches: r.launches,
203
+ graduated: r.graduated,
204
+ score: r.score,
205
+ graduationRate: r.graduationRate ?? r.score,
206
+ retention: r.retention ?? null,
207
+ retentionProvisional: r.retentionProvisional ?? false,
208
+ feesEth: big(r.feesEth)
209
+ }));
196
210
  }
197
211
  function parseLaunches(j) {
198
212
  return j.map((r) => ({
@@ -206,11 +220,33 @@ function parseLaunches(j) {
206
220
  launchedBlock: r.launchedBlock,
207
221
  launchedAt: r.launchedAt,
208
222
  recorded: r.recorded,
209
- graduated: r.graduated
223
+ graduated: r.graduated,
224
+ retention: r.retention ?? null,
225
+ retentionProvisional: r.retentionProvisional ?? false,
226
+ retentionPending: r.retentionPending ?? false,
227
+ earlyHolders: r.earlyHolders ?? null,
228
+ retained: r.retained ?? null
210
229
  }));
211
230
  }
212
231
  function parseHealth(j) {
213
- return { ok: j.ok, indexedBlock: bigOrNull(j.indexedBlock), head: big(j.head), lag: bigOrNull(j.lag) };
232
+ const k = j.keeper ?? {};
233
+ return {
234
+ ok: j.ok,
235
+ rpc: j.rpc ?? true,
236
+ indexedBlock: bigOrNull(j.indexedBlock),
237
+ head: bigOrNull(j.head),
238
+ lag: bigOrNull(j.lag),
239
+ keeper: {
240
+ address: k.address ?? null,
241
+ enabled: !!k.enabled,
242
+ balanceWei: bigOrNull(k.balanceWei),
243
+ low: !!k.low,
244
+ spent24hWei: big(k.spent24hWei ?? "0"),
245
+ dailyBudgetWei: big(k.dailyBudgetWei ?? "0"),
246
+ lastTickAt: k.lastTickAt ?? null
247
+ },
248
+ warnings: Array.isArray(j.warnings) ? j.warnings : []
249
+ };
214
250
  }
215
251
  function parseTx(t) {
216
252
  return { to: t.to, data: t.data, value: big(t.value) };
@@ -321,6 +357,14 @@ var Divy = class {
321
357
  async health() {
322
358
  return parseHealth(await apiRequest(this.apiUrl, "/health"));
323
359
  }
360
+ // Creates a fresh hosted wallet on the API. Needs no credential, so an agent can bootstrap
361
+ // itself from a read-only client, then continue with createDivy({ apiKey }).
362
+ async createHostedAgent(params = {}) {
363
+ const body = {};
364
+ if (params.payout) body.payout = params.payout;
365
+ if (params.label) body.label = params.label;
366
+ return apiRequest(this.apiUrl, "/agents", { body });
367
+ }
324
368
  async register() {
325
369
  this.requireSigner("register");
326
370
  if (this.mode === "hosted") {
@@ -437,6 +481,11 @@ var Divy = class {
437
481
  const receipt = await this.sendLocal(built.tx);
438
482
  return { txHash: receipt.transactionHash };
439
483
  }
484
+ // Own-wallet launches only: tell the API about a launch tx you mined yourself so the record
485
+ // updates now instead of on the indexer's next pass.
486
+ async confirmLaunch(txHash) {
487
+ return apiRequest(this.apiUrl, "/launches/confirm", { body: { txHash } });
488
+ }
440
489
  async waitForRecord(token, options = {}) {
441
490
  const timeoutMs = options.timeoutMs ?? 6e4;
442
491
  const intervalMs = options.intervalMs ?? 3e3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/chain.ts","../src/abi.ts","../src/errors.ts","../src/http.ts","../src/parse.ts"],"sourcesContent":["export { createDivy, Divy } from './client.js';\nexport { DivyError } from './errors.js';\nexport { addresses, defineDivyChain, explorerAddress, explorerTx, CHAIN_ID, DEFAULT_API_URL, DEFAULT_RPC_URL } from './chain.js';\nexport type {\n Address, Hex, Tx,\n CreateDivyOptions, CreateDivySelfCustody, CreateDivyHosted, CreateDivyReadOnly, DivyMode,\n InfoResult, FeePolicy, AgentRecord, AgentLaunch, LeaderboardEntry, LaunchListItem, HealthResult,\n QuoteParams, QuoteResult, RegisterResult, LaunchParams, LaunchResult, RecordResult,\n TradeParams, BuyParams, SellParams, TradeResult, HarvestResult, WaitForRecordOptions,\n} from './types.js';\n","import {\n createPublicClient, createWalletClient, http, encodeFunctionData, decodeEventLog, zeroAddress,\n} from 'viem';\nimport type { Address, Hex } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { addresses, defineDivyChain } from './chain.js';\nimport { curveAbi, factoryTokenLaunchedAbi } from './abi.js';\nimport { DivyError } from './errors.js';\nimport { apiRequest } from './http.js';\nimport {\n parseAgentRecord, parseHealth, parseInfo, parseLaunches, parseLeaderboard, parseQuote,\n} from './parse.js';\nimport type {\n AgentRecord, BuyParams, CreateDivyOptions, DivyMode, HarvestResult, HealthResult, InfoResult,\n LaunchListItem, LaunchParams, LaunchResult, LeaderboardEntry, QuoteParams, QuoteResult, RecordResult,\n RegisterResult, SellParams, TradeResult, Tx, WaitForRecordOptions,\n} from './types.js';\n\nconst PRIVATE_KEY_RE = /^0x[0-9a-fA-F]{64}$/;\nconst BPS_DENOM = 10000n;\n\nfunction readAmount(amount: bigint | string): bigint {\n return typeof amount === 'bigint' ? amount : BigInt(amount);\n}\n\nexport class Divy {\n readonly mode: DivyMode;\n readonly apiUrl: string;\n\n private readonly apiKey?: string;\n private readonly account?: ReturnType<typeof privateKeyToAccount>;\n // viem's client generics resist a clean stored type across the three constructor branches;\n // both are only ever touched through sendLocal(), which fixes the call shape in one place.\n private readonly wallet?: any;\n private readonly pub?: any;\n private readonly chain?: ReturnType<typeof defineDivyChain>;\n\n constructor(options: CreateDivyOptions) {\n const hasPrivateKey = 'privateKey' in options && options.privateKey !== undefined;\n const hasApiKey = 'apiKey' in options && options.apiKey !== undefined;\n if (hasPrivateKey && hasApiKey) {\n throw new Error('pass either privateKey or apiKey to createDivy, not both');\n }\n\n this.apiUrl = options.apiUrl ?? addresses.apiUrl;\n\n if (hasPrivateKey) {\n const { privateKey, rpcUrl } = options as { privateKey: Hex; rpcUrl?: string };\n if (!PRIVATE_KEY_RE.test(privateKey)) {\n throw new Error('privateKey must be a 0x-prefixed 32-byte hex string');\n }\n this.mode = 'self-custody';\n this.account = privateKeyToAccount(privateKey);\n this.chain = defineDivyChain(rpcUrl ?? addresses.rpcUrl);\n const transport = http(rpcUrl ?? addresses.rpcUrl);\n this.wallet = createWalletClient({ account: this.account, chain: this.chain, transport });\n this.pub = createPublicClient({ chain: this.chain, transport });\n } else if (hasApiKey) {\n const { apiKey } = options as { apiKey: string };\n if (typeof apiKey !== 'string' || apiKey.length === 0) {\n throw new Error('apiKey must be a non-empty string');\n }\n this.mode = 'hosted';\n this.apiKey = apiKey;\n } else {\n this.mode = 'read-only';\n }\n }\n\n private requireSigner(action: string): void {\n if (this.mode === 'read-only') {\n throw new Error(`${action} requires a privateKey (self-custody) or apiKey (hosted) — this client is read-only`);\n }\n }\n\n private async sendLocal(tx: Tx) {\n if (!this.wallet || !this.pub || !this.account) throw new Error('self-custody wallet is not configured');\n const hash = await this.wallet.sendTransaction({\n account: this.account, chain: this.chain, to: tx.to, data: tx.data, value: tx.value,\n });\n const receipt = await this.pub.waitForTransactionReceipt({ hash });\n if (receipt.status !== 'success') throw new Error(`transaction reverted on-chain: ${hash}`);\n return receipt;\n }\n\n async buildTx<T = Record<string, unknown>>(path: string, body?: object): Promise<T> {\n return apiRequest<T>(this.apiUrl, path, { body: body ?? {} });\n }\n\n async info(): Promise<InfoResult> {\n return parseInfo(await apiRequest(this.apiUrl, '/'));\n }\n\n async agent(address?: Address): Promise<AgentRecord> {\n if (!address) {\n if (this.mode === 'hosted') {\n return parseAgentRecord(await apiRequest(this.apiUrl, '/me', { apiKey: this.apiKey }));\n }\n if (this.mode === 'self-custody' && this.account) {\n address = this.account.address;\n } else {\n throw new Error('agent() requires an address in read-only mode');\n }\n }\n return parseAgentRecord(await apiRequest(this.apiUrl, `/agents/${address}`));\n }\n\n async leaderboard(): Promise<LeaderboardEntry[]> {\n return parseLeaderboard(await apiRequest(this.apiUrl, '/leaderboard'));\n }\n\n async launches(options: { limit?: number } = {}): Promise<LaunchListItem[]> {\n const qs = options.limit ? `?limit=${options.limit}` : '';\n return parseLaunches(await apiRequest(this.apiUrl, `/launches${qs}`));\n }\n\n async health(): Promise<HealthResult> {\n return parseHealth(await apiRequest(this.apiUrl, '/health'));\n }\n\n async register(): Promise<RegisterResult> {\n this.requireSigner('register');\n\n if (this.mode === 'hosted') {\n const me = await apiRequest<{ registered: boolean; split: Address | null }>(this.apiUrl, '/me', { apiKey: this.apiKey });\n if (me.registered) return { registered: true, split: me.split };\n return { registered: false, split: null };\n }\n\n const address = this.account!.address;\n const first = await apiRequest<{ registered: boolean; split: Address; tx?: Tx }>(this.apiUrl, '/agents', {\n body: { address },\n });\n if (first.registered) return { registered: true, split: first.split };\n\n const receipt = await this.sendLocal({ to: first.tx!.to, data: first.tx!.data, value: BigInt(first.tx!.value ?? 0) });\n const after = await apiRequest<{ registered: boolean; split: Address }>(this.apiUrl, '/agents', { body: { address } });\n return { registered: after.registered, split: after.split, txHash: receipt.transactionHash };\n }\n\n async quote(params: QuoteParams): Promise<QuoteResult> {\n let recipient = params.recipient;\n if (!recipient && this.mode === 'self-custody' && this.account) recipient = this.account.address;\n return parseQuote(\n await apiRequest(this.apiUrl, '/quote', {\n body: {\n curve: params.curve, token: params.token, side: params.side,\n amount: readAmount(params.amount).toString(), recipient: recipient ?? zeroAddress,\n },\n }),\n );\n }\n\n async launch(params: LaunchParams): Promise<LaunchResult> {\n this.requireSigner('launch');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ token: Address; curve: Address; txHash: Hex }>(this.apiUrl, '/launch', {\n apiKey: this.apiKey, body: params,\n });\n return { token: out.token, curve: out.curve, txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/launch', { body: { ...params, agent: address } });\n const receipt = await this.sendLocal(built.tx);\n\n let launched: { token: Address; curve: Address } | undefined;\n for (const log of receipt.logs) {\n try {\n const ev = decodeEventLog({ abi: factoryTokenLaunchedAbi, data: log.data, topics: log.topics });\n if (ev.eventName === 'TokenLaunched') { launched = ev.args as { token: Address; curve: Address }; break; }\n } catch { /* not a TokenLaunched log */ }\n }\n if (!launched) throw new Error(`launch mined (${receipt.transactionHash}) but no TokenLaunched event was found`);\n\n const result: LaunchResult = { token: launched.token, curve: launched.curve, txHash: receipt.transactionHash };\n try {\n const recorded = await this.record(launched.token);\n result.recordTxHash = recorded.txHash;\n } catch (e) {\n result.recordError = e instanceof Error ? e.message : String(e);\n }\n return result;\n }\n\n async record(token: Address): Promise<RecordResult> {\n if (this.mode !== 'self-custody') {\n throw new Error(\n 'record() requires self-custody (a privateKey): hosted and read-only launches are recorded '\n + 'automatically by Divy\\'s keeper within about a minute — use waitForRecord() to wait for it',\n );\n }\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/record', { body: { token } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async buy(params: BuyParams): Promise<TradeResult> {\n return this.trade('buy', readAmount(params.amountWei), params);\n }\n\n async sell(params: SellParams): Promise<TradeResult> {\n return this.trade('sell', readAmount(params.amountTokens), params);\n }\n\n private async trade(side: 'buy' | 'sell', amount: bigint, params: BuyParams | SellParams): Promise<TradeResult> {\n this.requireSigner(side);\n const slippageBps = params.slippageBps ?? 100;\n\n if (this.mode === 'hosted') {\n if (slippageBps !== 100) {\n throw new Error('slippageBps is not configurable in hosted mode: /trade hardcodes a 1% (100bps) slippage floor');\n }\n const out = await apiRequest<{ txHash: Hex; amountOut: string }>(this.apiUrl, '/trade', {\n apiKey: this.apiKey, body: { curve: params.curve, token: params.token, side, amount: amount.toString() },\n });\n return { txHash: out.txHash, amountOut: BigInt(out.amountOut) };\n }\n\n const address = this.account!.address;\n const q = await this.quote({ curve: params.curve, token: params.token, side, amount, recipient: address });\n\n let tradeTx = q.tx;\n if (slippageBps !== 100) {\n const minOut = (q.amountOut * (BPS_DENOM - BigInt(slippageBps))) / BPS_DENOM;\n const data = encodeFunctionData({ abi: curveAbi, functionName: side, args: [q.amountIn, minOut, address] });\n tradeTx = { ...q.tx, data };\n }\n\n if (q.approveTx) await this.sendLocal(q.approveTx);\n const receipt = await this.sendLocal(tradeTx);\n return { txHash: receipt.transactionHash, amountOut: q.amountOut };\n }\n\n async harvest(): Promise<HarvestResult> {\n this.requireSigner('harvest');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ txHash: Hex }>(this.apiUrl, '/harvest', { apiKey: this.apiKey, body: {} });\n return { txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/harvest', { body: { agent: address } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async waitForRecord(token: Address, options: WaitForRecordOptions = {}): Promise<LaunchListItem> {\n const timeoutMs = options.timeoutMs ?? 60_000;\n const intervalMs = options.intervalMs ?? 3_000;\n const deadline = Date.now() + timeoutMs;\n const wanted = token.toLowerCase();\n\n for (;;) {\n const rows = await this.launches({ limit: 200 });\n const row = rows.find((r) => r.token.toLowerCase() === wanted);\n if (row?.recorded) return row;\n if (Date.now() >= deadline) {\n throw new DivyError(`timed out waiting for ${token} to be recorded`, 408);\n }\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n\nexport function createDivy(options: CreateDivyOptions = {}): Divy {\n return new Divy(options);\n}\n","import { defineChain } from 'viem';\nimport type { Address } from 'viem';\n\nexport const CHAIN_ID = 4663;\nexport const DEFAULT_RPC_URL = 'https://rpc.mainnet.chain.robinhood.com';\nexport const DEFAULT_API_URL = 'https://divy-api-j8di.onrender.com';\nexport const EXPLORER_URL = 'https://robinhoodchain.blockscout.com';\n\nexport const addresses = {\n chainId: CHAIN_ID,\n registry: '0x0fEf638d8C88e6eD38eDcD9aB21BF39D083c8B1b' as Address,\n factory: '0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e' as Address,\n escrow: '0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e' as Address,\n rpcUrl: DEFAULT_RPC_URL,\n apiUrl: DEFAULT_API_URL,\n explorerUrl: EXPLORER_URL,\n} as const;\n\nexport function defineDivyChain(rpcUrl: string = DEFAULT_RPC_URL) {\n return defineChain({\n id: CHAIN_ID,\n name: 'robinhood-chain',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: { default: { http: [rpcUrl] } },\n blockExplorers: { default: { name: 'Blockscout', url: EXPLORER_URL } },\n });\n}\n\nexport function explorerTx(hash: string): string {\n return `${EXPLORER_URL}/tx/${hash}`;\n}\n\nexport function explorerAddress(address: string): string {\n return `${EXPLORER_URL}/address/${address}`;\n}\n","// Minimal ABIs: the API returns pre-encoded {to, data, value} for every write, so the SDK\n// only needs to encode locally when overriding the API's default 1% slippage floor, and to\n// decode the TokenLaunched event off a launch receipt.\n\nexport const curveAbi = [\n {\n type: 'function',\n name: 'buy',\n stateMutability: 'payable',\n inputs: [\n { name: 'quoteIn', type: 'uint256' },\n { name: 'minTokensOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'tokensOut', type: 'uint256' }],\n },\n {\n type: 'function',\n name: 'sell',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'tokensIn', type: 'uint256' },\n { name: 'minQuoteOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'quoteOut', type: 'uint256' }],\n },\n] as const;\n\nexport const factoryTokenLaunchedAbi = [\n {\n type: 'event',\n name: 'TokenLaunched',\n inputs: [\n { indexed: true, name: 'token', type: 'address' },\n { indexed: true, name: 'curve', type: 'address' },\n { indexed: true, name: 'deployer', type: 'address' },\n { indexed: false, name: 'pairToken', type: 'address' },\n { indexed: false, name: 'launchConfigId', type: 'uint256' },\n { indexed: false, name: 'graduationThreshold', type: 'uint256' },\n ],\n },\n] as const;\n","export class DivyError extends Error {\n readonly status: number;\n\n constructor(message: string, status: number) {\n super(message);\n this.name = 'DivyError';\n this.status = status;\n }\n}\n","import { DivyError } from './errors.js';\n\nconst stringify = (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));\n\nexport interface RequestOptions {\n method?: 'GET' | 'POST' | 'PATCH';\n body?: unknown;\n apiKey?: string;\n}\n\nexport async function apiRequest<T = unknown>(apiUrl: string, path: string, options: RequestOptions = {}): Promise<T> {\n const headers: Record<string, string> = {};\n if (options.body !== undefined) headers['content-type'] = 'application/json';\n if (options.apiKey) headers.authorization = `Bearer ${options.apiKey}`;\n\n const res = await fetch(`${apiUrl}${path}`, {\n method: options.method ?? (options.body !== undefined ? 'POST' : 'GET'),\n headers,\n body: options.body !== undefined ? stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let json: any;\n try {\n json = text ? JSON.parse(text) : {};\n } catch {\n // A gateway or proxy in front of the API (Render, Cloudflare, ...) can return an HTML\n // error page instead of JSON, typically on a 502/504 while the API is cold-starting or down.\n throw new DivyError(`${apiUrl} returned a non-JSON response (HTTP ${res.status} ${res.statusText}): the API may be down or restarting`, res.status);\n }\n if (!res.ok) {\n throw new DivyError(typeof json.error === 'string' ? json.error : res.statusText, res.status);\n }\n return json as T;\n}\n","import type {\n AgentLaunch, AgentRecord, HealthResult, InfoResult, LaunchListItem, LeaderboardEntry, QuoteResult, Tx,\n} from './types.js';\n\nconst big = (v: unknown): bigint => BigInt(v as string);\nconst bigOrNull = (v: unknown): bigint | null => (v === null || v === undefined ? null : big(v));\n\nexport function parseInfo(j: any): InfoResult {\n return {\n chain: j.chain,\n registry: j.registry,\n factory: j.factory,\n escrow: j.escrow,\n hostedWallets: j.hostedWallets,\n feePolicy: {\n treasury: j.feePolicy.treasury,\n divyBps: j.feePolicy.divyBps === null || j.feePolicy.divyBps === undefined ? null : Number(j.feePolicy.divyBps),\n agentShareOfBaseFee: j.feePolicy.agentShareOfBaseFee,\n ponsShare: j.feePolicy.ponsShare,\n divyShare: j.feePolicy.divyShare,\n },\n launchFee: { wei: big(j.launchFee.wei), eth: j.launchFee.eth },\n maxCreatorTaxBps: j.maxCreatorTaxBps,\n economics: j.economics,\n indexedBlock: bigOrNull(j.indexedBlock),\n keeper: j.keeper,\n };\n}\n\nfunction parseAgentLaunch(l: any): AgentLaunch {\n return {\n token: l.token,\n symbol: l.symbol,\n name: l.name,\n curve: l.curve,\n pairToken: l.pairToken,\n graduated: l.graduated,\n launchedAt: l.launchedAt,\n recorded: l.recorded,\n };\n}\n\nexport function parseAgentRecord(j: any): AgentRecord {\n return {\n agent: j.agent,\n split: j.split,\n registered: j.registered,\n record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score },\n fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },\n launches: j.launches.map(parseAgentLaunch),\n ...(j.balanceEth !== undefined ? { balanceEth: j.balanceEth } : {}),\n ...(j.payout !== undefined ? { payout: j.payout } : {}),\n ...(j.label !== undefined ? { label: j.label } : {}),\n };\n}\n\nexport function parseLeaderboard(j: any[]): LeaderboardEntry[] {\n return j.map((r) => ({ agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score, feesEth: big(r.feesEth) }));\n}\n\nexport function parseLaunches(j: any[]): LaunchListItem[] {\n return j.map((r) => ({\n token: r.token, agent: r.agent, split: r.split, curve: r.curve, pairToken: r.pairToken,\n name: r.name, symbol: r.symbol, launchedBlock: r.launchedBlock, launchedAt: r.launchedAt,\n recorded: r.recorded, graduated: r.graduated,\n }));\n}\n\nexport function parseHealth(j: any): HealthResult {\n return { ok: j.ok, indexedBlock: bigOrNull(j.indexedBlock), head: big(j.head), lag: bigOrNull(j.lag) };\n}\n\nfunction parseTx(t: any): Tx {\n return { to: t.to, data: t.data, value: big(t.value) };\n}\n\nexport function parseQuote(j: any): QuoteResult {\n return {\n curve: j.curve,\n amountIn: big(j.amountIn),\n amountOut: big(j.amountOut),\n minOut: big(j.minOut),\n feeBps: j.feeBps,\n creatorTaxBps: j.creatorTaxBps,\n snipeTaxBps: j.snipeTaxBps,\n tx: parseTx(j.tx),\n approveTx: j.approveTx ? parseTx(j.approveTx) : null,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAEO;AAEP,sBAAoC;;;ACJpC,kBAA4B;AAGrB,IAAM,WAAW;AACjB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AACxB,IAAM,eAAe;AAErB,IAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AACf;AAEO,SAAS,gBAAgB,SAAiB,iBAAiB;AAChE,aAAO,yBAAY;AAAA,IACjB,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,gBAAgB,EAAE,MAAM,SAAS,QAAQ,OAAO,UAAU,GAAG;AAAA,IAC7D,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;AAAA,IACvC,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,KAAK,aAAa,EAAE;AAAA,EACvE,CAAC;AACH;AAEO,SAAS,WAAW,MAAsB;AAC/C,SAAO,GAAG,YAAY,OAAO,IAAI;AACnC;AAEO,SAAS,gBAAgB,SAAyB;AACvD,SAAO,GAAG,YAAY,YAAY,OAAO;AAC3C;;;AC9BO,IAAM,WAAW;AAAA,EACtB;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,MACnC,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,MACxC,EAAE,MAAM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AChE,SAAO,IAAI,KAAK,OAAO;AACzB;","names":["import_viem"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts","../src/chain.ts","../src/abi.ts","../src/errors.ts","../src/http.ts","../src/parse.ts"],"sourcesContent":["export { createDivy, Divy } from './client.js';\nexport { DivyError } from './errors.js';\nexport { addresses, defineDivyChain, explorerAddress, explorerTx, CHAIN_ID, DEFAULT_API_URL, DEFAULT_RPC_URL } from './chain.js';\nexport type {\n Address, Hex, Tx,\n CreateDivyOptions, CreateDivySelfCustody, CreateDivyHosted, CreateDivyReadOnly, DivyMode,\n CreateHostedAgentParams, CreateHostedAgentResult,\n InfoResult, FeePolicy, AgentRecord, AgentLaunch, LeaderboardEntry, LaunchListItem, HealthResult,\n QuoteParams, QuoteResult, RegisterResult, LaunchParams, LaunchResult, RecordResult,\n TradeParams, BuyParams, SellParams, TradeResult, HarvestResult, WaitForRecordOptions,\n} from './types.js';\n","import {\n createPublicClient, createWalletClient, http, encodeFunctionData, decodeEventLog, zeroAddress,\n} from 'viem';\nimport type { Address, Hex } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { addresses, defineDivyChain } from './chain.js';\nimport { curveAbi, factoryTokenLaunchedAbi } from './abi.js';\nimport { DivyError } from './errors.js';\nimport { apiRequest } from './http.js';\nimport {\n parseAgentRecord, parseHealth, parseInfo, parseLaunches, parseLeaderboard, parseQuote,\n} from './parse.js';\nimport type {\n AgentRecord, BuyParams, CreateDivyOptions, CreateHostedAgentParams, CreateHostedAgentResult, DivyMode, HarvestResult, HealthResult, InfoResult,\n LaunchListItem, LaunchParams, LaunchResult, LeaderboardEntry, QuoteParams, QuoteResult, RecordResult,\n RegisterResult, SellParams, TradeResult, Tx, WaitForRecordOptions,\n} from './types.js';\n\nconst PRIVATE_KEY_RE = /^0x[0-9a-fA-F]{64}$/;\nconst BPS_DENOM = 10000n;\n\nfunction readAmount(amount: bigint | string): bigint {\n return typeof amount === 'bigint' ? amount : BigInt(amount);\n}\n\nexport class Divy {\n readonly mode: DivyMode;\n readonly apiUrl: string;\n\n private readonly apiKey?: string;\n private readonly account?: ReturnType<typeof privateKeyToAccount>;\n // viem's client generics resist a clean stored type across the three constructor branches;\n // both are only ever touched through sendLocal(), which fixes the call shape in one place.\n private readonly wallet?: any;\n private readonly pub?: any;\n private readonly chain?: ReturnType<typeof defineDivyChain>;\n\n constructor(options: CreateDivyOptions) {\n const hasPrivateKey = 'privateKey' in options && options.privateKey !== undefined;\n const hasApiKey = 'apiKey' in options && options.apiKey !== undefined;\n if (hasPrivateKey && hasApiKey) {\n throw new Error('pass either privateKey or apiKey to createDivy, not both');\n }\n\n this.apiUrl = options.apiUrl ?? addresses.apiUrl;\n\n if (hasPrivateKey) {\n const { privateKey, rpcUrl } = options as { privateKey: Hex; rpcUrl?: string };\n if (!PRIVATE_KEY_RE.test(privateKey)) {\n throw new Error('privateKey must be a 0x-prefixed 32-byte hex string');\n }\n this.mode = 'self-custody';\n this.account = privateKeyToAccount(privateKey);\n this.chain = defineDivyChain(rpcUrl ?? addresses.rpcUrl);\n const transport = http(rpcUrl ?? addresses.rpcUrl);\n this.wallet = createWalletClient({ account: this.account, chain: this.chain, transport });\n this.pub = createPublicClient({ chain: this.chain, transport });\n } else if (hasApiKey) {\n const { apiKey } = options as { apiKey: string };\n if (typeof apiKey !== 'string' || apiKey.length === 0) {\n throw new Error('apiKey must be a non-empty string');\n }\n this.mode = 'hosted';\n this.apiKey = apiKey;\n } else {\n this.mode = 'read-only';\n }\n }\n\n private requireSigner(action: string): void {\n if (this.mode === 'read-only') {\n throw new Error(`${action} requires a privateKey (self-custody) or apiKey (hosted) — this client is read-only`);\n }\n }\n\n private async sendLocal(tx: Tx) {\n if (!this.wallet || !this.pub || !this.account) throw new Error('self-custody wallet is not configured');\n const hash = await this.wallet.sendTransaction({\n account: this.account, chain: this.chain, to: tx.to, data: tx.data, value: tx.value,\n });\n const receipt = await this.pub.waitForTransactionReceipt({ hash });\n if (receipt.status !== 'success') throw new Error(`transaction reverted on-chain: ${hash}`);\n return receipt;\n }\n\n async buildTx<T = Record<string, unknown>>(path: string, body?: object): Promise<T> {\n return apiRequest<T>(this.apiUrl, path, { body: body ?? {} });\n }\n\n async info(): Promise<InfoResult> {\n return parseInfo(await apiRequest(this.apiUrl, '/'));\n }\n\n async agent(address?: Address): Promise<AgentRecord> {\n if (!address) {\n if (this.mode === 'hosted') {\n return parseAgentRecord(await apiRequest(this.apiUrl, '/me', { apiKey: this.apiKey }));\n }\n if (this.mode === 'self-custody' && this.account) {\n address = this.account.address;\n } else {\n throw new Error('agent() requires an address in read-only mode');\n }\n }\n return parseAgentRecord(await apiRequest(this.apiUrl, `/agents/${address}`));\n }\n\n async leaderboard(): Promise<LeaderboardEntry[]> {\n return parseLeaderboard(await apiRequest(this.apiUrl, '/leaderboard'));\n }\n\n async launches(options: { limit?: number } = {}): Promise<LaunchListItem[]> {\n const qs = options.limit ? `?limit=${options.limit}` : '';\n return parseLaunches(await apiRequest(this.apiUrl, `/launches${qs}`));\n }\n\n async health(): Promise<HealthResult> {\n return parseHealth(await apiRequest(this.apiUrl, '/health'));\n }\n\n // Creates a fresh hosted wallet on the API. Needs no credential, so an agent can bootstrap\n // itself from a read-only client, then continue with createDivy({ apiKey }).\n async createHostedAgent(params: CreateHostedAgentParams = {}): Promise<CreateHostedAgentResult> {\n const body: Record<string, unknown> = {};\n if (params.payout) body.payout = params.payout;\n if (params.label) body.label = params.label;\n return apiRequest<CreateHostedAgentResult>(this.apiUrl, '/agents', { body });\n }\n\n async register(): Promise<RegisterResult> {\n this.requireSigner('register');\n\n if (this.mode === 'hosted') {\n const me = await apiRequest<{ registered: boolean; split: Address | null }>(this.apiUrl, '/me', { apiKey: this.apiKey });\n if (me.registered) return { registered: true, split: me.split };\n return { registered: false, split: null };\n }\n\n const address = this.account!.address;\n const first = await apiRequest<{ registered: boolean; split: Address; tx?: Tx }>(this.apiUrl, '/agents', {\n body: { address },\n });\n if (first.registered) return { registered: true, split: first.split };\n\n const receipt = await this.sendLocal({ to: first.tx!.to, data: first.tx!.data, value: BigInt(first.tx!.value ?? 0) });\n const after = await apiRequest<{ registered: boolean; split: Address }>(this.apiUrl, '/agents', { body: { address } });\n return { registered: after.registered, split: after.split, txHash: receipt.transactionHash };\n }\n\n async quote(params: QuoteParams): Promise<QuoteResult> {\n let recipient = params.recipient;\n if (!recipient && this.mode === 'self-custody' && this.account) recipient = this.account.address;\n return parseQuote(\n await apiRequest(this.apiUrl, '/quote', {\n body: {\n curve: params.curve, token: params.token, side: params.side,\n amount: readAmount(params.amount).toString(), recipient: recipient ?? zeroAddress,\n },\n }),\n );\n }\n\n async launch(params: LaunchParams): Promise<LaunchResult> {\n this.requireSigner('launch');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ token: Address; curve: Address; txHash: Hex }>(this.apiUrl, '/launch', {\n apiKey: this.apiKey, body: params,\n });\n return { token: out.token, curve: out.curve, txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/launch', { body: { ...params, agent: address } });\n const receipt = await this.sendLocal(built.tx);\n\n let launched: { token: Address; curve: Address } | undefined;\n for (const log of receipt.logs) {\n try {\n const ev = decodeEventLog({ abi: factoryTokenLaunchedAbi, data: log.data, topics: log.topics });\n if (ev.eventName === 'TokenLaunched') { launched = ev.args as { token: Address; curve: Address }; break; }\n } catch { /* not a TokenLaunched log */ }\n }\n if (!launched) throw new Error(`launch mined (${receipt.transactionHash}) but no TokenLaunched event was found`);\n\n const result: LaunchResult = { token: launched.token, curve: launched.curve, txHash: receipt.transactionHash };\n try {\n const recorded = await this.record(launched.token);\n result.recordTxHash = recorded.txHash;\n } catch (e) {\n result.recordError = e instanceof Error ? e.message : String(e);\n }\n return result;\n }\n\n async record(token: Address): Promise<RecordResult> {\n if (this.mode !== 'self-custody') {\n throw new Error(\n 'record() requires self-custody (a privateKey): hosted and read-only launches are recorded '\n + 'automatically by Divy\\'s keeper within about a minute — use waitForRecord() to wait for it',\n );\n }\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/record', { body: { token } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async buy(params: BuyParams): Promise<TradeResult> {\n return this.trade('buy', readAmount(params.amountWei), params);\n }\n\n async sell(params: SellParams): Promise<TradeResult> {\n return this.trade('sell', readAmount(params.amountTokens), params);\n }\n\n private async trade(side: 'buy' | 'sell', amount: bigint, params: BuyParams | SellParams): Promise<TradeResult> {\n this.requireSigner(side);\n const slippageBps = params.slippageBps ?? 100;\n\n if (this.mode === 'hosted') {\n if (slippageBps !== 100) {\n throw new Error('slippageBps is not configurable in hosted mode: /trade hardcodes a 1% (100bps) slippage floor');\n }\n const out = await apiRequest<{ txHash: Hex; amountOut: string }>(this.apiUrl, '/trade', {\n apiKey: this.apiKey, body: { curve: params.curve, token: params.token, side, amount: amount.toString() },\n });\n return { txHash: out.txHash, amountOut: BigInt(out.amountOut) };\n }\n\n const address = this.account!.address;\n const q = await this.quote({ curve: params.curve, token: params.token, side, amount, recipient: address });\n\n let tradeTx = q.tx;\n if (slippageBps !== 100) {\n const minOut = (q.amountOut * (BPS_DENOM - BigInt(slippageBps))) / BPS_DENOM;\n const data = encodeFunctionData({ abi: curveAbi, functionName: side, args: [q.amountIn, minOut, address] });\n tradeTx = { ...q.tx, data };\n }\n\n if (q.approveTx) await this.sendLocal(q.approveTx);\n const receipt = await this.sendLocal(tradeTx);\n return { txHash: receipt.transactionHash, amountOut: q.amountOut };\n }\n\n async harvest(): Promise<HarvestResult> {\n this.requireSigner('harvest');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ txHash: Hex }>(this.apiUrl, '/harvest', { apiKey: this.apiKey, body: {} });\n return { txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/harvest', { body: { agent: address } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n // Own-wallet launches only: tell the API about a launch tx you mined yourself so the record\n // updates now instead of on the indexer's next pass.\n async confirmLaunch(txHash: Hex): Promise<{ token: Address; curve: Address; txHash: Hex; agent: Address | null; recorded: boolean }> {\n return apiRequest(this.apiUrl, '/launches/confirm', { body: { txHash } });\n }\n\n async waitForRecord(token: Address, options: WaitForRecordOptions = {}): Promise<LaunchListItem> {\n const timeoutMs = options.timeoutMs ?? 60_000;\n const intervalMs = options.intervalMs ?? 3_000;\n const deadline = Date.now() + timeoutMs;\n const wanted = token.toLowerCase();\n\n for (;;) {\n const rows = await this.launches({ limit: 200 });\n const row = rows.find((r) => r.token.toLowerCase() === wanted);\n if (row?.recorded) return row;\n if (Date.now() >= deadline) {\n throw new DivyError(`timed out waiting for ${token} to be recorded`, 408);\n }\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n\nexport function createDivy(options: CreateDivyOptions = {}): Divy {\n return new Divy(options);\n}\n","import { defineChain } from 'viem';\nimport type { Address } from 'viem';\n\nexport const CHAIN_ID = 4663;\nexport const DEFAULT_RPC_URL = 'https://rpc.mainnet.chain.robinhood.com';\nexport const DEFAULT_API_URL = 'https://divy-api-j8di.onrender.com';\nexport const EXPLORER_URL = 'https://robinhoodchain.blockscout.com';\n\nexport const addresses = {\n chainId: CHAIN_ID,\n registry: '0x0fEf638d8C88e6eD38eDcD9aB21BF39D083c8B1b' as Address,\n factory: '0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e' as Address,\n escrow: '0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e' as Address,\n rpcUrl: DEFAULT_RPC_URL,\n apiUrl: DEFAULT_API_URL,\n explorerUrl: EXPLORER_URL,\n} as const;\n\nexport function defineDivyChain(rpcUrl: string = DEFAULT_RPC_URL) {\n return defineChain({\n id: CHAIN_ID,\n name: 'robinhood-chain',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: { default: { http: [rpcUrl] } },\n blockExplorers: { default: { name: 'Blockscout', url: EXPLORER_URL } },\n });\n}\n\nexport function explorerTx(hash: string): string {\n return `${EXPLORER_URL}/tx/${hash}`;\n}\n\nexport function explorerAddress(address: string): string {\n return `${EXPLORER_URL}/address/${address}`;\n}\n","// Minimal ABIs: the API returns pre-encoded {to, data, value} for every write, so the SDK\n// only needs to encode locally when overriding the API's default 1% slippage floor, and to\n// decode the TokenLaunched event off a launch receipt.\n\nexport const curveAbi = [\n {\n type: 'function',\n name: 'buy',\n stateMutability: 'payable',\n inputs: [\n { name: 'quoteIn', type: 'uint256' },\n { name: 'minTokensOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'tokensOut', type: 'uint256' }],\n },\n {\n type: 'function',\n name: 'sell',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'tokensIn', type: 'uint256' },\n { name: 'minQuoteOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'quoteOut', type: 'uint256' }],\n },\n] as const;\n\nexport const factoryTokenLaunchedAbi = [\n {\n type: 'event',\n name: 'TokenLaunched',\n inputs: [\n { indexed: true, name: 'token', type: 'address' },\n { indexed: true, name: 'curve', type: 'address' },\n { indexed: true, name: 'deployer', type: 'address' },\n { indexed: false, name: 'pairToken', type: 'address' },\n { indexed: false, name: 'launchConfigId', type: 'uint256' },\n { indexed: false, name: 'graduationThreshold', type: 'uint256' },\n ],\n },\n] as const;\n","export class DivyError extends Error {\n readonly status: number;\n\n constructor(message: string, status: number) {\n super(message);\n this.name = 'DivyError';\n this.status = status;\n }\n}\n","import { DivyError } from './errors.js';\n\nconst stringify = (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));\n\nexport interface RequestOptions {\n method?: 'GET' | 'POST' | 'PATCH';\n body?: unknown;\n apiKey?: string;\n}\n\nexport async function apiRequest<T = unknown>(apiUrl: string, path: string, options: RequestOptions = {}): Promise<T> {\n const headers: Record<string, string> = {};\n if (options.body !== undefined) headers['content-type'] = 'application/json';\n if (options.apiKey) headers.authorization = `Bearer ${options.apiKey}`;\n\n const res = await fetch(`${apiUrl}${path}`, {\n method: options.method ?? (options.body !== undefined ? 'POST' : 'GET'),\n headers,\n body: options.body !== undefined ? stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let json: any;\n try {\n json = text ? JSON.parse(text) : {};\n } catch {\n // A gateway or proxy in front of the API (Render, Cloudflare, ...) can return an HTML\n // error page instead of JSON, typically on a 502/504 while the API is cold-starting or down.\n throw new DivyError(`${apiUrl} returned a non-JSON response (HTTP ${res.status} ${res.statusText}): the API may be down or restarting`, res.status);\n }\n if (!res.ok) {\n throw new DivyError(typeof json.error === 'string' ? json.error : res.statusText, res.status);\n }\n return json as T;\n}\n","import type {\n AgentLaunch, AgentRecord, HealthResult, InfoResult, LaunchListItem, LeaderboardEntry, QuoteResult, Tx,\n} from './types.js';\n\nconst big = (v: unknown): bigint => BigInt(v as string);\nconst bigOrNull = (v: unknown): bigint | null => (v === null || v === undefined ? null : big(v));\n\nexport function parseInfo(j: any): InfoResult {\n return {\n chain: j.chain,\n registry: j.registry,\n factory: j.factory,\n escrow: j.escrow,\n hostedWallets: j.hostedWallets,\n feePolicy: {\n treasury: j.feePolicy.treasury,\n divyBps: j.feePolicy.divyBps === null || j.feePolicy.divyBps === undefined ? null : Number(j.feePolicy.divyBps),\n agentShareOfBaseFee: j.feePolicy.agentShareOfBaseFee,\n ponsShare: j.feePolicy.ponsShare,\n divyShare: j.feePolicy.divyShare,\n },\n launchFee: { wei: big(j.launchFee.wei), eth: j.launchFee.eth },\n maxCreatorTaxBps: j.maxCreatorTaxBps,\n economics: j.economics,\n indexedBlock: bigOrNull(j.indexedBlock),\n keeper: j.keeper,\n };\n}\n\nfunction parseAgentLaunch(l: any): AgentLaunch {\n return {\n token: l.token,\n symbol: l.symbol,\n name: l.name,\n curve: l.curve,\n pairToken: l.pairToken,\n graduated: l.graduated,\n launchedAt: l.launchedAt,\n recorded: l.recorded,\n retention: l.retention ?? null, retentionProvisional: l.retentionProvisional ?? false, retentionPending: l.retentionPending ?? false,\n earlyHolders: l.earlyHolders ?? null, retained: l.retained ?? null,\n };\n}\n\nexport function parseAgentRecord(j: any): AgentRecord {\n return {\n agent: j.agent,\n split: j.split,\n registered: j.registered,\n record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score, graduationRate: j.record.graduationRate ?? j.record.score },\n fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },\n launches: j.launches.map(parseAgentLaunch),\n ...(j.balanceEth !== undefined ? { balanceEth: j.balanceEth } : {}),\n ...(j.payout !== undefined ? { payout: j.payout } : {}),\n ...(j.label !== undefined ? { label: j.label } : {}),\n };\n}\n\nexport function parseLeaderboard(j: any[]): LeaderboardEntry[] {\n return j.map((r) => ({\n agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score,\n graduationRate: r.graduationRate ?? r.score, retention: r.retention ?? null,\n retentionProvisional: r.retentionProvisional ?? false, feesEth: big(r.feesEth),\n }));\n}\n\nexport function parseLaunches(j: any[]): LaunchListItem[] {\n return j.map((r) => ({\n token: r.token, agent: r.agent, split: r.split, curve: r.curve, pairToken: r.pairToken,\n name: r.name, symbol: r.symbol, launchedBlock: r.launchedBlock, launchedAt: r.launchedAt,\n recorded: r.recorded, graduated: r.graduated,\n retention: r.retention ?? null, retentionProvisional: r.retentionProvisional ?? false, retentionPending: r.retentionPending ?? false,\n earlyHolders: r.earlyHolders ?? null, retained: r.retained ?? null,\n }));\n}\n\nexport function parseHealth(j: any): HealthResult {\n const k = j.keeper ?? {};\n return {\n ok: j.ok, rpc: j.rpc ?? true,\n indexedBlock: bigOrNull(j.indexedBlock), head: bigOrNull(j.head), lag: bigOrNull(j.lag),\n keeper: {\n address: k.address ?? null, enabled: !!k.enabled, balanceWei: bigOrNull(k.balanceWei), low: !!k.low,\n spent24hWei: big(k.spent24hWei ?? '0'), dailyBudgetWei: big(k.dailyBudgetWei ?? '0'), lastTickAt: k.lastTickAt ?? null,\n },\n warnings: Array.isArray(j.warnings) ? j.warnings : [],\n };\n}\n\nfunction parseTx(t: any): Tx {\n return { to: t.to, data: t.data, value: big(t.value) };\n}\n\nexport function parseQuote(j: any): QuoteResult {\n return {\n curve: j.curve,\n amountIn: big(j.amountIn),\n amountOut: big(j.amountOut),\n minOut: big(j.minOut),\n feeBps: j.feeBps,\n creatorTaxBps: j.creatorTaxBps,\n snipeTaxBps: j.snipeTaxBps,\n tx: parseTx(j.tx),\n approveTx: j.approveTx ? parseTx(j.approveTx) : null,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAEO;AAEP,sBAAoC;;;ACJpC,kBAA4B;AAGrB,IAAM,WAAW;AACjB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AACxB,IAAM,eAAe;AAErB,IAAM,YAAY;AAAA,EACvB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,aAAa;AACf;AAEO,SAAS,gBAAgB,SAAiB,iBAAiB;AAChE,aAAO,yBAAY;AAAA,IACjB,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,gBAAgB,EAAE,MAAM,SAAS,QAAQ,OAAO,UAAU,GAAG;AAAA,IAC7D,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE;AAAA,IACvC,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,KAAK,aAAa,EAAE;AAAA,EACvE,CAAC;AACH;AAEO,SAAS,WAAW,MAAsB;AAC/C,SAAO,GAAG,YAAY,OAAO,IAAI;AACnC;AAEO,SAAS,gBAAgB,SAAyB;AACvD,SAAO,GAAG,YAAY,YAAY,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;AAC/C,YAAM,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,MAAM,YAAY,MAAM,MAAM;AAC7D,UAAI,KAAK,SAAU,QAAO;AAC1B,UAAI,KAAK,IAAI,KAAK,UAAU;AAC1B,cAAM,IAAI,UAAU,yBAAyB,KAAK,mBAAmB,GAAG;AAAA,MAC1E;AACA,YAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,UAAU,CAAC;AAAA,IAChE;AAAA,EACF;AACF;AAEO,SAAS,WAAW,UAA6B,CAAC,GAAS;AAChE,SAAO,IAAI,KAAK,OAAO;AACzB;","names":["import_viem"]}
package/dist/index.d.cts CHANGED
@@ -22,6 +22,24 @@ interface CreateDivyReadOnly {
22
22
  }
23
23
  type CreateDivyOptions = CreateDivySelfCustody | CreateDivyHosted | CreateDivyReadOnly;
24
24
  type DivyMode = 'self-custody' | 'hosted' | 'read-only';
25
+ interface CreateHostedAgentParams {
26
+ /** Wallet that harvested fees are swept to. Defaults to the hosted wallet itself. */
27
+ payout?: Address;
28
+ label?: string;
29
+ }
30
+ interface CreateHostedAgentResult {
31
+ /** Shown once. Persist it: it is the only credential for this wallet. */
32
+ apiKey: string;
33
+ address: Address;
34
+ payout: Address | null;
35
+ fund: {
36
+ to: Address;
37
+ chainId: number;
38
+ minEth: string;
39
+ note: string;
40
+ };
41
+ next: string;
42
+ }
25
43
  interface FeePolicy {
26
44
  treasury: Address | null;
27
45
  divyBps: number | null;
@@ -55,15 +73,25 @@ interface AgentLaunch {
55
73
  graduated: boolean;
56
74
  launchedAt: number;
57
75
  recorded: boolean;
76
+ /** Share of early holders (wallets holding one day after launch) still holding at the measurement point; null until the launch is a day old. */
77
+ retention: number | null;
78
+ /** True while measured against the chain head because the launch is younger than 30 days. */
79
+ retentionProvisional: boolean;
80
+ /** Older than a day with no measurement yet; weighs zero in the record until measured. */
81
+ retentionPending: boolean;
82
+ earlyHolders: number | null;
83
+ retained: number | null;
58
84
  }
59
85
  interface AgentRecord {
60
86
  agent: Address;
61
87
  split: Address | null;
62
88
  registered: boolean;
89
+ /** score = sum(graduated_i * retention_i) / launches; graduationRate is the unweighted graduated / launches. */
63
90
  record: {
64
91
  launches: bigint;
65
92
  graduated: bigint;
66
93
  score: number;
94
+ graduationRate: number;
67
95
  };
68
96
  fees: {
69
97
  agentEth: bigint;
@@ -80,7 +108,12 @@ interface LeaderboardEntry {
80
108
  agent: Address;
81
109
  launches: number;
82
110
  graduated: number;
111
+ /** Graduation rate weighted by holder retention. */
83
112
  score: number;
113
+ graduationRate: number;
114
+ /** Mean retention over launches that have a measurement; null if none do. */
115
+ retention: number | null;
116
+ retentionProvisional: boolean;
84
117
  feesEth: bigint;
85
118
  }
86
119
  interface LaunchListItem {
@@ -95,12 +128,32 @@ interface LaunchListItem {
95
128
  launchedAt: number;
96
129
  recorded: boolean;
97
130
  graduated: boolean;
131
+ /** Share of early holders (wallets holding one day after launch) still holding at the measurement point; null until the launch is a day old. */
132
+ retention: number | null;
133
+ /** True while measured against the chain head because the launch is younger than 30 days. */
134
+ retentionProvisional: boolean;
135
+ /** Older than a day with no measurement yet; weighs zero in the record until measured. */
136
+ retentionPending: boolean;
137
+ earlyHolders: number | null;
138
+ retained: number | null;
98
139
  }
99
140
  interface HealthResult {
141
+ /** False whenever warnings is non-empty. The endpoint itself always answers 200 once the process is up. */
100
142
  ok: boolean;
143
+ rpc: boolean;
101
144
  indexedBlock: bigint | null;
102
- head: bigint;
145
+ head: bigint | null;
103
146
  lag: bigint | null;
147
+ keeper: {
148
+ address: Address | null;
149
+ enabled: boolean;
150
+ balanceWei: bigint | null;
151
+ low: boolean;
152
+ spent24hWei: bigint;
153
+ dailyBudgetWei: bigint;
154
+ lastTickAt: number | null;
155
+ };
156
+ warnings: string[];
104
157
  }
105
158
  interface QuoteParams {
106
159
  curve?: Address;
@@ -196,6 +249,7 @@ declare class Divy {
196
249
  limit?: number;
197
250
  }): Promise<LaunchListItem[]>;
198
251
  health(): Promise<HealthResult>;
252
+ createHostedAgent(params?: CreateHostedAgentParams): Promise<CreateHostedAgentResult>;
199
253
  register(): Promise<RegisterResult>;
200
254
  quote(params: QuoteParams): Promise<QuoteResult>;
201
255
  launch(params: LaunchParams): Promise<LaunchResult>;
@@ -204,6 +258,13 @@ declare class Divy {
204
258
  sell(params: SellParams): Promise<TradeResult>;
205
259
  private trade;
206
260
  harvest(): Promise<HarvestResult>;
261
+ confirmLaunch(txHash: Hex): Promise<{
262
+ token: Address;
263
+ curve: Address;
264
+ txHash: Hex;
265
+ agent: Address | null;
266
+ recorded: boolean;
267
+ }>;
207
268
  waitForRecord(token: Address, options?: WaitForRecordOptions): Promise<LaunchListItem>;
208
269
  }
209
270
  declare function createDivy(options?: CreateDivyOptions): Divy;
@@ -278,4 +339,4 @@ declare function defineDivyChain(rpcUrl?: string): {
278
339
  declare function explorerTx(hash: string): string;
279
340
  declare function explorerAddress(address: string): string;
280
341
 
281
- export { type AgentLaunch, type AgentRecord, type BuyParams, CHAIN_ID, type CreateDivyHosted, type CreateDivyOptions, type CreateDivyReadOnly, type CreateDivySelfCustody, DEFAULT_API_URL, DEFAULT_RPC_URL, Divy, DivyError, type DivyMode, type FeePolicy, type HarvestResult, type HealthResult, type InfoResult, type LaunchListItem, type LaunchParams, type LaunchResult, type LeaderboardEntry, type QuoteParams, type QuoteResult, type RecordResult, type RegisterResult, type SellParams, type TradeParams, type TradeResult, type Tx, type WaitForRecordOptions, addresses, createDivy, defineDivyChain, explorerAddress, explorerTx };
342
+ export { type AgentLaunch, type AgentRecord, type BuyParams, CHAIN_ID, type CreateDivyHosted, type CreateDivyOptions, type CreateDivyReadOnly, type CreateDivySelfCustody, type CreateHostedAgentParams, type CreateHostedAgentResult, DEFAULT_API_URL, DEFAULT_RPC_URL, Divy, DivyError, type DivyMode, type FeePolicy, type HarvestResult, type HealthResult, type InfoResult, type LaunchListItem, type LaunchParams, type LaunchResult, type LeaderboardEntry, type QuoteParams, type QuoteResult, type RecordResult, type RegisterResult, type SellParams, type TradeParams, type TradeResult, type Tx, type WaitForRecordOptions, addresses, createDivy, defineDivyChain, explorerAddress, explorerTx };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,24 @@ interface CreateDivyReadOnly {
22
22
  }
23
23
  type CreateDivyOptions = CreateDivySelfCustody | CreateDivyHosted | CreateDivyReadOnly;
24
24
  type DivyMode = 'self-custody' | 'hosted' | 'read-only';
25
+ interface CreateHostedAgentParams {
26
+ /** Wallet that harvested fees are swept to. Defaults to the hosted wallet itself. */
27
+ payout?: Address;
28
+ label?: string;
29
+ }
30
+ interface CreateHostedAgentResult {
31
+ /** Shown once. Persist it: it is the only credential for this wallet. */
32
+ apiKey: string;
33
+ address: Address;
34
+ payout: Address | null;
35
+ fund: {
36
+ to: Address;
37
+ chainId: number;
38
+ minEth: string;
39
+ note: string;
40
+ };
41
+ next: string;
42
+ }
25
43
  interface FeePolicy {
26
44
  treasury: Address | null;
27
45
  divyBps: number | null;
@@ -55,15 +73,25 @@ interface AgentLaunch {
55
73
  graduated: boolean;
56
74
  launchedAt: number;
57
75
  recorded: boolean;
76
+ /** Share of early holders (wallets holding one day after launch) still holding at the measurement point; null until the launch is a day old. */
77
+ retention: number | null;
78
+ /** True while measured against the chain head because the launch is younger than 30 days. */
79
+ retentionProvisional: boolean;
80
+ /** Older than a day with no measurement yet; weighs zero in the record until measured. */
81
+ retentionPending: boolean;
82
+ earlyHolders: number | null;
83
+ retained: number | null;
58
84
  }
59
85
  interface AgentRecord {
60
86
  agent: Address;
61
87
  split: Address | null;
62
88
  registered: boolean;
89
+ /** score = sum(graduated_i * retention_i) / launches; graduationRate is the unweighted graduated / launches. */
63
90
  record: {
64
91
  launches: bigint;
65
92
  graduated: bigint;
66
93
  score: number;
94
+ graduationRate: number;
67
95
  };
68
96
  fees: {
69
97
  agentEth: bigint;
@@ -80,7 +108,12 @@ interface LeaderboardEntry {
80
108
  agent: Address;
81
109
  launches: number;
82
110
  graduated: number;
111
+ /** Graduation rate weighted by holder retention. */
83
112
  score: number;
113
+ graduationRate: number;
114
+ /** Mean retention over launches that have a measurement; null if none do. */
115
+ retention: number | null;
116
+ retentionProvisional: boolean;
84
117
  feesEth: bigint;
85
118
  }
86
119
  interface LaunchListItem {
@@ -95,12 +128,32 @@ interface LaunchListItem {
95
128
  launchedAt: number;
96
129
  recorded: boolean;
97
130
  graduated: boolean;
131
+ /** Share of early holders (wallets holding one day after launch) still holding at the measurement point; null until the launch is a day old. */
132
+ retention: number | null;
133
+ /** True while measured against the chain head because the launch is younger than 30 days. */
134
+ retentionProvisional: boolean;
135
+ /** Older than a day with no measurement yet; weighs zero in the record until measured. */
136
+ retentionPending: boolean;
137
+ earlyHolders: number | null;
138
+ retained: number | null;
98
139
  }
99
140
  interface HealthResult {
141
+ /** False whenever warnings is non-empty. The endpoint itself always answers 200 once the process is up. */
100
142
  ok: boolean;
143
+ rpc: boolean;
101
144
  indexedBlock: bigint | null;
102
- head: bigint;
145
+ head: bigint | null;
103
146
  lag: bigint | null;
147
+ keeper: {
148
+ address: Address | null;
149
+ enabled: boolean;
150
+ balanceWei: bigint | null;
151
+ low: boolean;
152
+ spent24hWei: bigint;
153
+ dailyBudgetWei: bigint;
154
+ lastTickAt: number | null;
155
+ };
156
+ warnings: string[];
104
157
  }
105
158
  interface QuoteParams {
106
159
  curve?: Address;
@@ -196,6 +249,7 @@ declare class Divy {
196
249
  limit?: number;
197
250
  }): Promise<LaunchListItem[]>;
198
251
  health(): Promise<HealthResult>;
252
+ createHostedAgent(params?: CreateHostedAgentParams): Promise<CreateHostedAgentResult>;
199
253
  register(): Promise<RegisterResult>;
200
254
  quote(params: QuoteParams): Promise<QuoteResult>;
201
255
  launch(params: LaunchParams): Promise<LaunchResult>;
@@ -204,6 +258,13 @@ declare class Divy {
204
258
  sell(params: SellParams): Promise<TradeResult>;
205
259
  private trade;
206
260
  harvest(): Promise<HarvestResult>;
261
+ confirmLaunch(txHash: Hex): Promise<{
262
+ token: Address;
263
+ curve: Address;
264
+ txHash: Hex;
265
+ agent: Address | null;
266
+ recorded: boolean;
267
+ }>;
207
268
  waitForRecord(token: Address, options?: WaitForRecordOptions): Promise<LaunchListItem>;
208
269
  }
209
270
  declare function createDivy(options?: CreateDivyOptions): Divy;
@@ -278,4 +339,4 @@ declare function defineDivyChain(rpcUrl?: string): {
278
339
  declare function explorerTx(hash: string): string;
279
340
  declare function explorerAddress(address: string): string;
280
341
 
281
- export { type AgentLaunch, type AgentRecord, type BuyParams, CHAIN_ID, type CreateDivyHosted, type CreateDivyOptions, type CreateDivyReadOnly, type CreateDivySelfCustody, DEFAULT_API_URL, DEFAULT_RPC_URL, Divy, DivyError, type DivyMode, type FeePolicy, type HarvestResult, type HealthResult, type InfoResult, type LaunchListItem, type LaunchParams, type LaunchResult, type LeaderboardEntry, type QuoteParams, type QuoteResult, type RecordResult, type RegisterResult, type SellParams, type TradeParams, type TradeResult, type Tx, type WaitForRecordOptions, addresses, createDivy, defineDivyChain, explorerAddress, explorerTx };
342
+ export { type AgentLaunch, type AgentRecord, type BuyParams, CHAIN_ID, type CreateDivyHosted, type CreateDivyOptions, type CreateDivyReadOnly, type CreateDivySelfCustody, type CreateHostedAgentParams, type CreateHostedAgentResult, DEFAULT_API_URL, DEFAULT_RPC_URL, Divy, DivyError, type DivyMode, type FeePolicy, type HarvestResult, type HealthResult, type InfoResult, type LaunchListItem, type LaunchParams, type LaunchResult, type LeaderboardEntry, type QuoteParams, type QuoteResult, type RecordResult, type RegisterResult, type SellParams, type TradeParams, type TradeResult, type Tx, type WaitForRecordOptions, addresses, createDivy, defineDivyChain, explorerAddress, explorerTx };
package/dist/index.js CHANGED
@@ -147,7 +147,12 @@ function parseAgentLaunch(l) {
147
147
  pairToken: l.pairToken,
148
148
  graduated: l.graduated,
149
149
  launchedAt: l.launchedAt,
150
- recorded: l.recorded
150
+ recorded: l.recorded,
151
+ retention: l.retention ?? null,
152
+ retentionProvisional: l.retentionProvisional ?? false,
153
+ retentionPending: l.retentionPending ?? false,
154
+ earlyHolders: l.earlyHolders ?? null,
155
+ retained: l.retained ?? null
151
156
  };
152
157
  }
153
158
  function parseAgentRecord(j) {
@@ -155,7 +160,7 @@ function parseAgentRecord(j) {
155
160
  agent: j.agent,
156
161
  split: j.split,
157
162
  registered: j.registered,
158
- record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score },
163
+ record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score, graduationRate: j.record.graduationRate ?? j.record.score },
159
164
  fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },
160
165
  launches: j.launches.map(parseAgentLaunch),
161
166
  ...j.balanceEth !== void 0 ? { balanceEth: j.balanceEth } : {},
@@ -164,7 +169,16 @@ function parseAgentRecord(j) {
164
169
  };
165
170
  }
166
171
  function parseLeaderboard(j) {
167
- return j.map((r) => ({ agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score, feesEth: big(r.feesEth) }));
172
+ return j.map((r) => ({
173
+ agent: r.agent,
174
+ launches: r.launches,
175
+ graduated: r.graduated,
176
+ score: r.score,
177
+ graduationRate: r.graduationRate ?? r.score,
178
+ retention: r.retention ?? null,
179
+ retentionProvisional: r.retentionProvisional ?? false,
180
+ feesEth: big(r.feesEth)
181
+ }));
168
182
  }
169
183
  function parseLaunches(j) {
170
184
  return j.map((r) => ({
@@ -178,11 +192,33 @@ function parseLaunches(j) {
178
192
  launchedBlock: r.launchedBlock,
179
193
  launchedAt: r.launchedAt,
180
194
  recorded: r.recorded,
181
- graduated: r.graduated
195
+ graduated: r.graduated,
196
+ retention: r.retention ?? null,
197
+ retentionProvisional: r.retentionProvisional ?? false,
198
+ retentionPending: r.retentionPending ?? false,
199
+ earlyHolders: r.earlyHolders ?? null,
200
+ retained: r.retained ?? null
182
201
  }));
183
202
  }
184
203
  function parseHealth(j) {
185
- return { ok: j.ok, indexedBlock: bigOrNull(j.indexedBlock), head: big(j.head), lag: bigOrNull(j.lag) };
204
+ const k = j.keeper ?? {};
205
+ return {
206
+ ok: j.ok,
207
+ rpc: j.rpc ?? true,
208
+ indexedBlock: bigOrNull(j.indexedBlock),
209
+ head: bigOrNull(j.head),
210
+ lag: bigOrNull(j.lag),
211
+ keeper: {
212
+ address: k.address ?? null,
213
+ enabled: !!k.enabled,
214
+ balanceWei: bigOrNull(k.balanceWei),
215
+ low: !!k.low,
216
+ spent24hWei: big(k.spent24hWei ?? "0"),
217
+ dailyBudgetWei: big(k.dailyBudgetWei ?? "0"),
218
+ lastTickAt: k.lastTickAt ?? null
219
+ },
220
+ warnings: Array.isArray(j.warnings) ? j.warnings : []
221
+ };
186
222
  }
187
223
  function parseTx(t) {
188
224
  return { to: t.to, data: t.data, value: big(t.value) };
@@ -293,6 +329,14 @@ var Divy = class {
293
329
  async health() {
294
330
  return parseHealth(await apiRequest(this.apiUrl, "/health"));
295
331
  }
332
+ // Creates a fresh hosted wallet on the API. Needs no credential, so an agent can bootstrap
333
+ // itself from a read-only client, then continue with createDivy({ apiKey }).
334
+ async createHostedAgent(params = {}) {
335
+ const body = {};
336
+ if (params.payout) body.payout = params.payout;
337
+ if (params.label) body.label = params.label;
338
+ return apiRequest(this.apiUrl, "/agents", { body });
339
+ }
296
340
  async register() {
297
341
  this.requireSigner("register");
298
342
  if (this.mode === "hosted") {
@@ -409,6 +453,11 @@ var Divy = class {
409
453
  const receipt = await this.sendLocal(built.tx);
410
454
  return { txHash: receipt.transactionHash };
411
455
  }
456
+ // Own-wallet launches only: tell the API about a launch tx you mined yourself so the record
457
+ // updates now instead of on the indexer's next pass.
458
+ async confirmLaunch(txHash) {
459
+ return apiRequest(this.apiUrl, "/launches/confirm", { body: { txHash } });
460
+ }
412
461
  async waitForRecord(token, options = {}) {
413
462
  const timeoutMs = options.timeoutMs ?? 6e4;
414
463
  const intervalMs = options.intervalMs ?? 3e3;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client.ts","../src/chain.ts","../src/abi.ts","../src/errors.ts","../src/http.ts","../src/parse.ts"],"sourcesContent":["import {\n createPublicClient, createWalletClient, http, encodeFunctionData, decodeEventLog, zeroAddress,\n} from 'viem';\nimport type { Address, Hex } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { addresses, defineDivyChain } from './chain.js';\nimport { curveAbi, factoryTokenLaunchedAbi } from './abi.js';\nimport { DivyError } from './errors.js';\nimport { apiRequest } from './http.js';\nimport {\n parseAgentRecord, parseHealth, parseInfo, parseLaunches, parseLeaderboard, parseQuote,\n} from './parse.js';\nimport type {\n AgentRecord, BuyParams, CreateDivyOptions, DivyMode, HarvestResult, HealthResult, InfoResult,\n LaunchListItem, LaunchParams, LaunchResult, LeaderboardEntry, QuoteParams, QuoteResult, RecordResult,\n RegisterResult, SellParams, TradeResult, Tx, WaitForRecordOptions,\n} from './types.js';\n\nconst PRIVATE_KEY_RE = /^0x[0-9a-fA-F]{64}$/;\nconst BPS_DENOM = 10000n;\n\nfunction readAmount(amount: bigint | string): bigint {\n return typeof amount === 'bigint' ? amount : BigInt(amount);\n}\n\nexport class Divy {\n readonly mode: DivyMode;\n readonly apiUrl: string;\n\n private readonly apiKey?: string;\n private readonly account?: ReturnType<typeof privateKeyToAccount>;\n // viem's client generics resist a clean stored type across the three constructor branches;\n // both are only ever touched through sendLocal(), which fixes the call shape in one place.\n private readonly wallet?: any;\n private readonly pub?: any;\n private readonly chain?: ReturnType<typeof defineDivyChain>;\n\n constructor(options: CreateDivyOptions) {\n const hasPrivateKey = 'privateKey' in options && options.privateKey !== undefined;\n const hasApiKey = 'apiKey' in options && options.apiKey !== undefined;\n if (hasPrivateKey && hasApiKey) {\n throw new Error('pass either privateKey or apiKey to createDivy, not both');\n }\n\n this.apiUrl = options.apiUrl ?? addresses.apiUrl;\n\n if (hasPrivateKey) {\n const { privateKey, rpcUrl } = options as { privateKey: Hex; rpcUrl?: string };\n if (!PRIVATE_KEY_RE.test(privateKey)) {\n throw new Error('privateKey must be a 0x-prefixed 32-byte hex string');\n }\n this.mode = 'self-custody';\n this.account = privateKeyToAccount(privateKey);\n this.chain = defineDivyChain(rpcUrl ?? addresses.rpcUrl);\n const transport = http(rpcUrl ?? addresses.rpcUrl);\n this.wallet = createWalletClient({ account: this.account, chain: this.chain, transport });\n this.pub = createPublicClient({ chain: this.chain, transport });\n } else if (hasApiKey) {\n const { apiKey } = options as { apiKey: string };\n if (typeof apiKey !== 'string' || apiKey.length === 0) {\n throw new Error('apiKey must be a non-empty string');\n }\n this.mode = 'hosted';\n this.apiKey = apiKey;\n } else {\n this.mode = 'read-only';\n }\n }\n\n private requireSigner(action: string): void {\n if (this.mode === 'read-only') {\n throw new Error(`${action} requires a privateKey (self-custody) or apiKey (hosted) — this client is read-only`);\n }\n }\n\n private async sendLocal(tx: Tx) {\n if (!this.wallet || !this.pub || !this.account) throw new Error('self-custody wallet is not configured');\n const hash = await this.wallet.sendTransaction({\n account: this.account, chain: this.chain, to: tx.to, data: tx.data, value: tx.value,\n });\n const receipt = await this.pub.waitForTransactionReceipt({ hash });\n if (receipt.status !== 'success') throw new Error(`transaction reverted on-chain: ${hash}`);\n return receipt;\n }\n\n async buildTx<T = Record<string, unknown>>(path: string, body?: object): Promise<T> {\n return apiRequest<T>(this.apiUrl, path, { body: body ?? {} });\n }\n\n async info(): Promise<InfoResult> {\n return parseInfo(await apiRequest(this.apiUrl, '/'));\n }\n\n async agent(address?: Address): Promise<AgentRecord> {\n if (!address) {\n if (this.mode === 'hosted') {\n return parseAgentRecord(await apiRequest(this.apiUrl, '/me', { apiKey: this.apiKey }));\n }\n if (this.mode === 'self-custody' && this.account) {\n address = this.account.address;\n } else {\n throw new Error('agent() requires an address in read-only mode');\n }\n }\n return parseAgentRecord(await apiRequest(this.apiUrl, `/agents/${address}`));\n }\n\n async leaderboard(): Promise<LeaderboardEntry[]> {\n return parseLeaderboard(await apiRequest(this.apiUrl, '/leaderboard'));\n }\n\n async launches(options: { limit?: number } = {}): Promise<LaunchListItem[]> {\n const qs = options.limit ? `?limit=${options.limit}` : '';\n return parseLaunches(await apiRequest(this.apiUrl, `/launches${qs}`));\n }\n\n async health(): Promise<HealthResult> {\n return parseHealth(await apiRequest(this.apiUrl, '/health'));\n }\n\n async register(): Promise<RegisterResult> {\n this.requireSigner('register');\n\n if (this.mode === 'hosted') {\n const me = await apiRequest<{ registered: boolean; split: Address | null }>(this.apiUrl, '/me', { apiKey: this.apiKey });\n if (me.registered) return { registered: true, split: me.split };\n return { registered: false, split: null };\n }\n\n const address = this.account!.address;\n const first = await apiRequest<{ registered: boolean; split: Address; tx?: Tx }>(this.apiUrl, '/agents', {\n body: { address },\n });\n if (first.registered) return { registered: true, split: first.split };\n\n const receipt = await this.sendLocal({ to: first.tx!.to, data: first.tx!.data, value: BigInt(first.tx!.value ?? 0) });\n const after = await apiRequest<{ registered: boolean; split: Address }>(this.apiUrl, '/agents', { body: { address } });\n return { registered: after.registered, split: after.split, txHash: receipt.transactionHash };\n }\n\n async quote(params: QuoteParams): Promise<QuoteResult> {\n let recipient = params.recipient;\n if (!recipient && this.mode === 'self-custody' && this.account) recipient = this.account.address;\n return parseQuote(\n await apiRequest(this.apiUrl, '/quote', {\n body: {\n curve: params.curve, token: params.token, side: params.side,\n amount: readAmount(params.amount).toString(), recipient: recipient ?? zeroAddress,\n },\n }),\n );\n }\n\n async launch(params: LaunchParams): Promise<LaunchResult> {\n this.requireSigner('launch');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ token: Address; curve: Address; txHash: Hex }>(this.apiUrl, '/launch', {\n apiKey: this.apiKey, body: params,\n });\n return { token: out.token, curve: out.curve, txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/launch', { body: { ...params, agent: address } });\n const receipt = await this.sendLocal(built.tx);\n\n let launched: { token: Address; curve: Address } | undefined;\n for (const log of receipt.logs) {\n try {\n const ev = decodeEventLog({ abi: factoryTokenLaunchedAbi, data: log.data, topics: log.topics });\n if (ev.eventName === 'TokenLaunched') { launched = ev.args as { token: Address; curve: Address }; break; }\n } catch { /* not a TokenLaunched log */ }\n }\n if (!launched) throw new Error(`launch mined (${receipt.transactionHash}) but no TokenLaunched event was found`);\n\n const result: LaunchResult = { token: launched.token, curve: launched.curve, txHash: receipt.transactionHash };\n try {\n const recorded = await this.record(launched.token);\n result.recordTxHash = recorded.txHash;\n } catch (e) {\n result.recordError = e instanceof Error ? e.message : String(e);\n }\n return result;\n }\n\n async record(token: Address): Promise<RecordResult> {\n if (this.mode !== 'self-custody') {\n throw new Error(\n 'record() requires self-custody (a privateKey): hosted and read-only launches are recorded '\n + 'automatically by Divy\\'s keeper within about a minute — use waitForRecord() to wait for it',\n );\n }\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/record', { body: { token } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async buy(params: BuyParams): Promise<TradeResult> {\n return this.trade('buy', readAmount(params.amountWei), params);\n }\n\n async sell(params: SellParams): Promise<TradeResult> {\n return this.trade('sell', readAmount(params.amountTokens), params);\n }\n\n private async trade(side: 'buy' | 'sell', amount: bigint, params: BuyParams | SellParams): Promise<TradeResult> {\n this.requireSigner(side);\n const slippageBps = params.slippageBps ?? 100;\n\n if (this.mode === 'hosted') {\n if (slippageBps !== 100) {\n throw new Error('slippageBps is not configurable in hosted mode: /trade hardcodes a 1% (100bps) slippage floor');\n }\n const out = await apiRequest<{ txHash: Hex; amountOut: string }>(this.apiUrl, '/trade', {\n apiKey: this.apiKey, body: { curve: params.curve, token: params.token, side, amount: amount.toString() },\n });\n return { txHash: out.txHash, amountOut: BigInt(out.amountOut) };\n }\n\n const address = this.account!.address;\n const q = await this.quote({ curve: params.curve, token: params.token, side, amount, recipient: address });\n\n let tradeTx = q.tx;\n if (slippageBps !== 100) {\n const minOut = (q.amountOut * (BPS_DENOM - BigInt(slippageBps))) / BPS_DENOM;\n const data = encodeFunctionData({ abi: curveAbi, functionName: side, args: [q.amountIn, minOut, address] });\n tradeTx = { ...q.tx, data };\n }\n\n if (q.approveTx) await this.sendLocal(q.approveTx);\n const receipt = await this.sendLocal(tradeTx);\n return { txHash: receipt.transactionHash, amountOut: q.amountOut };\n }\n\n async harvest(): Promise<HarvestResult> {\n this.requireSigner('harvest');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ txHash: Hex }>(this.apiUrl, '/harvest', { apiKey: this.apiKey, body: {} });\n return { txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/harvest', { body: { agent: address } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async waitForRecord(token: Address, options: WaitForRecordOptions = {}): Promise<LaunchListItem> {\n const timeoutMs = options.timeoutMs ?? 60_000;\n const intervalMs = options.intervalMs ?? 3_000;\n const deadline = Date.now() + timeoutMs;\n const wanted = token.toLowerCase();\n\n for (;;) {\n const rows = await this.launches({ limit: 200 });\n const row = rows.find((r) => r.token.toLowerCase() === wanted);\n if (row?.recorded) return row;\n if (Date.now() >= deadline) {\n throw new DivyError(`timed out waiting for ${token} to be recorded`, 408);\n }\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n\nexport function createDivy(options: CreateDivyOptions = {}): Divy {\n return new Divy(options);\n}\n","import { defineChain } from 'viem';\nimport type { Address } from 'viem';\n\nexport const CHAIN_ID = 4663;\nexport const DEFAULT_RPC_URL = 'https://rpc.mainnet.chain.robinhood.com';\nexport const DEFAULT_API_URL = 'https://divy-api-j8di.onrender.com';\nexport const EXPLORER_URL = 'https://robinhoodchain.blockscout.com';\n\nexport const addresses = {\n chainId: CHAIN_ID,\n registry: '0x0fEf638d8C88e6eD38eDcD9aB21BF39D083c8B1b' as Address,\n factory: '0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e' as Address,\n escrow: '0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e' as Address,\n rpcUrl: DEFAULT_RPC_URL,\n apiUrl: DEFAULT_API_URL,\n explorerUrl: EXPLORER_URL,\n} as const;\n\nexport function defineDivyChain(rpcUrl: string = DEFAULT_RPC_URL) {\n return defineChain({\n id: CHAIN_ID,\n name: 'robinhood-chain',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: { default: { http: [rpcUrl] } },\n blockExplorers: { default: { name: 'Blockscout', url: EXPLORER_URL } },\n });\n}\n\nexport function explorerTx(hash: string): string {\n return `${EXPLORER_URL}/tx/${hash}`;\n}\n\nexport function explorerAddress(address: string): string {\n return `${EXPLORER_URL}/address/${address}`;\n}\n","// Minimal ABIs: the API returns pre-encoded {to, data, value} for every write, so the SDK\n// only needs to encode locally when overriding the API's default 1% slippage floor, and to\n// decode the TokenLaunched event off a launch receipt.\n\nexport const curveAbi = [\n {\n type: 'function',\n name: 'buy',\n stateMutability: 'payable',\n inputs: [\n { name: 'quoteIn', type: 'uint256' },\n { name: 'minTokensOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'tokensOut', type: 'uint256' }],\n },\n {\n type: 'function',\n name: 'sell',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'tokensIn', type: 'uint256' },\n { name: 'minQuoteOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'quoteOut', type: 'uint256' }],\n },\n] as const;\n\nexport const factoryTokenLaunchedAbi = [\n {\n type: 'event',\n name: 'TokenLaunched',\n inputs: [\n { indexed: true, name: 'token', type: 'address' },\n { indexed: true, name: 'curve', type: 'address' },\n { indexed: true, name: 'deployer', type: 'address' },\n { indexed: false, name: 'pairToken', type: 'address' },\n { indexed: false, name: 'launchConfigId', type: 'uint256' },\n { indexed: false, name: 'graduationThreshold', type: 'uint256' },\n ],\n },\n] as const;\n","export class DivyError extends Error {\n readonly status: number;\n\n constructor(message: string, status: number) {\n super(message);\n this.name = 'DivyError';\n this.status = status;\n }\n}\n","import { DivyError } from './errors.js';\n\nconst stringify = (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));\n\nexport interface RequestOptions {\n method?: 'GET' | 'POST' | 'PATCH';\n body?: unknown;\n apiKey?: string;\n}\n\nexport async function apiRequest<T = unknown>(apiUrl: string, path: string, options: RequestOptions = {}): Promise<T> {\n const headers: Record<string, string> = {};\n if (options.body !== undefined) headers['content-type'] = 'application/json';\n if (options.apiKey) headers.authorization = `Bearer ${options.apiKey}`;\n\n const res = await fetch(`${apiUrl}${path}`, {\n method: options.method ?? (options.body !== undefined ? 'POST' : 'GET'),\n headers,\n body: options.body !== undefined ? stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let json: any;\n try {\n json = text ? JSON.parse(text) : {};\n } catch {\n // A gateway or proxy in front of the API (Render, Cloudflare, ...) can return an HTML\n // error page instead of JSON, typically on a 502/504 while the API is cold-starting or down.\n throw new DivyError(`${apiUrl} returned a non-JSON response (HTTP ${res.status} ${res.statusText}): the API may be down or restarting`, res.status);\n }\n if (!res.ok) {\n throw new DivyError(typeof json.error === 'string' ? json.error : res.statusText, res.status);\n }\n return json as T;\n}\n","import type {\n AgentLaunch, AgentRecord, HealthResult, InfoResult, LaunchListItem, LeaderboardEntry, QuoteResult, Tx,\n} from './types.js';\n\nconst big = (v: unknown): bigint => BigInt(v as string);\nconst bigOrNull = (v: unknown): bigint | null => (v === null || v === undefined ? null : big(v));\n\nexport function parseInfo(j: any): InfoResult {\n return {\n chain: j.chain,\n registry: j.registry,\n factory: j.factory,\n escrow: j.escrow,\n hostedWallets: j.hostedWallets,\n feePolicy: {\n treasury: j.feePolicy.treasury,\n divyBps: j.feePolicy.divyBps === null || j.feePolicy.divyBps === undefined ? null : Number(j.feePolicy.divyBps),\n agentShareOfBaseFee: j.feePolicy.agentShareOfBaseFee,\n ponsShare: j.feePolicy.ponsShare,\n divyShare: j.feePolicy.divyShare,\n },\n launchFee: { wei: big(j.launchFee.wei), eth: j.launchFee.eth },\n maxCreatorTaxBps: j.maxCreatorTaxBps,\n economics: j.economics,\n indexedBlock: bigOrNull(j.indexedBlock),\n keeper: j.keeper,\n };\n}\n\nfunction parseAgentLaunch(l: any): AgentLaunch {\n return {\n token: l.token,\n symbol: l.symbol,\n name: l.name,\n curve: l.curve,\n pairToken: l.pairToken,\n graduated: l.graduated,\n launchedAt: l.launchedAt,\n recorded: l.recorded,\n };\n}\n\nexport function parseAgentRecord(j: any): AgentRecord {\n return {\n agent: j.agent,\n split: j.split,\n registered: j.registered,\n record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score },\n fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },\n launches: j.launches.map(parseAgentLaunch),\n ...(j.balanceEth !== undefined ? { balanceEth: j.balanceEth } : {}),\n ...(j.payout !== undefined ? { payout: j.payout } : {}),\n ...(j.label !== undefined ? { label: j.label } : {}),\n };\n}\n\nexport function parseLeaderboard(j: any[]): LeaderboardEntry[] {\n return j.map((r) => ({ agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score, feesEth: big(r.feesEth) }));\n}\n\nexport function parseLaunches(j: any[]): LaunchListItem[] {\n return j.map((r) => ({\n token: r.token, agent: r.agent, split: r.split, curve: r.curve, pairToken: r.pairToken,\n name: r.name, symbol: r.symbol, launchedBlock: r.launchedBlock, launchedAt: r.launchedAt,\n recorded: r.recorded, graduated: r.graduated,\n }));\n}\n\nexport function parseHealth(j: any): HealthResult {\n return { ok: j.ok, indexedBlock: bigOrNull(j.indexedBlock), head: big(j.head), lag: bigOrNull(j.lag) };\n}\n\nfunction parseTx(t: any): Tx {\n return { to: t.to, data: t.data, value: big(t.value) };\n}\n\nexport function parseQuote(j: any): QuoteResult {\n return {\n curve: j.curve,\n amountIn: big(j.amountIn),\n amountOut: big(j.amountOut),\n minOut: big(j.minOut),\n feeBps: j.feeBps,\n creatorTaxBps: j.creatorTaxBps,\n snipeTaxBps: j.snipeTaxBps,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":["import {\n createPublicClient, createWalletClient, http, encodeFunctionData, decodeEventLog, zeroAddress,\n} from 'viem';\nimport type { Address, Hex } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\nimport { addresses, defineDivyChain } from './chain.js';\nimport { curveAbi, factoryTokenLaunchedAbi } from './abi.js';\nimport { DivyError } from './errors.js';\nimport { apiRequest } from './http.js';\nimport {\n parseAgentRecord, parseHealth, parseInfo, parseLaunches, parseLeaderboard, parseQuote,\n} from './parse.js';\nimport type {\n AgentRecord, BuyParams, CreateDivyOptions, CreateHostedAgentParams, CreateHostedAgentResult, DivyMode, HarvestResult, HealthResult, InfoResult,\n LaunchListItem, LaunchParams, LaunchResult, LeaderboardEntry, QuoteParams, QuoteResult, RecordResult,\n RegisterResult, SellParams, TradeResult, Tx, WaitForRecordOptions,\n} from './types.js';\n\nconst PRIVATE_KEY_RE = /^0x[0-9a-fA-F]{64}$/;\nconst BPS_DENOM = 10000n;\n\nfunction readAmount(amount: bigint | string): bigint {\n return typeof amount === 'bigint' ? amount : BigInt(amount);\n}\n\nexport class Divy {\n readonly mode: DivyMode;\n readonly apiUrl: string;\n\n private readonly apiKey?: string;\n private readonly account?: ReturnType<typeof privateKeyToAccount>;\n // viem's client generics resist a clean stored type across the three constructor branches;\n // both are only ever touched through sendLocal(), which fixes the call shape in one place.\n private readonly wallet?: any;\n private readonly pub?: any;\n private readonly chain?: ReturnType<typeof defineDivyChain>;\n\n constructor(options: CreateDivyOptions) {\n const hasPrivateKey = 'privateKey' in options && options.privateKey !== undefined;\n const hasApiKey = 'apiKey' in options && options.apiKey !== undefined;\n if (hasPrivateKey && hasApiKey) {\n throw new Error('pass either privateKey or apiKey to createDivy, not both');\n }\n\n this.apiUrl = options.apiUrl ?? addresses.apiUrl;\n\n if (hasPrivateKey) {\n const { privateKey, rpcUrl } = options as { privateKey: Hex; rpcUrl?: string };\n if (!PRIVATE_KEY_RE.test(privateKey)) {\n throw new Error('privateKey must be a 0x-prefixed 32-byte hex string');\n }\n this.mode = 'self-custody';\n this.account = privateKeyToAccount(privateKey);\n this.chain = defineDivyChain(rpcUrl ?? addresses.rpcUrl);\n const transport = http(rpcUrl ?? addresses.rpcUrl);\n this.wallet = createWalletClient({ account: this.account, chain: this.chain, transport });\n this.pub = createPublicClient({ chain: this.chain, transport });\n } else if (hasApiKey) {\n const { apiKey } = options as { apiKey: string };\n if (typeof apiKey !== 'string' || apiKey.length === 0) {\n throw new Error('apiKey must be a non-empty string');\n }\n this.mode = 'hosted';\n this.apiKey = apiKey;\n } else {\n this.mode = 'read-only';\n }\n }\n\n private requireSigner(action: string): void {\n if (this.mode === 'read-only') {\n throw new Error(`${action} requires a privateKey (self-custody) or apiKey (hosted) — this client is read-only`);\n }\n }\n\n private async sendLocal(tx: Tx) {\n if (!this.wallet || !this.pub || !this.account) throw new Error('self-custody wallet is not configured');\n const hash = await this.wallet.sendTransaction({\n account: this.account, chain: this.chain, to: tx.to, data: tx.data, value: tx.value,\n });\n const receipt = await this.pub.waitForTransactionReceipt({ hash });\n if (receipt.status !== 'success') throw new Error(`transaction reverted on-chain: ${hash}`);\n return receipt;\n }\n\n async buildTx<T = Record<string, unknown>>(path: string, body?: object): Promise<T> {\n return apiRequest<T>(this.apiUrl, path, { body: body ?? {} });\n }\n\n async info(): Promise<InfoResult> {\n return parseInfo(await apiRequest(this.apiUrl, '/'));\n }\n\n async agent(address?: Address): Promise<AgentRecord> {\n if (!address) {\n if (this.mode === 'hosted') {\n return parseAgentRecord(await apiRequest(this.apiUrl, '/me', { apiKey: this.apiKey }));\n }\n if (this.mode === 'self-custody' && this.account) {\n address = this.account.address;\n } else {\n throw new Error('agent() requires an address in read-only mode');\n }\n }\n return parseAgentRecord(await apiRequest(this.apiUrl, `/agents/${address}`));\n }\n\n async leaderboard(): Promise<LeaderboardEntry[]> {\n return parseLeaderboard(await apiRequest(this.apiUrl, '/leaderboard'));\n }\n\n async launches(options: { limit?: number } = {}): Promise<LaunchListItem[]> {\n const qs = options.limit ? `?limit=${options.limit}` : '';\n return parseLaunches(await apiRequest(this.apiUrl, `/launches${qs}`));\n }\n\n async health(): Promise<HealthResult> {\n return parseHealth(await apiRequest(this.apiUrl, '/health'));\n }\n\n // Creates a fresh hosted wallet on the API. Needs no credential, so an agent can bootstrap\n // itself from a read-only client, then continue with createDivy({ apiKey }).\n async createHostedAgent(params: CreateHostedAgentParams = {}): Promise<CreateHostedAgentResult> {\n const body: Record<string, unknown> = {};\n if (params.payout) body.payout = params.payout;\n if (params.label) body.label = params.label;\n return apiRequest<CreateHostedAgentResult>(this.apiUrl, '/agents', { body });\n }\n\n async register(): Promise<RegisterResult> {\n this.requireSigner('register');\n\n if (this.mode === 'hosted') {\n const me = await apiRequest<{ registered: boolean; split: Address | null }>(this.apiUrl, '/me', { apiKey: this.apiKey });\n if (me.registered) return { registered: true, split: me.split };\n return { registered: false, split: null };\n }\n\n const address = this.account!.address;\n const first = await apiRequest<{ registered: boolean; split: Address; tx?: Tx }>(this.apiUrl, '/agents', {\n body: { address },\n });\n if (first.registered) return { registered: true, split: first.split };\n\n const receipt = await this.sendLocal({ to: first.tx!.to, data: first.tx!.data, value: BigInt(first.tx!.value ?? 0) });\n const after = await apiRequest<{ registered: boolean; split: Address }>(this.apiUrl, '/agents', { body: { address } });\n return { registered: after.registered, split: after.split, txHash: receipt.transactionHash };\n }\n\n async quote(params: QuoteParams): Promise<QuoteResult> {\n let recipient = params.recipient;\n if (!recipient && this.mode === 'self-custody' && this.account) recipient = this.account.address;\n return parseQuote(\n await apiRequest(this.apiUrl, '/quote', {\n body: {\n curve: params.curve, token: params.token, side: params.side,\n amount: readAmount(params.amount).toString(), recipient: recipient ?? zeroAddress,\n },\n }),\n );\n }\n\n async launch(params: LaunchParams): Promise<LaunchResult> {\n this.requireSigner('launch');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ token: Address; curve: Address; txHash: Hex }>(this.apiUrl, '/launch', {\n apiKey: this.apiKey, body: params,\n });\n return { token: out.token, curve: out.curve, txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/launch', { body: { ...params, agent: address } });\n const receipt = await this.sendLocal(built.tx);\n\n let launched: { token: Address; curve: Address } | undefined;\n for (const log of receipt.logs) {\n try {\n const ev = decodeEventLog({ abi: factoryTokenLaunchedAbi, data: log.data, topics: log.topics });\n if (ev.eventName === 'TokenLaunched') { launched = ev.args as { token: Address; curve: Address }; break; }\n } catch { /* not a TokenLaunched log */ }\n }\n if (!launched) throw new Error(`launch mined (${receipt.transactionHash}) but no TokenLaunched event was found`);\n\n const result: LaunchResult = { token: launched.token, curve: launched.curve, txHash: receipt.transactionHash };\n try {\n const recorded = await this.record(launched.token);\n result.recordTxHash = recorded.txHash;\n } catch (e) {\n result.recordError = e instanceof Error ? e.message : String(e);\n }\n return result;\n }\n\n async record(token: Address): Promise<RecordResult> {\n if (this.mode !== 'self-custody') {\n throw new Error(\n 'record() requires self-custody (a privateKey): hosted and read-only launches are recorded '\n + 'automatically by Divy\\'s keeper within about a minute — use waitForRecord() to wait for it',\n );\n }\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/record', { body: { token } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n async buy(params: BuyParams): Promise<TradeResult> {\n return this.trade('buy', readAmount(params.amountWei), params);\n }\n\n async sell(params: SellParams): Promise<TradeResult> {\n return this.trade('sell', readAmount(params.amountTokens), params);\n }\n\n private async trade(side: 'buy' | 'sell', amount: bigint, params: BuyParams | SellParams): Promise<TradeResult> {\n this.requireSigner(side);\n const slippageBps = params.slippageBps ?? 100;\n\n if (this.mode === 'hosted') {\n if (slippageBps !== 100) {\n throw new Error('slippageBps is not configurable in hosted mode: /trade hardcodes a 1% (100bps) slippage floor');\n }\n const out = await apiRequest<{ txHash: Hex; amountOut: string }>(this.apiUrl, '/trade', {\n apiKey: this.apiKey, body: { curve: params.curve, token: params.token, side, amount: amount.toString() },\n });\n return { txHash: out.txHash, amountOut: BigInt(out.amountOut) };\n }\n\n const address = this.account!.address;\n const q = await this.quote({ curve: params.curve, token: params.token, side, amount, recipient: address });\n\n let tradeTx = q.tx;\n if (slippageBps !== 100) {\n const minOut = (q.amountOut * (BPS_DENOM - BigInt(slippageBps))) / BPS_DENOM;\n const data = encodeFunctionData({ abi: curveAbi, functionName: side, args: [q.amountIn, minOut, address] });\n tradeTx = { ...q.tx, data };\n }\n\n if (q.approveTx) await this.sendLocal(q.approveTx);\n const receipt = await this.sendLocal(tradeTx);\n return { txHash: receipt.transactionHash, amountOut: q.amountOut };\n }\n\n async harvest(): Promise<HarvestResult> {\n this.requireSigner('harvest');\n\n if (this.mode === 'hosted') {\n const out = await apiRequest<{ txHash: Hex }>(this.apiUrl, '/harvest', { apiKey: this.apiKey, body: {} });\n return { txHash: out.txHash };\n }\n\n const address = this.account!.address;\n const built = await apiRequest<{ tx: Tx }>(this.apiUrl, '/harvest', { body: { agent: address } });\n const receipt = await this.sendLocal(built.tx);\n return { txHash: receipt.transactionHash };\n }\n\n // Own-wallet launches only: tell the API about a launch tx you mined yourself so the record\n // updates now instead of on the indexer's next pass.\n async confirmLaunch(txHash: Hex): Promise<{ token: Address; curve: Address; txHash: Hex; agent: Address | null; recorded: boolean }> {\n return apiRequest(this.apiUrl, '/launches/confirm', { body: { txHash } });\n }\n\n async waitForRecord(token: Address, options: WaitForRecordOptions = {}): Promise<LaunchListItem> {\n const timeoutMs = options.timeoutMs ?? 60_000;\n const intervalMs = options.intervalMs ?? 3_000;\n const deadline = Date.now() + timeoutMs;\n const wanted = token.toLowerCase();\n\n for (;;) {\n const rows = await this.launches({ limit: 200 });\n const row = rows.find((r) => r.token.toLowerCase() === wanted);\n if (row?.recorded) return row;\n if (Date.now() >= deadline) {\n throw new DivyError(`timed out waiting for ${token} to be recorded`, 408);\n }\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n }\n }\n}\n\nexport function createDivy(options: CreateDivyOptions = {}): Divy {\n return new Divy(options);\n}\n","import { defineChain } from 'viem';\nimport type { Address } from 'viem';\n\nexport const CHAIN_ID = 4663;\nexport const DEFAULT_RPC_URL = 'https://rpc.mainnet.chain.robinhood.com';\nexport const DEFAULT_API_URL = 'https://divy-api-j8di.onrender.com';\nexport const EXPLORER_URL = 'https://robinhoodchain.blockscout.com';\n\nexport const addresses = {\n chainId: CHAIN_ID,\n registry: '0x0fEf638d8C88e6eD38eDcD9aB21BF39D083c8B1b' as Address,\n factory: '0x7eD598BcEf8bd9Edd8C97A195C6d13f40801EC7e' as Address,\n escrow: '0xd3AFEB2a57f70eF218Aa82451c51B2fb0416Ac9e' as Address,\n rpcUrl: DEFAULT_RPC_URL,\n apiUrl: DEFAULT_API_URL,\n explorerUrl: EXPLORER_URL,\n} as const;\n\nexport function defineDivyChain(rpcUrl: string = DEFAULT_RPC_URL) {\n return defineChain({\n id: CHAIN_ID,\n name: 'robinhood-chain',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n rpcUrls: { default: { http: [rpcUrl] } },\n blockExplorers: { default: { name: 'Blockscout', url: EXPLORER_URL } },\n });\n}\n\nexport function explorerTx(hash: string): string {\n return `${EXPLORER_URL}/tx/${hash}`;\n}\n\nexport function explorerAddress(address: string): string {\n return `${EXPLORER_URL}/address/${address}`;\n}\n","// Minimal ABIs: the API returns pre-encoded {to, data, value} for every write, so the SDK\n// only needs to encode locally when overriding the API's default 1% slippage floor, and to\n// decode the TokenLaunched event off a launch receipt.\n\nexport const curveAbi = [\n {\n type: 'function',\n name: 'buy',\n stateMutability: 'payable',\n inputs: [\n { name: 'quoteIn', type: 'uint256' },\n { name: 'minTokensOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'tokensOut', type: 'uint256' }],\n },\n {\n type: 'function',\n name: 'sell',\n stateMutability: 'nonpayable',\n inputs: [\n { name: 'tokensIn', type: 'uint256' },\n { name: 'minQuoteOut', type: 'uint256' },\n { name: 'recipient', type: 'address' },\n ],\n outputs: [{ name: 'quoteOut', type: 'uint256' }],\n },\n] as const;\n\nexport const factoryTokenLaunchedAbi = [\n {\n type: 'event',\n name: 'TokenLaunched',\n inputs: [\n { indexed: true, name: 'token', type: 'address' },\n { indexed: true, name: 'curve', type: 'address' },\n { indexed: true, name: 'deployer', type: 'address' },\n { indexed: false, name: 'pairToken', type: 'address' },\n { indexed: false, name: 'launchConfigId', type: 'uint256' },\n { indexed: false, name: 'graduationThreshold', type: 'uint256' },\n ],\n },\n] as const;\n","export class DivyError extends Error {\n readonly status: number;\n\n constructor(message: string, status: number) {\n super(message);\n this.name = 'DivyError';\n this.status = status;\n }\n}\n","import { DivyError } from './errors.js';\n\nconst stringify = (body: unknown): string =>\n JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value));\n\nexport interface RequestOptions {\n method?: 'GET' | 'POST' | 'PATCH';\n body?: unknown;\n apiKey?: string;\n}\n\nexport async function apiRequest<T = unknown>(apiUrl: string, path: string, options: RequestOptions = {}): Promise<T> {\n const headers: Record<string, string> = {};\n if (options.body !== undefined) headers['content-type'] = 'application/json';\n if (options.apiKey) headers.authorization = `Bearer ${options.apiKey}`;\n\n const res = await fetch(`${apiUrl}${path}`, {\n method: options.method ?? (options.body !== undefined ? 'POST' : 'GET'),\n headers,\n body: options.body !== undefined ? stringify(options.body) : undefined,\n });\n\n const text = await res.text();\n let json: any;\n try {\n json = text ? JSON.parse(text) : {};\n } catch {\n // A gateway or proxy in front of the API (Render, Cloudflare, ...) can return an HTML\n // error page instead of JSON, typically on a 502/504 while the API is cold-starting or down.\n throw new DivyError(`${apiUrl} returned a non-JSON response (HTTP ${res.status} ${res.statusText}): the API may be down or restarting`, res.status);\n }\n if (!res.ok) {\n throw new DivyError(typeof json.error === 'string' ? json.error : res.statusText, res.status);\n }\n return json as T;\n}\n","import type {\n AgentLaunch, AgentRecord, HealthResult, InfoResult, LaunchListItem, LeaderboardEntry, QuoteResult, Tx,\n} from './types.js';\n\nconst big = (v: unknown): bigint => BigInt(v as string);\nconst bigOrNull = (v: unknown): bigint | null => (v === null || v === undefined ? null : big(v));\n\nexport function parseInfo(j: any): InfoResult {\n return {\n chain: j.chain,\n registry: j.registry,\n factory: j.factory,\n escrow: j.escrow,\n hostedWallets: j.hostedWallets,\n feePolicy: {\n treasury: j.feePolicy.treasury,\n divyBps: j.feePolicy.divyBps === null || j.feePolicy.divyBps === undefined ? null : Number(j.feePolicy.divyBps),\n agentShareOfBaseFee: j.feePolicy.agentShareOfBaseFee,\n ponsShare: j.feePolicy.ponsShare,\n divyShare: j.feePolicy.divyShare,\n },\n launchFee: { wei: big(j.launchFee.wei), eth: j.launchFee.eth },\n maxCreatorTaxBps: j.maxCreatorTaxBps,\n economics: j.economics,\n indexedBlock: bigOrNull(j.indexedBlock),\n keeper: j.keeper,\n };\n}\n\nfunction parseAgentLaunch(l: any): AgentLaunch {\n return {\n token: l.token,\n symbol: l.symbol,\n name: l.name,\n curve: l.curve,\n pairToken: l.pairToken,\n graduated: l.graduated,\n launchedAt: l.launchedAt,\n recorded: l.recorded,\n retention: l.retention ?? null, retentionProvisional: l.retentionProvisional ?? false, retentionPending: l.retentionPending ?? false,\n earlyHolders: l.earlyHolders ?? null, retained: l.retained ?? null,\n };\n}\n\nexport function parseAgentRecord(j: any): AgentRecord {\n return {\n agent: j.agent,\n split: j.split,\n registered: j.registered,\n record: { launches: big(j.record.launches), graduated: big(j.record.graduated), score: j.record.score, graduationRate: j.record.graduationRate ?? j.record.score },\n fees: { agentEth: big(j.fees.agentEth), divyEth: big(j.fees.divyEth), pendingEscrowEth: big(j.fees.pendingEscrowEth) },\n launches: j.launches.map(parseAgentLaunch),\n ...(j.balanceEth !== undefined ? { balanceEth: j.balanceEth } : {}),\n ...(j.payout !== undefined ? { payout: j.payout } : {}),\n ...(j.label !== undefined ? { label: j.label } : {}),\n };\n}\n\nexport function parseLeaderboard(j: any[]): LeaderboardEntry[] {\n return j.map((r) => ({\n agent: r.agent, launches: r.launches, graduated: r.graduated, score: r.score,\n graduationRate: r.graduationRate ?? r.score, retention: r.retention ?? null,\n retentionProvisional: r.retentionProvisional ?? false, feesEth: big(r.feesEth),\n }));\n}\n\nexport function parseLaunches(j: any[]): LaunchListItem[] {\n return j.map((r) => ({\n token: r.token, agent: r.agent, split: r.split, curve: r.curve, pairToken: r.pairToken,\n name: r.name, symbol: r.symbol, launchedBlock: r.launchedBlock, launchedAt: r.launchedAt,\n recorded: r.recorded, graduated: r.graduated,\n retention: r.retention ?? null, retentionProvisional: r.retentionProvisional ?? false, retentionPending: r.retentionPending ?? false,\n earlyHolders: r.earlyHolders ?? null, retained: r.retained ?? null,\n }));\n}\n\nexport function parseHealth(j: any): HealthResult {\n const k = j.keeper ?? {};\n return {\n ok: j.ok, rpc: j.rpc ?? true,\n indexedBlock: bigOrNull(j.indexedBlock), head: bigOrNull(j.head), lag: bigOrNull(j.lag),\n keeper: {\n address: k.address ?? null, enabled: !!k.enabled, balanceWei: bigOrNull(k.balanceWei), low: !!k.low,\n spent24hWei: big(k.spent24hWei ?? '0'), dailyBudgetWei: big(k.dailyBudgetWei ?? '0'), lastTickAt: k.lastTickAt ?? null,\n },\n warnings: Array.isArray(j.warnings) ? j.warnings : [],\n };\n}\n\nfunction parseTx(t: any): Tx {\n return { to: t.to, data: t.data, value: big(t.value) };\n}\n\nexport function parseQuote(j: any): QuoteResult {\n return {\n curve: j.curve,\n amountIn: big(j.amountIn),\n amountOut: big(j.amountOut),\n minOut: big(j.minOut),\n feeBps: j.feeBps,\n creatorTaxBps: j.creatorTaxBps,\n snipeTaxBps: j.snipeTaxBps,\n tx: parseTx(j.tx),\n approveTx: j.approveTx ? parseTx(j.approveTx) : null,\n };\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAAoB;AAAA,EAAoB;AAAA,EAAM;AAAA,EAAoB;AAAA,EAAgB;AAAA,OAC7E;AAEP,SAAS,2BAA2B;;;ACJpC,SAAS,mBAAmB;AAGrB,IAAM,WAAW;AACjB,IAA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AAAA,IAC9B;AAEA,UAAM,UAAU,KAAK,QAAS;AAC9B,UAAM,QAAQ,MAAM,WAAuB,KAAK,QAAQ,YAAY,EAAE,MAAM,EAAE,OAAO,QAAQ,EAAE,CAAC;AAChG,UAAM,UAAU,MAAM,KAAK,UAAU,MAAM,EAAE;AAC7C,WAAO,EAAE,QAAQ,QAAQ,gBAAgB;AAAA,EAC3C;AAAA;AAAA;AAAA,EAIA,MAAM,cAAc,QAAiH;AACnI,WAAO,WAAW,KAAK,QAAQ,qBAAqB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAAA,EAC1E;AAAA,EAEA,MAAM,cAAc,OAAgB,UAAgC,CAAC,GAA4B;AAC/F,UAAM,YAAY,QAAQ,aAAa;AACvC,UAAM,aAAa,QAAQ,cAAc;AACzC,UAAM,WAAW,KAAK,IAAI,IAAI;AAC9B,UAAM,SAAS,MAAM,YAAY;AAEjC,eAAS;AACP,YAAM,OAAO,MAAM,KAAK,SAAS,EAAE,OAAO,IAAI,CAAC;AAC/C,YAAM,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,MAAM,YAAY,MAAM,MAAM;AAC7D,UAAI,KAAK,SAAU,QAAO;AAC1B,UAAI,KAAK,IAAI,KAAK,UAAU;AAC1B,cAAM,IAAI,UAAU,yBAAyB,KAAK,mBAAmB,GAAG;AAAA,MAC1E;AACA,YAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,UAAU,CAAC;AAAA,IAChE;AAAA,EACF;AACF;AAEO,SAAS,WAAW,UAA6B,CAAC,GAAS;AAChE,SAAO,IAAI,KAAK,OAAO;AACzB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "divy-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Typed TypeScript SDK for Divy: register agents, launch tokens on Pons, trade, and harvest fees on Robinhood Chain.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,5 +52,9 @@
52
52
  "tsup": "^8.5.1",
53
53
  "typescript": "^5.9.3",
54
54
  "vitest": "^4.1.11"
55
+ },
56
+ "homepage": "https://rundivy.com/docs.html",
57
+ "bugs": {
58
+ "url": "https://github.com/ElizenDevVini/divy/issues"
55
59
  }
56
60
  }