@dev.sail.money/sailor 0.0.2-28 → 0.0.2-30

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.
Files changed (116) hide show
  1. package/AGENTS.md +31 -2
  2. package/README.md +77 -12
  3. package/package.json +9 -3
  4. package/packages/cli/dist/index.cjs +285 -127
  5. package/packages/cli/dist/server.cjs +586 -1401
  6. package/packages/sdk/dist/chains.d.ts +12 -0
  7. package/packages/sdk/dist/chains.d.ts.map +1 -0
  8. package/packages/sdk/dist/chains.js +94 -0
  9. package/packages/sdk/dist/chains.js.map +1 -0
  10. package/packages/sdk/dist/index.d.ts +1 -0
  11. package/packages/sdk/dist/index.d.ts.map +1 -1
  12. package/packages/sdk/dist/index.js +1 -0
  13. package/packages/sdk/dist/index.js.map +1 -1
  14. package/packages/sdk/dist/intelligence.d.ts +1 -1
  15. package/packages/sdk/dist/intelligence.js +1 -1
  16. package/packages/sdk/dist/types.d.ts +2 -0
  17. package/packages/sdk/dist/types.d.ts.map +1 -1
  18. package/packages/sdk/package.json +27 -0
  19. package/packages/ui/dist/assets/{add-Cj0EIUcG.js → add-BtPPKW_S.js} +1 -1
  20. package/packages/ui/dist/assets/{all-wallets-DlyRsWoN.js → all-wallets-CliTUt-P.js} +1 -1
  21. package/packages/ui/dist/assets/{app-store-CXP08sks.js → app-store-Dn-qzfPP.js} +1 -1
  22. package/packages/ui/dist/assets/{apple-B62K6dJr.js → apple-CCxYFT90.js} +1 -1
  23. package/packages/ui/dist/assets/{arrow-bottom-BTuC5-tQ.js → arrow-bottom-Bo24o32F.js} +1 -1
  24. package/packages/ui/dist/assets/{arrow-bottom-circle-dlgFXE0q.js → arrow-bottom-circle-DEnDTNB2.js} +1 -1
  25. package/packages/ui/dist/assets/{arrow-left-Uohbz9c6.js → arrow-left-ufrfqGG4.js} +1 -1
  26. package/packages/ui/dist/assets/{arrow-right-CH0vSHgl.js → arrow-right-BkX5DoAK.js} +1 -1
  27. package/packages/ui/dist/assets/{arrow-top-CxY6BKDT.js → arrow-top-CtvgpoOn.js} +1 -1
  28. package/packages/ui/dist/assets/{bank-Dz6PlF79.js → bank-CfyC7KhE.js} +1 -1
  29. package/packages/ui/dist/assets/{basic-CTV3Ph_S.js → basic-GLsmxA9Q.js} +1 -1
  30. package/packages/ui/dist/assets/{browser-DBRTpG2H.js → browser-BXl5SSvD.js} +1 -1
  31. package/packages/ui/dist/assets/{card-DWA4Ne8q.js → card-BwTrNMXe.js} +1 -1
  32. package/packages/ui/dist/assets/{ccip-CJCerfkJ.js → ccip-BMqD_Aug.js} +1 -1
  33. package/packages/ui/dist/assets/{checkmark-Cx-ePFrg.js → checkmark-Dv3bs_r-.js} +1 -1
  34. package/packages/ui/dist/assets/{checkmark-bold-BhDIlGHD.js → checkmark-bold-v3XYVY9B.js} +1 -1
  35. package/packages/ui/dist/assets/{chevron-bottom-2uFzesS3.js → chevron-bottom-BtuSFYmE.js} +1 -1
  36. package/packages/ui/dist/assets/{chevron-left-BoKXXZ4E.js → chevron-left-Bj0j6Cyx.js} +1 -1
  37. package/packages/ui/dist/assets/{chevron-right-EUp-RhYw.js → chevron-right-QsZgfMHX.js} +1 -1
  38. package/packages/ui/dist/assets/{chevron-top-D51M78MN.js → chevron-top-B2LmuCUs.js} +1 -1
  39. package/packages/ui/dist/assets/{chrome-store-DrRbU0Rc.js → chrome-store-Be1HnDGs.js} +1 -1
  40. package/packages/ui/dist/assets/{clock-9mIuX-1G.js → clock-CCcblz1f.js} +1 -1
  41. package/packages/ui/dist/assets/{close-BvuXlx8s.js → close-rdnFQxXT.js} +1 -1
  42. package/packages/ui/dist/assets/{coinPlaceholder-Bi7hJj5a.js → coinPlaceholder-fRMoMI0y.js} +1 -1
  43. package/packages/ui/dist/assets/{compass-C623d6DE.js → compass-CSPR58D9.js} +1 -1
  44. package/packages/ui/dist/assets/{copy-CFhZQkfE.js → copy-C5WgEU7N.js} +1 -1
  45. package/packages/ui/dist/assets/{core-BGl4d2YS.js → core-CVXQL7tu.js} +3 -3
  46. package/packages/ui/dist/assets/cursor-C04TRGDh.js +3 -0
  47. package/packages/ui/dist/assets/{cursor-transparent-FBFMyBY2.js → cursor-transparent-zEBpsOE4.js} +1 -1
  48. package/packages/ui/dist/assets/{desktop-Cco6Py8z.js → desktop-CdkiOqLx.js} +1 -1
  49. package/packages/ui/dist/assets/{disconnect-GkX8GhOW.js → disconnect-B8I112zP.js} +1 -1
  50. package/packages/ui/dist/assets/{discord-BNJe-HNX.js → discord-x2BbO6cW.js} +1 -1
  51. package/packages/ui/dist/assets/{etherscan-CoY2RMWw.js → etherscan-C2OxN9Au.js} +1 -1
  52. package/packages/ui/dist/assets/{events-DlxPGhin.js → events-DwmWfwqa.js} +1 -1
  53. package/packages/ui/dist/assets/{exclamation-triangle-9thkvaBf.js → exclamation-triangle-IY-Iojhj.js} +1 -1
  54. package/packages/ui/dist/assets/{extension-BshOJ_bn.js → extension-Clnc3k0E.js} +1 -1
  55. package/packages/ui/dist/assets/{external-link-97rok_V_.js → external-link-DKjw-POo.js} +1 -1
  56. package/packages/ui/dist/assets/{facebook-BsiLEVlU.js → facebook-DA_F9Z5R.js} +1 -1
  57. package/packages/ui/dist/assets/{fallback-DlWsoHyh.js → fallback-CWZLJXZ9.js} +1 -1
  58. package/packages/ui/dist/assets/{farcaster-CmRL47La.js → farcaster-CulNjKFL.js} +1 -1
  59. package/packages/ui/dist/assets/{filters-DXAWgNLO.js → filters-BpETqr4_.js} +1 -1
  60. package/packages/ui/dist/assets/{github-bCBJUbbe.js → github-DywjW1rE.js} +1 -1
  61. package/packages/ui/dist/assets/{google-CYTI0KrI.js → google-DH_kH7BK.js} +1 -1
  62. package/packages/ui/dist/assets/{help-circle-LNgEbcGY.js → help-circle-DsMbG4i7.js} +1 -1
  63. package/packages/ui/dist/assets/{id-ChJn0Ugg.js → id-O5zOjYCk.js} +1 -1
  64. package/packages/ui/dist/assets/{image--Y7maC5b.js → image-BBJ-S1oj.js} +1 -1
  65. package/packages/ui/dist/assets/{index-BONuaN6W.js → index-9Als8Pk1.js} +1 -1
  66. package/packages/ui/dist/assets/{index-5MkegeeB.js → index-BP0G8SWV.js} +3 -3
  67. package/packages/ui/dist/assets/{index-BlU0aZ21.js → index-C9Q98LC_.js} +1 -1
  68. package/packages/ui/dist/assets/{index-CZMzzRJU.js → index-CMLePJSP.js} +1 -1
  69. package/packages/ui/dist/assets/{index-O4l6CrZ0.js → index-CkNlzfQa.js} +1 -1
  70. package/packages/ui/dist/assets/{index-BN0O-ZFZ.js → index-EVUMkF7X.js} +4 -4
  71. package/packages/ui/dist/assets/{index.es-CXlLR_xG.js → index.es-BS-p_sCc.js} +4 -4
  72. package/packages/ui/dist/assets/{info-DUq1c6sJ.js → info-CD3CYp-i.js} +1 -1
  73. package/packages/ui/dist/assets/{info-circle-UobJ0GGG.js → info-circle-CXbPnDro.js} +1 -1
  74. package/packages/ui/dist/assets/{lightbulb-BI4WR-IB.js → lightbulb-Bz1DT8Ju.js} +1 -1
  75. package/packages/ui/dist/assets/{mail-BSN2fVMe.js → mail-Lj8n2gbA.js} +1 -1
  76. package/packages/ui/dist/assets/{metamask-sdk-B7CK8pn-.js → metamask-sdk-DwS0o7ov.js} +1 -1
  77. package/packages/ui/dist/assets/{mobile-BfuUs9p7.js → mobile-O_sAbq2l.js} +1 -1
  78. package/packages/ui/dist/assets/{more-C1zkGuE3.js → more-DdiT_mbp.js} +1 -1
  79. package/packages/ui/dist/assets/{network-placeholder-CtiEl1UM.js → network-placeholder-Dx9MDHLN.js} +1 -1
  80. package/packages/ui/dist/assets/{nftPlaceholder-C_B9PGkr.js → nftPlaceholder-K9kW2r88.js} +1 -1
  81. package/packages/ui/dist/assets/{off-B93fIkKw.js → off-BOYfR8XB.js} +1 -1
  82. package/packages/ui/dist/assets/{parseSignature-BKzLunwo.js → parseSignature-NiLF290o.js} +1 -1
  83. package/packages/ui/dist/assets/{play-store-DfDTySLA.js → play-store-DRuPz3YP.js} +1 -1
  84. package/packages/ui/dist/assets/{plus-_EYE7Soi.js → plus-BhHn5k_7.js} +1 -1
  85. package/packages/ui/dist/assets/{qr-code-CSklhafe.js → qr-code-XQgVWw1M.js} +1 -1
  86. package/packages/ui/dist/assets/{recycle-horizontal-CoH2EBIZ.js → recycle-horizontal-B3DKBHl3.js} +1 -1
  87. package/packages/ui/dist/assets/{refresh-COGV5RR9.js → refresh-Bdt5zEiy.js} +1 -1
  88. package/packages/ui/dist/assets/{reown-logo-YYxIj6hm.js → reown-logo-B3-LoRif.js} +1 -1
  89. package/packages/ui/dist/assets/{search-CpoWhaNF.js → search-CT85WnLr.js} +1 -1
  90. package/packages/ui/dist/assets/{secp256k1-ZWo-L7nJ.js → secp256k1-CSD4IkAn.js} +1 -1
  91. package/packages/ui/dist/assets/{send-CjEG2p8N.js → send-DFlOyILV.js} +1 -1
  92. package/packages/ui/dist/assets/{swapHorizontal-3V6lypqD.js → swapHorizontal-BnJarCPM.js} +1 -1
  93. package/packages/ui/dist/assets/{swapHorizontalBold-7swnGG5R.js → swapHorizontalBold-BdXwQcVw.js} +1 -1
  94. package/packages/ui/dist/assets/{swapHorizontalMedium-zPdpOjAy.js → swapHorizontalMedium-DruY4Nll.js} +1 -1
  95. package/packages/ui/dist/assets/{swapHorizontalRoundedBold-2Mxr5XPm.js → swapHorizontalRoundedBold-BmU0rX2_.js} +1 -1
  96. package/packages/ui/dist/assets/{swapVertical-D9KAlnz7.js → swapVertical-BDYBLaB-.js} +1 -1
  97. package/packages/ui/dist/assets/{telegram-DztV38YW.js → telegram-Dj0PC8gI.js} +1 -1
  98. package/packages/ui/dist/assets/{three-dots-DWOvYMr0.js → three-dots-DCjLXmgH.js} +1 -1
  99. package/packages/ui/dist/assets/{twitch-B3UH6j0S.js → twitch-DtF7PahJ.js} +1 -1
  100. package/packages/ui/dist/assets/{twitterIcon-C2lA-xQv.js → twitterIcon-D5fHAEXR.js} +1 -1
  101. package/packages/ui/dist/assets/{verify-BP_uBvwh.js → verify-CvDrZusr.js} +1 -1
  102. package/packages/ui/dist/assets/{verify-filled-DLByZnlA.js → verify-filled-CPKWSwyP.js} +1 -1
  103. package/packages/ui/dist/assets/{w3m-modal-C2-cKwor.js → w3m-modal-DdzuRc6-.js} +1 -1
  104. package/packages/ui/dist/assets/{wallet-Bc7LMFHM.js → wallet-BDKdLwf0.js} +1 -1
  105. package/packages/ui/dist/assets/{wallet-placeholder-DsjujZQW.js → wallet-placeholder-DjYKf3de.js} +1 -1
  106. package/packages/ui/dist/assets/{walletconnect-i_fC7jz3.js → walletconnect-DtsEmRsg.js} +1 -1
  107. package/packages/ui/dist/assets/{warning-circle-DIxNhxFp.js → warning-circle-vXvip1Eh.js} +1 -1
  108. package/packages/ui/dist/assets/{x-BamJJInV.js → x-CIVAuGSw.js} +1 -1
  109. package/packages/ui/dist/index.html +1 -1
  110. package/templates/default/.env.example +15 -1
  111. package/templates/default/examples/dca/agent.ts +1 -1
  112. package/templates/default/examples/dca/mandate.ts +1 -1
  113. package/templates/default/src/agent.ts +1 -1
  114. package/templates/default/tsconfig.json +5 -2
  115. package/templates/lifi-permissions/README.md +1 -1
  116. package/packages/ui/dist/assets/cursor-CUSm3LCL.js +0 -3
