@toon-protocol/townhouse 0.5.0 → 0.5.3

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.
@@ -14050,20 +14050,6 @@ var CHAIN_PRESETS = {
14050
14050
  usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
14051
14051
  tokenNetworkAddress: "",
14052
14052
  registryAddress: ""
14053
- },
14054
- // Akash-hosted Anvil devnet (chain-id 31338, deployed via akash-deploy.sh).
14055
- // Contract addresses are the deterministic Foundry deploy from
14056
- // contracts/evm/script/DeployLocal.s.sol (deployer + nonce, chain-id
14057
- // independent), so this is settlement-complete. rpcUrl is empty by design —
14058
- // the Akash ingress URL rotates per redeploy, so the operator supplies it
14059
- // (TOON_RPC_URL / EVM_RPC_URL via `init --network akash --akash-evm-url`).
14060
- "akash-anvil": {
14061
- name: "akash-anvil",
14062
- chainId: 31338,
14063
- rpcUrl: "",
14064
- usdcAddress: MOCK_USDC_ADDRESS,
14065
- tokenNetworkAddress: "0xCafac3dD18aC6c6e92c921884f9E4176737C052c",
14066
- registryAddress: "0xe7f1725e7734ce288f8367e1bb143e90bb3f0512"
14067
14053
  }
14068
14054
  };
14069
14055
  function buildEvmProviderEntry(config, keyId) {
@@ -14098,7 +14084,7 @@ function buildMinaProviderEntry(config, keyId) {
14098
14084
  network: config.network
14099
14085
  };
14100
14086
  }
