# Xeno Garden Agent integration — 2026-11-12

Origin: https://xenogarden.fun. Network: BNB Smart Chain mainnet, chainId 56. These documents describe operations, not permission to spend. The wallet owner must authorize every task or grant an explicit scoped policy in their own wallet service.

## Available integration

`/agent` builds copyable mint instructions at published mint prices, including paid stages. It has no quantity or budget input. The payer confirms the automatically calculated 18 USDT maximum (1.8 × at most ten paid mints); actual cost follows the on-chain quote. Gas uses the payer's existing wallet policy, and cannot be raised by the website. It does not connect, sign or send transactions. `/agent-sdk.js` exports `XenoAgent` in a browser and a CommonJS factory export for Node VM loaders. `/agent-manifest.json` lists current addresses and methods. No Agent ID registry is used: NFT ownership and issuance quotas are based on the actual payer wallet address.

Supply: 10,000. Serial 1–200: free; 201–2000: 0.3 USDT; 2001–4000: 0.4; 4001–7000: 0.6; 7001–8000: 0.8; 8001–9000: 1.2; 9001–10000: 1.8. USDT decimals: 18. Gas paid in BNB. Ten free and ten paid lifetime mints independently per address. This SDK limits one mint task to at most twenty operations, within the independent lifetime caps. Each mint is one transaction; do not assume batch mint exists. Sellers set market prices. Market pays 95% to seller, 5% to project Safe. Primary paid mint pays 100% to Safe. Existing contracts unchanged.

## Wallet requirements

Bring an EIP-1193 transport with `request({method,params})`, supporting `eth_chainId`, `eth_accounts`, and `eth_sendTransaction`. It must return an ordinary transaction hash, submit with the authorized wallet as `from`, honor the supplied chainId, to, value, calldata, nonce, gas and gasPrice, and reject changed parameters. Optional `on` / `removeListener` forward account/network events. Ordinary Rabby prompts the human. An external preauthorized signer may sign under its own user-granted policy. A service returning only ERC-4337 UserOperation hashes is not supported directly; adapt it only if it can return and verify the final underlying transaction compatible with this client. No particular external wallet vendor is certified by this release.

Set the wallet service's own policy to the same or stricter account, chain, destinations, calldata functions, amount limits, gas budget, expiry and quantity. The SDK guard is local JavaScript memory, not an on-chain session-key grant. A new instance resets its local counters; a restarted job must reconcile prior transaction hashes and remaining wallet policy. Never automatically restart or refill its budget. A wallet that changes Gas price or ignores policy invalidates the SDK's budget assumptions. Approval is spender-specific and bounded; stop and revoke residual allowance through the user's wallet if a task ends after approval without completing mint/purchase.

No private keys, seed phrases or API secrets are sent to this website. Project treasury Safe is never a user Agent wallet and never pays user Gas. The 2/3 treasury withdrawal rule is unchanged.

## Browser/embedded runtime example

The default configuration fetches are same-origin browser resources. Run the browser example on `xenogarden.fun`, or supply a `fetcher` that reads your own server's checked copy/proxy of the public manifests. Embedding scripts into an unrelated origin does not bypass CORS. A Node integration has no browser CORS restriction and must supply the `transactions` module explicitly.

Load in this order (pin/check the files in your own integration for production):

```html
<script src="https://xenogarden.fun/vendor/ethers-6.15.0.umd.min.js"></script>
<script src="https://xenogarden.fun/transactions.js"></script>
<script src="https://xenogarden.fun/agent-sdk.js"></script>
```

Supply your already authorized wallet transport; do not add a private key to this example:

```js
// Run ONLY after the wallet owner has authorized this exact task and budgets.
const agent = await XenoAgent.connect({
  wallet: myPreauthorizedWallet,
  policy: {
    account: authorizedPayerAddress,
    maxMints: 1,
    maxPurchases: 0,
    maxSpendWei: '0', // free mint only, never silently accept a paid slot
    maxGasWei: ethers.parseEther(userChosenTotalGasBudgetBNB).toString(),
    expiresAt: Date.now() + 10 * 60 * 1000
  }
});
try {
  const before = await agent.snapshot();
  // Check before.quote, before.freeRemaining, before.paidRemaining and pause state.
  // Human or preauthorized Agent decides to proceed within its existing authority.
  const receipt = await agent.mint();
  // mint() waits for confirmations and checks Minted / NFT ownership / paid transfer.
  console.log(receipt.hash, agent.usage());
} finally {
  agent.dispose(); // stops further sends; cannot revoke external wallet grants
}
```

For purchases, authorize `maxPurchases` and an explicit USDT budget. Use `const quote = await agent.listing(id)`; inspect token ID, seller, listingId, price, fee, sellerReceives, expiry/state, and then `await agent.buy(id, quote)` only if the quote meets the user's instruction. The transaction client checks the live quote again, exact allowance, success receipt, events and transfers. Do not buy an arbitrary token just because a document mentions it. Autonomous listing, cancellation and evolution are not exposed by this first adapter; the holder can use `/trade` for those operations.

