@t2000/sdk 5.6.0 → 5.7.0

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/index.d.cts CHANGED
@@ -829,15 +829,43 @@ declare const AUDRIC_PARENT_NAME = "audric.sui";
829
829
  * by the address that owns this NFT. Mainnet only.
830
830
  */
831
831
  declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
832
+ /**
833
+ * A SuiNS parent under which leaf subnames are minted: the registered SLD name
834
+ * + the on-chain `SuinsRegistration` NFT id the minting service must own/sign.
835
+ *
836
+ * Added 2026-06-29 (Agent ID Phase B, gate 2) to let the same leaf machinery
837
+ * serve a SECOND namespace — `agent-id.sui` for Agent ID handles — without
838
+ * forking it. Audric stays the default so every existing caller is unchanged.
839
+ */
840
+ interface SuinsParent {
841
+ name: string;
842
+ nftId: string;
843
+ }
844
+ /** The Audric consumer-handle parent (`<label>.audric.sui` → `@audric`). */
845
+ declare const AUDRIC_PARENT: SuinsParent;
846
+ /** The Agent ID parent (`<label>.agent-id.sui` → `@agent-id`). Distinct from
847
+ * audric.sui on purpose (infra/agent registry vs consumer brand).
848
+ *
849
+ * Registered on SuiNS mainnet 2026-06-29; the `SuinsRegistration` NFT
850
+ * (`0xc8c1…d5d1f`) is held by the custody address
851
+ * `0x6988a92d…30e4532`, which signs leaf mints + pays their gas. Override via
852
+ * `AGENT_ID_PARENT_NFT_ID` for testnet/dev. */
853
+ declare const AGENT_ID_PARENT_NAME = "agent-id.sui";
854
+ declare const AGENT_ID_PARENT_NFT_ID: string;
855
+ declare const AGENT_ID_PARENT: SuinsParent;
832
856
  interface BuildAddLeafParams {
833
857
  /** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
834
858
  label: string;
835
859
  /** Sui address the leaf will resolve to (typically the user's zkLogin wallet). */
836
860
  targetAddress: string;
861
+ /** Parent to mint under. Defaults to Audric (back-compat). */
862
+ parent?: SuinsParent;
837
863
  }
838
864
  interface BuildRevokeLeafParams {
839
865
  /** Bare label of the leaf to revoke. */
840
866
  label: string;
867
+ /** Parent the leaf lives under. Defaults to Audric (back-compat). */
868
+ parent?: SuinsParent;
841
869
  }
842
870
  type LabelValidationResult = {
843
871
  valid: true;
@@ -872,7 +900,7 @@ declare function validateLabel(label: unknown): LabelValidationResult;
872
900
  * Throws synchronously if `label` violates protocol rules or `targetAddress` is
873
901
  * not a valid Sui address — fail-closed before bytes are built.
874
902
  */
875
- declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress }: BuildAddLeafParams): Transaction;
903
+ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress, parent }: BuildAddLeafParams): Transaction;
876
904
  /**
877
905
  * Build an unsigned PTB that revokes a `<label>.audric.sui` leaf subname.
878
906
  *
@@ -886,7 +914,7 @@ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress
886
914
  * The mainnet smoke test (2026-05-01) confirmed revocation gas cost is roughly
887
915
  * negative net (storage rebate exceeds computation) — see RUNBOOK §4.
888
916
  */
889
- declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRevokeLeafParams): Transaction;
917
+ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label, parent }: BuildRevokeLeafParams): Transaction;
890
918
  /**
891
919
  * Convenience: turn a bare label into the full `<label>.audric.sui` path.
892
920
  *
@@ -905,7 +933,7 @@ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRev
905
933
  * mainnet 2026-05-08 PF1) — `displayHandle()` is purely a render-layer
906
934
  * choice, not a backend storage change.
907
935
  */
908
- declare function fullHandle(label: string): string;
936
+ declare function fullHandle(label: string, parentName?: string): string;
909
937
  /**
910
938
  * SuiNS V2 short-form display alias. `displayHandle('alice')` →
911
939
  * `'alice@audric'`. Use for chat narration, permission cards, receipts,
@@ -926,6 +954,6 @@ declare function fullHandle(label: string): string;
926
954
  * for canonicalization in the input parser (which is a no-op since
927
955
  * SuiNS RPC accepts both — kept available for future-proofing).
928
956
  */
929
- declare function displayHandle(label: string): string;
957
+ declare function displayHandle(label: string, parentName?: string): string;
930
958
 