14101
- var DEV_EVM_PRESET = "akash-anvil";
14087
+ var DEV_EVM_PRESET = "anvil";
14102
14088
  var DEV_SOLANA = {
14103
14089
  usdcMint: "6GbdrVghwNKTz9raga7y3Y4qqX5Zgg3AC4d48Kt7C59Q",
14104
14090
  programId: ""
@@ -14302,6 +14288,7 @@ function resolveConfigNetworkProfile(config, keyId) {
14302
14288
  // src/connector/hs-config-writer.ts
14303
14289
  var HS_DIR = "/var/lib/anon/hs";
14304
14290
  var HS_PORT = 3e3;
14291
+ var DVM_HANDLER_URL = "http://townhouse-hs-dvm:3300";
14305
14292
  function writeHsConnectorConfig(configDir, config, options = {}) {
14306
14293
  const yamlPath = join4(configDir, "connector.yaml");
14307
14294
  if (!options.force && existsSync2(yamlPath)) {
@@ -14340,6 +14327,19 @@ function writeHsConnectorConfig(configDir, config, options = {}) {
14340
14327
  const baseYaml = generator.toYaml(hsRuntimeConfig);
14341
14328
  const parsed = parse2(baseYaml);
14342
14329
  parsed["anon"] = { enabled: true };
14330
+ const apexNodeId = typeof parsed["nodeId"] === "string" ? parsed["nodeId"] : "g.townhouse";
14331
+ parsed["localDelivery"] = { enabled: true, handlerUrl: DVM_HANDLER_URL };
14332
+ const existingRoutes = Array.isArray(parsed["routes"]) ? parsed["routes"] : [];
14333
+ if (!existingRoutes.some(
14334
+ (r) => r["prefix"] === apexNodeId && r["nextHop"] === "local"
14335
+ )) {
14336
+ existingRoutes.push({
14337
+ prefix: apexNodeId,
14338
+ nextHop: "local",
14339
+ priority: 100
14340
+ });
14341
+ }
14342
+ parsed["routes"] = existingRoutes;
14343
14343
  const finalYaml = yamlStringify2(parsed);
14344
14344
  writeFileSync3(yamlPath, finalYaml, { mode: 384, encoding: "utf-8" });
14345
14345
  chmodSync(yamlPath, 384);
@@ -14641,7 +14641,14 @@ var BootReconciler = class {
14641
14641
  id: entry.peerId,
14642
14642
  url: deriveBtpUrl(entry),
14643
14643
  authToken: "",
14644
- routes: [{ prefix: entry.ilpAddress, priority: 0 }]
14644
+ routes: [{ prefix: entry.ilpAddress, priority: 0 }],
14645
+ // Re-registration must mirror the provisioning-path peer config
14646
+ // (nodes-lifecycle.ts), or a connector restart silently restores
14647
+ // peers as settlement 'peer's (paid packets → T00) dialled over the
14648
+ // global SOCKS5 transport (Docker-internal hostnames → HostUnreachable).
14649
+ // Every nodes.yaml entry is an apex-owned child.
14650
+ relation: "child",
14651
+ transport: "direct"
14645
14652
  });
14646
14653
  summary.reregistered++;
14647
14654
  await this.tryAppendLog({
@@ -20325,6 +20332,17 @@ var ACCOUNT_INDEX = {
20325
20332
  dvm: ACCOUNT_INDEX_DVM
20326
20333
  };
20327
20334
  var APEX_ILP_ADDRESS = "g.townhouse";
20335
+ function zeroChannelIdForChain(chain2) {
20336
+ if (chain2.startsWith("solana:")) return "1".repeat(32);
20337
+ return "0x" + "0".repeat(64);
20338
+ }
20339
+ function buildMillChainProviders(config) {
20340
+ const source = config.chainProviders && config.chainProviders.length > 0 ? config.chainProviders : DEFAULT_HS_CHAIN_PROVIDERS;
20341
+ return source.map((provider) => {
20342
+ const { keyId: _keyId, ...rest } = provider;
20343
+ return rest;
20344
+ });
20345
+ }
20328
20346
  function buildMillSwapPairConfig(config) {
20329
20347
  const fromChain = config.chainProviders?.[0]?.chainId ?? "evm:base:31337";
20330
20348
  const toChain = "solana:devnet";
@@ -20340,12 +20358,13 @@ function buildMillSwapPairConfig(config) {
20340
20358
  ],
20341
20359
  chains: ["evm", "solana"],
20342
20360
  // Bootstrap: validateConfig() requires a non-empty channels array for
20343
- // each distinct pair.to.chain. The zero channelId is a valid-format
20344
- // sentinel that will never match a real on-chain channel.
20361
+ // each distinct pair.to.chain. The sentinel channelId is valid-FORMAT for
20362
+ // the target chain (see zeroChannelIdForChain) and never matches a real
20363
+ // on-chain channel.
20345
20364
  channels: {
20346
20365
  [toChain]: [
20347
20366
  {
20348
- channelId: "0x" + "0".repeat(64),
20367
+ channelId: zeroChannelIdForChain(toChain),
20349
20368
  cumulativeAmount: "0",
20350
20369
  nonce: "0"
20351
20370
  }
@@ -20354,7 +20373,9 @@ function buildMillSwapPairConfig(config) {
20354
20373
  // Zero initial SOL inventory; parsed to 0n by the Mill CLI.
20355
20374
  inventory: {
20356
20375
  [toChain]: "0"
20357
- }
20376
+ },
20377
+ // Per-packet claim service config — REQUIRED for the mill to accept swaps.
20378
+ chainProviders: buildMillChainProviders(config)
20358
20379
  };
20359
20380
  }
20360
20381
  async function waitForHealthy(url, timeoutMs) {
@@ -20615,7 +20636,7 @@ function registerNodeLifecycleRoutes(app, deps) {
20615
20636
  await fs5.chmod(dirname8(millConfigPath), 448);
20616
20637
  await fs5.writeFile(millConfigPath, defaultMillConfig, {
20617
20638
  encoding: "utf-8",
20618
- mode: 384
20639
+ mode: 420
20619
20640
  });
20620
20641
  millConfigWritten = true;
20621
20642
  } catch (err) {
@@ -20767,6 +20788,16 @@ function registerNodeLifecycleRoutes(app, deps) {
20767
20788
  url: btpUrl,
20768
20789
  authToken: "",
20769
20790
  routes: [{ prefix: ilpAddress, priority: 0 }],
20791
+ // Tag every provisioned node as a CHILD of the apex. The connector's
20792
+ // `requiresSettlementClaim()` returns false for children, so the apex
20793
+ // forwards client-paid PREPAREs to the node for FREE (parent→child
20794
+ // packets carry no per-packet claim — the apex settles in aggregate).
20795
+ // Without this the peer defaults to 'peer' and every paid packet
20796
+ // forwarded to a town/mill/dvm node is rejected `T00 No payment
20797
+ // channel available for peer`. Pairs with the child-side
20798
+ // `TOON_PARENT_PEER_ID` in townhouse-hs.yml (which MUST equal the
20799
+ // apex connector's nodeId so the child applies the parent relation).
20800
+ relation: "child",
20770
20801
  // Force direct (non-SOCKS5) BTP dial for this Docker-sibling
20771
20802
  // peer. The apex connector runs with `transport.type: socks5`
20772
20803
  // so the .anyone HS can publish; without this override, every
@@ -22803,4 +22834,4 @@ export {
22803
22834
  @scure/bip32/index.js:
22804
22835
  (*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
22805
22836
  */
22806
- //# sourceMappingURL=chunk-IXG4IYTG.js.map
22837
+ //# sourceMappingURL=chunk-XFPIK22M.js.map