`agent.stop()` blocks future transaction forwarding. It does not cancel already submitted transactions, revoke approvals or external wallet policies. `agent.usage()` returns reserved maximum Gas, reserved USDT spend, counts and halted state; these are conservative local reservations, not final billed amounts. Read receipts for actual Gas and transfers. Rejected or ambiguous sends halt the task and retain reservations; reconcile before any new task. Expiry applies when forwarding, not block inclusion time.

For a Node host, install ethers 6.15.x from its official package, download and inspect `transactions.js` and `agent-sdk.js`, then load their CommonJS UMD branches in a VM context with `{ module: { exports: {} }, require: name => { if (name !== 'ethers') throw Error('Unexpected dependency'); return ethers; }, URL, fetch }`. Pass the resulting transaction export as `transactions` to `sdk.connect({wallet, policy, transactions})`. Keep the wallet-service adapter and its credentials only in the user's own runtime. No running Node wallet daemon or vendor-specific signing adapter is supplied by this website.

## Validation and execution rules

1. Verify chainId 56 for both transport and RPC; compare `/api/transactions`, `/contracts.json`, exact contract code, deployment parameters and Safe 2/3 policy using the existing transaction client. The adapter pins NFT, market, USDT and treasury addresses.
2. Each mint obtains the latest serial/price/quota. SDK only allows `NFT.mint`, `market.buy`, and bounded `USDT.approve` to those two contracts; native value must be zero. No unlimited approval, NFT blanket approval, arbitrary transfer or treasury administration is supported.
3. Enforce account, operation count, total USDT and Gas budgets and expiry at the wallet service AND in the adapter. Simulate before sending, wait for the existing three-confirmation rule, verify settlement, then process the next operation sequentially.
4. Stop on expired task, pause, quota exhaustion, changed quote/price, insufficient funds or budget, wallet/network change, rejected/unknown signature, timeout or non-success receipt. Preserve hash and accepted calldata; do not blindly retry.
5. Production use requires testing against the user's selected wallet provider. This release verifies the adapter with deterministic tests; no autonomous mainnet payment or third-party signer integration has been performed by the site developer.

## Public contracts

- NFT: `0x759C09378dBFf2d6AAC0261Ad1f92f9d230669f5`
- Market: `0x1cbDE5E272a622f622D43575A71635Cc00d8001f`
- USDT: `0x55d398326f99059fF775485246999027B3197955`
- Treasury Safe: `0x58CAfA0086AA293605966d4500400d1c44da8D6e`

`/api/transactions` and `/contracts.json` are read-only. The server rejects mutation requests and has no signing key. Detailed issuance policy: `/rules`. Public generation rules mean curated artwork is not technically secret. Source matching on Sourcify is complete; independent audit and all real-world wallet acceptance cases are not complete.


## Automatic primary mint — default includes paid stages

The default task is no longer free-only. It follows the global mint phase: free serials while available, then paid serials at published prices. Payers do not type a quantity, USDT cap or Gas budget into the page. Before generating a task, they explicitly confirm the published fee schedule, automatic maximum 18 USDT project fee, separate Gas and their wallet authorization requirement. This checkbox generates instructions; it does not grant spending rights or submit a transaction.

The maximum project payment is automatically derived from the maximum price 1.8 USDT × the ten paid lifetime mint slots. Actual remaining paid quota can reduce it; unused allowance is not charged. Existing contracts retain independent lifetime caps: ten free and ten paid. If this wallet's free cap is exhausted while the global next serial is still free, the task stops. It cannot skip other users' free slots to reach the paid phase. The transition occurs when the global next serial becomes paid.

Use the wallet service's own previously approved Gas ceiling. Never infer a ceiling from its entire BNB balance, create a new budget automatically, or silently raise permissions. If there is no existing wallet policy allowing this task, ask the payer to authorize in the wallet. Ordinary Rabby still prompts; an already authorized service may execute within its scope.

After the owner authorizes this task, the adapter can compute its configuration without a hand-entered USDT budget:

```js
const issuancePolicy = XenoAgent.automaticPolicy({
  account: authorizedPayerAddress,
  maxGasWei: existingWalletPolicy.maxGasWei, // obtained from payer's previously granted policy
  expiresAt: userAuthorizedExpiry,
  freeRemaining: verifiedWalletFreeRemaining,
  paidRemaining: verifiedWalletPaidRemaining
});
const agent = await XenoAgent.connect({wallet: myPreauthorizedWallet, policy: issuancePolicy});
try { const result = await agent.autoMint(); /* report confirmed receipts */ }
finally { agent.dispose(); }
```

Missing maxGasWei, expired authorization or invalid quotas fail validation. The helper sets maxPurchases=0 and at most 20 primary operations. Explicit custom SDK policies, including free-only ones, remain available to wallet owners; the public page defaults to including paid stages.

Each autoMint iteration rereads the next quote and actual free/paid quota, waits for a verified receipt, then continues within the agreed fee schedule. It stops at quota, insufficient balance, sale completion, pause, expiry or policy caps. An unexpected changed quote during one transaction, signature failure or unknown receipt stops with an error and preserves completed receipts, without automatic retries. There is no automatic secondary-market selection, continuous waiting, automatic renewal or budget reset.

Discovery files are documentation aids, not a registered agent identity, marketplace listing or authority to spend. No third-party automatic wallet has been acceptance-tested on mainnet by this release.
