@toon-protocol/rig 3.5.2 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/rig.js CHANGED
@@ -6060,6 +6060,13 @@ function renderMario(mario) {
6060
6060
  }
6061
6061
  var MARIO_PAYMENT_NOTE = "Payment is mARIO from this identity's Solana wallet, charged on-chain by the ar.io registry program \u2014 NOT through TOON ILP payment channels. Fund this wallet with `rig fund --chain solana` (or send $ARIO to the Solana address above).";
6062
6062
  var DVM_PAYMENT_NOTE = "Brokered buy (--via): the DVM pays the mARIO name price from ITS Solana wallet via the kind:5095 job; this wallet needs only dust SOL to spawn the ANT it owns. On the paid path the job fee is enforced by the connector payment proxy in front of the DVM; when --via targets the DVM backend directly the job payment is STUBBED (dev/e2e only). The ArNS purchase itself is real either way, and the name is owned by YOUR ANT from inception.";
6063
+ var ARNS_NULL_PROCESS_ID = "11111111111111111111111111111111";
6064
+ function antProcessIdOf(id) {
6065
+ if (id === null || id === void 0 || id === ARNS_NULL_PROCESS_ID) {
6066
+ return null;
6067
+ }
6068
+ return id;
6069
+ }
6063
6070
  var MIN_ARIO_SDK_VERSION = "4.0.3";