@@ -35206,12 +35206,13 @@ var {
35206
35206
  Help
35207
35207
  } = import_index.default;
35208
35208
 
35209
- // ../chains/dist/index.js
35209
+ // ../sdk/src/chains.ts
35210
35210
  var chains = {
35211
35211
  // Ethereum mainnet
35212
35212
  1: {
35213
35213
  chainId: 1,
35214
35214
  name: "Ethereum",
35215
+ rpcEnvVar: "ETH_MAINNET_RPC_URL",
35215
35216
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35216
35217
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
35217
35218
  mandateFactory: "0x14EDd6c2a56EfC0d71E215ab13094B9AF90543d2",
@@ -35223,6 +35224,7 @@ var chains = {
35223
35224
  8453: {
35224
35225
  chainId: 8453,
35225
35226
  name: "Base",
35227
+ rpcEnvVar: "BASE_RPC_URL",
35226
35228
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35227
35229
  // Supersedes 0x6319d3dfDDe3804ba93D65752b00c52bFb05a1ab (SAIL-405).
35228
35230
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
@@ -35235,6 +35237,7 @@ var chains = {
35235
35237
  42161: {
35236
35238
  chainId: 42161,
35237
35239
  name: "Arbitrum",
35240
+ rpcEnvVar: "ARBITRUM_RPC_URL",
35238
35241
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35239
35242
  // Supersedes 0x2716B12832DED0EF5688519c5Fe069EFc0374E02 (SAIL-405).
35240
35243
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
@@ -35247,6 +35250,7 @@ var chains = {
35247
35250
  130: {
35248
35251
  chainId: 130,
35249
35252
  name: "Unichain",
35253
+ rpcEnvVar: "UNICHAIN_RPC_URL",
35250
35254
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35251
35255
  // Supersedes 0xD985029960a9B7C2E7E38e102C448b8b8539B156 (SAIL-406).
35252
35256
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
@@ -35259,6 +35263,7 @@ var chains = {
35259
35263
  84532: {
35260
35264
  chainId: 84532,
35261
35265
  name: "Base Sepolia",
35266
+ rpcEnvVar: "BASE_SEPOLIA_RPC_URL",
35262
35267
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35263
35268
  // Supersedes 0xf1D0F4C9893612627409948BAa9d82a01a373799 (SAIL-405).
35264
35269
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
@@ -35271,6 +35276,7 @@ var chains = {
35271
35276
  11155111: {
35272
35277
  chainId: 11155111,
35273
35278
  name: "Eth Sepolia",
35279
+ rpcEnvVar: "SEPOLIA_RPC_URL",
35274
35280
  // CREATE2 deterministic deploy (2026-06-09, gitCommit 1199b33).
35275
35281
  kernel: "0x02ABC18B65A328de2e749F56ba79ACF2718a6659",
35276
35282
  mandateFactory: "0x14EDd6c2a56EfC0d71E215ab13094B9AF90543d2",
@@ -35282,15 +35288,17 @@ var chains = {
35282
35288
  function getChain(chainId) {
35283
35289
  const config = chains[chainId];
35284
35290
  if (!config) {
35285
- throw new Error(`Chain ${chainId} is not yet supported. Add it to @sail/chains once SailKernel is deployed.`);
35291
+ throw new Error(
35292
+ `Chain ${chainId} is not supported. Supported chains: 1 (Ethereum), 8453 (Base), 42161 (Arbitrum), 130 (Unichain), 84532 (Base Sepolia), 11155111 (Eth Sepolia).`
35293
+ );
35286
35294
  }
35287
35295
  return config;
35288
35296
  }
35289
35297
 
35290
- // ../sdk/dist/client.js
35298
+ // ../sdk/src/client.ts
35291
35299
  init_esm2();
35292
35300
 
35293
- // ../sdk/dist/abis/SailKernel.js
35301
+ // ../sdk/src/abis/SailKernel.ts
35294
35302
  var SailKernelAbi = [
35295
35303
  // ── Account instantiation ────────────────────────────────────────────────
35296
35304
  {
@@ -35595,7 +35603,7 @@ var SailKernelAbi = [
35595
35603
  }
35596
35604
  ];
35597
35605
 
35598
- // ../sdk/dist/capabilities.js
35606
+ // ../sdk/src/capabilities.ts
35599
35607
  init_esm2();
35600
35608
  var DISPATCH_TYPE_STRINGS = {
35601
35609
  conjunctive: "Dispatch(address account,address target,uint256 value,bytes32 dataHash,uint256 nonce,uint256 deadline)",
@@ -35640,7 +35648,9 @@ function fromDispatchTypehash(kernel, dispatchTypehash, registerPermissionTypeha
35640
35648
  } else if (dispatchTypehash === DISPATCH_TYPEHASHES.selective) {
35641
35649
  dispatchModel = "selective";
35642
35650
  } else {
35643
- throw new Error(`Unrecognized kernel DISPATCH_TYPEHASH ${dispatchTypehash} for ${kernel}. The SDK cannot safely sign dispatches for this kernel version. Known: conjunctive=${DISPATCH_TYPEHASHES.conjunctive}, selective=${DISPATCH_TYPEHASHES.selective}.`);
35651
+ throw new Error(
35652
+ `Unrecognized kernel DISPATCH_TYPEHASH ${dispatchTypehash} for ${kernel}. The SDK cannot safely sign dispatches for this kernel version. Known: conjunctive=${DISPATCH_TYPEHASHES.conjunctive}, selective=${DISPATCH_TYPEHASHES.selective}.`
35653
+ );
35644
35654
  }
35645
35655
  let registerPermissionHasDeadline = dispatchModel === "selective";
35646
35656
  if (registerPermissionTypehash === REGISTER_PERMISSION_TYPEHASHES.withDeadline) {
@@ -35665,8 +35675,7 @@ async function detectKernelCapabilities(publicClient, kernel, opts) {
35665
35675
  const key = cacheKey2(chainId, kernel);
35666
35676
  if (!opts?.force) {
35667
35677
  const hit = cache.get(key);
35668
- if (hit)
35669
- return hit;
35678
+ if (hit) return hit;
35670
35679
  }
35671
35680
  let dispatchTypehash;
35672
35681
  let registerPermissionTypehash;
@@ -35688,17 +35697,29 @@ async function detectKernelCapabilities(publicClient, kernel, opts) {
35688
35697
  }
35689
35698
  let caps;
35690
35699
  if (dispatchTypehash) {
35691
- caps = fromDispatchTypehash(kernel, dispatchTypehash, registerPermissionTypehash, "onchain-typehash");
35700
+ caps = fromDispatchTypehash(
35701
+ kernel,
35702
+ dispatchTypehash,
35703
+ registerPermissionTypehash,
35704
+ "onchain-typehash"
35705
+ );
35692
35706
  } else if (opts?.staticModel) {
35693
- caps = fromDispatchTypehash(kernel, DISPATCH_TYPEHASHES[opts.staticModel], void 0, "static-hint");
35707
+ caps = fromDispatchTypehash(
35708
+ kernel,
35709
+ DISPATCH_TYPEHASHES[opts.staticModel],
35710
+ void 0,
35711
+ "static-hint"
35712
+ );
35694
35713
  } else {
35695
- throw new Error(`Could not read DISPATCH_TYPEHASH from kernel ${kernel}, and no staticModel hint was given. Pass opts.staticModel ('conjunctive' | 'selective') to proceed without on-chain detection.`);
35714
+ throw new Error(
35715
+ `Could not read DISPATCH_TYPEHASH from kernel ${kernel}, and no staticModel hint was given. Pass opts.staticModel ('conjunctive' | 'selective') to proceed without on-chain detection.`
35716
+ );
35696
35717
  }
35697
35718
  cache.set(key, caps);
35698
35719
  return caps;
35699
35720
  }
35700
35721
 
35701
- // ../sdk/dist/deployments.js
35722
+ // ../sdk/src/deployments.ts
35702
35723
  var CREATE2_KERNEL = "0x02ABC18B65A328de2e749F56ba79ACF2718a6659";
35703
35724
  var CREATE2_GOVERNANCE = "0x7A478118715791728BDE3bc7A4D7ECfdEB89C6EC";
35704
35725
  var CREATE2_TIMELOCK = "0xE48Ba8DB6d748adafD13155c3590f62e58a77f56";
@@ -35851,7 +35872,7 @@ function getSailDeployment(chainId) {
35851
35872
  return deployment;
35852
35873
  }
35853
35874
 
35854
- // ../sdk/dist/errors.js
35875
+ // ../sdk/src/errors.ts
35855
35876
  init_esm2();
35856
35877
  var KERNEL_ERROR_SIGNATURES = [
35857
35878
  "error AccountAlreadyRegistered(address account)",
@@ -35930,14 +35951,12 @@ async function decode2(data) {
35930
35951
  }
35931
35952
  }
35932
35953
  function decodeKernelError(data) {
35933
- if (!data || data === "0x")
35934
- return Promise.resolve(null);
35954
+ if (!data || data === "0x") return Promise.resolve(null);
35935
35955
  return decode2(data);
35936
35956
  }
35937
35957
  async function explainKernelRevert(err) {
35938
35958
  const data = extractRevertData(err);
35939
- if (!data)
35940
- return null;
35959
+ if (!data) return null;
35941
35960
  return decodeKernelError(data);
35942
35961
  }
35943
35962
  function extractRevertData(err) {
@@ -35967,7 +35986,7 @@ function extractRevertData(err) {
35967
35986
  return null;
35968
35987
  }
35969
35988
 
35970
- // ../sdk/dist/eip712.js
35989
+ // ../sdk/src/eip712.ts
35971
35990
  init_esm2();
35972
35991
  function sailKernelDomain(args) {
35973
35992
  return {
@@ -36021,12 +36040,16 @@ async function buildDispatchSignature(params) {
36021
36040
  const dataHash = keccak256(call2.data);
36022
36041
  const selective = caps.dispatchModel === "selective";
36023
36042
  const message = selective ? { account: account2, permission, target: call2.target, value: call2.value, dataHash, nonce, deadline } : { account: account2, target: call2.target, value: call2.value, dataHash, nonce, deadline };
36024
- const signature = await manager.signTyped(sailKernelDomain({ chainId, kernel }), {
36025
- primaryType: "Dispatch",
36026
- types: {
36027
- Dispatch: DISPATCH_EIP712_FIELDS[caps.dispatchModel]
36028
- }
36029
- }, message);
36043
+ const signature = await manager.signTyped(
36044
+ sailKernelDomain({ chainId, kernel }),
36045
+ {
36046
+ primaryType: "Dispatch",
36047
+ types: {
36048
+ Dispatch: DISPATCH_EIP712_FIELDS[caps.dispatchModel]
36049
+ }
36050
+ },
36051
+ message
36052
+ );
36030
36053
  return { signature, nonce, deadline, dispatchModel: caps.dispatchModel };
36031
36054
  }
36032
36055
  var REGISTER_PERMISSION_TYPES = {
@@ -36105,7 +36128,7 @@ function buildRegisterPermissionsBatchTypedData(args) {
36105
36128
  };
36106
36129
  }
36107
36130
 
36108
- // ../sdk/dist/lifi.js
36131
+ // ../sdk/src/lifi.ts
36109
36132
  init_esm2();
36110
36133
  var LIFI_QUOTE_URL = "https://li.quest/v1/quote";
36111
36134
  var LIFI_ROUTERS = {
@@ -36144,7 +36167,9 @@ async function fetchLifiQuote(params) {
36144
36167
  const quote = await res.json();
36145
36168
  const tx = quote.transactionRequest;
36146
36169
  if (!tx?.to || !tx?.data) {
36147
- throw new Error("LiFi quote returned no usable transactionRequest: " + JSON.stringify(quote).slice(0, 400));
36170
+ throw new Error(
36171
+ "LiFi quote returned no usable transactionRequest: " + JSON.stringify(quote).slice(0, 400)
36172
+ );
36148
36173
  }
36149
36174
  return {
36150
36175
  target: tx.to,
@@ -36155,7 +36180,7 @@ async function fetchLifiQuote(params) {
36155
36180
  };
36156
36181
  }
36157
36182
 
36158
- // ../sdk/dist/client.js
36183
+ // ../sdk/src/client.ts
36159
36184
  function notImplemented() {
36160
36185
  throw new Error("not implemented");
36161
36186
  }
@@ -36199,17 +36224,13 @@ var CONJUNCTIVE_DISPATCH_ABI = [
36199
36224
  async function enrichKernelRevert(err) {
36200
36225
  const decoded = await explainKernelRevert(err);
36201
36226
  const base2 = err instanceof Error ? err : new Error(String(err));
36202
- if (!decoded)
36203
- return base2;
36227
+ if (!decoded) return base2;
36204
36228
  const wrapped = new Error(`Kernel reverted: ${decoded.message}`);
36205
36229
  wrapped.cause = base2;
36206
36230
  wrapped.kernelError = decoded;
36207
36231
  return wrapped;
36208
36232
  }
36209
36233
  var KernelNamespace = class {
36210
- publicClient;
36211
- config;
36212
- walletClient;
36213
36234
  constructor(publicClient, config, walletClient) {
36214
36235
  this.publicClient = publicClient;
36215
36236
  this.config = config;
@@ -36218,13 +36239,17 @@ var KernelNamespace = class {
36218
36239
  requireKernel() {
36219
36240
  const kernel = this.config.kernel;
36220
36241
  if (!kernel) {
36221
- throw new Error("SailKernel address not configured \u2014 set `kernel` in SailorClientConfig.");
36242
+ throw new Error(
36243
+ "SailKernel address not configured \u2014 set `kernel` in SailorClientConfig."
36244
+ );
36222
36245
  }
36223
36246
  return kernel;
36224
36247
  }
36225
36248
  requireSigner() {
36226
36249
  if (!this.walletClient) {
36227
- throw new Error("No signer attached \u2014 call client.withSigner(walletClient) before write operations.");
36250
+ throw new Error(
36251
+ "No signer attached \u2014 call client.withSigner(walletClient) before write operations."
36252
+ );
36228
36253
  }
36229
36254
  return this.walletClient;
36230
36255
  }
@@ -36247,7 +36272,9 @@ var AccountNamespace = class extends KernelNamespace {
36247
36272
  const kernel = this.requireKernel();
36248
36273
  const signer = this.requireSigner();
36249
36274
  if (!params.safeFactory || !params.safeSingleton || !params.safeInitializer) {
36250
- throw new Error("createAccount requires safeFactory, safeSingleton, and safeInitializer.");
36275
+ throw new Error(
36276
+ "createAccount requires safeFactory, safeSingleton, and safeInitializer."
36277
+ );
36251
36278
  }
36252
36279
  const txHash = await signer.writeContract({
36253
36280
  address: kernel,
@@ -36308,17 +36335,21 @@ var MandateNamespace = class extends KernelNamespace {
36308
36335
  functionName: "signerNonces",
36309
36336
  args: [safe]
36310
36337
  });
36311
- const sig = await signer.signTyped(sailKernelDomain({ chainId: this.config.chainId, kernel }), {
36312
- primaryType: "RegisterPermissions",
36313
- types: {
36314
- RegisterPermissions: [
36315
- { name: "account", type: "address" },
36316
- { name: "permissions", type: "address[]" },
36317
- { name: "nonce", type: "uint256" },
36318
- { name: "deadline", type: "uint256" }
36319
- ]
36320
- }
36321
- }, { account: safe, permissions, nonce, deadline });
36338
+ const sig = await signer.signTyped(
36339
+ sailKernelDomain({ chainId: this.config.chainId, kernel }),
36340
+ {
36341
+ primaryType: "RegisterPermissions",
36342
+ types: {
36343
+ RegisterPermissions: [
36344
+ { name: "account", type: "address" },
36345
+ { name: "permissions", type: "address[]" },
36346
+ { name: "nonce", type: "uint256" },
36347
+ { name: "deadline", type: "uint256" }
36348
+ ]
36349
+ }
36350
+ },
36351
+ { account: safe, permissions, nonce, deadline }
36352
+ );
36322
36353
  await wallet.writeContract({
36323
36354
  address: kernel,
36324
36355
  abi: SailKernelAbi,
@@ -36337,7 +36368,9 @@ var MandateNamespace = class extends KernelNamespace {
36337
36368
  return notImplemented();
36338
36369
  }
36339
36370
  deployAndAttachClone(_safe, _impl, _initData, _salt, _signer) {
36340
- throw new Error("deployAndAttachClone is not yet implemented in the SDK.\nUse `sailor mandate attach --address <impl>` to attach a clone template via the factory.");
36371
+ throw new Error(
36372
+ "deployAndAttachClone is not yet implemented in the SDK.\nUse `sailor mandate attach --address <impl>` to attach a clone template via the factory."
36373
+ );
36341
36374
  }
36342
36375
  async list(safe) {
36343
36376
  const kernel = this.requireKernel();
@@ -36407,11 +36440,12 @@ var DispatchNamespace = class extends KernelNamespace {
36407
36440
  let latest = 0n;
36408
36441
  for (let i = 0; i < tries; i++) {
36409
36442
  latest = await this.readManagerNonce(kernel, safe);
36410
- if (latest >= expected)
36411
- return latest;
36443
+ if (latest >= expected) return latest;
36412
36444
  await delay(1e3);
36413
36445
  }
36414
- throw new Error(`Manager nonce for ${safe} did not reach ${expected} after ${tries}s (last seen ${latest}). The prior dispatch may not have mined, or the RPC endpoint is lagging. Retry, or pass an explicit nonce via options.nonce.`);
36446
+ throw new Error(
36447
+ `Manager nonce for ${safe} did not reach ${expected} after ${tries}s (last seen ${latest}). The prior dispatch may not have mined, or the RPC endpoint is lagging. Retry, or pass an explicit nonce via options.nonce.`
36448
+ );
36415
36449
  }
36416
36450
  /**
36417
36451
  * Determine the nonce to sign with. Honors an explicit `options.nonce`
@@ -36420,8 +36454,7 @@ var DispatchNamespace = class extends KernelNamespace {
36420
36454
  * dispatch on this account) before reading the live value.
36421
36455
  */
36422
36456
  async resolveNonce(kernel, safe, options) {
36423
- if (options?.nonce !== void 0)
36424
- return options.nonce;
36457
+ if (options?.nonce !== void 0) return options.nonce;
36425
36458
  const expected = options?.awaitNonce ?? this.nextNonce.get(this.nonceKey(kernel, safe));
36426
36459
  if (expected !== void 0) {
36427
36460
  return this.waitForManagerNonce(kernel, safe, expected);
@@ -36513,7 +36546,9 @@ var DispatchNamespace = class extends KernelNamespace {
36513
36546
  const deadline = defaultDeadline();
36514
36547
  const caps = await this.capabilities();
36515
36548
  if (caps.dispatchModel === "conjunctive") {
36516
- throw new Error(`Batch dispatch is not supported by the conjunctive kernel at ${kernel} (it has no dispatchBatch). Submit calls individually via dispatch.single, ensuring the manager nonce advances between them.`);
36549
+ throw new Error(
36550
+ `Batch dispatch is not supported by the conjunctive kernel at ${kernel} (it has no dispatchBatch). Submit calls individually via dispatch.single, ensuring the manager nonce advances between them.`
36551
+ );
36517
36552
  }
36518
36553
  const nonce = await this.publicClient.readContract({
36519
36554
  address: kernel,
@@ -36521,19 +36556,25 @@ var DispatchNamespace = class extends KernelNamespace {
36521
36556
  functionName: "batchNonces",
36522
36557
  args: [safe]
36523
36558
  });
36524
- const callsHash = keccak256(encodeAbiParameters([{ type: "tuple[]", components: CALL_COMPONENTS }], [calls]));
36525
- const managerSig = await manager.signTyped(sailKernelDomain({ chainId: this.config.chainId, kernel }), {
36526
- primaryType: "DispatchBatch",
36527
- types: {
36528
- DispatchBatch: [
36529
- { name: "account", type: "address" },
36530
- { name: "permission", type: "address" },
36531
- { name: "callsHash", type: "bytes32" },
36532
- { name: "nonce", type: "uint256" },
36533
- { name: "deadline", type: "uint256" }
36534
- ]
36535
- }
36536
- }, { account: safe, permission, callsHash, nonce, deadline });
36559
+ const callsHash = keccak256(
36560
+ encodeAbiParameters([{ type: "tuple[]", components: CALL_COMPONENTS }], [calls])
36561
+ );
36562
+ const managerSig = await manager.signTyped(
36563
+ sailKernelDomain({ chainId: this.config.chainId, kernel }),
36564
+ {
36565
+ primaryType: "DispatchBatch",
36566
+ types: {
36567
+ DispatchBatch: [
36568
+ { name: "account", type: "address" },
36569
+ { name: "permission", type: "address" },
36570
+ { name: "callsHash", type: "bytes32" },
36571
+ { name: "nonce", type: "uint256" },
36572
+ { name: "deadline", type: "uint256" }
36573
+ ]
36574
+ }
36575
+ },
36576
+ { account: safe, permission, callsHash, nonce, deadline }
36577
+ );
36537
36578
  let txHash;
36538
36579
  try {
36539
36580
  txHash = await wallet.writeContract({
@@ -36558,7 +36599,9 @@ var DispatchNamespace = class extends KernelNamespace {
36558
36599
  const kernel = this.requireKernel();
36559
36600
  const caps = await this.capabilities();
36560
36601
  if (caps.dispatchModel === "conjunctive") {
36561
- throw new Error(`Dry-run preview is not supported by the conjunctive kernel at ${kernel} (it has no previewBatch view). Validate calls off-chain against each registered permission's evaluate() logic, or simulate the dispatch.single tx instead.`);
36602
+ throw new Error(
36603
+ `Dry-run preview is not supported by the conjunctive kernel at ${kernel} (it has no previewBatch view). Validate calls off-chain against each registered permission's evaluate() logic, or simulate the dispatch.single tx instead.`
36604
+ );
36562
36605
  }
36563
36606
  const [approved, reason] = await this.publicClient.readContract({
36564
36607
  address: kernel,
@@ -36570,7 +36613,6 @@ var DispatchNamespace = class extends KernelNamespace {
36570
36613
  }
36571
36614
  };
36572
36615
  var StrategyNamespace = class extends KernelNamespace {
36573
- dispatch;
36574
36616
  constructor(publicClient, config, dispatch, walletClient) {
36575
36617
  super(publicClient, config, walletClient);
36576
36618
  this.dispatch = dispatch;
@@ -36588,13 +36630,17 @@ var StrategyNamespace = class extends KernelNamespace {
36588
36630
  const slippage = params.slippage ?? DEFAULT_SLIPPAGE;
36589
36631
  const router = params.router ?? LIFI_ROUTERS[this.config.chainId];
36590
36632
  if (!router) {
36591
- throw new Error(`No LiFi router known for chain ${this.config.chainId}. Pass params.router explicitly.`);
36633
+ throw new Error(
36634
+ `No LiFi router known for chain ${this.config.chainId}. Pass params.router explicitly.`
36635
+ );
36592
36636
  }
36593
36637
  const caps = await this.capabilities();
36594
36638
  const swapPermission = params.swapPermission ?? router;
36595
36639
  const approvePermission = params.approvePermission ?? params.swapPermission ?? router;
36596
36640
  if (caps.dispatchModel === "selective" && !params.swapPermission) {
36597
- throw new Error("This kernel uses the selective dispatch model \u2014 params.swapPermission is required (the permission that authorizes the swap).");
36641
+ throw new Error(
36642
+ "This kernel uses the selective dispatch model \u2014 params.swapPermission is required (the permission that authorizes the swap)."
36643
+ );
36598
36644
  }
36599
36645
  const quote = await fetchLifiQuote({
36600
36646
  chainId: this.config.chainId,
@@ -36614,9 +36660,19 @@ var StrategyNamespace = class extends KernelNamespace {
36614
36660
  let approve;
36615
36661
  if (allowance < params.amount) {
36616
36662
  const approveAmount = params.approveAmount ?? params.amount;
36617
- approve = await this.dispatch.single(safe, approvePermission, { target: params.from, value: 0n, data: encodeApprove(router, approveAmount) }, manager);
36663
+ approve = await this.dispatch.single(
36664
+ safe,
36665
+ approvePermission,
36666
+ { target: params.from, value: 0n, data: encodeApprove(router, approveAmount) },
36667
+ manager
36668
+ );
36618
36669
  }
36619
- const swap = await this.dispatch.single(safe, swapPermission, { target: quote.target, value: quote.value, data: quote.data }, manager);
36670
+ const swap = await this.dispatch.single(
36671
+ safe,
36672
+ swapPermission,
36673
+ { target: quote.target, value: quote.value, data: quote.data },
36674
+ manager
36675
+ );
36620
36676
  return {
36621
36677
  swap,
36622
36678
  approve,
@@ -36736,7 +36792,7 @@ var SailorClient = class _SailorClient {
36736
36792
  }
36737
36793
  };
36738
36794
 
36739
- // ../sdk/dist/keyring.js
36795
+ // ../sdk/src/keyring.ts
36740
36796
  var import_node_crypto = require("node:crypto");
36741
36797
  var import_node_fs = require("node:fs");
36742
36798
  init_esm2();
@@ -37418,7 +37474,7 @@ function mnemonicToAccount(mnemonic, { passphrase, ...hdKeyOpts } = {}) {
37418
37474
  return hdKeyToAccount(HDKey.fromMasterSeed(seed), hdKeyOpts);
37419
37475
  }
37420
37476
 
37421
- // ../sdk/dist/keyring.js
37477
+ // ../sdk/src/keyring.ts
37422
37478
  var SCRYPT_N = 1 << 18;
37423
37479
  var SCRYPT_R = 8;
37424
37480
  var SCRYPT_P = 1;
@@ -37436,11 +37492,16 @@ var LocalKeyring = class _LocalKeyring {
37436
37492
  this.address = account2.address;
37437
37493
  this.privateKey = options.privateKey;
37438
37494
  } else if (options.type === "mnemonic") {
37439
- const account2 = mnemonicToAccount(options.mnemonic, options.derivationPath ? { path: options.derivationPath } : void 0);
37495
+ const account2 = mnemonicToAccount(
37496
+ options.mnemonic,
37497
+ options.derivationPath ? { path: options.derivationPath } : void 0
37498
+ );
37440
37499
  this.account = account2;
37441
37500
  this.address = account2.address;
37442
37501
  } else {
37443
- throw new Error("keystore decryption not implemented \u2014 use type: 'privateKey' or type: 'mnemonic' instead");
37502
+ throw new Error(
37503
+ "keystore decryption not implemented \u2014 use type: 'privateKey' or type: 'mnemonic' instead"
37504
+ );
37444
37505
  }
37445
37506
  }
37446
37507
  /** Returns a lightweight signer stub for read-only contexts where the key is not available. */
@@ -37470,7 +37531,9 @@ var LocalKeyring = class _LocalKeyring {
37470
37531
  }
37471
37532
  const { n, r, p, dklen, salt } = crypto3.kdfparams;
37472
37533
  if (n < 1 << 14) {
37473
- throw new Error(`Keystore scrypt N=${n} is below the minimum accepted value (16384). Refusing to decrypt.`);
37534
+ throw new Error(
37535
+ `Keystore scrypt N=${n} is below the minimum accepted value (16384). Refusing to decrypt.`
37536
+ );
37474
37537
  }
37475
37538
  if (r < 8) {
37476
37539
  throw new Error(`Keystore scrypt r=${r} is below the minimum accepted value (8).`);
@@ -37488,7 +37551,11 @@ var LocalKeyring = class _LocalKeyring {
37488
37551
  if (computedMac.length !== storedMac.length || !(0, import_node_crypto.timingSafeEqual)(computedMac, storedMac)) {
37489
37552
  throw new Error("Invalid password or corrupt keystore");
37490
37553
  }
37491
- const decipher = (0, import_node_crypto.createDecipheriv)("aes-128-ctr", derived.subarray(0, 16), Buffer.from(crypto3.cipherparams.iv, "hex"));
37554
+ const decipher = (0, import_node_crypto.createDecipheriv)(
37555
+ "aes-128-ctr",
37556
+ derived.subarray(0, 16),
37557
+ Buffer.from(crypto3.cipherparams.iv, "hex")
37558
+ );
37492
37559
  const pkBytes = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
37493
37560
  return _LocalKeyring.fromPrivateKey(`0x${pkBytes.toString("hex")}`);
37494
37561
  }
@@ -37526,7 +37593,9 @@ var LocalKeyring = class _LocalKeyring {
37526
37593
  /** Exports the private key as an encrypted keystore JSON (scrypt + aes-128-ctr, geth v3). */
37527
37594
  async exportKeystore(password) {
37528
37595
  if (!this.privateKey) {
37529
- throw new Error("Private key unavailable \u2014 only privateKey/generated keyrings can be exported");
37596
+ throw new Error(
37597
+ "Private key unavailable \u2014 only privateKey/generated keyrings can be exported"
37598
+ );
37530
37599
  }
37531
37600
  const salt = (0, import_node_crypto.randomBytes)(32);
37532
37601
  const derived = (0, import_node_crypto.scryptSync)(password, salt, SCRYPT_DKLEN, {
@@ -37563,7 +37632,7 @@ var LocalKeyring = class _LocalKeyring {
37563
37632
  }
37564
37633
  };
37565
37634
 
37566
- // ../sdk/dist/abis/SailGovernance.js
37635
+ // ../sdk/src/abis/SailGovernance.ts
37567
37636
  var SailGovernanceAbi = [
37568
37637
  {
37569
37638
  type: "function",
@@ -37609,7 +37678,7 @@ var SailGovernanceAbi = [
37609
37678
  }
37610
37679
  ];
37611
37680
 
37612
- // ../sdk/dist/safe.js
37681
+ // ../sdk/src/safe.ts
37613
37682
  init_esm2();
37614
37683
  var setManagerAbi = [
37615
37684
  {
@@ -37699,7 +37768,10 @@ function buildSafeSetupInitializer(params) {
37699
37768
  });
37700
37769
  }
37701
37770
  function buildApprovedHashSignature(owner2) {
37702
- return encodePacked(["bytes32", "bytes32", "uint8"], [pad(owner2, { size: 32 }), pad("0x", { size: 32 }), 1]);
37771
+ return encodePacked(
37772
+ ["bytes32", "bytes32", "uint8"],
37773
+ [pad(owner2, { size: 32 }), pad("0x", { size: 32 }), 1]
37774
+ );
37703
37775
  }
37704
37776
  var safeProxyFactoryAbi = [
37705
37777
  {
@@ -37712,11 +37784,15 @@ var safeProxyFactoryAbi = [
37712
37784
  ];
37713
37785
  function computeSafeProxyAddress(params) {
37714
37786
  const { initializer, saltNonce, proxyCreationCode } = params;
37715
- const initCodeHash = keccak256(concat([
37716
- proxyCreationCode,
37717
- encodeAbiParameters([{ type: "address" }], [SAFE_V141.singletonL2])
37718
- ]));
37719
- const salt = keccak256(encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce]));
37787
+ const initCodeHash = keccak256(
37788
+ concat([
37789
+ proxyCreationCode,
37790
+ encodeAbiParameters([{ type: "address" }], [SAFE_V141.singletonL2])
37791
+ ])
37792
+ );
37793
+ const salt = keccak256(
37794
+ encodePacked(["bytes32", "uint256"], [keccak256(initializer), saltNonce])
37795
+ );
37720
37796
  return getCreate2Address({
37721
37797
  from: SAFE_V141.proxyFactory,
37722
37798
  salt,
@@ -37725,13 +37801,20 @@ function computeSafeProxyAddress(params) {
37725
37801
  }
37726
37802
  function computeKernelBoundSalt(params) {
37727
37803
  const { saltNonce, deployer, permissionSigner, manager, feePolicy } = params;
37728
- return BigInt(keccak256(encodeAbiParameters([
37729
- { type: "uint256" },
37730
- { type: "address" },
37731
- { type: "address" },
37732
- { type: "address" },
37733
- { type: "address" }
37734
- ], [saltNonce, deployer, permissionSigner, manager, feePolicy])));
37804
+ return BigInt(
37805
+ keccak256(
37806
+ encodeAbiParameters(
37807
+ [
37808
+ { type: "uint256" },
37809
+ { type: "address" },
37810
+ { type: "address" },
37811
+ { type: "address" },
37812
+ { type: "address" }
37813
+ ],
37814
+ [saltNonce, deployer, permissionSigner, manager, feePolicy]
37815
+ )
37816
+ )
37817
+ );
37735
37818
  }
37736
37819
  function computeSailSmaAddress(params) {
37737
37820
  const boundSalt = computeKernelBoundSalt(params);
@@ -37778,7 +37861,7 @@ function buildSetManagerExecTransaction(params) {
37778
37861
  return { to: params.safe, data };
37779
37862
  }
37780
37863
 
37781
- // ../sdk/dist/discovery.js
37864
+ // ../sdk/src/discovery.ts
37782
37865
  var SAFE_TX_SERVICE_SLUGS = {
37783
37866
  1: "eth",
37784
37867
  100: "gno",
@@ -37806,7 +37889,7 @@ async function discoverSafesForOwner(owner2, chainId) {
37806
37889
  return data.safes ?? [];
37807
37890
  }
37808
37891
 
37809
- // ../sdk/dist/fees.js
37892
+ // ../sdk/src/fees.ts
37810
37893
  function min(a, b) {
37811
37894
  return a < b ? a : b;
37812
37895
  }
@@ -37842,7 +37925,7 @@ async function estimatePermissionFee(publicClient, governance, permission) {
37842
37925
  }
37843
37926
  }
37844
37927
 
37845
- // ../sdk/dist/intelligence.js
37928
+ // ../sdk/src/intelligence.ts
37846
37929
  var SAIL_INTELLIGENCE_BASE_URL = "https://api.sail.money";
37847
37930
  var SAIL_INTELLIGENCE_DOCS_URL = "https://api.sail.money/docs";
37848
37931
 
@@ -38396,23 +38479,15 @@ function getChainById(chainId) {
38396
38479
  }
38397
38480
  return chain2;
38398
38481
  }
38399
- var RPC_ENV_VARS = {
38400
- 1: "ETH_MAINNET_RPC_URL",
38401
- 8453: "BASE_RPC_URL",
38402
- 42161: "ARBITRUM_RPC_URL",
38403
- 130: "UNICHAIN_RPC_URL",
38404
- 84532: "BASE_SEPOLIA_RPC_URL",
38405
- 11155111: "SEPOLIA_RPC_URL"
38406
- };
38407
38482
  function getRpcUrl(chainId) {
38408
38483
  const env = parseEnvFile(sailPath(".env.local"));
38409
- const fromProject = env.RPC_URL;
38410
- if (fromProject?.trim()) return fromProject.trim();
38411
- const perChain = RPC_ENV_VARS[chainId];
38412
- const fromPerChain = perChain ? process.env[perChain] : void 0;
38413
- if (fromPerChain?.trim()) return fromPerChain.trim();
38414
- const fromEnv = process.env.RPC_URL;
38415
- return fromEnv?.trim() ? fromEnv.trim() : void 0;
38484
+ const perChainVar = chains[chainId]?.rpcEnvVar;
38485
+ const fromProjectChain = perChainVar ? env[perChainVar] : void 0;
38486
+ if (fromProjectChain?.trim()) return fromProjectChain.trim();
38487
+ if (env.RPC_URL?.trim()) return env.RPC_URL.trim();
38488
+ const fromEnvChain = perChainVar ? process.env[perChainVar] : void 0;
38489
+ if (fromEnvChain?.trim()) return fromEnvChain.trim();
38490
+ return process.env.RPC_URL?.trim() || void 0;
38416
38491
  }
38417
38492
 
38418
38493
  // src/lib/keys.ts
@@ -39900,6 +39975,68 @@ async function capabilities(options = {}) {
39900
39975
  );
39901
39976
  }
39902
39977
 
39978
+ // src/commands/chains.ts
39979
+ init_esm2();
39980
+ function resolveVerifyRpc(chainId, activeChainId, env) {
39981
+ const varName = chains[chainId]?.rpcEnvVar;
39982
+ if (varName && env[varName]?.trim()) return env[varName].trim();
39983
+ if (chainId === activeChainId && env.RPC_URL?.trim()) return env.RPC_URL.trim();
39984
+ if (varName && process.env[varName]?.trim()) return process.env[varName].trim();
39985
+ if (chainId === activeChainId && process.env.RPC_URL?.trim()) return process.env.RPC_URL.trim();
39986
+ return void 0;
39987
+ }
39988
+ async function chainsCommand(options = {}) {
39989
+ const entries = Object.values(chains);
39990
+ const env = parseEnvFile(sailPath(".env.local"));
39991
+ const configChainId = readJsonFile(sailPath("config.json"))?.chainId;
39992
+ const activeChainIdRaw = env.CHAIN_ID ?? process.env.CHAIN_ID ?? (configChainId != null ? String(configChainId) : void 0);
39993
+ const activeChainId = activeChainIdRaw != null ? Number(activeChainIdRaw) : null;
39994
+ const results = await Promise.all(
39995
+ entries.map(async (cfg) => {
39996
+ if (!options.verify) return { ...cfg, verified: void 0, rpcUrl: void 0, error: void 0 };
39997
+ const rpcUrl = resolveVerifyRpc(cfg.chainId, activeChainId, env);
39998
+ if (!rpcUrl) {
39999
+ return { ...cfg, verified: null, rpcUrl: null, error: "no RPC configured" };
40000
+ }
40001
+ try {
40002
+ const client = createPublicClient({
40003
+ chain: getChainById(cfg.chainId),
40004
+ transport: http(rpcUrl)
40005
+ });
40006
+ const code = await client.getCode({ address: cfg.kernel });
40007
+ return { ...cfg, verified: !!code && code !== "0x", rpcUrl, error: null };
40008
+ } catch (err) {
40009
+ const message = err.message.split("\n")[0];
40010
+ console.error(`[chain ${cfg.chainId}] RPC unreachable (${rpcUrl}): ${message}`);
40011
+ return { ...cfg, verified: null, rpcUrl, error: message };
40012
+ }
40013
+ })
40014
+ );
40015
+ emit(
40016
+ options.json,
40017
+ () => {
40018
+ console.log("Supported chains");
40019
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
40020
+ for (const r of results) {
40021
+ let status2 = "";
40022
+ if (options.verify) {
40023
+ status2 = r.verified === true ? " \u2713 deployed" : r.verified === false ? " \u2717 not found" : r.error === "no RPC configured" ? " \u2013 no RPC configured" : " ? unreachable";
40024
+ }
40025
+ console.log(` ${r.name.padEnd(16)} (${String(r.chainId).padEnd(8)}) ${r.dispatchModel}${status2}`);
40026
+ console.log(` kernel: ${r.kernel}`);
40027
+ console.log(` mandateFactory: ${r.mandateFactory}`);
40028
+ console.log(` governance: ${r.governance}`);
40029
+ }
40030
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
40031
+ if (options.verify) {
40032
+ console.log("\u2713 deployed \u2717 not found ? RPC unreachable \u2013 no RPC configured");
40033
+ console.log("Set RPC_URL or per-chain vars (BASE_RPC_URL, ARBITRUM_RPC_URL, \u2026) in .sail/.env.local to verify more chains.");
40034
+ }
40035
+ },
40036
+ results
40037
+ );
40038
+ }
40039
+
39903
40040
  // src/commands/doctor.ts
39904
40041
  init_esm2();
39905
40042
 
@@ -40429,7 +40566,7 @@ function copyDirSync(src, dest) {
40429
40566
  for (const entry of import_node_fs8.default.readdirSync(src, { withFileTypes: true })) {
40430
40567
  if (TEMPLATE_COPY_EXCLUDES.has(entry.name)) continue;
40431
40568
  const srcPath = import_node_path7.default.join(src, entry.name);
40432
- const destName = entry.name === "_gitignore" ? ".gitignore" : entry.name;
40569
+ const destName = entry.name.startsWith("_") ? `.${entry.name.slice(1)}` : entry.name;
40433
40570
  const destPath = import_node_path7.default.join(dest, destName);
40434
40571
  if (entry.isDirectory()) {
40435
40572
  copyDirSync(srcPath, destPath);
@@ -40487,30 +40624,50 @@ function scaffoldProjectWorkspace(dest, name, options) {
40487
40624
  "utf-8"
40488
40625
  );
40489
40626
  writeIfMissing2(import_node_path7.default.join(sailDir2, "README.md"), SAIL_WORKSPACE_README);
40490
- const chainIdLine = chainId != null ? `CHAIN_ID=${chainId}
40491
- ` : `# CHAIN_ID=8453 # set after choosing your chain in Stage 1
40492
- `;
40627
+ const chainEntries = Object.values(chains);
40628
+ const perChainVarLines = chainEntries.map((c) => `# ${c.rpcEnvVar}=https://your-${c.name.toLowerCase().replace(/\s+/g, "-")}-endpoint`).join("\n");
40629
+ const chainIdExample = chainId != null ? `CHAIN_ID=${chainId}` : `# CHAIN_ID=8453 # set after choosing your chain in Stage 1`;
40493
40630
  import_node_fs8.default.writeFileSync(
40494
40631
  import_node_path7.default.join(dest, ".env.example"),
40495
40632
  `# Sailor agent environment
40633
+ #
40634
+ # RPC configuration \u2014 two patterns, pick one:
40635
+ #
40636
+ # Option A: single active chain (simplest)
40496
40637
  RPC_URL=https://your-rpc-endpoint
40497
- ${chainIdLine}
40498
- # Optional for non-interactive runs
40638
+ ${chainIdExample}
40639
+ #
40640
+ # Option B: per-chain endpoints (multi-chain projects, or if you prefer explicit names)
40641
+ # Set CHAIN_ID to the chain sailor run uses; omit RPC_URL if all chains have a specific var.
40642
+ ${perChainVarLines}
40643
+
40644
+ # Optional: non-interactive passphrase (CI, GitHub Actions, launchd, systemd)
40499
40645
  # SAIL_PASSPHRASE=change-me-to-a-strong-passphrase
40500
40646
  `,
40501
40647
  "utf-8"
40502
40648
  );
40503
- const rpcLine = options.rpcUrl ? `RPC_URL=${options.rpcUrl}` : `# Paste your RPC endpoint here (Alchemy, Infura, or any HTTPS endpoint)
40504
- # RPC_URL=https://your-rpc-endpoint`;
40505
- const chainLine = chainId != null ? `
40506
- CHAIN_ID=${chainId}` : ``;
40507
- writeIfMissing2(
40649
+ const rpcUrlLine = options.rpcUrl ? `RPC_URL=${options.rpcUrl}` : `# RPC_URL=https://your-rpc-endpoint`;
40650
+ const chainIdLine = chainId != null ? `CHAIN_ID=${chainId}` : `# CHAIN_ID=8453 # set after choosing your chain`;
40651
+ const allChainVarLines = chainEntries.map((c) => {
40652
+ const isActive = c.chainId === chainId;
40653
+ const val = isActive && options.rpcUrl ? options.rpcUrl : `https://your-${c.name.toLowerCase().replace(/\s+/g, "-")}-endpoint`;
40654
+ return isActive && options.rpcUrl ? `${c.rpcEnvVar}=${val}` : `# ${c.rpcEnvVar}=${val}`;
40655
+ }).join("\n");
40656
+ import_node_fs8.default.writeFileSync(
40508
40657
  import_node_path7.default.join(sailDir2, ".env.local"),
40509
- `${rpcLine}${chainLine}
40658
+ `# Real values \u2014 never commit this file.
40659
+ #
40660
+ # Option A: single active chain (simplest)
40661
+ ${rpcUrlLine}
40662
+ ${chainIdLine}
40663
+ #
40664
+ # Option B: per-chain endpoints (multi-chain or explicit names; omit RPC_URL if every chain has its own var)
40665
+ ${allChainVarLines}
40510
40666
 
40511
- # Optional for non-interactive runs (CI, GitHub Actions, launchd, systemd)
40667
+ # Optional: non-interactive passphrase (CI, GitHub Actions, launchd, systemd)
40512
40668
  # SAIL_PASSPHRASE=change-me-to-a-strong-passphrase
40513
- `
40669
+ `,
40670
+ "utf-8"
40514
40671
  );
40515
40672
  }
40516
40673
  async function initCommand(dir, options = {}) {
@@ -40621,7 +40778,7 @@ function detectState(dest) {
40621
40778
  return { kind: "A" };
40622
40779
  }
40623
40780
  }
40624
- function printWelcome(dest, name, inPlace, hasRpc, freshInit = false) {
40781
+ function printWelcome(dest, name, inPlace, _hasRpc, freshInit = false) {
40625
40782
  const state = freshInit ? { kind: "A" } : detectState(dest);
40626
40783
  if (state.kind === "B") {
40627
40784
  console.log("\nWelcome back.\n");
@@ -44211,6 +44368,7 @@ program2.command("doctor").description(
44211
44368
  program2.command("capabilities").description(
44212
44369
  "Feasibility map (read-only): chains, kernel model, mandate templates, strategy primitives"
44213
44370
  ).option("--json", "Emit machine-readable JSON").action(actionWith(capabilities));
44371
+ program2.command("chains").description("List supported chains and their SailKernel deployment addresses").option("--verify", "Verify each kernel is deployed via eth_getCode (one RPC call per chain)").option("--json", "Emit machine-readable JSON").action(actionWith(chainsCommand));
44214
44372
  function stub(name, description) {
44215
44373
  program2.command(name).description(description).allowUnknownOption().action(() => {
44216
44374
  console.log(`sailor ${name}: not implemented yet`);