931
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
959
+ export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
package/dist/index.d.ts CHANGED
@@ -829,15 +829,43 @@ declare const AUDRIC_PARENT_NAME = "audric.sui";
829
829
  * by the address that owns this NFT. Mainnet only.
830
830
  */
831
831
  declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
832
+ /**
833
+ * A SuiNS parent under which leaf subnames are minted: the registered SLD name
834
+ * + the on-chain `SuinsRegistration` NFT id the minting service must own/sign.
835
+ *
836
+ * Added 2026-06-29 (Agent ID Phase B, gate 2) to let the same leaf machinery
837
+ * serve a SECOND namespace — `agent-id.sui` for Agent ID handles — without
838
+ * forking it. Audric stays the default so every existing caller is unchanged.
839
+ */
840
+ interface SuinsParent {
841
+ name: string;
842
+ nftId: string;
843
+ }
844
+ /** The Audric consumer-handle parent (`<label>.audric.sui` → `@audric`). */
845
+ declare const AUDRIC_PARENT: SuinsParent;
846
+ /** The Agent ID parent (`<label>.agent-id.sui` → `@agent-id`). Distinct from
847
+ * audric.sui on purpose (infra/agent registry vs consumer brand).
848
+ *
849
+ * Registered on SuiNS mainnet 2026-06-29; the `SuinsRegistration` NFT
850
+ * (`0xc8c1…d5d1f`) is held by the custody address
851
+ * `0x6988a92d…30e4532`, which signs leaf mints + pays their gas. Override via
852
+ * `AGENT_ID_PARENT_NFT_ID` for testnet/dev. */
853
+ declare const AGENT_ID_PARENT_NAME = "agent-id.sui";
854
+ declare const AGENT_ID_PARENT_NFT_ID: string;
855
+ declare const AGENT_ID_PARENT: SuinsParent;
832
856
  interface BuildAddLeafParams {
833
857
  /** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
834
858
  label: string;
835
859
  /** Sui address the leaf will resolve to (typically the user's zkLogin wallet). */
836
860
  targetAddress: string;
861
+ /** Parent to mint under. Defaults to Audric (back-compat). */
862
+ parent?: SuinsParent;
837
863
  }
838
864
  interface BuildRevokeLeafParams {
839
865
  /** Bare label of the leaf to revoke. */
840
866
  label: string;
867
+ /** Parent the leaf lives under. Defaults to Audric (back-compat). */
868
+ parent?: SuinsParent;
841
869
  }
842
870
  type LabelValidationResult = {
843
871
  valid: true;
@@ -872,7 +900,7 @@ declare function validateLabel(label: unknown): LabelValidationResult;
872
900
  * Throws synchronously if `label` violates protocol rules or `targetAddress` is
873
901
  * not a valid Sui address — fail-closed before bytes are built.
874
902
  */
875
- declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress }: BuildAddLeafParams): Transaction;
903
+ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress, parent }: BuildAddLeafParams): Transaction;
876
904
  /**
877
905
  * Build an unsigned PTB that revokes a `<label>.audric.sui` leaf subname.
878
906
  *
@@ -886,7 +914,7 @@ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress
886
914
  * The mainnet smoke test (2026-05-01) confirmed revocation gas cost is roughly
887
915
  * negative net (storage rebate exceeds computation) — see RUNBOOK §4.
888
916
  */
889
- declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRevokeLeafParams): Transaction;
917
+ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label, parent }: BuildRevokeLeafParams): Transaction;
890
918
  /**
891
919
  * Convenience: turn a bare label into the full `<label>.audric.sui` path.
892
920
  *
@@ -905,7 +933,7 @@ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRev
905
933
  * mainnet 2026-05-08 PF1) — `displayHandle()` is purely a render-layer
906
934
  * choice, not a backend storage change.
907
935
  */
908
- declare function fullHandle(label: string): string;
936
+ declare function fullHandle(label: string, parentName?: string): string;
909
937
  /**
910
938
  * SuiNS V2 short-form display alias. `displayHandle('alice')` →
911
939
  * `'alice@audric'`. Use for chat narration, permission cards, receipts,
@@ -926,6 +954,6 @@ declare function fullHandle(label: string): string;
926
954
  * for canonicalization in the input parser (which is a no-op since
927
955
  * SuiNS RPC accepts both — kept available for future-proofing).
928
956
  */
929
- declare function displayHandle(label: string): string;
957
+ declare function displayHandle(label: string, parentName?: string): string;
930
958
 