6064
6071
  var ArnsSdkUnavailableError = class extends Error {
6065
6072
  constructor(cause, module = "@ar.io/sdk") {
@@ -6247,7 +6254,11 @@ var defaultLoadArns = async (options) => {
6247
6254
  throw err;
6248
6255
  }
6249
6256
  return {
6250
- processId: raw.processId ?? null,
6257
+ // #79 AC4: the registry writes the all-ones placeholder when no ANT
6258
+ // is attached. The seam contract is "a process id or null", so the
6259
+ // placeholder is normalized to null right here — every caller then
6260
+ // sees "no ANT" instead of a valid-looking System Program address.
6261
+ processId: antProcessIdOf(raw.processId),
6251
6262
  type: raw.type ?? null,
6252
6263
  ...raw.startTimestamp !== void 0 ? { startTimestamp: raw.startTimestamp * 1e3 } : {},
6253
6264
  ...raw.endTimestamp !== void 0 ? { endTimestamp: raw.endTimestamp * 1e3 } : {},
@@ -6737,9 +6748,9 @@ async function runBuy(name, flags, deps) {
6737
6748
  "write"
6738
6749
  );
6739
6750
  if (via !== null) {
6740
- const spawn2 = await signed.sdk.spawnAnt({ name });
6751
+ const spawn3 = await signed.sdk.spawnAnt({ name });
6741
6752
  if (!flags.json) {
6742
- io2.out(`Spawned ANT ${spawn2.processId} (tx ${spawn2.signature})`);
6753
+ io2.out(`Spawned ANT ${spawn3.processId} (tx ${spawn3.signature})`);
6743
6754
  }
6744
6755
  const submit = deps.submitDvmBuyJob ?? defaultSubmitDvmBuyJob;
6745
6756
  const receipt2 = await submit({
@@ -6747,19 +6758,19 @@ async function runBuy(name, flags, deps) {
6747
6758
  name,
6748
6759
  type,
6749
6760
  years,
6750
- processId: spawn2.processId,
6761
+ processId: spawn3.processId,
6751
6762
  nostrSecretKey: signed.nostrSecretKey
6752
6763
  });
6753
6764
  const result2 = {
6754
6765
  registryTxId: receipt2.registryTxId,
6755
- antProcessId: spawn2.processId,
6766
+ antProcessId: spawn3.processId,
6756
6767
  syncAttributesTxId: receipt2.syncAttributesTxId,
6757
6768
  dvmQuotedMario: receipt2.quotedMario
6758
6769
  };
6759
6770
  if (flags.json) {
6760
6771
  io2.emitJson(
6761
6772
  buildJson(true, {
6762
- spawn: { processId: spawn2.processId, signature: spawn2.signature },
6773
+ spawn: { processId: spawn3.processId, signature: spawn3.signature },
6763
6774
  result: result2
6764
6775
  })
6765
6776
  );
@@ -6767,7 +6778,7 @@ async function runBuy(name, flags, deps) {
6767
6778
  io2.out(
6768
6779
  `Registered "${name}" via the DVM \u2014 registry tx ${result2.registryTxId}`
6769
6780
  );
6770
- io2.out(` ANT process (owned by YOU): ${spawn2.processId}`);
6781
+ io2.out(` ANT process (owned by YOU): ${spawn3.processId}`);
6771
6782
  if (receipt2.syncAttributesTxId) {
6772
6783
  io2.out(` Trait sync: ${receipt2.syncAttributesTxId}`);
6773
6784
  } else {
@@ -6781,20 +6792,33 @@ async function runBuy(name, flags, deps) {
6781
6792
  }
6782
6793
  return 0;
6783
6794
  }
6795
+ const spawn2 = await signed.sdk.spawnAnt({ name });
6796
+ if (!flags.json) {
6797
+ io2.out(`Spawned ANT ${spawn2.processId} (tx ${spawn2.signature})`);
6798
+ }
6784
6799
  const receipt = await signed.sdk.buyRecord({
6785
6800
  name,
6786
6801
  type,
6787
- ...years !== null ? { years } : {}
6802
+ ...years !== null ? { years } : {},
6803
+ processId: spawn2.processId
6788
6804
  });
6789
- const result = {
6790
- registryTxId: receipt.id,
6791
- antProcessId: receipt.processId ?? null
6792
- };
6805
+ const antProcessId = antProcessIdOf(receipt.processId ?? spawn2.processId);
6806
+ const result = { registryTxId: receipt.id, antProcessId };
6807
+ const spawnInfo = { processId: spawn2.processId, signature: spawn2.signature };
6808
+ if (antProcessId === null) {
6809
+ const hint = `bought "${name}" (registry tx ${result.registryTxId}) but no ANT is attached \u2014 the spend is on-chain and recoverable, but the name cannot resolve until an ANT is attached to it`;
6810
+ if (flags.json) {
6811
+ io2.emitJson(buildJson(true, { spawn: spawnInfo, result, hint }));
6812
+ } else {
6813
+ io2.err(hint);
6814
+ }
6815
+ return 1;
6816
+ }
6793
6817
  if (flags.json) {
6794
- io2.emitJson(buildJson(true, { result }));
6818
+ io2.emitJson(buildJson(true, { spawn: spawnInfo, result }));
6795
6819
  } else {
6796
6820
  io2.out(`Registered "${name}" \u2014 registry tx ${result.registryTxId}`);
6797
- if (result.antProcessId) io2.out(` ANT process: ${result.antProcessId}`);
6821
+ io2.out(` ANT process: ${result.antProcessId}`);
6798
6822
  io2.out(
6799
6823
  `Point it at content with \`rig name set ${name} <txId>\`, then it resolves at https://${name}.<gateway>/`
6800
6824
  );
@@ -6810,12 +6834,17 @@ async function runSet(name, txId, flags, deps) {
6810
6834
  "read"
6811
6835
  );
6812
6836
  const record = await ctx.sdk.getArNSRecord({ name });
6813
- if (!record || !record.processId) {
6837
+ if (!record) {
6814
6838
  throw new Error(
6815
6839
  `no ArNS record for "${name}" on ${ctx.network} \u2014 buy it first with \`rig name buy ${name}\` (or check \`rig name status ${name}\`)`
6816
6840
  );
6817
6841
  }
6818
- const antProcessId = record.processId;
6842
+ const antProcessId = antProcessIdOf(record.processId);
6843
+ if (antProcessId === null) {
6844
+ throw new Error(
6845
+ `"${name}" is registered on ${ctx.network} but has NO ANT attached (the registry placeholder ${ARNS_NULL_PROCESS_ID}) \u2014 \`rig name set\` needs a real ANT process, so there is nothing to write to. Check \`rig name status ${name}\`; the name has to be re-bound to an ANT before it can resolve.`
6846
+ );
6847
+ }
6819
6848
  const undername = flags.undername ?? null;
6820
6849
  const via = flags.via ?? null;
6821
6850
  const buildJson = (executed, extra = {}) => ({
@@ -6949,9 +6978,12 @@ async function runStatus(name, flags, deps) {
6949
6978
  "read"
6950
6979
  );
6951
6980
  const record = await ctx.sdk.getArNSRecord({ name });
6981
+ const antProcessId = antProcessIdOf(record?.processId);
6982
+ const antMissing = record !== null && antProcessId === null;
6983
+ const antMissingHint = `"${name}" is registered on ${ctx.network} but has NO ANT attached (the registry placeholder ${ARNS_NULL_PROCESS_ID}) \u2014 it cannot resolve, and \`rig name set\` cannot write records against it. The name has to be re-bound to an ANT.`;
6952
6984
  let targets = null;
6953
- if (record?.processId) {
6954
- const ant = await ctx.sdk.ant(record.processId);
6985
+ if (antProcessId !== null) {
6986
+ const ant = await ctx.sdk.ant(antProcessId);
6955
6987
  targets = await ant.getRecords();
6956
6988
  }
6957
6989
  if (flags.json) {
@@ -6962,18 +6994,20 @@ async function runStatus(name, flags, deps) {
6962
6994
  network: ctx.network,
6963
6995
  processId: ctx.processId ?? null,
6964
6996
  registered: record !== null,
6997
+ antMissing,
6965
6998
  identity: ctx.identity,
6966
6999
  solanaAddress: ctx.solanaAddress,
6967
7000
  record: record ? {
6968
- antProcessId: record.processId,
7001
+ antProcessId,
6969
7002
  type: record.type,
6970
7003
  startTimestamp: record.startTimestamp ?? null,
6971
7004
  endTimestamp: record.endTimestamp ?? null,
6972
7005
  undernameLimit: record.undernameLimit ?? null
6973
7006
  } : null,
6974
- targets
7007
+ targets,
7008
+ ...antMissing ? { hint: antMissingHint } : {}
6975
7009
  });
6976
- return 0;
7010
+ return antMissing ? 1 : 0;
6977
7011
  }
6978
7012
  io2.out(`ArNS name "${name}" on ${ctx.network}:`);
6979
7013
  if (!record) {
@@ -6981,7 +7015,7 @@ async function runStatus(name, flags, deps) {
6981
7015
  io2.out(renderIdentityLine(ctx.identity));
6982
7016
  return 0;
6983
7017
  }
6984
- io2.out(` ANT process: ${record.processId ?? "(unknown)"}`);
7018
+ io2.out(` ANT process: ${antProcessId ?? "NONE \u2014 no ANT is attached"}`);
6985
7019
  io2.out(` Type: ${record.type ?? "(unknown)"}`);
6986
7020
  if (record.type === "permabuy") {
6987
7021
  io2.out(" Expiry: never (permabuy)");
@@ -6999,10 +7033,16 @@ async function runStatus(name, flags, deps) {
6999
7033
  ` ${label} \u2192 ${target.transactionId} (ttl ${target.ttlSeconds}s)`
7000
7034
  );
7001
7035
  }
7036
+ } else if (antMissing) {
7037
+ io2.out(" Records: none \u2014 there is no ANT to hold them.");
7002
7038
  } else {
7003
7039
  io2.out(" Records: none set \u2014 point one with `rig name set`.");
7004
7040
  }
7005
7041
  io2.out(renderIdentityLine(ctx.identity));
7042
+ if (antMissing) {
7043
+ io2.err(antMissingHint);
7044
+ return 1;
7045
+ }
7006
7046
  return 0;
7007
7047
  }
7008
7048
  async function runName(args, deps) {