@unlink-xyz/multisig 0.1.5 → 0.1.7-canary.252b8ea

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.
@@ -11320,9 +11320,9 @@ function genBech32(encoding) {
11320
11320
  }
11321
11321
  var bech32m = /* @__PURE__ */ genBech32("bech32m");
11322
11322
  var VERSION = 1;
11323
- var LIMIT = 127;
11323
+ var LIMIT = 130;
11324
11324
  var ALL_CHAINS = "ffffffffffffffff";
11325
- var PREFIX = "0zk";
11325
+ var PREFIX = "unlink";
11326
11326
  var SALT = new TextEncoder().encode("unlink");
11327
11327
  function xorWithSalt(hex2) {
11328
11328
  const bytes2 = Hex.toBytes(hex2);
@@ -23744,8 +23744,8 @@ var ContractUnknownEventPayload = class extends EventPayload {
23744
23744
  /**
23745
23745
  * @_event:
23746
23746
  */
23747
- constructor(contract, listener, filter, log) {
23748
- super(contract, listener, filter);
23747
+ constructor(contract2, listener, filter, log) {
23748
+ super(contract2, listener, filter);
23749
23749
  defineProperties(this, { log });
23750
23750
  }
23751
23751
  /**
@@ -23771,9 +23771,9 @@ var ContractEventPayload = class extends ContractUnknownEventPayload {
23771
23771
  /**
23772
23772
  * @_ignore:
23773
23773
  */
23774
- constructor(contract, listener, filter, fragment, _log) {
23775
- super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));
23776
- const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);
23774
+ constructor(contract2, listener, filter, fragment, _log) {
23775
+ super(contract2, listener, filter, new EventLog(_log, contract2.interface, fragment));
23776
+ const args = contract2.interface.decodeEventLog(fragment, this.log.data, this.log.topics);
23777
23777
  defineProperties(this, { args, fragment });
23778
23778
  }
23779
23779
  /**
@@ -23816,12 +23816,12 @@ function getResolver(value) {
23816
23816
  var PreparedTopicFilter = class {
23817
23817
  #filter;
23818
23818
  fragment;
23819
- constructor(contract, fragment, args) {
23819
+ constructor(contract2, fragment, args) {
23820
23820
  defineProperties(this, { fragment });
23821
23821
  if (fragment.inputs.length < args.length) {
23822
23822
  throw new Error("too many arguments");
23823
23823
  }
23824
- const runner = getRunner(contract.runner, "resolveName");
23824
+ const runner = getRunner(contract2.runner, "resolveName");
23825
23825
  const resolver = canResolve(runner) ? runner : null;
23826
23826
  this.#filter = (async function() {
23827
23827
  const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {
@@ -23839,7 +23839,7 @@ var PreparedTopicFilter = class {
23839
23839
  return value;
23840
23840
  });
23841
23841
  }));
23842
- return contract.interface.encodeFilterTopics(fragment, resolvedArgs);
23842
+ return contract2.interface.encodeFilterTopics(fragment, resolvedArgs);
23843
23843
  })();
23844
23844
  }
23845
23845
  getTopicFilter() {
@@ -23888,14 +23888,14 @@ async function resolveArgs(_runner, inputs, args) {
23888
23888
  });
23889
23889
  }));
23890
23890
  }
23891
- function buildWrappedFallback(contract) {
23891
+ function buildWrappedFallback(contract2) {
23892
23892
  const populateTransaction = async function(overrides) {
23893
23893
  const tx2 = await copyOverrides(overrides, ["data"]);
23894
- tx2.to = await contract.getAddress();
23894
+ tx2.to = await contract2.getAddress();
23895
23895
  if (tx2.from) {
23896
- tx2.from = await resolveAddress(tx2.from, getResolver(contract.runner));
23896
+ tx2.from = await resolveAddress(tx2.from, getResolver(contract2.runner));
23897
23897
  }
23898
- const iface = contract.interface;
23898
+ const iface = contract2.interface;
23899
23899
  const noValue = getBigInt(tx2.value || BN_09, "overrides.value") === BN_09;
23900
23900
  const noData = (tx2.data || "0x") === "0x";
23901
23901
  if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {
@@ -23908,27 +23908,27 @@ function buildWrappedFallback(contract) {
23908
23908
  return tx2;
23909
23909
  };
23910
23910
  const staticCall = async function(overrides) {
23911
- const runner = getRunner(contract.runner, "call");
23911
+ const runner = getRunner(contract2.runner, "call");
23912
23912
  assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
23913
23913
  const tx2 = await populateTransaction(overrides);
23914
23914
  try {
23915
23915
  return await runner.call(tx2);
23916
23916
  } catch (error) {
23917
23917
  if (isCallException(error) && error.data) {
23918
- throw contract.interface.makeError(error.data, tx2);
23918
+ throw contract2.interface.makeError(error.data, tx2);
23919
23919
  }
23920
23920
  throw error;
23921
23921
  }
23922
23922
  };
23923
23923
  const send = async function(overrides) {
23924
- const runner = contract.runner;
23924
+ const runner = contract2.runner;
23925
23925
  assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
23926
23926
  const tx2 = await runner.sendTransaction(await populateTransaction(overrides));
23927
- const provider = getProvider(contract.runner);
23928
- return new ContractTransactionResponse(contract.interface, provider, tx2);
23927
+ const provider = getProvider(contract2.runner);
23928
+ return new ContractTransactionResponse(contract2.interface, provider, tx2);
23929
23929
  };
23930
23930
  const estimateGas = async function(overrides) {
23931
- const runner = getRunner(contract.runner, "estimateGas");
23931
+ const runner = getRunner(contract2.runner, "estimateGas");
23932
23932
  assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" });
23933
23933
  return await runner.estimateGas(await populateTransaction(overrides));
23934
23934
  };
@@ -23936,7 +23936,7 @@ function buildWrappedFallback(contract) {
23936
23936
  return await send(overrides);
23937
23937
  };
23938
23938
  defineProperties(method, {
23939
- _contract: contract,
23939
+ _contract: contract2,
23940
23940
  estimateGas,
23941
23941
  populateTransaction,
23942
23942
  send,
@@ -23944,9 +23944,9 @@ function buildWrappedFallback(contract) {
23944
23944
  });
23945
23945
  return method;
23946
23946
  }
23947
- function buildWrappedMethod(contract, key) {
23947
+ function buildWrappedMethod(contract2, key) {
23948
23948
  const getFragment = function(...args) {
23949
- const fragment = contract.interface.getFunction(key, args);
23949
+ const fragment = contract2.interface.getFunction(key, args);
23950
23950
  assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
23951
23951
  operation: "fragment",
23952
23952
  info: { key, args }
@@ -23959,16 +23959,16 @@ function buildWrappedMethod(contract, key) {
23959
23959
  if (fragment.inputs.length + 1 === args.length) {
23960
23960
  overrides = await copyOverrides(args.pop());
23961
23961
  if (overrides.from) {
23962
- overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));
23962
+ overrides.from = await resolveAddress(overrides.from, getResolver(contract2.runner));
23963
23963
  }
23964
23964
  }
23965
23965
  if (fragment.inputs.length !== args.length) {
23966
23966
  throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");
23967
23967
  }
23968
- const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);
23968
+ const resolvedArgs = await resolveArgs(contract2.runner, fragment.inputs, args);
23969
23969
  return Object.assign({}, overrides, await resolveProperties({
23970
- to: contract.getAddress(),
23971
- data: contract.interface.encodeFunctionData(fragment, resolvedArgs)
23970
+ to: contract2.getAddress(),
23971
+ data: contract2.interface.encodeFunctionData(fragment, resolvedArgs)
23972
23972
  }));
23973
23973
  };
23974
23974
  const staticCall = async function(...args) {
@@ -23979,19 +23979,19 @@ function buildWrappedMethod(contract, key) {
23979
23979
  return result;
23980
23980
  };
23981
23981
  const send = async function(...args) {
23982
- const runner = contract.runner;
23982
+ const runner = contract2.runner;
23983
23983
  assert(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" });
23984
23984
  const tx2 = await runner.sendTransaction(await populateTransaction(...args));
23985
- const provider = getProvider(contract.runner);
23986
- return new ContractTransactionResponse(contract.interface, provider, tx2);
23985
+ const provider = getProvider(contract2.runner);
23986
+ return new ContractTransactionResponse(contract2.interface, provider, tx2);
23987
23987
  };
23988
23988
  const estimateGas = async function(...args) {
23989
- const runner = getRunner(contract.runner, "estimateGas");
23989
+ const runner = getRunner(contract2.runner, "estimateGas");
23990
23990
  assert(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" });
23991
23991
  return await runner.estimateGas(await populateTransaction(...args));
23992
23992
  };
23993
23993
  const staticCallResult = async function(...args) {
23994
- const runner = getRunner(contract.runner, "call");
23994
+ const runner = getRunner(contract2.runner, "call");
23995
23995
  assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
23996
23996
  const tx2 = await populateTransaction(...args);
23997
23997
  let result = "0x";
@@ -23999,12 +23999,12 @@ function buildWrappedMethod(contract, key) {
23999
23999
  result = await runner.call(tx2);
24000
24000
  } catch (error) {
24001
24001
  if (isCallException(error) && error.data) {
24002
- throw contract.interface.makeError(error.data, tx2);
24002
+ throw contract2.interface.makeError(error.data, tx2);
24003
24003
  }
24004
24004
  throw error;
24005
24005
  }
24006
24006
  const fragment = getFragment(...args);
24007
- return contract.interface.decodeFunctionResult(fragment, result);
24007
+ return contract2.interface.decodeFunctionResult(fragment, result);
24008
24008
  };
24009
24009
  const method = async (...args) => {
24010
24010
  const fragment = getFragment(...args);
@@ -24014,8 +24014,8 @@ function buildWrappedMethod(contract, key) {
24014
24014
  return await send(...args);
24015
24015
  };
24016
24016
  defineProperties(method, {
24017
- name: contract.interface.getFunctionName(key),
24018
- _contract: contract,
24017
+ name: contract2.interface.getFunctionName(key),
24018
+ _contract: contract2,
24019
24019
  _key: key,
24020
24020
  getFragment,
24021
24021
  estimateGas,
@@ -24028,7 +24028,7 @@ function buildWrappedMethod(contract, key) {
24028
24028
  configurable: false,
24029
24029
  enumerable: true,
24030
24030
  get: () => {
24031
- const fragment = contract.interface.getFunction(key);
24031
+ const fragment = contract2.interface.getFunction(key);
24032
24032
  assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
24033
24033
  operation: "fragment",
24034
24034
  info: { key }
@@ -24038,9 +24038,9 @@ function buildWrappedMethod(contract, key) {
24038
24038
  });
24039
24039
  return method;
24040
24040
  }
24041
- function buildWrappedEvent(contract, key) {
24041
+ function buildWrappedEvent(contract2, key) {
24042
24042
  const getFragment = function(...args) {
24043
- const fragment = contract.interface.getEvent(key, args);
24043
+ const fragment = contract2.interface.getEvent(key, args);
24044
24044
  assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
24045
24045
  operation: "fragment",
24046
24046
  info: { key, args }
@@ -24048,11 +24048,11 @@ function buildWrappedEvent(contract, key) {
24048
24048
  return fragment;
24049
24049
  };
24050
24050
  const method = function(...args) {
24051
- return new PreparedTopicFilter(contract, getFragment(...args), args);
24051
+ return new PreparedTopicFilter(contract2, getFragment(...args), args);
24052
24052
  };
24053
24053
  defineProperties(method, {
24054
- name: contract.interface.getEventName(key),
24055
- _contract: contract,
24054
+ name: contract2.interface.getEventName(key),
24055
+ _contract: contract2,
24056
24056
  _key: key,
24057
24057
  getFragment
24058
24058
  });
@@ -24060,7 +24060,7 @@ function buildWrappedEvent(contract, key) {
24060
24060
  configurable: false,
24061
24061
  enumerable: true,
24062
24062
  get: () => {
24063
- const fragment = contract.interface.getEvent(key);
24063
+ const fragment = contract2.interface.getEvent(key);
24064
24064
  assert(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", {
24065
24065
  operation: "fragment",
24066
24066
  info: { key }
@@ -24072,16 +24072,16 @@ function buildWrappedEvent(contract, key) {
24072
24072
  }
24073
24073
  var internal2 = /* @__PURE__ */ Symbol.for("_ethersInternal_contract");
24074
24074
  var internalValues = /* @__PURE__ */ new WeakMap();
24075
- function setInternal(contract, values) {
24076
- internalValues.set(contract[internal2], values);
24075
+ function setInternal(contract2, values) {
24076
+ internalValues.set(contract2[internal2], values);
24077
24077
  }
24078
- function getInternal(contract) {
24079
- return internalValues.get(contract[internal2]);
24078
+ function getInternal(contract2) {
24079
+ return internalValues.get(contract2[internal2]);
24080
24080
  }
24081
24081
  function isDeferred(value) {
24082
24082
  return value && typeof value === "object" && "getTopicFilter" in value && typeof value.getTopicFilter === "function" && value.fragment;
24083
24083
  }
24084
- async function getSubInfo(contract, event) {
24084
+ async function getSubInfo(contract2, event) {
24085
24085
  let topics;
24086
24086
  let fragment = null;
24087
24087
  if (Array.isArray(event)) {
@@ -24089,7 +24089,7 @@ async function getSubInfo(contract, event) {
24089
24089
  if (isHexString(name, 32)) {
24090
24090
  return name;
24091
24091
  }
24092
- const fragment2 = contract.interface.getEvent(name);
24092
+ const fragment2 = contract2.interface.getEvent(name);
24093
24093
  assertArgument(fragment2, "unknown fragment", "name", name);
24094
24094
  return fragment2.topicHash;
24095
24095
  };
@@ -24108,7 +24108,7 @@ async function getSubInfo(contract, event) {
24108
24108
  if (isHexString(event, 32)) {
24109
24109
  topics = [event];
24110
24110
  } else {
24111
- fragment = contract.interface.getEvent(event);
24111
+ fragment = contract2.interface.getEvent(event);
24112
24112
  assertArgument(fragment, "unknown fragment", "event", event);
24113
24113
  topics = [fragment.topicHash];
24114
24114
  }
@@ -24145,36 +24145,36 @@ async function getSubInfo(contract, event) {
24145
24145
  }).join("&");
24146
24146
  return { fragment, tag, topics };
24147
24147
  }
24148
- async function hasSub(contract, event) {
24149
- const { subs } = getInternal(contract);
24150
- return subs.get((await getSubInfo(contract, event)).tag) || null;
24148
+ async function hasSub(contract2, event) {
24149
+ const { subs } = getInternal(contract2);
24150
+ return subs.get((await getSubInfo(contract2, event)).tag) || null;
24151
24151
  }
24152
- async function getSub(contract, operation, event) {
24153
- const provider = getProvider(contract.runner);
24152
+ async function getSub(contract2, operation, event) {
24153
+ const provider = getProvider(contract2.runner);
24154
24154
  assert(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation });
24155
- const { fragment, tag, topics } = await getSubInfo(contract, event);
24156
- const { addr, subs } = getInternal(contract);
24155
+ const { fragment, tag, topics } = await getSubInfo(contract2, event);
24156
+ const { addr, subs } = getInternal(contract2);
24157
24157
  let sub2 = subs.get(tag);
24158
24158
  if (!sub2) {
24159
- const address = addr ? addr : contract;
24159
+ const address = addr ? addr : contract2;
24160
24160
  const filter = { address, topics };
24161
24161
  const listener = (log) => {
24162
24162
  let foundFragment = fragment;
24163
24163
  if (foundFragment == null) {
24164
24164
  try {
24165
- foundFragment = contract.interface.getEvent(log.topics[0]);
24165
+ foundFragment = contract2.interface.getEvent(log.topics[0]);
24166
24166
  } catch (error) {
24167
24167
  }
24168
24168
  }
24169
24169
  if (foundFragment) {
24170
24170
  const _foundFragment = foundFragment;
24171
- const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : [];
24172
- emit22(contract, event, args, (listener2) => {
24173
- return new ContractEventPayload(contract, listener2, event, _foundFragment, log);
24171
+ const args = fragment ? contract2.interface.decodeEventLog(fragment, log.data, log.topics) : [];
24172
+ emit22(contract2, event, args, (listener2) => {
24173
+ return new ContractEventPayload(contract2, listener2, event, _foundFragment, log);
24174
24174
  });
24175
24175
  } else {
24176
- emit22(contract, event, [], (listener2) => {
24177
- return new ContractUnknownEventPayload(contract, listener2, event, log);
24176
+ emit22(contract2, event, [], (listener2) => {
24177
+ return new ContractUnknownEventPayload(contract2, listener2, event, log);
24178
24178
  });
24179
24179
  }
24180
24180
  };
@@ -24200,9 +24200,9 @@ async function getSub(contract, operation, event) {
24200
24200
  return sub2;
24201
24201
  }
24202
24202
  var lastEmit = Promise.resolve();
24203
- async function _emit(contract, event, args, payloadFunc) {
24203
+ async function _emit(contract2, event, args, payloadFunc) {
24204
24204
  await lastEmit;
24205
- const sub2 = await hasSub(contract, event);
24205
+ const sub2 = await hasSub(contract2, event);
24206
24206
  if (!sub2) {
24207
24207
  return false;
24208
24208
  }
@@ -24213,23 +24213,23 @@ async function _emit(contract, event, args, payloadFunc) {
24213
24213
  passArgs.push(payloadFunc(once22 ? null : listener));
24214
24214
  }
24215
24215
  try {
24216
- listener.call(contract, ...passArgs);
24216
+ listener.call(contract2, ...passArgs);
24217
24217
  } catch (error) {
24218
24218
  }
24219
24219
  return !once22;
24220
24220
  });
24221
24221
  if (sub2.listeners.length === 0) {
24222
24222
  sub2.stop();
24223
- getInternal(contract).subs.delete(sub2.tag);
24223
+ getInternal(contract2).subs.delete(sub2.tag);
24224
24224
  }
24225
24225
  return count > 0;
24226
24226
  }
24227
- async function emit22(contract, event, args, payloadFunc) {
24227
+ async function emit22(contract2, event, args, payloadFunc) {
24228
24228
  try {
24229
24229
  await lastEmit;
24230
24230
  } catch (error) {
24231
24231
  }
24232
- const resultPromise = _emit(contract, event, args, payloadFunc);
24232
+ const resultPromise = _emit(contract2, event, args, payloadFunc);
24233
24233
  lastEmit = resultPromise;
24234
24234
  return await resultPromise;
24235
24235
  }
@@ -24655,8 +24655,8 @@ var BaseContract = class _BaseContract {
24655
24655
  if (runner == null) {
24656
24656
  runner = null;
24657
24657
  }
24658
- const contract = new this(target, abi, runner);
24659
- return contract;
24658
+ const contract2 = new this(target, abi, runner);
24659
+ return contract2;
24660
24660
  }
24661
24661
  };
24662
24662
  function _ContractBase() {
@@ -27982,6 +27982,114 @@ var circuits_default = {
27982
27982
  template: "JoinSplit",
27983
27983
  pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
27984
27984
  params: [5, 2, 16]
27985
+ },
27986
+ joinsplit_1x3_16: {
27987
+ file: "joinsplit",
27988
+ template: "JoinSplit",
27989
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
27990
+ params: [1, 3, 16]
27991
+ },
27992
+ joinsplit_4x3_16: {
27993
+ file: "joinsplit",
27994
+ template: "JoinSplit",
27995
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
27996
+ params: [4, 3, 16]
27997
+ },
27998
+ joinsplit_5x3_16: {
27999
+ file: "joinsplit",
28000
+ template: "JoinSplit",
28001
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28002
+ params: [5, 3, 16]
28003
+ },
28004
+ joinsplit_6x1_16: {
28005
+ file: "joinsplit",
28006
+ template: "JoinSplit",
28007
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28008
+ params: [6, 1, 16]
28009
+ },
28010
+ joinsplit_6x2_16: {
28011
+ file: "joinsplit",
28012
+ template: "JoinSplit",
28013
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28014
+ params: [6, 2, 16]
28015
+ },
28016
+ joinsplit_6x3_16: {
28017
+ file: "joinsplit",
28018
+ template: "JoinSplit",
28019
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28020
+ params: [6, 3, 16]
28021
+ },
28022
+ joinsplit_7x1_16: {
28023
+ file: "joinsplit",
28024
+ template: "JoinSplit",
28025
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28026
+ params: [7, 1, 16]
28027
+ },
28028
+ joinsplit_7x2_16: {
28029
+ file: "joinsplit",
28030
+ template: "JoinSplit",
28031
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28032
+ params: [7, 2, 16]
28033
+ },
28034
+ joinsplit_7x3_16: {
28035
+ file: "joinsplit",
28036
+ template: "JoinSplit",
28037
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28038
+ params: [7, 3, 16]
28039
+ },
28040
+ joinsplit_8x1_16: {
28041
+ file: "joinsplit",
28042
+ template: "JoinSplit",
28043
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28044
+ params: [8, 1, 16]
28045
+ },
28046
+ joinsplit_8x2_16: {
28047
+ file: "joinsplit",
28048
+ template: "JoinSplit",
28049
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28050
+ params: [8, 2, 16]
28051
+ },
28052
+ joinsplit_8x3_16: {
28053
+ file: "joinsplit",
28054
+ template: "JoinSplit",
28055
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28056
+ params: [8, 3, 16]
28057
+ },
28058
+ joinsplit_9x1_16: {
28059
+ file: "joinsplit",
28060
+ template: "JoinSplit",
28061
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28062
+ params: [9, 1, 16]
28063
+ },
28064
+ joinsplit_9x2_16: {
28065
+ file: "joinsplit",
28066
+ template: "JoinSplit",
28067
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28068
+ params: [9, 2, 16]
28069
+ },
28070
+ joinsplit_9x3_16: {
28071
+ file: "joinsplit",
28072
+ template: "JoinSplit",
28073
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28074
+ params: [9, 3, 16]
28075
+ },
28076
+ joinsplit_10x1_16: {
28077
+ file: "joinsplit",
28078
+ template: "JoinSplit",
28079
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28080
+ params: [10, 1, 16]
28081
+ },
28082
+ joinsplit_10x2_16: {
28083
+ file: "joinsplit",
28084
+ template: "JoinSplit",
28085
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28086
+ params: [10, 2, 16]
28087
+ },
28088
+ joinsplit_10x3_16: {
28089
+ file: "joinsplit",
28090
+ template: "JoinSplit",
28091
+ pubs: ["merkleRoot", "boundParamsHash", "nullifiers", "commitmentsOut"],
28092
+ params: [10, 3, 16]
27985
28093
  }
27986
28094
  };
27987
28095
  var registry = {};
@@ -28605,7 +28713,7 @@ function serializeMultisigAccount(account) {
28605
28713
  for (const [idx, points] of account.coefficientCommitments) {
28606
28714
  coeffEntries.push([idx, points.map(serializePoint)]);
28607
28715
  }
28608
- return {
28716
+ const result = {
28609
28717
  version: MULTISIG_ACCOUNT_VERSION,
28610
28718
  groupId: account.groupId,
28611
28719
  config: account.config,
@@ -28626,6 +28734,10 @@ function serializeMultisigAccount(account) {
28626
28734
  gatewayUrl: account.gatewayUrl,
28627
28735
  address: account.address
28628
28736
  };
28737
+ if (account.name !== void 0) {
28738
+ result.name = account.name;
28739
+ }
28740
+ return result;
28629
28741
  }
28630
28742
  function deserializeMultisigAccount(data) {
28631
28743
  if (data.version !== MULTISIG_ACCOUNT_VERSION) {
@@ -28636,6 +28748,7 @@ function deserializeMultisigAccount(data) {
28636
28748
  coefficientCommitments.set(idx, serializedPoints.map(deserializePoint));
28637
28749
  }
28638
28750
  return {
28751
+ ...data.name !== void 0 ? { name: data.name } : {},
28639
28752
  groupId: data.groupId,
28640
28753
  config: data.config,
28641
28754
  participantIndex: data.participantIndex,
@@ -28662,14 +28775,18 @@ var FrostCoordinator = class {
28662
28775
  baseUrl;
28663
28776
  pollIntervalMs;
28664
28777
  timeoutMs;
28778
+ maxRetries;
28779
+ retryDelayMs;
28665
28780
  constructor(config3) {
28666
28781
  this.baseUrl = config3.baseUrl.replace(/\/$/, "");
28667
- this.pollIntervalMs = config3.pollIntervalMs ?? 1e3;
28782
+ this.pollIntervalMs = config3.pollIntervalMs ?? 3e3;
28668
28783
  this.timeoutMs = config3.timeoutMs ?? 12e4;
28784
+ this.maxRetries = config3.maxRetries ?? 3;
28785
+ this.retryDelayMs = config3.retryDelayMs ?? 500;
28669
28786
  }
28670
28787
  // === DKG ===
28671
28788
  async createDkgSession(threshold, totalParticipants) {
28672
- const resp = await fetch(`${this.baseUrl}/dkg/groups`, {
28789
+ const resp = await this.fetchWithRetry(`${this.baseUrl}/dkg/groups`, {
28673
28790
  method: "POST",
28674
28791
  headers: { "Content-Type": "application/json" },
28675
28792
  body: JSON.stringify({
@@ -28682,9 +28799,10 @@ var FrostCoordinator = class {
28682
28799
  return { code: body.code };
28683
28800
  }
28684
28801
  async joinDkgSession(code) {
28685
- const resp = await fetch(`${this.baseUrl}/dkg/groups/${code}/join`, {
28686
- method: "POST"
28687
- });
28802
+ const resp = await this.fetchWithRetry(
28803
+ `${this.baseUrl}/dkg/groups/${code}/join`,
28804
+ { method: "POST" }
28805
+ );
28688
28806
  if (!resp.ok) throw await this.toError(resp);
28689
28807
  const body = await resp.json();
28690
28808
  return {
@@ -28694,14 +28812,17 @@ var FrostCoordinator = class {
28694
28812
  };
28695
28813
  }
28696
28814
  async submitRound1(code, pkg) {
28697
- const resp = await fetch(`${this.baseUrl}/dkg/groups/${code}/round1`, {
28698
- method: "POST",
28699
- headers: { "Content-Type": "application/json" },
28700
- body: JSON.stringify({
28701
- participant_index: pkg.participantIndex,
28702
- data: serializeDkgRound1Package(pkg)
28703
- })
28704
- });
28815
+ const resp = await this.fetchWithRetry(
28816
+ `${this.baseUrl}/dkg/groups/${code}/round1`,
28817
+ {
28818
+ method: "POST",
28819
+ headers: { "Content-Type": "application/json" },
28820
+ body: JSON.stringify({
28821
+ participant_index: pkg.participantIndex,
28822
+ data: serializeDkgRound1Package(pkg)
28823
+ })
28824
+ }
28825
+ );
28705
28826
  if (!resp.ok) throw await this.toError(resp);
28706
28827
  }
28707
28828
  async waitForRound1(code) {
@@ -28711,14 +28832,17 @@ var FrostCoordinator = class {
28711
28832
  );
28712
28833
  }
28713
28834
  async submitRound2(code, pkg) {
28714
- const resp = await fetch(`${this.baseUrl}/dkg/groups/${code}/round2`, {
28715
- method: "POST",
28716
- headers: { "Content-Type": "application/json" },
28717
- body: JSON.stringify({
28718
- participant_index: pkg.participantIndex,
28719
- data: serializeDkgRound2Package(pkg)
28720
- })
28721
- });
28835
+ const resp = await this.fetchWithRetry(
28836
+ `${this.baseUrl}/dkg/groups/${code}/round2`,
28837
+ {
28838
+ method: "POST",
28839
+ headers: { "Content-Type": "application/json" },
28840
+ body: JSON.stringify({
28841
+ participant_index: pkg.participantIndex,
28842
+ data: serializeDkgRound2Package(pkg)
28843
+ })
28844
+ }
28845
+ );
28722
28846
  if (!resp.ok) throw await this.toError(resp);
28723
28847
  }
28724
28848
  async waitForRound2(code) {
@@ -28739,7 +28863,7 @@ var FrostCoordinator = class {
28739
28863
  if (metadata !== void 0) {
28740
28864
  body.metadata = metadata;
28741
28865
  }
28742
- const resp = await fetch(`${this.baseUrl}/sign/sessions`, {
28866
+ const resp = await this.fetchWithRetry(`${this.baseUrl}/sign/sessions`, {
28743
28867
  method: "POST",
28744
28868
  headers: { "Content-Type": "application/json" },
28745
28869
  body: JSON.stringify(body)
@@ -28749,7 +28873,7 @@ var FrostCoordinator = class {
28749
28873
  return { code: result.code };
28750
28874
  }
28751
28875
  async submitCommitment(code, c) {
28752
- const resp = await fetch(
28876
+ const resp = await this.fetchWithRetry(
28753
28877
  `${this.baseUrl}/sign/sessions/${code}/commitments`,
28754
28878
  {
28755
28879
  method: "POST",
@@ -28769,14 +28893,17 @@ var FrostCoordinator = class {
28769
28893
  );
28770
28894
  }
28771
28895
  async submitShare(code, share) {
28772
- const resp = await fetch(`${this.baseUrl}/sign/sessions/${code}/shares`, {
28773
- method: "POST",
28774
- headers: { "Content-Type": "application/json" },
28775
- body: JSON.stringify({
28776
- participant_index: share.participantIndex,
28777
- data: serializeSignatureShare(share)
28778
- })
28779
- });
28896
+ const resp = await this.fetchWithRetry(
28897
+ `${this.baseUrl}/sign/sessions/${code}/shares`,
28898
+ {
28899
+ method: "POST",
28900
+ headers: { "Content-Type": "application/json" },
28901
+ body: JSON.stringify({
28902
+ participant_index: share.participantIndex,
28903
+ data: serializeSignatureShare(share)
28904
+ })
28905
+ }
28906
+ );
28780
28907
  if (!resp.ok) throw await this.toError(resp);
28781
28908
  }
28782
28909
  async waitForShares(code) {
@@ -28786,19 +28913,23 @@ var FrostCoordinator = class {
28786
28913
  );
28787
28914
  }
28788
28915
  async getSigningSessionStatus(code) {
28789
- const resp = await fetch(`${this.baseUrl}/sign/sessions/${code}/status`);
28916
+ const resp = await this.fetchWithRetry(
28917
+ `${this.baseUrl}/sign/sessions/${code}/status`
28918
+ );
28790
28919
  if (!resp.ok) throw await this.toError(resp);
28791
28920
  const body = await resp.json();
28792
28921
  return { ...body, message: deserializeBigint(body.message) };
28793
28922
  }
28794
28923
  async getSigningSession(code) {
28795
- const resp = await fetch(`${this.baseUrl}/sign/sessions/${code}`);
28924
+ const resp = await this.fetchWithRetry(
28925
+ `${this.baseUrl}/sign/sessions/${code}`
28926
+ );
28796
28927
  if (!resp.ok) throw await this.toError(resp);
28797
28928
  const body = await resp.json();
28798
28929
  return deserializeSessionInfo(body);
28799
28930
  }
28800
28931
  async listSigningSessions(groupId) {
28801
- const resp = await fetch(
28932
+ const resp = await this.fetchWithRetry(
28802
28933
  `${this.baseUrl}/sign/sessions?group_id=${encodeURIComponent(groupId)}`
28803
28934
  );
28804
28935
  if (!resp.ok) throw await this.toError(resp);
@@ -28815,30 +28946,36 @@ var FrostCoordinator = class {
28815
28946
  if (sessions.length > 0) {
28816
28947
  return sessions[0];
28817
28948
  }
28818
- await sleep(this.pollIntervalMs);
28949
+ await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
28819
28950
  }
28820
28951
  throw new Error("Coordinator polling timeout");
28821
28952
  }
28822
28953
  // === Internal ===
28823
28954
  async pollRound1(code) {
28824
- const resp = await fetch(`${this.baseUrl}/dkg/groups/${code}/round1`);
28955
+ const resp = await this.fetchWithRetry(
28956
+ `${this.baseUrl}/dkg/groups/${code}/round1`
28957
+ );
28825
28958
  if (!resp.ok) throw await this.toError(resp);
28826
28959
  return await resp.json();
28827
28960
  }
28828
28961
  async pollRound2(code) {
28829
- const resp = await fetch(`${this.baseUrl}/dkg/groups/${code}/round2`);
28962
+ const resp = await this.fetchWithRetry(
28963
+ `${this.baseUrl}/dkg/groups/${code}/round2`
28964
+ );
28830
28965
  if (!resp.ok) throw await this.toError(resp);
28831
28966
  return await resp.json();
28832
28967
  }
28833
28968
  async pollCommitments(code) {
28834
- const resp = await fetch(
28969
+ const resp = await this.fetchWithRetry(
28835
28970
  `${this.baseUrl}/sign/sessions/${code}/commitments`
28836
28971
  );
28837
28972
  if (!resp.ok) throw await this.toError(resp);
28838
28973
  return await resp.json();
28839
28974
  }
28840
28975
  async pollShares(code) {
28841
- const resp = await fetch(`${this.baseUrl}/sign/sessions/${code}/shares`);
28976
+ const resp = await this.fetchWithRetry(
28977
+ `${this.baseUrl}/sign/sessions/${code}/shares`
28978
+ );
28842
28979
  if (!resp.ok) throw await this.toError(resp);
28843
28980
  return await resp.json();
28844
28981
  }
@@ -28849,12 +28986,32 @@ var FrostCoordinator = class {
28849
28986
  if (result.complete) {
28850
28987
  return result.packages.map((p) => deserializeFn(p));
28851
28988
  }
28852
- await sleep(this.pollIntervalMs);
28989
+ await sleep(this.pollIntervalMs * (0.8 + Math.random() * 0.4));
28853
28990
  }
28854
28991
  throw new Error("Coordinator polling timeout");
28855
28992
  }
28993
+ async fetchWithRetry(url, init4) {
28994
+ let lastError;
28995
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
28996
+ if (attempt > 0) {
28997
+ await sleep(this.retryDelayMs * 2 ** (attempt - 1));
28998
+ }
28999
+ const resp = await fetch(url, init4);
29000
+ if (resp.ok || !isTransientError(resp.status)) {
29001
+ return resp;
29002
+ }
29003
+ lastError = await this.toError(resp);
29004
+ }
29005
+ throw lastError;
29006
+ }
28856
29007
  async toError(resp) {
28857
29008
  const body = await resp.text();
29009
+ const isHtml = body.trimStart().startsWith("<") || resp.headers.get("content-type")?.includes("text/html");
29010
+ if (isHtml) {
29011
+ return new Error(
29012
+ `Coordinator unavailable (HTTP ${resp.status}). The service may be temporarily overloaded \u2014 try again shortly.`
29013
+ );
29014
+ }
28858
29015
  return new Error(`Coordinator error ${resp.status}: ${body}`);
28859
29016
  }
28860
29017
  };
@@ -28868,13 +29025,16 @@ function deserializeSessionInfo(raw) {
28868
29025
  metadata: raw.metadata
28869
29026
  };
28870
29027
  }
29028
+ function isTransientError(status) {
29029
+ return status === 502 || status === 503 || status === 504;
29030
+ }
28871
29031
  function sleep(ms) {
28872
29032
  return new Promise((resolve) => setTimeout(resolve, ms));
28873
29033
  }
28874
29034
 
28875
29035
  // src/frost/account.ts
28876
- function frostUrl(gatewayUrl) {
28877
- return `${gatewayUrl.replace(/\/$/, "")}/frost`;
29036
+ function resolveFrostUrl(gatewayUrl, explicitFrostUrl) {
29037
+ return explicitFrostUrl ?? `${gatewayUrl.replace(/\/$/, "")}/frost`;
28878
29038
  }
28879
29039
  function deriveVerificationShare(participantIndex, coefficientCommitments) {
28880
29040
  const idx = BigInt(participantIndex);
@@ -28888,7 +29048,7 @@ function deriveVerificationShare(participantIndex, coefficientCommitments) {
28888
29048
  }
28889
29049
  return result;
28890
29050
  }
28891
- function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl) {
29051
+ function buildMultisigAccount(result, viewingKeyPair, groupId, config3, participantIndex, gatewayUrl, frostUrl) {
28892
29052
  const nullifyingKey = computeNullifyingKey(viewingKeyPair.privateKey);
28893
29053
  const masterPublicKey = computeMasterPublicKey(
28894
29054
  result.groupPublicKey,
@@ -28909,6 +29069,7 @@ function buildMultisigAccount(result, viewingKeyPair, groupId, config3, particip
28909
29069
  nullifyingKey,
28910
29070
  masterPublicKey,
28911
29071
  gatewayUrl,
29072
+ ...frostUrl !== void 0 ? { frostUrl } : {},
28912
29073
  address
28913
29074
  };
28914
29075
  }
@@ -28929,7 +29090,7 @@ async function createMultisig(params) {
28929
29090
  totalShares: params.totalShares
28930
29091
  };
28931
29092
  const coordinator = new FrostCoordinator({
28932
- baseUrl: frostUrl(params.gatewayUrl)
29093
+ baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
28933
29094
  });
28934
29095
  const { code } = await coordinator.createDkgSession(
28935
29096
  config3.threshold,
@@ -28963,14 +29124,15 @@ async function createMultisig(params) {
28963
29124
  code,
28964
29125
  config3,
28965
29126
  1,
28966
- params.gatewayUrl
29127
+ params.gatewayUrl,
29128
+ params.frostUrl
28967
29129
  );
28968
29130
  }
28969
29131
  };
28970
29132
  }
28971
29133
  async function joinMultisig(params) {
28972
29134
  const coordinator = new FrostCoordinator({
28973
- baseUrl: frostUrl(params.gatewayUrl)
29135
+ baseUrl: resolveFrostUrl(params.gatewayUrl, params.frostUrl)
28974
29136
  });
28975
29137
  const { participantIndex, threshold, totalParticipants } = await coordinator.joinDkgSession(params.code);
28976
29138
  const config3 = { threshold, totalShares: totalParticipants };
@@ -28999,12 +29161,16 @@ async function joinMultisig(params) {
28999
29161
  params.code,
29000
29162
  config3,
29001
29163
  participantIndex,
29002
- params.gatewayUrl
29164
+ params.gatewayUrl,
29165
+ params.frostUrl
29003
29166
  );
29004
29167
  }
29005
29168
  async function signMultisig(params) {
29006
29169
  const coordinator = new FrostCoordinator({
29007
- baseUrl: frostUrl(params.account.gatewayUrl)
29170
+ baseUrl: resolveFrostUrl(
29171
+ params.account.gatewayUrl,
29172
+ params.account.frostUrl
29173
+ )
29008
29174
  });
29009
29175
  const { nonces, commitment } = generateCommitment(
29010
29176
  params.account.participantIndex
@@ -29042,7 +29208,10 @@ function createFrostSigner(params) {
29042
29208
  publicKey: params.account.groupPublicKey,
29043
29209
  sign: async (message) => {
29044
29210
  const coordinator = new FrostCoordinator({
29045
- baseUrl: frostUrl(params.account.gatewayUrl)
29211
+ baseUrl: resolveFrostUrl(
29212
+ params.account.gatewayUrl,
29213
+ params.account.frostUrl
29214
+ )
29046
29215
  });
29047
29216
  const { code } = await coordinator.createSigningSession(
29048
29217
  params.participants,
@@ -29065,7 +29234,7 @@ async function runSigningListener(params) {
29065
29234
  const { account, signal, onSession, approve, onError } = params;
29066
29235
  const pollIntervalMs = params.pollIntervalMs ?? 1e3;
29067
29236
  const coordinator = new FrostCoordinator({
29068
- baseUrl: `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
29237
+ baseUrl: account.frostUrl ?? `${account.gatewayUrl.replace(/\/$/, "")}/frost`,
29069
29238
  pollIntervalMs
29070
29239
  });
29071
29240
  const seen = /* @__PURE__ */ new Set();
@@ -29116,13 +29285,14 @@ async function runSigningListener(params) {
29116
29285
 
29117
29286
  // src/wallet/wallet.ts
29118
29287
  function createMultisigWallet(config3) {
29119
- const { gatewayUrl } = config3;
29288
+ const { gatewayUrl, frostUrl } = config3;
29120
29289
  return {
29121
29290
  create(params) {
29122
29291
  return createMultisig({
29123
29292
  threshold: params.threshold,
29124
29293
  totalShares: params.totalShares,
29125
29294
  gatewayUrl,
29295
+ frostUrl,
29126
29296
  viewingKeyPair: params.viewingKeyPair
29127
29297
  });
29128
29298
  },
@@ -29130,6 +29300,7 @@ function createMultisigWallet(config3) {
29130
29300
  return joinMultisig({
29131
29301
  code: params.code,
29132
29302
  gatewayUrl,
29303
+ frostUrl,
29133
29304
  viewingKeyPair: params.viewingKeyPair
29134
29305
  });
29135
29306
  },
@@ -29151,7 +29322,7 @@ function createMultisigWallet(config3) {
29151
29322
  },
29152
29323
  async createSigningSession(params) {
29153
29324
  const coordinator = new FrostCoordinator({
29154
- baseUrl: `${gatewayUrl.replace(/\/$/, "")}/frost`
29325
+ baseUrl: frostUrl ?? `${gatewayUrl.replace(/\/$/, "")}/frost`
29155
29326
  });
29156
29327
  return coordinator.createSigningSession(
29157
29328
  params.participants,