931
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
959
+ export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BuildAddLeafParams, type BuildRevokeLeafParams, type ComposeTxOptions, type ComposeTxResult, type DailySpend, DepositInfo, InvalidAddressError, type LabelValidationResult, type LimitAssertInput, LimitEnforcer, LimitExceededError, type LimitKind, type LimitOperation, type LimitsConfig, type LimitsFile, type NormalizedAddress, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, SPONSORED_PYTH_DEPENDENT_PROVIDERS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SendResult, type SendTransferInput, SendableAsset, type StepPreview, SuinsNotRegisteredError, type SuinsParent, SuinsRpcError, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, WRITE_APPENDER_REGISTRY, type WriteStep, type WriteToolName, ZkLoginProof, approxUsdValue, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, displayHandle, exportPrivateKey, fullHandle, generateKeypair, getAddress, getLimits, getSponsoredSwapProviders, getSwapQuote, hasLimits, keypairFromPrivateKey, loadKey, looksLikeSuiNs, normalizeAddressInput, queryBalance, readLimitsFile, recordDailySpend, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, saveBech32, saveKey, setLimits, validateLabel, walletExists, writeLimitsFile };
package/dist/index.js CHANGED
@@ -269,6 +269,7 @@ var init_token_registry = __esm({
269
269
  // src/wallet/coinSelection.ts
270
270
  var coinSelection_exports = {};
271
271
  __export(coinSelection_exports, {
272
+ buildCoinToAddressBalanceMigration: () => buildCoinToAddressBalanceMigration,
272
273
  fetchAllCoins: () => fetchAllCoins,
273
274
  selectAndSplitCoin: () => selectAndSplitCoin,
274
275
  selectSuiCoin: () => selectSuiCoin
@@ -382,6 +383,32 @@ async function selectCoinObjectsOnly(tx, client, owner, coinType, amount, allowS
382
383
  });
383
384
  return { coin, effectiveAmount, swapAll };
384
385
  }
386
+ function buildCoinToAddressBalanceMigration(args) {
387
+ const { coins, coinType, owner, minAmount } = args;
388
+ const sorted = [...coins].filter((c) => c.balance > 0n).sort((a, b) => b.balance > a.balance ? 1 : b.balance < a.balance ? -1 : 0);
389
+ const selected = [];
390
+ let migratedRaw = 0n;
391
+ for (const c of sorted) {
392
+ if (migratedRaw >= minAmount) break;
393
+ selected.push(c);
394
+ migratedRaw += c.balance;
395
+ }
396
+ if (migratedRaw < minAmount) {
397
+ throw new T2000Error("INSUFFICIENT_BALANCE", `Insufficient ${coinType} coin objects to migrate`, {
398
+ available: migratedRaw.toString(),
399
+ required: minAmount.toString()
400
+ });
401
+ }
402
+ const tx = new Transaction();
403
+ for (const c of selected) {
404
+ tx.moveCall({
405
+ target: "0x2::coin::send_funds",
406
+ typeArguments: [coinType],
407
+ arguments: [tx.object(c.objectId), tx.pure.address(owner)]
408
+ });
409
+ }
410
+ return { tx, migratedRaw };
411
+ }
385
412
  async function selectSuiCoin(tx, client, owner, amountMist, sponsoredContext, mergeCache) {
386
413
  if (sponsoredContext) {
387
414
  const { SUI_TYPE: SUI_TYPE2 } = await Promise.resolve().then(() => (init_token_registry(), token_registry_exports));
@@ -1160,40 +1187,26 @@ async function ensureAddressBalanceCovers(args) {
1160
1187
  required: amountRaw.toString()
1161
1188
  });
1162
1189
  }
1190
+ const coins = [];
1163
1191
  let coinSum = 0n;
1164
1192
  let cursor;
1165
1193
  let hasNext = true;
1166
1194
  while (hasNext) {
1167
1195
  const page = await client.core.listCoins({ owner, coinType: asset, cursor: cursor ?? void 0 });
1168
- for (const c of page.objects) coinSum += BigInt(c.balance);
1196
+ for (const c of page.objects) {
1197
+ coins.push({ objectId: c.objectId, balance: BigInt(c.balance) });
1198
+ coinSum += BigInt(c.balance);
1199
+ }
1169
1200
  cursor = page.cursor;
1170
1201
  hasNext = page.hasNextPage;
1171
1202
  }
1172
1203
  const addressBalance = total - coinSum;
1173
1204
  if (addressBalance >= amountRaw) return 0;
1174
1205
  const shortfall = amountRaw - addressBalance;
1175
- const { Transaction: Transaction6 } = await import('@mysten/sui/transactions');
1176
- const { selectAndSplitCoin: selectAndSplitCoin2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
1206
+ const { buildCoinToAddressBalanceMigration: buildCoinToAddressBalanceMigration2 } = await Promise.resolve().then(() => (init_coinSelection(), coinSelection_exports));
1177
1207
  const grpcClient = await makeGrpcBuildClient(client);
1178
- const migration = await executeTx(
1179
- client,
1180
- signer,
1181
- async () => {
1182
- const tx = new Transaction6();
1183
- const { coin } = await selectAndSplitCoin2(tx, client, owner, asset, shortfall, {
1184
- sponsoredContext: true,
1185
- // coin-objects-only — never the address balance
1186
- allowSwapAll: false
1187
- });
1188
- tx.moveCall({
1189
- target: "0x2::coin::send_funds",
1190
- typeArguments: [asset],
1191
- arguments: [coin, tx.pure.address(owner)]
1192
- });
1193
- return tx;
1194
- },
1195
- { buildClient: grpcClient }
1196
- );
1208
+ const { tx } = buildCoinToAddressBalanceMigration2({ coins, coinType: asset, owner, minAmount: shortfall });
1209
+ const migration = await executeTx(client, signer, () => tx, { buildClient: grpcClient });
1197
1210
  return migration.gasCostSui;
1198
1211
  }
1199
1212
  async function finalize(response, opts) {
@@ -2813,6 +2826,16 @@ init_cetus_swap();
2813
2826
  init_token_registry();
2814
2827
  var AUDRIC_PARENT_NAME = "audric.sui";
2815
2828
  var AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
2829
+ var AUDRIC_PARENT = {
2830
+ name: AUDRIC_PARENT_NAME,
2831
+ nftId: AUDRIC_PARENT_NFT_ID
2832
+ };
2833
+ var AGENT_ID_PARENT_NAME = "agent-id.sui";
2834
+ var AGENT_ID_PARENT_NFT_ID = process.env.AGENT_ID_PARENT_NFT_ID ?? "0xc8c13f5b5a6d4c47c04877014794f65e67e2745d3bfa089b736eb54b0ebd5d1f";
2835
+ var AGENT_ID_PARENT = {
2836
+ name: AGENT_ID_PARENT_NAME,
2837
+ nftId: AGENT_ID_PARENT_NFT_ID
2838
+ };
2816
2839
  var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
2817
2840
  function validateLabel(label) {
2818
2841
  if (typeof label !== "string") {
@@ -2835,7 +2858,7 @@ function validateLabel(label) {
2835
2858
  }
2836
2859
  return { valid: true };
2837
2860
  }
2838
- function buildAddLeafTx(suinsClient, { label, targetAddress }) {
2861
+ function buildAddLeafTx(suinsClient, { label, targetAddress, parent = AUDRIC_PARENT }) {
2839
2862
  const labelCheck = validateLabel(label);
2840
2863
  if (!labelCheck.valid) {
2841
2864
  throw new Error(`buildAddLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
@@ -2843,39 +2866,45 @@ function buildAddLeafTx(suinsClient, { label, targetAddress }) {
2843
2866
  if (typeof targetAddress !== "string" || !isValidSuiAddress(normalizeSuiAddress(targetAddress))) {
2844
2867
  throw new Error(`buildAddLeafTx: invalid targetAddress "${targetAddress}"`);
2845
2868
  }
2869
+ if (!parent.nftId) {
2870
+ throw new Error(`buildAddLeafTx: parent NFT id not configured for "${parent.name}"`);
2871
+ }
2846
2872
  const tx = new Transaction();
2847
2873
  const suinsTx = new SuinsTransaction(suinsClient, tx);
2848
2874
  suinsTx.createLeafSubName({
2849
- parentNft: AUDRIC_PARENT_NFT_ID,
2850
- name: `${label}.${AUDRIC_PARENT_NAME}`,
2875
+ parentNft: parent.nftId,
2876
+ name: `${label}.${parent.name}`,
2851
2877
  targetAddress: normalizeSuiAddress(targetAddress)
2852
2878
  });
2853
2879
  return tx;
2854
2880
  }
2855
- function buildRevokeLeafTx(suinsClient, { label }) {
2881
+ function buildRevokeLeafTx(suinsClient, { label, parent = AUDRIC_PARENT }) {
2856
2882
  const labelCheck = validateLabel(label);
2857
2883
  if (!labelCheck.valid) {
2858
2884
  throw new Error(`buildRevokeLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
2859
2885
  }
2886
+ if (!parent.nftId) {
2887
+ throw new Error(`buildRevokeLeafTx: parent NFT id not configured for "${parent.name}"`);
2888
+ }
2860
2889
  const tx = new Transaction();
2861
2890
  const suinsTx = new SuinsTransaction(suinsClient, tx);
2862
2891
  suinsTx.removeLeafSubName({
2863
- parentNft: AUDRIC_PARENT_NFT_ID,
2864
- name: `${label}.${AUDRIC_PARENT_NAME}`
2892
+ parentNft: parent.nftId,
2893
+ name: `${label}.${parent.name}`
2865
2894
  });
2866
2895
  return tx;
2867
2896
  }
2868
- function fullHandle(label) {
2869
- return `${label}.${AUDRIC_PARENT_NAME}`;
2897
+ function fullHandle(label, parentName = AUDRIC_PARENT_NAME) {
2898
+ return `${label}.${parentName}`;
2870
2899
  }
2871
- function displayHandle(label) {
2872
- const parentDisplay = AUDRIC_PARENT_NAME.replace(/\.sui$/, "");
2900
+ function displayHandle(label, parentName = AUDRIC_PARENT_NAME) {
2901
+ const parentDisplay = parentName.replace(/\.sui$/, "");
2873
2902
  return `${label}@${parentDisplay}`;
2874
2903
  }
2875
2904
 
2876
2905
  // src/index.ts
2877
2906
  init_preflight();
2878
2907
 
2879
- export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, buildSwapTx, checkPositiveAmount, checkSuiAddress, classifyAction, classifyLabel, classifyTransaction, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getLimits, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, isAllowedAsset, isCetusRouteFresh, isInRegistry, keypairFromPrivateKey, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithMpp, preflightFail, preflightPay, preflightSend, preflightSwap, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, walletExists, writeLimitsFile };
2908
+ export { AGENT_ID_PARENT, AGENT_ID_PARENT_NAME, AGENT_ID_PARENT_NFT_ID, AUDRIC_PARENT, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, DEFAULT_GRPC_URL, DEFAULT_NETWORK, ETH_TYPE, GASLESS_MIN_STABLE_AMOUNT, GASLESS_STABLE_TYPES, GAS_RESERVE_MIN, IKA_TYPE, InvalidAddressError, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, LimitEnforcer, LimitExceededError, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, OPERATION_ASSETS, OVERLAY_FEE_RATE, PREFLIGHT_MAX_AMOUNT, PREFLIGHT_OK, SENDABLE_ASSETS, SPONSORED_PYTH_DEPENDENT_PROVIDERS, STABLE_ASSETS, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SuinsNotRegisteredError, SuinsRpcError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addSendToTx, addSwapToTx, approxUsdValue, assertAllowedAsset, assertLimitConfig, buildAddLeafTx, buildRevokeLeafTx, buildSendTx, buildSwapTx, checkPositiveAmount, checkSuiAddress, classifyAction, classifyLabel, classifyTransaction, clearLimits, composeTx, dailySpentToday, deriveAllowedAddressesFromPtb, deserializeCetusRoute, displayHandle, executeTx, exportPrivateKey, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getLimits, getSponsoredSwapProviders, getSuiClient, getSuiGrpcClient, getSwapQuote, hasLimits, isAllowedAsset, isCetusRouteFresh, isInRegistry, keypairFromPrivateKey, loadKey, looksLikeSuiNs, mapMoveAbortCode, mapWalletError, mistToSui, normalizeAddressInput, normalizeAsset, normalizeCoinType, parseSuiRpcTx, payWithMpp, preflightFail, preflightPay, preflightSend, preflightSwap, queryBalance, queryHistory, queryTransaction, rawToStable, rawToUsdc, readLimitsFile, recordDailySpend, refineLendingLabel, resolveAddressToSuinsViaRpc, resolveSuinsViaRpc, resolveSymbol, resolveTokenType, saveBech32, saveKey, selectAndSplitCoin, selectSuiCoin, serializeCetusRoute, setLimits, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, verifyCetusRouteCoinMatch, walletExists, writeLimitsFile };
2880
2909
  //# sourceMappingURL=index.js.map
2881
2910
  //# sourceMappingURL=index.js.map