@dev.sail.money/sailor 1.3.0-206 → 1.3.0-209

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 (104) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/dist/index.cjs +555 -414
  3. package/packages/cli/dist/server.cjs +1263 -56
  4. package/packages/sdk/dist/intelligence.d.ts +1 -1
  5. package/packages/sdk/dist/intelligence.js +1 -1
  6. package/packages/sdk/dist/keyring.d.ts +0 -6
  7. package/packages/sdk/dist/keyring.d.ts.map +1 -1
  8. package/packages/sdk/dist/keyring.js +1 -8
  9. package/packages/sdk/dist/keyring.js.map +1 -1
  10. package/packages/sdk/dist/signing.d.ts +29 -0
  11. package/packages/sdk/dist/signing.d.ts.map +1 -1
  12. package/packages/ui/dist/assets/{add-Dj4_n773.js → add-CLs0-B0p.js} +1 -1
  13. package/packages/ui/dist/assets/{all-wallets-BaFysN1G.js → all-wallets-CDOk28sj.js} +1 -1
  14. package/packages/ui/dist/assets/{app-store-DOc31zzY.js → app-store-DVzpi1qN.js} +1 -1
  15. package/packages/ui/dist/assets/{apple-BvrvOkPH.js → apple-C9U9iH1l.js} +1 -1
  16. package/packages/ui/dist/assets/{arrow-bottom-E1AfjXOT.js → arrow-bottom-DjQ4jGMe.js} +1 -1
  17. package/packages/ui/dist/assets/{arrow-bottom-circle-sou7Vo1V.js → arrow-bottom-circle-jxial9Si.js} +1 -1
  18. package/packages/ui/dist/assets/{arrow-left-wk3G9Ywf.js → arrow-left-BjAyI8D1.js} +1 -1
  19. package/packages/ui/dist/assets/{arrow-right-_a703_Pw.js → arrow-right-BlFO4Tcx.js} +1 -1
  20. package/packages/ui/dist/assets/{arrow-top-txyg3R3e.js → arrow-top-DJ3oh3DH.js} +1 -1
  21. package/packages/ui/dist/assets/{bank-BB1kd0NJ.js → bank-B98it1qN.js} +1 -1
  22. package/packages/ui/dist/assets/{basic-D0dy7nIZ.js → basic-DsgeyPNu.js} +1 -1
  23. package/packages/ui/dist/assets/{browser-BwHLhsTn.js → browser-j4vCeHwE.js} +1 -1
  24. package/packages/ui/dist/assets/{card-DRC6HmPF.js → card-CzxbMvEd.js} +1 -1
  25. package/packages/ui/dist/assets/{ccip-Dq6KeJQl.js → ccip-U9yiu_EK.js} +1 -1
  26. package/packages/ui/dist/assets/{checkmark-TbAAQGjd.js → checkmark-D5sWBbk3.js} +1 -1
  27. package/packages/ui/dist/assets/{checkmark-bold-4723vJ0-.js → checkmark-bold-BW6w3KCC.js} +1 -1
  28. package/packages/ui/dist/assets/{chevron-bottom-DtLoBRe9.js → chevron-bottom-BbHhmTQq.js} +1 -1
  29. package/packages/ui/dist/assets/{chevron-left-BtydsF9j.js → chevron-left-D8BDH4Wo.js} +1 -1
  30. package/packages/ui/dist/assets/{chevron-right-BbkU_Kf8.js → chevron-right-BQuQk5zc.js} +1 -1
  31. package/packages/ui/dist/assets/{chevron-top-BWf-sN-F.js → chevron-top-1oeSXkx4.js} +1 -1
  32. package/packages/ui/dist/assets/{chrome-store-CVFxc5H2.js → chrome-store-B1OMtzC-.js} +1 -1
  33. package/packages/ui/dist/assets/{clock-B4hJww1X.js → clock-e0HueehS.js} +1 -1
  34. package/packages/ui/dist/assets/{close-Ci93jqGe.js → close-Cy1ytr26.js} +1 -1
  35. package/packages/ui/dist/assets/{coinPlaceholder-cRv_xDgC.js → coinPlaceholder-DqJu3ZPV.js} +1 -1
  36. package/packages/ui/dist/assets/{compass-_sZZPtm6.js → compass-XDz_N2Hg.js} +1 -1
  37. package/packages/ui/dist/assets/{copy-DLaiLK0n.js → copy-DmDo3Nob.js} +1 -1
  38. package/packages/ui/dist/assets/{core-YssZmpJa.js → core-DbkMGSYW.js} +3 -3
  39. package/packages/ui/dist/assets/cursor-DRFqL8nZ.js +3 -0
  40. package/packages/ui/dist/assets/{cursor-transparent-CzXQbB2p.js → cursor-transparent-DF2aA10D.js} +1 -1
  41. package/packages/ui/dist/assets/{desktop-BiqQI1Ss.js → desktop-CVydOWLn.js} +1 -1
  42. package/packages/ui/dist/assets/{disconnect-DYu7YCzu.js → disconnect-BuN2Whnz.js} +1 -1
  43. package/packages/ui/dist/assets/{discord-C-ife-UZ.js → discord-DMNPvTB2.js} +1 -1
  44. package/packages/ui/dist/assets/{etherscan-Dq7ac-p9.js → etherscan-CacW-93f.js} +1 -1
  45. package/packages/ui/dist/assets/{events-BhTGLk8n.js → events-CZkVDFih.js} +1 -1
  46. package/packages/ui/dist/assets/{exclamation-triangle-BcOdRdbp.js → exclamation-triangle-B26hIvqO.js} +1 -1
  47. package/packages/ui/dist/assets/{extension-DmJLIidM.js → extension-B7rI0gv7.js} +1 -1
  48. package/packages/ui/dist/assets/{external-link-HNjp7-Po.js → external-link-CX8skCbH.js} +1 -1
  49. package/packages/ui/dist/assets/{facebook-BrSvHNyw.js → facebook-BDqbE6kl.js} +1 -1
  50. package/packages/ui/dist/assets/{fallback-Ubz80uXP.js → fallback-DWQYKf3l.js} +1 -1
  51. package/packages/ui/dist/assets/{farcaster-BsjltM6k.js → farcaster-zQ3oQzZ8.js} +1 -1
  52. package/packages/ui/dist/assets/{filters-B4yQbYZP.js → filters-DCglZYsM.js} +1 -1
  53. package/packages/ui/dist/assets/{github-CFq82Dds.js → github-BH-BYjss.js} +1 -1
  54. package/packages/ui/dist/assets/{google-DwZutf4a.js → google-DYFWxZbC.js} +1 -1
  55. package/packages/ui/dist/assets/{help-circle-CyA_8KQg.js → help-circle-BXH_DtZ_.js} +1 -1
  56. package/packages/ui/dist/assets/{id-jyZYn4LJ.js → id-Dr2yTeX1.js} +1 -1
  57. package/packages/ui/dist/assets/{image-Zv0yoBcH.js → image-DeJey1Eg.js} +1 -1
  58. package/packages/ui/dist/assets/{index-CeGppB9s.js → index-BP-UuQ8g.js} +1 -1
  59. package/packages/ui/dist/assets/{index-BY8A6EK8.js → index-BksbyFjf.js} +1 -1
  60. package/packages/ui/dist/assets/{index-BdG43zCl.js → index-C55-Ne92.js} +1 -1
  61. package/packages/ui/dist/assets/index-D6_Zei-R.js +1790 -0
  62. package/packages/ui/dist/assets/{index-67NncC_u.js → index-DVjAiPHI.js} +3 -3
  63. package/packages/ui/dist/assets/{index-BxRaYDiX.js → index-uSdXE5b_.js} +1 -1
  64. package/packages/ui/dist/assets/{index.es-C8EklrJY.js → index.es-dZlNPpfR.js} +4 -4
  65. package/packages/ui/dist/assets/{info-BwGEOdmB.js → info-B91pD5Rw.js} +1 -1
  66. package/packages/ui/dist/assets/{info-circle-BPCcX-Iq.js → info-circle-CySl3_on.js} +1 -1
  67. package/packages/ui/dist/assets/{lightbulb-BRwr4IaC.js → lightbulb-wwG8LQLo.js} +1 -1
  68. package/packages/ui/dist/assets/{mail-D-k_Vhe4.js → mail-D617YZ8y.js} +1 -1
  69. package/packages/ui/dist/assets/{metamask-sdk-AcOgwGrj.js → metamask-sdk-RbLbxUgF.js} +1 -1
  70. package/packages/ui/dist/assets/{mobile-B1ok9PfY.js → mobile-CD9KlA0m.js} +1 -1
  71. package/packages/ui/dist/assets/{more-DeMTMLWs.js → more-BQ_rpPXo.js} +1 -1
  72. package/packages/ui/dist/assets/{network-placeholder-J0Rc1I89.js → network-placeholder-BA7nl9e6.js} +1 -1
  73. package/packages/ui/dist/assets/{nftPlaceholder-dXGrzzoa.js → nftPlaceholder-D1EaaeDn.js} +1 -1
  74. package/packages/ui/dist/assets/{off-CS0f77lw.js → off-DnGG35_w.js} +1 -1
  75. package/packages/ui/dist/assets/{parseSignature-DJ16fHC4.js → parseSignature-E29x8poM.js} +1 -1
  76. package/packages/ui/dist/assets/{play-store-DmK8UaNC.js → play-store-C5u2FvYB.js} +1 -1
  77. package/packages/ui/dist/assets/{plus-CSGSnoCh.js → plus-CM4xJkvI.js} +1 -1
  78. package/packages/ui/dist/assets/{qr-code-BJMH0xmM.js → qr-code-kM3FUIdR.js} +1 -1
  79. package/packages/ui/dist/assets/{recycle-horizontal-D5XP5VgJ.js → recycle-horizontal-DWrRWIBM.js} +1 -1
  80. package/packages/ui/dist/assets/{refresh-MLX3Rdp6.js → refresh-CztbjK2d.js} +1 -1
  81. package/packages/ui/dist/assets/{reown-logo-CVoDFQbM.js → reown-logo-DUHEIodF.js} +1 -1
  82. package/packages/ui/dist/assets/{search-BDJDyvjC.js → search-BJtb4mn1.js} +1 -1
  83. package/packages/ui/dist/assets/{secp256k1-BWh3B02k.js → secp256k1-BjrTZpQx.js} +1 -1
  84. package/packages/ui/dist/assets/{send-BOq2svx_.js → send-B3_kavG1.js} +1 -1
  85. package/packages/ui/dist/assets/{swapHorizontal-ByjLi_-_.js → swapHorizontal-BrF9POiv.js} +1 -1
  86. package/packages/ui/dist/assets/{swapHorizontalBold-fmCp_4AE.js → swapHorizontalBold-Dgf8OjXj.js} +1 -1
  87. package/packages/ui/dist/assets/{swapHorizontalMedium-D6dFseYw.js → swapHorizontalMedium-C6wX0JZj.js} +1 -1
  88. package/packages/ui/dist/assets/{swapHorizontalRoundedBold-B2V3m4ha.js → swapHorizontalRoundedBold-DTAVw6oF.js} +1 -1
  89. package/packages/ui/dist/assets/{swapVertical-DVmCsmeT.js → swapVertical-KGlTFNoi.js} +1 -1
  90. package/packages/ui/dist/assets/{telegram-Bv8JRbMM.js → telegram-DnLrK-4y.js} +1 -1
  91. package/packages/ui/dist/assets/{three-dots-YYDJ18z6.js → three-dots-C6_oMJfw.js} +1 -1
  92. package/packages/ui/dist/assets/{twitch-B2_Jy-Ft.js → twitch-DvPqPD4f.js} +1 -1
  93. package/packages/ui/dist/assets/{twitterIcon-pKQzPQRt.js → twitterIcon-BZdk82Am.js} +1 -1
  94. package/packages/ui/dist/assets/{verify-Bty2jIav.js → verify-CbESD5G0.js} +1 -1
  95. package/packages/ui/dist/assets/{verify-filled-CKz2fuKl.js → verify-filled-BRjTrLxw.js} +1 -1
  96. package/packages/ui/dist/assets/{w3m-modal-Wg1mtmVM.js → w3m-modal-D9b2TGHc.js} +1 -1
  97. package/packages/ui/dist/assets/{wallet-DslzC8rD.js → wallet-B87E5UId.js} +1 -1
  98. package/packages/ui/dist/assets/{wallet-placeholder-Dyw8jJ56.js → wallet-placeholder-DmssSbYf.js} +1 -1
  99. package/packages/ui/dist/assets/{walletconnect-DZBfbgp4.js → walletconnect-CZkLKWMZ.js} +1 -1
  100. package/packages/ui/dist/assets/{warning-circle-D7NPDx4k.js → warning-circle-BPTpHB1P.js} +1 -1
  101. package/packages/ui/dist/assets/{x-DRR_9FNs.js → x-D_dEtEDU.js} +1 -1
  102. package/packages/ui/dist/index.html +1 -1
  103. package/packages/ui/dist/assets/cursor-B_xyJnjj.js +0 -3
  104. package/packages/ui/dist/assets/index-_DkPx8RN.js +0 -1790
@@ -15943,7 +15943,7 @@ var require_get_intrinsic = __commonJS({
15943
15943
  var abs = require_abs();
15944
15944
  var floor = require_floor();
15945
15945
  var max = require_max();
15946
- var min = require_min();
15946
+ var min2 = require_min();
15947
15947
  var pow = require_pow();
15948
15948
  var round = require_round();
15949
15949
  var sign3 = require_sign();
@@ -16057,7 +16057,7 @@ var require_get_intrinsic = __commonJS({
16057
16057
  "%Math.abs%": abs,
16058
16058
  "%Math.floor%": floor,
16059
16059
  "%Math.max%": max,
16060
- "%Math.min%": min,
16060
+ "%Math.min%": min2,
16061
16061
  "%Math.pow%": pow,
16062
16062
  "%Math.round%": round,
16063
16063
  "%Math.sign%": sign3,
@@ -22055,12 +22055,12 @@ var require_cookie = __commonJS({
22055
22055
  } while (++index2 < max);
22056
22056
  return max;
22057
22057
  }
22058
- function endIndex(str, index2, min) {
22059
- while (index2 > min) {
22058
+ function endIndex(str, index2, min2) {
22059
+ while (index2 > min2) {
22060
22060
  var code = str.charCodeAt(--index2);
22061
22061
  if (code !== 32 && code !== 9) return index2 + 1;
22062
22062
  }
22063
- return min;
22063
+ return min2;
22064
22064
  }
22065
22065
  function serialize(name, val, opt) {
22066
22066
  var enc = opt && opt.encode || encodeURIComponent;
@@ -26953,8 +26953,8 @@ var init_encoding = __esm({
26953
26953
  "../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.4.3/node_modules/viem/_esm/errors/encoding.js"() {
26954
26954
  init_base();
26955
26955
  IntegerOutOfRangeError = class extends BaseError {
26956
- constructor({ max, min, signed, size: size6, value }) {
26957
- super(`Number "${value}" is not in safe ${size6 ? `${size6 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
26956
+ constructor({ max, min: min2, signed, size: size6, value }) {
26957
+ super(`Number "${value}" is not in safe ${size6 ? `${size6 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min2} to ${max})` : `(above ${min2})`}`, { name: "IntegerOutOfRangeError" });
26958
26958
  }
26959
26959
  };
26960
26960
  SizeOverflowError = class extends BaseError {
@@ -27265,9 +27265,9 @@ function aexists(instance, checkFinished = true) {
27265
27265
  }
27266
27266
  function aoutput(out, instance) {
27267
27267
  abytes(out);
27268
- const min = instance.outputLen;
27269
- if (out.length < min) {
27270
- throw new Error("digestInto() expects output buffer of length at least " + min);
27268
+ const min2 = instance.outputLen;
27269
+ if (out.length < min2) {
27270
+ throw new Error("digestInto() expects output buffer of length at least " + min2);
27271
27271
  }
27272
27272
  }
27273
27273
  function u32(arr) {
@@ -28063,11 +28063,11 @@ function encodeBool(value) {
28063
28063
  function encodeNumber(value, { signed, size: size6 = 256 }) {
28064
28064
  if (typeof size6 === "number") {
28065
28065
  const max = 2n ** (BigInt(size6) - (signed ? 1n : 0n)) - 1n;
28066
- const min = signed ? -max - 1n : 0n;
28067
- if (value > max || value < min)
28066
+ const min2 = signed ? -max - 1n : 0n;
28067
+ if (value > max || value < min2)
28068
28068
  throw new IntegerOutOfRangeError({
28069
28069
  max: max.toString(),
28070
- min: min.toString(),
28070
+ min: min2.toString(),
28071
28071
  signed,
28072
28072
  size: size6 / 8,
28073
28073
  value: value.toString()
@@ -29898,12 +29898,12 @@ function utf8ToBytes2(str) {
29898
29898
  throw new Error("string expected");
29899
29899
  return new Uint8Array(new TextEncoder().encode(str));
29900
29900
  }
29901
- function inRange(n, min, max) {
29902
- return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
29901
+ function inRange(n, min2, max) {
29902
+ return isPosBig(n) && isPosBig(min2) && isPosBig(max) && min2 <= n && n < max;
29903
29903
  }
29904
- function aInRange(title, n, min, max) {
29905
- if (!inRange(n, min, max))
29906
- throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n);
29904
+ function aInRange(title, n, min2, max) {
29905
+ if (!inRange(n, min2, max))
29906
+ throw new Error("expected valid " + title + ": " + min2 + " <= n < " + max + ", got " + n);
29907
29907
  }
29908
29908
  function bitLen(n) {
29909
29909
  let len;
@@ -34260,8 +34260,8 @@ var init_encoding2 = __esm({
34260
34260
  "../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/encoding.js"() {
34261
34261
  init_base2();
34262
34262
  IntegerOutOfRangeError2 = class extends BaseError3 {
34263
- constructor({ max, min, signed, size: size6, value }) {
34264
- super(`Number "${value}" is not in safe ${size6 ? `${size6 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
34263
+ constructor({ max, min: min2, signed, size: size6, value }) {
34264
+ super(`Number "${value}" is not in safe ${size6 ? `${size6 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min2} to ${max})` : `(above ${min2})`}`, { name: "IntegerOutOfRangeError" });
34265
34265
  }
34266
34266
  };
34267
34267
  InvalidBytesBooleanError = class extends BaseError3 {
@@ -34990,11 +34990,11 @@ function encodeBool2(value) {
34990
34990
  function encodeNumber2(value, { signed, size: size6 = 256 }) {
34991
34991
  if (typeof size6 === "number") {
34992
34992
  const max = 2n ** (BigInt(size6) - (signed ? 1n : 0n)) - 1n;
34993
- const min = signed ? -max - 1n : 0n;
34994
- if (value > max || value < min)
34993
+ const min2 = signed ? -max - 1n : 0n;
34994
+ if (value > max || value < min2)
34995
34995
  throw new IntegerOutOfRangeError2({
34996
34996
  max: max.toString(),
34997
- min: min.toString(),
34997
+ min: min2.toString(),
34998
34998
  signed,
34999
34999
  size: size6 / 8,
35000
35000
  value: value.toString()
@@ -38094,8 +38094,8 @@ var init_Hex = __esm({
38094
38094
  encoder6 = /* @__PURE__ */ new TextEncoder();
38095
38095
  hexes5 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
38096
38096
  IntegerOutOfRangeError3 = class extends BaseError4 {
38097
- constructor({ max, min, signed, size: size6, value }) {
38098
- super(`Number \`${value}\` is not in safe${size6 ? ` ${size6 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`);
38097
+ constructor({ max, min: min2, signed, size: size6, value }) {
38098
+ super(`Number \`${value}\` is not in safe${size6 ? ` ${size6 * 8}-bit` : ""}${signed ? " signed" : " unsigned"} integer range ${max ? `(\`${min2}\` to \`${max}\`)` : `(above \`${min2}\`)`}`);
38099
38099
  Object.defineProperty(this, "name", {
38100
38100
  enumerable: true,
38101
38101
  configurable: true,
@@ -38597,7 +38597,7 @@ var init_contracts = __esm({
38597
38597
  });
38598
38598
 
38599
38599
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/chain.js
38600
- var ChainDoesNotSupportContract, ClientChainNotConfiguredError, InvalidChainIdError2;
38600
+ var ChainDoesNotSupportContract, ChainMismatchError, ChainNotFoundError, ClientChainNotConfiguredError, InvalidChainIdError2;
38601
38601
  var init_chain2 = __esm({
38602
38602
  "../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/chain.js"() {
38603
38603
  init_base2();
@@ -38616,6 +38616,27 @@ var init_chain2 = __esm({
38616
38616
  });
38617
38617
  }
38618
38618
  };
38619
+ ChainMismatchError = class extends BaseError3 {
38620
+ constructor({ chain: chain2, currentChainId }) {
38621
+ super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain2.id} \u2013 ${chain2.name}).`, {
38622
+ metaMessages: [
38623
+ `Current Chain ID: ${currentChainId}`,
38624
+ `Expected Chain ID: ${chain2.id} \u2013 ${chain2.name}`
38625
+ ],
38626
+ name: "ChainMismatchError"
38627
+ });
38628
+ }
38629
+ };
38630
+ ChainNotFoundError = class extends BaseError3 {
38631
+ constructor() {
38632
+ super([
38633
+ "No chain was provided to the request.",
38634
+ "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
38635
+ ].join("\n"), {
38636
+ name: "ChainNotFoundError"
38637
+ });
38638
+ }
38639
+ };
38619
38640
  ClientChainNotConfiguredError = class extends BaseError3 {
38620
38641
  constructor() {
38621
38642
  super("No chain was provided to the Client.", {
@@ -40557,18 +40578,12 @@ var LocalKeyring = class _LocalKeyring {
40557
40578
  this.account = account;
40558
40579
  this.address = account.address;
40559
40580
  this.privateKey = options.privateKey;
40560
- } else if (options.type === "mnemonic") {
40581
+ } else {
40561
40582
  const account = mnemonicToAccount(options.mnemonic, options.derivationPath ? { path: options.derivationPath } : void 0);
40562
40583
  this.account = account;
40563
40584
  this.address = account.address;
40564
- } else {
40565
- throw new Error("keystore decryption not implemented \u2014 use type: 'privateKey' or type: 'mnemonic' instead");
40566
40585
  }
40567
40586
  }
40568
- /** Returns a lightweight signer stub for read-only contexts where the key is not available. */
40569
- static fromAddress(address) {
40570
- return { address };
40571
- }
40572
40587
  /** Generates a brand-new keyring backed by a random private key. */
40573
40588
  static generate() {
40574
40589
  return new _LocalKeyring({ type: "privateKey", privateKey: generatePrivateKey() });
@@ -40685,6 +40700,52 @@ var LocalKeyring = class _LocalKeyring {
40685
40700
  }
40686
40701
  };
40687
40702
 
40703
+ // ../sdk/dist/abis/SailGovernance.js
40704
+ var SailGovernanceAbi = [
40705
+ {
40706
+ type: "function",
40707
+ name: "baseFee",
40708
+ stateMutability: "view",
40709
+ inputs: [],
40710
+ outputs: [{ type: "uint256" }]
40711
+ },
40712
+ {
40713
+ type: "function",
40714
+ name: "complexityRate",
40715
+ stateMutability: "view",
40716
+ inputs: [],
40717
+ outputs: [{ type: "uint256" }]
40718
+ },
40719
+ {
40720
+ type: "function",
40721
+ name: "MAX_PERMISSION_FEE_WEI",
40722
+ stateMutability: "view",
40723
+ inputs: [],
40724
+ outputs: [{ type: "uint256" }]
40725
+ },
40726
+ {
40727
+ type: "function",
40728
+ name: "permissionRegistrationFee",
40729
+ stateMutability: "view",
40730
+ inputs: [],
40731
+ outputs: [{ type: "uint256" }]
40732
+ },
40733
+ {
40734
+ type: "function",
40735
+ name: "maxPermissionsPerAccount",
40736
+ stateMutability: "view",
40737
+ inputs: [],
40738
+ outputs: [{ type: "uint256" }]
40739
+ },
40740
+ {
40741
+ type: "function",
40742
+ name: "isPaused",
40743
+ stateMutability: "view",
40744
+ inputs: [],
40745
+ outputs: [{ type: "bool" }]
40746
+ }
40747
+ ];
40748
+
40688
40749
  // ../sdk/dist/safe.js
40689
40750
  init_esm();
40690
40751
  var gnosisSafeAbi = [
@@ -40746,6 +40807,42 @@ function buildSafeSetupInitializer(params) {
40746
40807
  });
40747
40808
  }
40748
40809
 
40810
+ // ../sdk/dist/fees.js
40811
+ function min(a, b) {
40812
+ return a < b ? a : b;
40813
+ }
40814
+ async function estimatePermissionFee(publicClient, governance, permission) {
40815
+ try {
40816
+ const [baseFee, complexityRate, cap, code] = await Promise.all([
40817
+ publicClient.readContract({
40818
+ address: governance,
40819
+ abi: SailGovernanceAbi,
40820
+ functionName: "baseFee"
40821
+ }),
40822
+ publicClient.readContract({
40823
+ address: governance,
40824
+ abi: SailGovernanceAbi,
40825
+ functionName: "complexityRate"
40826
+ }),
40827
+ publicClient.readContract({
40828
+ address: governance,
40829
+ abi: SailGovernanceAbi,
40830
+ functionName: "MAX_PERMISSION_FEE_WEI"
40831
+ }),
40832
+ publicClient.getBytecode({ address: permission })
40833
+ ]);
40834
+ const byteLength = code ? BigInt((code.length - 2) / 2) : 0n;
40835
+ const fee = min(baseFee, cap) + min(byteLength * complexityRate, cap);
40836
+ return min(fee, cap);
40837
+ } catch {
40838
+ return publicClient.readContract({
40839
+ address: governance,
40840
+ abi: SailGovernanceAbi,
40841
+ functionName: "permissionRegistrationFee"
40842
+ });
40843
+ }
40844
+ }
40845
+
40749
40846
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/getAction.js
40750
40847
  function getAction(client, actionFn, name) {
40751
40848
  const action_implicit = client[actionFn.name];
@@ -42806,6 +42903,56 @@ function watchContractEvent(client, parameters) {
42806
42903
  return enablePolling ? pollContractEvent() : subscribeContractEvent();
42807
42904
  }
42808
42905
 
42906
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/writeContract.js
42907
+ init_parseAccount();
42908
+
42909
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/account.js
42910
+ init_base2();
42911
+ var AccountNotFoundError = class extends BaseError3 {
42912
+ constructor({ docsPath: docsPath9 } = {}) {
42913
+ super([
42914
+ "Could not find an Account to execute with this Action.",
42915
+ "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
42916
+ ].join("\n"), {
42917
+ docsPath: docsPath9,
42918
+ docsSlug: "account",
42919
+ name: "AccountNotFoundError"
42920
+ });
42921
+ }
42922
+ };
42923
+ var AccountTypeNotSupportedError = class extends BaseError3 {
42924
+ constructor({ docsPath: docsPath9, metaMessages, type }) {
42925
+ super(`Account type "${type}" is not supported.`, {
42926
+ docsPath: docsPath9,
42927
+ metaMessages,
42928
+ name: "AccountTypeNotSupportedError"
42929
+ });
42930
+ }
42931
+ };
42932
+
42933
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/writeContract.js
42934
+ init_encodeFunctionData2();
42935
+
42936
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendTransaction.js
42937
+ init_parseAccount();
42938
+ init_base2();
42939
+
42940
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/chain/assertCurrentChain.js
42941
+ init_chain2();
42942
+ function assertCurrentChain({ chain: chain2, currentChainId }) {
42943
+ if (!chain2)
42944
+ throw new ChainNotFoundError();
42945
+ if (currentChainId !== chain2.id)
42946
+ throw new ChainMismatchError({ chain: chain2, currentChainId });
42947
+ }
42948
+
42949
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendTransaction.js
42950
+ init_concat2();
42951
+ init_extract();
42952
+ init_transactionRequest();
42953
+ init_lru2();
42954
+ init_assertRequest();
42955
+
42809
42956
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendRawTransaction.js
42810
42957
  async function sendRawTransaction(client, { serializedTransaction }) {
42811
42958
  return client.request({
@@ -42814,6 +42961,218 @@ async function sendRawTransaction(client, { serializedTransaction }) {
42814
42961
  }, { retryCount: 0 });
42815
42962
  }
42816
42963
 
42964
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendTransaction.js
42965
+ var supportsWalletNamespace = new LruMap2(128);
42966
+ async function sendTransaction(client, parameters) {
42967
+ const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, type, value, ...rest } = parameters;
42968
+ if (typeof account_ === "undefined")
42969
+ throw new AccountNotFoundError({
42970
+ docsPath: "/docs/actions/wallet/sendTransaction"
42971
+ });
42972
+ const account = account_ ? parseAccount(account_) : null;
42973
+ let nonceManagerParameters;
42974
+ try {
42975
+ assertRequest(parameters);
42976
+ const to = await (async () => {
42977
+ if (parameters.to)
42978
+ return parameters.to;
42979
+ if (parameters.to === null)
42980
+ return void 0;
42981
+ if (authorizationList && authorizationList.length > 0)
42982
+ return await recoverAuthorizationAddress({
42983
+ authorization: authorizationList[0]
42984
+ }).catch(() => {
42985
+ throw new BaseError3("`to` is required. Could not infer from `authorizationList`.");
42986
+ });
42987
+ return void 0;
42988
+ })();
42989
+ if (account?.type === "json-rpc" || account === null) {
42990
+ let chainId;
42991
+ if (chain2 !== null) {
42992
+ chainId = await getAction(client, getChainId, "getChainId")({});
42993
+ if (assertChainId)
42994
+ assertCurrentChain({
42995
+ currentChainId: chainId,
42996
+ chain: chain2
42997
+ });
42998
+ }
42999
+ const chainFormat = client.chain?.formatters?.transactionRequest?.format;
43000
+ const format = chainFormat || formatTransactionRequest;
43001
+ const request = format({
43002
+ // Pick out extra data that might exist on the chain's transaction request type.
43003
+ ...extract(rest, { format: chainFormat }),
43004
+ accessList,
43005
+ account,
43006
+ authorizationList,
43007
+ blobs,
43008
+ chainId,
43009
+ data: dataSuffix ? concat2([data ?? "0x", dataSuffix]) : data,
43010
+ gas,
43011
+ gasPrice,
43012
+ maxFeePerBlobGas,
43013
+ maxFeePerGas,
43014
+ maxPriorityFeePerGas,
43015
+ nonce,
43016
+ to,
43017
+ type,
43018
+ value
43019
+ }, "sendTransaction");
43020
+ const isWalletNamespaceSupported = supportsWalletNamespace.get(client.uid);
43021
+ const method = isWalletNamespaceSupported ? "wallet_sendTransaction" : "eth_sendTransaction";
43022
+ try {
43023
+ return await client.request({
43024
+ method,
43025
+ params: [request]
43026
+ }, { retryCount: 0 });
43027
+ } catch (e) {
43028
+ if (isWalletNamespaceSupported === false)
43029
+ throw e;
43030
+ const error = e;
43031
+ if (error.name === "InvalidInputRpcError" || error.name === "InvalidParamsRpcError" || error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError") {
43032
+ return await client.request({
43033
+ method: "wallet_sendTransaction",
43034
+ params: [request]
43035
+ }, { retryCount: 0 }).then((hash4) => {
43036
+ supportsWalletNamespace.set(client.uid, true);
43037
+ return hash4;
43038
+ }).catch((e2) => {
43039
+ const walletNamespaceError = e2;
43040
+ if (walletNamespaceError.name === "MethodNotFoundRpcError" || walletNamespaceError.name === "MethodNotSupportedRpcError") {
43041
+ supportsWalletNamespace.set(client.uid, false);
43042
+ throw error;
43043
+ }
43044
+ throw walletNamespaceError;
43045
+ });
43046
+ }
43047
+ throw error;
43048
+ }
43049
+ }
43050
+ if (account?.type === "local") {
43051
+ if (account.nonceManager && typeof nonce === "undefined") {
43052
+ const requestChainId = rest.chainId;
43053
+ const chainId = await (async () => {
43054
+ if (typeof requestChainId === "number")
43055
+ return requestChainId;
43056
+ if (chain2)
43057
+ return chain2.id;
43058
+ return getAction(client, getChainId, "getChainId")({});
43059
+ })();
43060
+ nonceManagerParameters = { address: account.address, chainId };
43061
+ }
43062
+ const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
43063
+ account,
43064
+ accessList,
43065
+ authorizationList,
43066
+ blobs,
43067
+ chain: chain2,
43068
+ data: dataSuffix ? concat2([data ?? "0x", dataSuffix]) : data,
43069
+ gas,
43070
+ gasPrice,
43071
+ maxFeePerBlobGas,
43072
+ maxFeePerGas,
43073
+ maxPriorityFeePerGas,
43074
+ nonce,
43075
+ nonceManager: account.nonceManager,
43076
+ parameters: [...defaultParameters, "sidecars"],
43077
+ type,
43078
+ value,
43079
+ ...rest,
43080
+ to
43081
+ });
43082
+ const serializer = chain2?.serializers?.transaction;
43083
+ const serializedTransaction = await account.signTransaction(request, {
43084
+ serializer
43085
+ });
43086
+ return await getAction(client, sendRawTransaction, "sendRawTransaction")({
43087
+ serializedTransaction
43088
+ });
43089
+ }
43090
+ if (account?.type === "smart")
43091
+ throw new AccountTypeNotSupportedError({
43092
+ metaMessages: [
43093
+ "Consider using the `sendUserOperation` Action instead."
43094
+ ],
43095
+ docsPath: "/docs/actions/bundler/sendUserOperation",
43096
+ type: "smart"
43097
+ });
43098
+ throw new AccountTypeNotSupportedError({
43099
+ docsPath: "/docs/actions/wallet/sendTransaction",
43100
+ type: account?.type
43101
+ });
43102
+ } catch (err) {
43103
+ if (err instanceof AccountTypeNotSupportedError)
43104
+ throw err;
43105
+ if (nonceManagerParameters)
43106
+ account?.nonceManager?.reset(nonceManagerParameters);
43107
+ throw getTransactionError(err, {
43108
+ ...parameters,
43109
+ account,
43110
+ chain: parameters.chain || void 0
43111
+ });
43112
+ }
43113
+ }
43114
+
43115
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/writeContract.js
43116
+ async function writeContract(client, parameters) {
43117
+ return writeContract.internal(client, sendTransaction, "sendTransaction", parameters);
43118
+ }
43119
+ (function(writeContract2) {
43120
+ async function internal(client, actionFn, name, parameters) {
43121
+ const { abi: abi2, account: account_ = client.account, address, args, functionName, ...request } = parameters;
43122
+ if (typeof account_ === "undefined")
43123
+ throw new AccountNotFoundError({
43124
+ docsPath: "/docs/contract/writeContract"
43125
+ });
43126
+ const account = account_ ? parseAccount(account_) : null;
43127
+ const data = encodeFunctionData2({
43128
+ abi: abi2,
43129
+ args,
43130
+ functionName
43131
+ });
43132
+ try {
43133
+ return await getAction(client, actionFn, name)({
43134
+ data,
43135
+ to: address,
43136
+ account,
43137
+ ...request
43138
+ });
43139
+ } catch (error) {
43140
+ throw getContractError(error, {
43141
+ abi: abi2,
43142
+ address,
43143
+ args,
43144
+ docsPath: "/docs/contract/writeContract",
43145
+ functionName,
43146
+ sender: account?.address
43147
+ });
43148
+ }
43149
+ }
43150
+ writeContract2.internal = internal;
43151
+ })(writeContract || (writeContract = {}));
43152
+
43153
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/waitForCallsStatus.js
43154
+ init_base2();
43155
+
43156
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/errors/calls.js
43157
+ init_base2();
43158
+ var BundleFailedError = class extends BaseError3 {
43159
+ constructor(result) {
43160
+ super(`Call bundle failed with status: ${result.statusCode}`, {
43161
+ name: "BundleFailedError"
43162
+ });
43163
+ Object.defineProperty(this, "result", {
43164
+ enumerable: true,
43165
+ configurable: true,
43166
+ writable: true,
43167
+ value: void 0
43168
+ });
43169
+ this.result = result;
43170
+ }
43171
+ };
43172
+
43173
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/waitForCallsStatus.js
43174
+ init_withResolvers();
43175
+
42817
43176
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/promise/withRetry.js
42818
43177
  init_utils4();
42819
43178
  function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shouldRetry2 = () => true, signal } = {}) {
@@ -42856,6 +43215,14 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
42856
43215
  });
42857
43216
  }
42858
43217
 
43218
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/waitForCallsStatus.js
43219
+ init_stringify2();
43220
+
43221
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/getCallsStatus.js
43222
+ init_slice2();
43223
+ init_trim2();
43224
+ init_fromHex2();
43225
+
42859
43226
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/formatters/transactionReceipt.js
42860
43227
  init_fromHex2();
42861
43228
  var receiptStatuses = {
@@ -42883,6 +43250,251 @@ function formatTransactionReceipt(transactionReceipt, _) {
42883
43250
  return receipt;
42884
43251
  }
42885
43252
 
43253
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendCalls.js
43254
+ init_parseAccount();
43255
+ init_base2();
43256
+ init_rpc();
43257
+ init_encodeFunctionData2();
43258
+ init_concat2();
43259
+ init_fromHex2();
43260
+ init_toHex2();
43261
+ var fallbackMagicIdentifier = "0x5792579257925792579257925792579257925792579257925792579257925792";
43262
+ var fallbackTransactionErrorMagicIdentifier = numberToHex2(0, {
43263
+ size: 32
43264
+ });
43265
+ async function sendCalls(client, parameters) {
43266
+ const { account: account_ = client.account, chain: chain2 = client.chain, experimental_fallback, experimental_fallbackDelay = 32, forceAtomic = false, id, version: version5 = "2.0.0" } = parameters;
43267
+ const account = account_ ? parseAccount(account_) : null;
43268
+ let capabilities = parameters.capabilities;
43269
+ if (client.dataSuffix && !parameters.capabilities?.dataSuffix) {
43270
+ if (typeof client.dataSuffix === "string")
43271
+ capabilities = {
43272
+ ...parameters.capabilities,
43273
+ dataSuffix: { value: client.dataSuffix, optional: true }
43274
+ };
43275
+ else
43276
+ capabilities = {
43277
+ ...parameters.capabilities,
43278
+ dataSuffix: {
43279
+ value: client.dataSuffix.value,
43280
+ ...client.dataSuffix.required ? {} : { optional: true }
43281
+ }
43282
+ };
43283
+ }
43284
+ const calls = parameters.calls.map((call_) => {
43285
+ const call2 = call_;
43286
+ const data = call2.abi ? encodeFunctionData2({
43287
+ abi: call2.abi,
43288
+ functionName: call2.functionName,
43289
+ args: call2.args
43290
+ }) : call2.data;
43291
+ return {
43292
+ data: call2.dataSuffix && data ? concat2([data, call2.dataSuffix]) : data,
43293
+ to: call2.to,
43294
+ value: call2.value ? numberToHex2(call2.value) : void 0
43295
+ };
43296
+ });
43297
+ try {
43298
+ const response = await client.request({
43299
+ method: "wallet_sendCalls",
43300
+ params: [
43301
+ {
43302
+ atomicRequired: forceAtomic,
43303
+ calls,
43304
+ capabilities,
43305
+ chainId: numberToHex2(chain2.id),
43306
+ from: account?.address,
43307
+ id,
43308
+ version: version5
43309
+ }
43310
+ ]
43311
+ }, { retryCount: 0 });
43312
+ if (typeof response === "string")
43313
+ return { id: response };
43314
+ return response;
43315
+ } catch (err) {
43316
+ const error = err;
43317
+ if (experimental_fallback && (error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError" || error.name === "UnknownRpcError" || error.details.toLowerCase().includes("does not exist / is not available") || error.details.toLowerCase().includes("missing or invalid. request()") || error.details.toLowerCase().includes("did not match any variant of untagged enum") || error.details.toLowerCase().includes("account upgraded to unsupported contract") || error.details.toLowerCase().includes("eip-7702 not supported") || error.details.toLowerCase().includes("unsupported wc_ method") || // magic.link
43318
+ error.details.toLowerCase().includes("feature toggled misconfigured") || // Trust Wallet
43319
+ error.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))) {
43320
+ if (capabilities) {
43321
+ const hasNonOptionalCapability = Object.values(capabilities).some((capability) => !capability.optional);
43322
+ if (hasNonOptionalCapability) {
43323
+ const message = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
43324
+ throw new UnsupportedNonOptionalCapabilityError(new BaseError3(message, {
43325
+ details: message
43326
+ }));
43327
+ }
43328
+ }
43329
+ if (forceAtomic && calls.length > 1) {
43330
+ const message = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
43331
+ throw new AtomicityNotSupportedError(new BaseError3(message, {
43332
+ details: message
43333
+ }));
43334
+ }
43335
+ const results = [];
43336
+ for (const call2 of calls) {
43337
+ try {
43338
+ const value = await sendTransaction(client, {
43339
+ account,
43340
+ chain: chain2,
43341
+ data: call2.data,
43342
+ to: call2.to,
43343
+ value: call2.value ? hexToBigInt2(call2.value) : void 0
43344
+ });
43345
+ results.push({ status: "fulfilled", value });
43346
+ } catch (reason) {
43347
+ results.push({ reason, status: "rejected" });
43348
+ }
43349
+ if (experimental_fallbackDelay > 0)
43350
+ await new Promise((resolve) => setTimeout(resolve, experimental_fallbackDelay));
43351
+ }
43352
+ if (results.every((r) => r.status === "rejected"))
43353
+ throw results[0].reason;
43354
+ const hashes = results.map((result) => {
43355
+ if (result.status === "fulfilled")
43356
+ return result.value;
43357
+ return fallbackTransactionErrorMagicIdentifier;
43358
+ });
43359
+ return {
43360
+ id: concat2([
43361
+ ...hashes,
43362
+ numberToHex2(chain2.id, { size: 32 }),
43363
+ fallbackMagicIdentifier
43364
+ ])
43365
+ };
43366
+ }
43367
+ throw getTransactionError(err, {
43368
+ ...parameters,
43369
+ account,
43370
+ chain: parameters.chain
43371
+ });
43372
+ }
43373
+ }
43374
+
43375
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/getCallsStatus.js
43376
+ async function getCallsStatus(client, parameters) {
43377
+ async function getStatus(id) {
43378
+ const isTransactions = id.endsWith(fallbackMagicIdentifier.slice(2));
43379
+ if (isTransactions) {
43380
+ const chainId2 = trim2(sliceHex2(id, -64, -32));
43381
+ const hashes = sliceHex2(id, 0, -64).slice(2).match(/.{1,64}/g);
43382
+ const receipts2 = await Promise.all(hashes.map((hash4) => fallbackTransactionErrorMagicIdentifier.slice(2) !== hash4 ? client.request({
43383
+ method: "eth_getTransactionReceipt",
43384
+ params: [`0x${hash4}`]
43385
+ }, { dedupe: true }) : void 0));
43386
+ const status2 = (() => {
43387
+ if (receipts2.some((r) => r === null))
43388
+ return 100;
43389
+ if (receipts2.every((r) => r?.status === "0x1"))
43390
+ return 200;
43391
+ if (receipts2.every((r) => r?.status === "0x0"))
43392
+ return 500;
43393
+ return 600;
43394
+ })();
43395
+ return {
43396
+ atomic: false,
43397
+ chainId: hexToNumber3(chainId2),
43398
+ receipts: receipts2.filter(Boolean),
43399
+ status: status2,
43400
+ version: "2.0.0"
43401
+ };
43402
+ }
43403
+ return client.request({
43404
+ method: "wallet_getCallsStatus",
43405
+ params: [id]
43406
+ });
43407
+ }
43408
+ const { atomic = false, chainId, receipts, version: version5 = "2.0.0", ...response } = await getStatus(parameters.id);
43409
+ const [status, statusCode] = (() => {
43410
+ const statusCode2 = response.status;
43411
+ if (statusCode2 >= 100 && statusCode2 < 200)
43412
+ return ["pending", statusCode2];
43413
+ if (statusCode2 >= 200 && statusCode2 < 300)
43414
+ return ["success", statusCode2];
43415
+ if (statusCode2 >= 300 && statusCode2 < 700)
43416
+ return ["failure", statusCode2];
43417
+ if (statusCode2 === "CONFIRMED")
43418
+ return ["success", 200];
43419
+ if (statusCode2 === "PENDING")
43420
+ return ["pending", 100];
43421
+ return [void 0, statusCode2];
43422
+ })();
43423
+ return {
43424
+ ...response,
43425
+ atomic,
43426
+ // @ts-expect-error: for backwards compatibility
43427
+ chainId: chainId ? hexToNumber3(chainId) : void 0,
43428
+ receipts: receipts?.map((receipt) => ({
43429
+ ...receipt,
43430
+ blockNumber: hexToBigInt2(receipt.blockNumber),
43431
+ gasUsed: hexToBigInt2(receipt.gasUsed),
43432
+ status: receiptStatuses[receipt.status]
43433
+ })) ?? [],
43434
+ statusCode,
43435
+ status,
43436
+ version: version5
43437
+ };
43438
+ }
43439
+
43440
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/waitForCallsStatus.js
43441
+ async function waitForCallsStatus(client, parameters) {
43442
+ const {
43443
+ id,
43444
+ pollingInterval = client.pollingInterval,
43445
+ status = ({ statusCode }) => statusCode === 200 || statusCode >= 300,
43446
+ retryCount = 4,
43447
+ retryDelay = ({ count }) => ~~(1 << count) * 200,
43448
+ // exponential backoff
43449
+ timeout = 6e4,
43450
+ throwOnFailure = false
43451
+ } = parameters;
43452
+ const observerId = stringify2(["waitForCallsStatus", client.uid, id]);
43453
+ const { promise, resolve, reject } = withResolvers();
43454
+ let timer;
43455
+ const unobserve = observe(observerId, { resolve, reject }, (emit) => {
43456
+ const unpoll = poll(async () => {
43457
+ const done = (fn) => {
43458
+ clearTimeout(timer);
43459
+ unpoll();
43460
+ fn();
43461
+ unobserve();
43462
+ };
43463
+ try {
43464
+ const result = await withRetry(async () => {
43465
+ const result2 = await getAction(client, getCallsStatus, "getCallsStatus")({ id });
43466
+ if (throwOnFailure && result2.status === "failure")
43467
+ throw new BundleFailedError(result2);
43468
+ return result2;
43469
+ }, {
43470
+ retryCount,
43471
+ delay: retryDelay
43472
+ });
43473
+ if (!status(result))
43474
+ return;
43475
+ done(() => emit.resolve(result));
43476
+ } catch (error) {
43477
+ done(() => emit.reject(error));
43478
+ }
43479
+ }, {
43480
+ interval: pollingInterval,
43481
+ emitOnBegin: true
43482
+ });
43483
+ return unpoll;
43484
+ });
43485
+ timer = timeout ? setTimeout(() => {
43486
+ unobserve();
43487
+ clearTimeout(timer);
43488
+ reject(new WaitForCallsStatusTimeoutError({ id }));
43489
+ }, timeout) : void 0;
43490
+ return await promise;
43491
+ }
43492
+ var WaitForCallsStatusTimeoutError = class extends BaseError3 {
43493
+ constructor({ id }) {
43494
+ super(`Timed out while waiting for call bundle with id "${id}" to be confirmed.`, { name: "WaitForCallsStatusTimeoutError" });
43495
+ }
43496
+ };
43497
+
42886
43498
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/clients/createClient.js
42887
43499
  init_parseAccount();
42888
43500
 
@@ -44423,6 +45035,26 @@ function hashString(str, seed = 0) {
44423
45035
  return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36);
44424
45036
  }
44425
45037
 
45038
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/chain/defineChain.js
45039
+ function defineChain(chain2) {
45040
+ const chainInstance = {
45041
+ formatters: void 0,
45042
+ fees: void 0,
45043
+ serializers: void 0,
45044
+ ...chain2
45045
+ };
45046
+ function extend(base) {
45047
+ return (fnOrExtended) => {
45048
+ const properties = typeof fnOrExtended === "function" ? fnOrExtended(base) : fnOrExtended;
45049
+ const combined = { ...base, ...properties };
45050
+ return Object.assign(combined, { extend: extend(combined) });
45051
+ };
45052
+ }
45053
+ return Object.assign(chainInstance, {
45054
+ extend: extend(chainInstance)
45055
+ });
45056
+ }
45057
+
44426
45058
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/utils/index.js
44427
45059
  init_fromHex2();
44428
45060
 
@@ -44655,6 +45287,32 @@ init_isAddress2();
44655
45287
  init_size2();
44656
45288
  init_toHex2();
44657
45289
  init_regex4();
45290
+ init_stringify2();
45291
+ function serializeTypedData(parameters) {
45292
+ const { domain: domain_, message: message_, primaryType, types } = parameters;
45293
+ const normalizeData = (struct, data_) => {
45294
+ const data = { ...data_ };
45295
+ for (const param of struct) {
45296
+ const { name, type } = param;
45297
+ if (type === "address")
45298
+ data[name] = data[name].toLowerCase();
45299
+ }
45300
+ return data;
45301
+ };
45302
+ const domain = (() => {
45303
+ if (!types.EIP712Domain)
45304
+ return {};
45305
+ if (!domain_)
45306
+ return {};
45307
+ return normalizeData(types.EIP712Domain, domain_);
45308
+ })();
45309
+ const message = (() => {
45310
+ if (primaryType === "EIP712Domain")
45311
+ return void 0;
45312
+ return normalizeData(types[primaryType], message_);
45313
+ })();
45314
+ return stringify2({ domain, message, primaryType, types });
45315
+ }
44658
45316
  function validateTypedData2(parameters) {
44659
45317
  const { domain, message, primaryType, types } = parameters;
44660
45318
  const validateData = (struct, data) => {
@@ -45570,11 +46228,11 @@ function encodeBoolean(value) {
45570
46228
  function encodeNumber3(value, { signed, size: size6 }) {
45571
46229
  if (typeof size6 === "number") {
45572
46230
  const max = 2n ** (BigInt(size6) - (signed ? 1n : 0n)) - 1n;
45573
- const min = signed ? -max - 1n : 0n;
45574
- if (value > max || value < min)
46231
+ const min2 = signed ? -max - 1n : 0n;
46232
+ if (value > max || value < min2)
45575
46233
  throw new IntegerOutOfRangeError3({
45576
46234
  max: max.toString(),
45577
- min: min.toString(),
46235
+ min: min2.toString(),
45578
46236
  signed,
45579
46237
  size: size6 / 8,
45580
46238
  value: value.toString()
@@ -48443,6 +49101,507 @@ function createPublicClient(parameters) {
48443
49101
  return client.extend(publicActions);
48444
49102
  }
48445
49103
 
49104
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/addChain.js
49105
+ init_toHex2();
49106
+ async function addChain(client, { chain: chain2 }) {
49107
+ const { id, name, nativeCurrency, rpcUrls, blockExplorers } = chain2;
49108
+ await client.request({
49109
+ method: "wallet_addEthereumChain",
49110
+ params: [
49111
+ {
49112
+ chainId: numberToHex2(id),
49113
+ chainName: name,
49114
+ nativeCurrency,
49115
+ rpcUrls: rpcUrls.default.http,
49116
+ blockExplorerUrls: blockExplorers ? Object.values(blockExplorers).map(({ url }) => url) : void 0
49117
+ }
49118
+ ]
49119
+ }, { dedupe: true, retryCount: 0 });
49120
+ }
49121
+
49122
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/deployContract.js
49123
+ init_encodeDeployData();
49124
+ function deployContract(walletClient, parameters) {
49125
+ const { abi: abi2, args, bytecode, ...request } = parameters;
49126
+ const calldata = encodeDeployData({ abi: abi2, args, bytecode });
49127
+ return sendTransaction(walletClient, {
49128
+ ...request,
49129
+ ...request.authorizationList ? { to: null } : {},
49130
+ data: calldata
49131
+ });
49132
+ }
49133
+
49134
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/getAddresses.js
49135
+ init_getAddress2();
49136
+ async function getAddresses(client) {
49137
+ if (client.account?.type === "local")
49138
+ return [client.account.address];
49139
+ const addresses = await client.request({ method: "eth_accounts" }, { dedupe: true });
49140
+ return addresses.map((address) => checksumAddress2(address));
49141
+ }
49142
+
49143
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/getCapabilities.js
49144
+ init_parseAccount();
49145
+ init_toHex2();
49146
+ async function getCapabilities(client, parameters = {}) {
49147
+ const { account = client.account, chainId } = parameters;
49148
+ const account_ = account ? parseAccount(account) : void 0;
49149
+ const params = chainId ? [account_?.address, [numberToHex2(chainId)]] : [account_?.address];
49150
+ const capabilities_raw = await client.request({
49151
+ method: "wallet_getCapabilities",
49152
+ params
49153
+ });
49154
+ const capabilities = {};
49155
+ for (const [chainId2, capabilities_] of Object.entries(capabilities_raw)) {
49156
+ capabilities[Number(chainId2)] = {};
49157
+ for (let [key, value] of Object.entries(capabilities_)) {
49158
+ if (key === "addSubAccount")
49159
+ key = "unstable_addSubAccount";
49160
+ capabilities[Number(chainId2)][key] = value;
49161
+ }
49162
+ }
49163
+ return typeof chainId === "number" ? capabilities[chainId] : capabilities;
49164
+ }
49165
+
49166
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/getPermissions.js
49167
+ async function getPermissions(client) {
49168
+ const permissions = await client.request({ method: "wallet_getPermissions" }, { dedupe: true });
49169
+ return permissions;
49170
+ }
49171
+
49172
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/prepareAuthorization.js
49173
+ init_parseAccount();
49174
+ init_isAddressEqual();
49175
+ async function prepareAuthorization(client, parameters) {
49176
+ const { account: account_ = client.account, chainId, nonce } = parameters;
49177
+ if (!account_)
49178
+ throw new AccountNotFoundError({
49179
+ docsPath: "/docs/eip7702/prepareAuthorization"
49180
+ });
49181
+ const account = parseAccount(account_);
49182
+ const executor = (() => {
49183
+ if (!parameters.executor)
49184
+ return void 0;
49185
+ if (parameters.executor === "self")
49186
+ return parameters.executor;
49187
+ return parseAccount(parameters.executor);
49188
+ })();
49189
+ const authorization = {
49190
+ address: parameters.contractAddress ?? parameters.address,
49191
+ chainId,
49192
+ nonce
49193
+ };
49194
+ if (typeof authorization.chainId === "undefined")
49195
+ authorization.chainId = client.chain?.id ?? await getAction(client, getChainId, "getChainId")({});
49196
+ if (typeof authorization.nonce === "undefined") {
49197
+ authorization.nonce = await getAction(client, getTransactionCount, "getTransactionCount")({
49198
+ address: account.address,
49199
+ blockTag: "pending"
49200
+ });
49201
+ if (executor === "self" || executor?.address && isAddressEqual(executor.address, account.address))
49202
+ authorization.nonce += 1;
49203
+ }
49204
+ return authorization;
49205
+ }
49206
+
49207
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/requestAddresses.js
49208
+ init_getAddress2();
49209
+ async function requestAddresses(client) {
49210
+ const addresses = await client.request({ method: "eth_requestAccounts" }, { dedupe: true, retryCount: 0 });
49211
+ return addresses.map((address) => getAddress(address));
49212
+ }
49213
+
49214
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/requestPermissions.js
49215
+ async function requestPermissions(client, permissions) {
49216
+ return client.request({
49217
+ method: "wallet_requestPermissions",
49218
+ params: [permissions]
49219
+ }, { retryCount: 0 });
49220
+ }
49221
+
49222
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendCallsSync.js
49223
+ async function sendCallsSync(client, parameters) {
49224
+ const { chain: chain2 = client.chain } = parameters;
49225
+ const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
49226
+ const result = await getAction(client, sendCalls, "sendCalls")(parameters);
49227
+ const status = await getAction(client, waitForCallsStatus, "waitForCallsStatus")({
49228
+ ...parameters,
49229
+ id: result.id,
49230
+ timeout
49231
+ });
49232
+ return status;
49233
+ }
49234
+
49235
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/sendTransactionSync.js
49236
+ init_parseAccount();
49237
+ init_base2();
49238
+ init_transaction2();
49239
+ init_concat2();
49240
+ init_extract();
49241
+ init_transactionRequest();
49242
+ init_lru2();
49243
+ init_assertRequest();
49244
+ var supportsWalletNamespace2 = new LruMap2(128);
49245
+ async function sendTransactionSync(client, parameters) {
49246
+ const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
49247
+ const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
49248
+ if (typeof account_ === "undefined")
49249
+ throw new AccountNotFoundError({
49250
+ docsPath: "/docs/actions/wallet/sendTransactionSync"
49251
+ });
49252
+ const account = account_ ? parseAccount(account_) : null;
49253
+ let nonceManagerParameters;
49254
+ try {
49255
+ assertRequest(parameters);
49256
+ const to = await (async () => {
49257
+ if (parameters.to)
49258
+ return parameters.to;
49259
+ if (parameters.to === null)
49260
+ return void 0;
49261
+ if (authorizationList && authorizationList.length > 0)
49262
+ return await recoverAuthorizationAddress({
49263
+ authorization: authorizationList[0]
49264
+ }).catch(() => {
49265
+ throw new BaseError3("`to` is required. Could not infer from `authorizationList`.");
49266
+ });
49267
+ return void 0;
49268
+ })();
49269
+ if (account?.type === "json-rpc" || account === null) {
49270
+ let chainId;
49271
+ if (chain2 !== null) {
49272
+ chainId = await getAction(client, getChainId, "getChainId")({});
49273
+ if (assertChainId)
49274
+ assertCurrentChain({
49275
+ currentChainId: chainId,
49276
+ chain: chain2
49277
+ });
49278
+ }
49279
+ const chainFormat = client.chain?.formatters?.transactionRequest?.format;
49280
+ const format = chainFormat || formatTransactionRequest;
49281
+ const request = format({
49282
+ // Pick out extra data that might exist on the chain's transaction request type.
49283
+ ...extract(rest, { format: chainFormat }),
49284
+ accessList,
49285
+ account,
49286
+ authorizationList,
49287
+ blobs,
49288
+ chainId,
49289
+ data: dataSuffix ? concat2([data ?? "0x", dataSuffix]) : data,
49290
+ gas,
49291
+ gasPrice,
49292
+ maxFeePerBlobGas,
49293
+ maxFeePerGas,
49294
+ maxPriorityFeePerGas,
49295
+ nonce,
49296
+ to,
49297
+ type,
49298
+ value
49299
+ }, "sendTransaction");
49300
+ const isWalletNamespaceSupported = supportsWalletNamespace2.get(client.uid);
49301
+ const method = isWalletNamespaceSupported ? "wallet_sendTransaction" : "eth_sendTransaction";
49302
+ const hash4 = await (async () => {
49303
+ try {
49304
+ return await client.request({
49305
+ method,
49306
+ params: [request]
49307
+ }, { retryCount: 0 });
49308
+ } catch (e) {
49309
+ if (isWalletNamespaceSupported === false)
49310
+ throw e;
49311
+ const error = e;
49312
+ if (error.name === "InvalidInputRpcError" || error.name === "InvalidParamsRpcError" || error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError") {
49313
+ return await client.request({
49314
+ method: "wallet_sendTransaction",
49315
+ params: [request]
49316
+ }, { retryCount: 0 }).then((hash5) => {
49317
+ supportsWalletNamespace2.set(client.uid, true);
49318
+ return hash5;
49319
+ }).catch((e2) => {
49320
+ const walletNamespaceError = e2;
49321
+ if (walletNamespaceError.name === "MethodNotFoundRpcError" || walletNamespaceError.name === "MethodNotSupportedRpcError") {
49322
+ supportsWalletNamespace2.set(client.uid, false);
49323
+ throw error;
49324
+ }
49325
+ throw walletNamespaceError;
49326
+ });
49327
+ }
49328
+ throw error;
49329
+ }
49330
+ })();
49331
+ const receipt = await getAction(client, waitForTransactionReceipt, "waitForTransactionReceipt")({
49332
+ checkReplacement: false,
49333
+ hash: hash4,
49334
+ pollingInterval,
49335
+ timeout
49336
+ });
49337
+ if (throwOnReceiptRevert && receipt.status === "reverted")
49338
+ throw new TransactionReceiptRevertedError({ receipt });
49339
+ return receipt;
49340
+ }
49341
+ if (account?.type === "local") {
49342
+ if (account.nonceManager && typeof nonce === "undefined") {
49343
+ const requestChainId = rest.chainId;
49344
+ const chainId = await (async () => {
49345
+ if (typeof requestChainId === "number")
49346
+ return requestChainId;
49347
+ if (chain2)
49348
+ return chain2.id;
49349
+ return getAction(client, getChainId, "getChainId")({});
49350
+ })();
49351
+ nonceManagerParameters = { address: account.address, chainId };
49352
+ }
49353
+ const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
49354
+ account,
49355
+ accessList,
49356
+ authorizationList,
49357
+ blobs,
49358
+ chain: chain2,
49359
+ data: dataSuffix ? concat2([data ?? "0x", dataSuffix]) : data,
49360
+ gas,
49361
+ gasPrice,
49362
+ maxFeePerBlobGas,
49363
+ maxFeePerGas,
49364
+ maxPriorityFeePerGas,
49365
+ nonce,
49366
+ nonceManager: account.nonceManager,
49367
+ parameters: [...defaultParameters, "sidecars"],
49368
+ type,
49369
+ value,
49370
+ ...rest,
49371
+ to
49372
+ });
49373
+ const serializer = chain2?.serializers?.transaction;
49374
+ const serializedTransaction = await account.signTransaction(request, {
49375
+ serializer
49376
+ });
49377
+ return await getAction(client, sendRawTransactionSync, "sendRawTransactionSync")({
49378
+ serializedTransaction,
49379
+ throwOnReceiptRevert,
49380
+ timeout: parameters.timeout
49381
+ });
49382
+ }
49383
+ if (account?.type === "smart")
49384
+ throw new AccountTypeNotSupportedError({
49385
+ metaMessages: [
49386
+ "Consider using the `sendUserOperation` Action instead."
49387
+ ],
49388
+ docsPath: "/docs/actions/bundler/sendUserOperation",
49389
+ type: "smart"
49390
+ });
49391
+ throw new AccountTypeNotSupportedError({
49392
+ docsPath: "/docs/actions/wallet/sendTransactionSync",
49393
+ type: account?.type
49394
+ });
49395
+ } catch (err) {
49396
+ if (err instanceof AccountTypeNotSupportedError)
49397
+ throw err;
49398
+ if (nonceManagerParameters && !(err instanceof TransactionReceiptRevertedError))
49399
+ account?.nonceManager?.reset(nonceManagerParameters);
49400
+ throw getTransactionError(err, {
49401
+ ...parameters,
49402
+ account,
49403
+ chain: parameters.chain || void 0
49404
+ });
49405
+ }
49406
+ }
49407
+
49408
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/showCallsStatus.js
49409
+ async function showCallsStatus(client, parameters) {
49410
+ const { id } = parameters;
49411
+ await client.request({
49412
+ method: "wallet_showCallsStatus",
49413
+ params: [id]
49414
+ });
49415
+ return;
49416
+ }
49417
+
49418
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/signAuthorization.js
49419
+ init_parseAccount();
49420
+ async function signAuthorization2(client, parameters) {
49421
+ const { account: account_ = client.account } = parameters;
49422
+ if (!account_)
49423
+ throw new AccountNotFoundError({
49424
+ docsPath: "/docs/eip7702/signAuthorization"
49425
+ });
49426
+ const account = parseAccount(account_);
49427
+ if (!account.signAuthorization)
49428
+ throw new AccountTypeNotSupportedError({
49429
+ docsPath: "/docs/eip7702/signAuthorization",
49430
+ metaMessages: [
49431
+ "The `signAuthorization` Action does not support JSON-RPC Accounts."
49432
+ ],
49433
+ type: account.type
49434
+ });
49435
+ const authorization = await prepareAuthorization(client, parameters);
49436
+ return account.signAuthorization(authorization);
49437
+ }
49438
+
49439
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/signMessage.js
49440
+ init_parseAccount();
49441
+ init_toHex2();
49442
+ async function signMessage2(client, { account: account_ = client.account, message }) {
49443
+ if (!account_)
49444
+ throw new AccountNotFoundError({
49445
+ docsPath: "/docs/actions/wallet/signMessage"
49446
+ });
49447
+ const account = parseAccount(account_);
49448
+ if (account.signMessage)
49449
+ return account.signMessage({ message });
49450
+ const message_ = (() => {
49451
+ if (typeof message === "string")
49452
+ return stringToHex2(message);
49453
+ if (message.raw instanceof Uint8Array)
49454
+ return toHex2(message.raw);
49455
+ return message.raw;
49456
+ })();
49457
+ return client.request({
49458
+ method: "personal_sign",
49459
+ params: [message_, account.address]
49460
+ }, { retryCount: 0 });
49461
+ }
49462
+
49463
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/signTransaction.js
49464
+ init_parseAccount();
49465
+ init_toHex2();
49466
+ init_transactionRequest();
49467
+ init_assertRequest();
49468
+ async function signTransaction2(client, parameters) {
49469
+ const { account: account_ = client.account, chain: chain2 = client.chain, ...transaction } = parameters;
49470
+ if (!account_)
49471
+ throw new AccountNotFoundError({
49472
+ docsPath: "/docs/actions/wallet/signTransaction"
49473
+ });
49474
+ const account = parseAccount(account_);
49475
+ assertRequest({
49476
+ account,
49477
+ ...parameters
49478
+ });
49479
+ const chainId = await getAction(client, getChainId, "getChainId")({});
49480
+ if (chain2 !== null)
49481
+ assertCurrentChain({
49482
+ currentChainId: chainId,
49483
+ chain: chain2
49484
+ });
49485
+ const formatters = chain2?.formatters || client.chain?.formatters;
49486
+ const format = formatters?.transactionRequest?.format || formatTransactionRequest;
49487
+ if (account.signTransaction)
49488
+ return account.signTransaction({
49489
+ ...transaction,
49490
+ account,
49491
+ chainId
49492
+ }, { serializer: client.chain?.serializers?.transaction });
49493
+ return await client.request({
49494
+ method: "eth_signTransaction",
49495
+ params: [
49496
+ {
49497
+ ...format({
49498
+ ...transaction,
49499
+ account
49500
+ }, "signTransaction"),
49501
+ chainId: numberToHex2(chainId),
49502
+ from: account.address
49503
+ }
49504
+ ]
49505
+ }, { retryCount: 0 });
49506
+ }
49507
+
49508
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/signTypedData.js
49509
+ init_parseAccount();
49510
+ async function signTypedData2(client, parameters) {
49511
+ const { account: account_ = client.account, domain, message, primaryType } = parameters;
49512
+ if (!account_)
49513
+ throw new AccountNotFoundError({
49514
+ docsPath: "/docs/actions/wallet/signTypedData"
49515
+ });
49516
+ const account = parseAccount(account_);
49517
+ const types = {
49518
+ EIP712Domain: getTypesForEIP712Domain2({ domain }),
49519
+ ...parameters.types
49520
+ };
49521
+ validateTypedData2({ domain, message, primaryType, types });
49522
+ if (account.signTypedData)
49523
+ return account.signTypedData({ domain, message, primaryType, types });
49524
+ const typedData = serializeTypedData({ domain, message, primaryType, types });
49525
+ return client.request({
49526
+ method: "eth_signTypedData_v4",
49527
+ params: [account.address, typedData]
49528
+ }, { retryCount: 0 });
49529
+ }
49530
+
49531
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/switchChain.js
49532
+ init_toHex2();
49533
+ async function switchChain(client, { id }) {
49534
+ await client.request({
49535
+ method: "wallet_switchEthereumChain",
49536
+ params: [
49537
+ {
49538
+ chainId: numberToHex2(id)
49539
+ }
49540
+ ]
49541
+ }, { retryCount: 0 });
49542
+ }
49543
+
49544
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/watchAsset.js
49545
+ async function watchAsset(client, params) {
49546
+ const added = await client.request({
49547
+ method: "wallet_watchAsset",
49548
+ params
49549
+ }, { retryCount: 0 });
49550
+ return added;
49551
+ }
49552
+
49553
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/actions/wallet/writeContractSync.js
49554
+ async function writeContractSync(client, parameters) {
49555
+ return writeContract.internal(client, sendTransactionSync, "sendTransactionSync", parameters);
49556
+ }
49557
+
49558
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/clients/decorators/wallet.js
49559
+ function walletActions(client) {
49560
+ return {
49561
+ addChain: (args) => addChain(client, args),
49562
+ deployContract: (args) => deployContract(client, args),
49563
+ fillTransaction: (args) => fillTransaction(client, args),
49564
+ getAddresses: () => getAddresses(client),
49565
+ getCallsStatus: (args) => getCallsStatus(client, args),
49566
+ getCapabilities: (args) => getCapabilities(client, args),
49567
+ getChainId: () => getChainId(client),
49568
+ getPermissions: () => getPermissions(client),
49569
+ prepareAuthorization: (args) => prepareAuthorization(client, args),
49570
+ prepareTransactionRequest: (args) => prepareTransactionRequest(client, args),
49571
+ requestAddresses: () => requestAddresses(client),
49572
+ requestPermissions: (args) => requestPermissions(client, args),
49573
+ sendCalls: (args) => sendCalls(client, args),
49574
+ sendCallsSync: (args) => sendCallsSync(client, args),
49575
+ sendRawTransaction: (args) => sendRawTransaction(client, args),
49576
+ sendRawTransactionSync: (args) => sendRawTransactionSync(client, args),
49577
+ sendTransaction: (args) => sendTransaction(client, args),
49578
+ sendTransactionSync: (args) => sendTransactionSync(client, args),
49579
+ showCallsStatus: (args) => showCallsStatus(client, args),
49580
+ signAuthorization: (args) => signAuthorization2(client, args),
49581
+ signMessage: (args) => signMessage2(client, args),
49582
+ signTransaction: (args) => signTransaction2(client, args),
49583
+ signTypedData: (args) => signTypedData2(client, args),
49584
+ switchChain: (args) => switchChain(client, args),
49585
+ waitForCallsStatus: (args) => waitForCallsStatus(client, args),
49586
+ watchAsset: (args) => watchAsset(client, args),
49587
+ writeContract: (args) => writeContract(client, args),
49588
+ writeContractSync: (args) => writeContractSync(client, args)
49589
+ };
49590
+ }
49591
+
49592
+ // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/clients/createWalletClient.js
49593
+ function createWalletClient(parameters) {
49594
+ const { key = "wallet", name = "Wallet Client", transport } = parameters;
49595
+ const client = createClient({
49596
+ ...parameters,
49597
+ key,
49598
+ name,
49599
+ transport,
49600
+ type: "walletClient"
49601
+ });
49602
+ return client.extend(walletActions);
49603
+ }
49604
+
48446
49605
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/clients/transports/createTransport.js
48447
49606
  function createTransport({ key, methods, name, request, retryCount = 3, retryDelay = 150, timeout, type }, value) {
48448
49607
  const uid2 = uid();
@@ -48626,7 +49785,7 @@ async function sign2({ hash: hash4, privateKey, to = "object" }) {
48626
49785
  }
48627
49786
 
48628
49787
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/accounts/utils/signAuthorization.js
48629
- async function signAuthorization2(parameters) {
49788
+ async function signAuthorization3(parameters) {
48630
49789
  const { chainId, nonce, privateKey, to = "object" } = parameters;
48631
49790
  const address = parameters.contractAddress ?? parameters.address;
48632
49791
  const signature = await sign2({
@@ -48645,13 +49804,13 @@ async function signAuthorization2(parameters) {
48645
49804
  }
48646
49805
 
48647
49806
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/accounts/utils/signMessage.js
48648
- async function signMessage2({ message, privateKey }) {
49807
+ async function signMessage3({ message, privateKey }) {
48649
49808
  return await sign2({ hash: hashMessage2(message), privateKey, to: "hex" });
48650
49809
  }
48651
49810
 
48652
49811
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/accounts/utils/signTransaction.js
48653
49812
  init_keccak2562();
48654
- async function signTransaction2(parameters) {
49813
+ async function signTransaction3(parameters) {
48655
49814
  const { privateKey, transaction, serializer = serializeTransaction2 } = parameters;
48656
49815
  const signableTransaction = (() => {
48657
49816
  if (transaction.type === "eip4844")
@@ -48669,7 +49828,7 @@ async function signTransaction2(parameters) {
48669
49828
  }
48670
49829
 
48671
49830
  // ../../node_modules/.pnpm/viem@2.51.3_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@5.0.10_zod@3.25.76/node_modules/viem/_esm/accounts/utils/signTypedData.js
48672
- async function signTypedData2(parameters) {
49831
+ async function signTypedData3(parameters) {
48673
49832
  const { privateKey, ...typedData } = parameters;
48674
49833
  return await sign2({
48675
49834
  hash: hashTypedData2(typedData),
@@ -48690,16 +49849,16 @@ function privateKeyToAccount2(privateKey, options = {}) {
48690
49849
  return sign2({ hash: hash4, privateKey, to: "hex" });
48691
49850
  },
48692
49851
  async signAuthorization(authorization) {
48693
- return signAuthorization2({ ...authorization, privateKey });
49852
+ return signAuthorization3({ ...authorization, privateKey });
48694
49853
  },
48695
49854
  async signMessage({ message }) {
48696
- return signMessage2({ message, privateKey });
49855
+ return signMessage3({ message, privateKey });
48697
49856
  },
48698
49857
  async signTransaction(transaction, { serializer } = {}) {
48699
- return signTransaction2({ privateKey, transaction, serializer });
49858
+ return signTransaction3({ privateKey, transaction, serializer });
48700
49859
  },
48701
49860
  async signTypedData(typedData) {
48702
- return signTypedData2({ ...typedData, privateKey });
49861
+ return signTypedData3({ ...typedData, privateKey });
48703
49862
  }
48704
49863
  });
48705
49864
  return {
@@ -48729,6 +49888,11 @@ function mnemonicToAccount2(mnemonic, { passphrase, ...hdKeyOpts } = {}) {
48729
49888
  // ../ui/server.js
48730
49889
  var import_meta = {};
48731
49890
  var PORT = Number(process.env.PORT ?? 3334);
49891
+ var DEFAULT_CORS_ORIGINS = ["http://localhost:3333"];
49892
+ var CORS_ORIGINS = [
49893
+ ...DEFAULT_CORS_ORIGINS,
49894
+ ...(process.env.SAILOR_CORS_ORIGINS ?? "").split(",").map((o) => o.trim()).filter(Boolean)
49895
+ ];
48732
49896
  var _thisFile = (() => {
48733
49897
  try {
48734
49898
  return (0, import_node_url.fileURLToPath)(import_meta.url);
@@ -48869,7 +50033,7 @@ function addManagerToList(existing, current, next) {
48869
50033
  var OVERVIEW_TTL_MS = 1e4;
48870
50034
  function startServer(sailDir, { port = PORT } = {}) {
48871
50035
  const app = (0, import_express.default)();
48872
- app.use((0, import_cors.default)({ origin: "http://localhost:3333" }));
50036
+ app.use((0, import_cors.default)({ origin: CORS_ORIGINS }));
48873
50037
  app.use(import_express.default.json());
48874
50038
  const at = (name) => import_node_path.default.join(sailDir, name);
48875
50039
  const syncConfigChainId = (chainId) => {
@@ -49387,8 +50551,8 @@ function startServer(sailDir, { port = PORT } = {}) {
49387
50551
  }
49388
50552
  res.json({ ok: true });
49389
50553
  });
49390
- app.post("/api/mandate-submit", (req, res) => {
49391
- const { signature, signedAt } = req.body ?? {};
50554
+ app.post("/api/mandate-submit", async (req, res) => {
50555
+ const { signature, signedAt, permissions: signedAddrs, deadline } = req.body ?? {};
49392
50556
  if (!signature) {
49393
50557
  res.status(400).json({ error: "missing signature" });
49394
50558
  return;
@@ -49400,17 +50564,57 @@ function startServer(sailDir, { port = PORT } = {}) {
49400
50564
  res.status(404).json({ error: "no mandate draft to submit" });
49401
50565
  return;
49402
50566
  }
50567
+ const safe = draft.account;
50568
+ const chainId = draft.chainId;
50569
+ const draftPerms = draft.permissions ?? draft.items ?? [];
50570
+ const permissionMeta = draftPerms.map((p) => ({
50571
+ template: p.label ?? p.template ?? null,
50572
+ address: p.address ?? p.template ?? null,
50573
+ explanation: p.explanation ?? null
50574
+ }));
50575
+ const addrs = (Array.isArray(signedAddrs) && signedAddrs.length ? signedAddrs : permissionMeta.map((p) => p.address)).filter(Boolean).map((a) => getAddress(a));
50576
+ let txHash = null;
50577
+ try {
50578
+ if (!deadline) throw new Error("missing deadline");
50579
+ if (addrs.length === 0) throw new Error("no permissions to register");
50580
+ const env = parseEnvFile(at(".env.local"));
50581
+ const password = process.env.SAIL_PASSPHRASE || env.SAIL_PASSPHRASE;
50582
+ if (!password) throw new Error("SAIL_PASSPHRASE not set \u2014 cannot unlock the agent key");
50583
+ const rpcUrl = env.RPC_URL || env.BASE_SEPOLIA_RPC_URL;
50584
+ if (!rpcUrl) throw new Error("RPC_URL not set in .sail/.env.local");
50585
+ const deployment = getSailDeployment(Number(chainId));
50586
+ if (!deployment?.kernel) throw new Error(`No SailKernel deployment for chain ${chainId}`);
50587
+ const keyring = await LocalKeyring.fromKeystoreFile(at("keys/manager.json"), password);
50588
+ const publicClient = createPublicClient({ transport: http(rpcUrl) });
50589
+ let fee = 0n;
50590
+ for (const a of addrs) fee += await estimatePermissionFee(publicClient, deployment.governance, a);
50591
+ const chain2 = defineChain({
50592
+ id: Number(chainId),
50593
+ name: `chain-${chainId}`,
50594
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
50595
+ rpcUrls: { default: { http: [rpcUrl] } }
50596
+ });
50597
+ const walletClient = createWalletClient({ account: keyring.viemAccount, chain: chain2, transport: http(rpcUrl) });
50598
+ const data = encodeFunctionData2({
50599
+ abi: SailKernelAbi,
50600
+ functionName: "registerPermissions",
50601
+ args: [getAddress(safe), addrs, BigInt(deadline), signature]
50602
+ });
50603
+ txHash = await walletClient.sendTransaction({ to: deployment.kernel, data, value: fee, account: keyring.viemAccount, chain: chain2 });
50604
+ const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
50605
+ if (receipt.status !== "success") throw new Error(`registerPermissions reverted (tx ${txHash})`);
50606
+ } catch (err) {
50607
+ res.status(500).json({ error: `On-chain registration failed: ${err?.message ?? String(err)}` });
50608
+ return;
50609
+ }
49403
50610
  const mandate = {
49404
- safe: draft.account,
49405
- chainId: draft.chainId,
50611
+ safe,
50612
+ chainId,
49406
50613
  signedAt: signedAt || (/* @__PURE__ */ new Date()).toISOString(),
49407
50614
  signature,
49408
- registeredOnChain: false,
49409
- permissions: (draft.items ?? []).map((it) => ({
49410
- template: it.template,
49411
- params: it.params,
49412
- explanation: it.explanation
49413
- }))
50615
+ registeredOnChain: true,
50616
+ txHash,
50617
+ permissions: permissionMeta
49414
50618
  };
49415
50619
  try {
49416
50620
  import_node_fs2.default.mkdirSync(sailDir, { recursive: true });
@@ -49420,7 +50624,10 @@ function startServer(sailDir, { port = PORT } = {}) {
49420
50624
  existing = Array.isArray(raw) ? raw : [raw];
49421
50625
  } catch {
49422
50626
  }
49423
- import_node_fs2.default.writeFileSync(at("mandate.json"), `${JSON.stringify([...existing, mandate], null, 2)}
50627
+ const deduped = existing.filter(
50628
+ (m) => !(m.safe?.toLowerCase() === safe?.toLowerCase() && m.chainId === chainId)
50629
+ );
50630
+ import_node_fs2.default.writeFileSync(at("mandate.json"), `${JSON.stringify([...deduped, mandate], null, 2)}
49424
50631
  `);
49425
50632
  try {
49426
50633
  import_node_fs2.default.rmSync(at("mandate-draft.json"));