@t2000/sdk 1.21.0 → 1.22.1

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
@@ -8,6 +8,7 @@ export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H
8
8
  import { i as T2000Options, P as PayOptions, c as PayResult, j as StakeVSuiResult, U as UnstakeVSuiResult, k as SwapResult, l as SwapQuoteResult, h as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, m as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, g as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, d as PendingReward, C as ClaimRewardsResult, n as CompoundRewardsResult, f as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, o as FinancialSummary } from './types-jAD-e7Pq.cjs';
9
9
  export { A as AssetRates, G as GasReserve, p as HFAlertLevel, e as PositionEntry } from './types-jAD-e7Pq.cjs';
10
10
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
11
+ import { SuinsClient } from '@mysten/suins';
11
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.cjs';
12
13
  import '@cetusprotocol/aggregator-sdk';
13
14
 
@@ -915,4 +916,112 @@ declare function addUnstakeVSuiToTx(tx: Transaction, client: SuiJsonRpcClient, a
915
916
  effectiveAmountMist: bigint | 'all';
916
917
  }>;
917
918
 
918
- export { type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, buildClaimRewardsTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, fetchAllCoins, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, walletExists };
919
+ /**
920
+ * SuiNS leaf-subname builders for the `audric.sui` parent NFT.
921
+ *
922
+ * Used by SPEC 10 v0.2.1 Phase A.1 — Audric Passport Identity. Lets the audric host
923
+ * mint and revoke `username.audric.sui` leaves under the parent NFT held by the
924
+ * dedicated custody address (`0xaca29165…23d11`).
925
+ *
926
+ * **Why a dedicated SDK module (not inline in the audric route):**
927
+ * - Consumers (audric/web's `/api/identity/{reserve,change,release}` routes) can import
928
+ * the canonical builder shape without re-discovering the `SuinsTransaction` API.
929
+ * - Single source of truth for the parent NFT ID + parent name.
930
+ * - Single source of truth for label validation (length / charset / hyphen rules).
931
+ *
932
+ * **Signer model — read this before wiring into a route:**
933
+ * These builders are signed by the **service account** (the parent NFT custody address),
934
+ * NOT by the user's zkLogin key. Per `audric/.cursor/rules/audric-canonical-write.mdc`,
935
+ * the SPEC 10 leaf-mint API routes are explicitly documented as a CANONICAL-BYPASS of
936
+ * the `composeTx` write contract — they are server-to-server, the user's key is never
937
+ * in the loop, and Enoki sponsors the gas. PTB atomicity requires single-signer, so
938
+ * leaf mints cannot be bundled with chat-agent writes via composeTx.
939
+ *
940
+ * **Reference:** `spec/runbooks/RUNBOOK_audric_sui_parent.md` §1 (parent NFT ID) +
941
+ * §3 (validated SDK reference shape) + §4 (mainnet smoke test 2026-05-01).
942
+ */
943
+
944
+ /**
945
+ * Parent name registered on SuiNS mainnet. Audric's identity namespace anchor.
946
+ *
947
+ * Every leaf created via `buildAddLeafTx` becomes `<label>.audric.sui` and resolves
948
+ * via the standard SuiNS resolver (`suix_resolveNameServiceAddress`).
949
+ */
950
+ declare const AUDRIC_PARENT_NAME = "audric.sui";
951
+ /**
952
+ * On-chain object ID of the `audric.sui` parent NFT (a `SuinsRegistration`).
953
+ *
954
+ * Owned by the dedicated custody address `0xaca29165188f10136073788f648e1186dd25100100146186ebecedaf94b23d11`
955
+ * (per `RUNBOOK_audric_sui_parent.md` §1). Every leaf mint / revoke MUST be signed
956
+ * by the address that owns this NFT. Mainnet only.
957
+ */
958
+ declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
959
+ interface BuildAddLeafParams {
960
+ /** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
961
+ label: string;
962
+ /** Sui address the leaf will resolve to (typically the user's zkLogin wallet). */
963
+ targetAddress: string;
964
+ }
965
+ interface BuildRevokeLeafParams {
966
+ /** Bare label of the leaf to revoke. */
967
+ label: string;
968
+ }
969
+ type LabelValidationResult = {
970
+ valid: true;
971
+ } | {
972
+ valid: false;
973
+ reason: string;
974
+ };
975
+ /**
976
+ * Validate a leaf label against SuiNS protocol rules. Pure function; no I/O.
977
+ *
978
+ * Pre-call this before `buildAddLeafTx` / `buildRevokeLeafTx` if you want a
979
+ * structured error (the builder functions throw on invalid labels). The audric
980
+ * `/api/identity/check` endpoint uses this to drive the picker's real-time
981
+ * availability indicator.
982
+ *
983
+ * Reserved-name policy (specific Audric handles like `support`, `admin`,
984
+ * `official`) is NOT enforced here — that's a UI / route-level concern owned
985
+ * by the audric host, not a protocol-level rule. See SPEC 10 D3.
986
+ */
987
+ declare function validateLabel(label: unknown): LabelValidationResult;
988
+ /**
989
+ * Build an unsigned PTB that creates a `<label>.audric.sui` leaf subname pointing
990
+ * to `targetAddress`.
991
+ *
992
+ * The returned `Transaction` has neither sender nor gas configured — the caller
993
+ * (audric's `/api/identity/reserve` route) sets the sender to the parent NFT
994
+ * custody address and submits via Enoki sponsorship. See `audric-transaction-flow.mdc`
995
+ * for the sponsored-tx wrapper pattern; note SPEC 10 leaf-mint is a documented
996
+ * CANONICAL-BYPASS of `composeTx` because the signer is the service account, not
997
+ * the user's zkLogin key.
998
+ *
999
+ * Throws synchronously if `label` violates protocol rules or `targetAddress` is
1000
+ * not a valid Sui address — fail-closed before bytes are built.
1001
+ */
1002
+ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress }: BuildAddLeafParams): Transaction;
1003
+ /**
1004
+ * Build an unsigned PTB that revokes a `<label>.audric.sui` leaf subname.
1005
+ *
1006
+ * Used by:
1007
+ * 1. The change-username flow (`/api/identity/change`): revoke old leaf inside
1008
+ * the same PTB as the new leaf creation, atomically.
1009
+ * 2. The release-username flow (`/api/admin/identity/release`): admin recovery
1010
+ * of squatted / impersonating handles.
1011
+ * 3. Account-deletion flow (future): revoke leaf when user deletes their account.
1012
+ *
1013
+ * The mainnet smoke test (2026-05-01) confirmed revocation gas cost is roughly
1014
+ * negative net (storage rebate exceeds computation) — see RUNBOOK §4.
1015
+ */
1016
+ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRevokeLeafParams): Transaction;
1017
+ /**
1018
+ * Convenience: turn a bare label into the full `<label>.audric.sui` path.
1019
+ *
1020
+ * Audric host code uses this when rendering handles in chat / cards / receipts
1021
+ * per SPEC 10 D10 (full handle ALWAYS — `@alice` is an input shortcut only).
1022
+ * Keeps the canonical concatenation in one place so a hypothetical future parent
1023
+ * rename only touches this module.
1024
+ */
1025
+ declare function fullHandle(label: string): string;
1026
+
1027
+ export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, type BuildRevokeLeafParams, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, buildAddLeafTx, buildClaimRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export { A as AdapterCapability, b as AdapterPositions, c as AdapterTxResult, H
8
8
  import { i as T2000Options, P as PayOptions, c as PayResult, j as StakeVSuiResult, U as UnstakeVSuiResult, k as SwapResult, l as SwapQuoteResult, h as SendResult, B as BalanceResponse, T as TransactionRecord, D as DepositInfo, m as PaymentRequest, S as SaveResult, W as WithdrawResult, b as MaxWithdrawResult, a as BorrowResult, g as RepayResult, M as MaxBorrowResult, H as HealthFactorResult, d as PendingReward, C as ClaimRewardsResult, n as CompoundRewardsResult, f as PositionsResult, R as RatesResult, E as EarningsResult, F as FundStatusResult, o as FinancialSummary } from './types-jAD-e7Pq.js';
9
9
  export { A as AssetRates, G as GasReserve, p as HFAlertLevel, e as PositionEntry } from './types-jAD-e7Pq.js';
10
10
  import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
11
+ import { SuinsClient } from '@mysten/suins';
11
12
  export { NaviAdapter, ProtocolRegistry } from './adapters/index.js';
12
13
  import '@cetusprotocol/aggregator-sdk';
13
14
 
@@ -915,4 +916,112 @@ declare function addUnstakeVSuiToTx(tx: Transaction, client: SuiJsonRpcClient, a
915
916
  effectiveAmountMist: bigint | 'all';
916
917
  }>;
917
918
 
918
- export { type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, buildClaimRewardsTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, fetchAllCoins, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, walletExists };
919
+ /**
920
+ * SuiNS leaf-subname builders for the `audric.sui` parent NFT.
921
+ *
922
+ * Used by SPEC 10 v0.2.1 Phase A.1 — Audric Passport Identity. Lets the audric host
923
+ * mint and revoke `username.audric.sui` leaves under the parent NFT held by the
924
+ * dedicated custody address (`0xaca29165…23d11`).
925
+ *
926
+ * **Why a dedicated SDK module (not inline in the audric route):**
927
+ * - Consumers (audric/web's `/api/identity/{reserve,change,release}` routes) can import
928
+ * the canonical builder shape without re-discovering the `SuinsTransaction` API.
929
+ * - Single source of truth for the parent NFT ID + parent name.
930
+ * - Single source of truth for label validation (length / charset / hyphen rules).
931
+ *
932
+ * **Signer model — read this before wiring into a route:**
933
+ * These builders are signed by the **service account** (the parent NFT custody address),
934
+ * NOT by the user's zkLogin key. Per `audric/.cursor/rules/audric-canonical-write.mdc`,
935
+ * the SPEC 10 leaf-mint API routes are explicitly documented as a CANONICAL-BYPASS of
936
+ * the `composeTx` write contract — they are server-to-server, the user's key is never
937
+ * in the loop, and Enoki sponsors the gas. PTB atomicity requires single-signer, so
938
+ * leaf mints cannot be bundled with chat-agent writes via composeTx.
939
+ *
940
+ * **Reference:** `spec/runbooks/RUNBOOK_audric_sui_parent.md` §1 (parent NFT ID) +
941
+ * §3 (validated SDK reference shape) + §4 (mainnet smoke test 2026-05-01).
942
+ */
943
+
944
+ /**
945
+ * Parent name registered on SuiNS mainnet. Audric's identity namespace anchor.
946
+ *
947
+ * Every leaf created via `buildAddLeafTx` becomes `<label>.audric.sui` and resolves
948
+ * via the standard SuiNS resolver (`suix_resolveNameServiceAddress`).
949
+ */
950
+ declare const AUDRIC_PARENT_NAME = "audric.sui";
951
+ /**
952
+ * On-chain object ID of the `audric.sui` parent NFT (a `SuinsRegistration`).
953
+ *
954
+ * Owned by the dedicated custody address `0xaca29165188f10136073788f648e1186dd25100100146186ebecedaf94b23d11`
955
+ * (per `RUNBOOK_audric_sui_parent.md` §1). Every leaf mint / revoke MUST be signed
956
+ * by the address that owns this NFT. Mainnet only.
957
+ */
958
+ declare const AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
959
+ interface BuildAddLeafParams {
960
+ /** Bare label, e.g. `'alice'` — NOT the full `'alice.audric.sui'` path. */
961
+ label: string;
962
+ /** Sui address the leaf will resolve to (typically the user's zkLogin wallet). */
963
+ targetAddress: string;
964
+ }
965
+ interface BuildRevokeLeafParams {
966
+ /** Bare label of the leaf to revoke. */
967
+ label: string;
968
+ }
969
+ type LabelValidationResult = {
970
+ valid: true;
971
+ } | {
972
+ valid: false;
973
+ reason: string;
974
+ };
975
+ /**
976
+ * Validate a leaf label against SuiNS protocol rules. Pure function; no I/O.
977
+ *
978
+ * Pre-call this before `buildAddLeafTx` / `buildRevokeLeafTx` if you want a
979
+ * structured error (the builder functions throw on invalid labels). The audric
980
+ * `/api/identity/check` endpoint uses this to drive the picker's real-time
981
+ * availability indicator.
982
+ *
983
+ * Reserved-name policy (specific Audric handles like `support`, `admin`,
984
+ * `official`) is NOT enforced here — that's a UI / route-level concern owned
985
+ * by the audric host, not a protocol-level rule. See SPEC 10 D3.
986
+ */
987
+ declare function validateLabel(label: unknown): LabelValidationResult;
988
+ /**
989
+ * Build an unsigned PTB that creates a `<label>.audric.sui` leaf subname pointing
990
+ * to `targetAddress`.
991
+ *
992
+ * The returned `Transaction` has neither sender nor gas configured — the caller
993
+ * (audric's `/api/identity/reserve` route) sets the sender to the parent NFT
994
+ * custody address and submits via Enoki sponsorship. See `audric-transaction-flow.mdc`
995
+ * for the sponsored-tx wrapper pattern; note SPEC 10 leaf-mint is a documented
996
+ * CANONICAL-BYPASS of `composeTx` because the signer is the service account, not
997
+ * the user's zkLogin key.
998
+ *
999
+ * Throws synchronously if `label` violates protocol rules or `targetAddress` is
1000
+ * not a valid Sui address — fail-closed before bytes are built.
1001
+ */
1002
+ declare function buildAddLeafTx(suinsClient: SuinsClient, { label, targetAddress }: BuildAddLeafParams): Transaction;
1003
+ /**
1004
+ * Build an unsigned PTB that revokes a `<label>.audric.sui` leaf subname.
1005
+ *
1006
+ * Used by:
1007
+ * 1. The change-username flow (`/api/identity/change`): revoke old leaf inside
1008
+ * the same PTB as the new leaf creation, atomically.
1009
+ * 2. The release-username flow (`/api/admin/identity/release`): admin recovery
1010
+ * of squatted / impersonating handles.
1011
+ * 3. Account-deletion flow (future): revoke leaf when user deletes their account.
1012
+ *
1013
+ * The mainnet smoke test (2026-05-01) confirmed revocation gas cost is roughly
1014
+ * negative net (storage rebate exceeds computation) — see RUNBOOK §4.
1015
+ */
1016
+ declare function buildRevokeLeafTx(suinsClient: SuinsClient, { label }: BuildRevokeLeafParams): Transaction;
1017
+ /**
1018
+ * Convenience: turn a bare label into the full `<label>.audric.sui` path.
1019
+ *
1020
+ * Audric host code uses this when rendering handles in chat / cards / receipts
1021
+ * per SPEC 10 D10 (full handle ALWAYS — `@alice` is an input shortcut only).
1022
+ * Keeps the canonical concatenation in one place so a hypothetical future parent
1023
+ * rename only touches this module.
1024
+ */
1025
+ declare function fullHandle(label: string): string;
1026
+
1027
+ export { AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, type AppenderContext, BalanceResponse, type BorrowInput, BorrowResult, type BuildAddLeafParams, type BuildRevokeLeafParams, type ClaimRewardsInput, ClaimRewardsResult, type CoinPage, type ComposeTxFeeHookContext, type ComposeTxFeeHooks, type ComposeTxOptions, type ComposeTxResult, CompoundRewardsResult, ContactManager, DepositInfo, EarningsResult, FinancialSummary, type FinancialSummaryOptions, FundStatusResult, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, HealthFactorResult, type LabelValidationResult, LendingAdapter, LendingRates, MaxBorrowResult, MaxWithdrawResult, OverlayFeeConfig, PayOptions, PayResult, PaymentRequest, PendingReward, PositionsResult, RatesResult, type RepayDebtInput, RepayResult, SafeguardConfig, SafeguardEnforcer, type SaveDepositInput, SaveResult, type SelectAndSplitResult, SendResult, type SendTransferInput, StakeVSuiResult, type StepPreview, SupportedAsset, type SwapExecuteInput, SwapQuoteResult, SwapResult, SwapRouteResult, T2000, T2000Error, T2000Options, TransactionRecord, TransactionSigner, TxMetadata, UnstakeVSuiResult, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, type VoloStakeInput, type VoloStats, type VoloUnstakeInput, WRITE_APPENDER_REGISTRY, type WithdrawInput, WithdrawResult, type WriteStep, type WriteToolName, ZkLoginProof, addSendToTx, addStakeVSuiToTx, addUnstakeVSuiToTx, buildAddLeafTx, buildClaimRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildUnstakeVSuiTx, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, fetchAllCoins, fullHandle, generateKeypair, getAddress, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getVoloStats, keypairFromPrivateKey, loadKey, saveKey, selectAndSplitCoin, selectSuiCoin, validateLabel, walletExists };
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ import { homedir } from 'os';
13
13
  import { SuiPriceServiceConnection, SuiPythClient } from '@pythnetwork/pyth-sui-js';
14
14
  import { bcs as bcs$1 } from '@mysten/sui/bcs';
15
15
  import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
16
+ import { SuinsTransaction } from '@mysten/suins';
16
17
 
17
18
  var __create = Object.create;
18
19
  var __defProp = Object.defineProperty;
@@ -7994,12 +7995,69 @@ async function getSwapQuote(params) {
7994
7995
  init_cetus_swap();
7995
7996
  init_token_registry();
7996
7997
  init_volo();
7998
+ var AUDRIC_PARENT_NAME = "audric.sui";
7999
+ var AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
8000
+ var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
8001
+ function validateLabel(label) {
8002
+ if (typeof label !== "string") {
8003
+ return { valid: false, reason: "label must be a string" };
8004
+ }
8005
+ if (label.length < 3) {
8006
+ return { valid: false, reason: "label must be at least 3 characters" };
8007
+ }
8008
+ if (label.length > 63) {
8009
+ return { valid: false, reason: "label must be at most 63 characters" };
8010
+ }
8011
+ if (!LABEL_PATTERN.test(label)) {
8012
+ return {
8013
+ valid: false,
8014
+ reason: "label may only contain lowercase letters, digits, and hyphens, and may not start or end with a hyphen"
8015
+ };
8016
+ }
8017
+ if (label.includes("--")) {
8018
+ return { valid: false, reason: "label may not contain consecutive hyphens" };
8019
+ }
8020
+ return { valid: true };
8021
+ }
8022
+ function buildAddLeafTx(suinsClient, { label, targetAddress }) {
8023
+ const labelCheck = validateLabel(label);
8024
+ if (!labelCheck.valid) {
8025
+ throw new Error(`buildAddLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
8026
+ }
8027
+ if (typeof targetAddress !== "string" || !isValidSuiAddress(normalizeSuiAddress(targetAddress))) {
8028
+ throw new Error(`buildAddLeafTx: invalid targetAddress "${targetAddress}"`);
8029
+ }
8030
+ const tx = new Transaction();
8031
+ const suinsTx = new SuinsTransaction(suinsClient, tx);
8032
+ suinsTx.createLeafSubName({
8033
+ parentNft: AUDRIC_PARENT_NFT_ID,
8034
+ name: `${label}.${AUDRIC_PARENT_NAME}`,
8035
+ targetAddress: normalizeSuiAddress(targetAddress)
8036
+ });
8037
+ return tx;
8038
+ }
8039
+ function buildRevokeLeafTx(suinsClient, { label }) {
8040
+ const labelCheck = validateLabel(label);
8041
+ if (!labelCheck.valid) {
8042
+ throw new Error(`buildRevokeLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
8043
+ }
8044
+ const tx = new Transaction();
8045
+ const suinsTx = new SuinsTransaction(suinsClient, tx);
8046
+ suinsTx.removeLeafSubName({
8047
+ parentNft: AUDRIC_PARENT_NFT_ID,
8048
+ name: `${label}.${AUDRIC_PARENT_NAME}`
8049
+ });
8050
+ return tx;
8051
+ }
8052
+ function fullHandle(label) {
8053
+ return `${label}.${AUDRIC_PARENT_NAME}`;
8054
+ }
7997
8055
  /*! Bundled license information:
7998
8056
 
7999
8057
  @scure/base/index.js:
8000
8058
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
8001
8059
  */
8002
8060
 
8003
- export { ALL_NAVI_ASSETS, BORROW_FEE_BPS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, OVERLAY_FEE_RATE, ProtocolRegistry, SAVE_FEE_BPS, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addFeeTransfer, addSendToTx, addStakeVSuiToTx, addSwapToTx, addUnstakeVSuiToTx, allDescriptors, assertAllowedAsset, buildClaimRewardsTx, buildSendTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, classifyAction, classifyLabel, classifyTransaction, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
8061
+ export { ALL_NAVI_ASSETS, AUDRIC_PARENT_NAME, AUDRIC_PARENT_NFT_ID, BORROW_FEE_BPS, BPS_DENOMINATOR, CETUS_USDC_SUI_POOL, CLOCK_ID, COIN_REGISTRY, ContactManager, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, HF_CRITICAL_THRESHOLD, HF_WARN_THRESHOLD, IKA_TYPE, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, NaviAdapter, OPERATION_ASSETS, OUTBOUND_OPS, OVERLAY_FEE_RATE, ProtocolRegistry, SAVE_FEE_BPS, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardEnforcer, SafeguardError, T2000, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, VOLO_METADATA, VOLO_PKG, VOLO_POOL, VSUI_TYPE, WAL_TYPE, WBTC_TYPE, WRITE_APPENDER_REGISTRY, ZkLoginSigner, addFeeTransfer, addSendToTx, addStakeVSuiToTx, addSwapToTx, addUnstakeVSuiToTx, allDescriptors, assertAllowedAsset, buildAddLeafTx, buildClaimRewardsTx, buildRevokeLeafTx, buildSendTx, buildStakeVSuiTx, buildSwapTx, buildUnstakeVSuiTx, calculateFee, classifyAction, classifyLabel, classifyTransaction, composeTx, deriveAllowedAddressesFromPtb, exportPrivateKey, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, fetchAllCoins, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fullHandle, generateKeypair, getAddress, getCoinMeta, getDecimals, getDecimalsForCoinType, getFinancialSummary, getPendingRewards, getRates, getSwapQuote, getTier, getVoloStats, isAllowedAsset, isInRegistry, isSupported, isTier1, isTier2, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, naviDescriptor, normalizeAsset, normalizeCoinType, parseSuiRpcTx, queryHistory, queryTransaction, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, saveKey, selectAndSplitCoin, selectSuiCoin, simulateTransaction, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, validateLabel, walletExists };
8004
8062
  //# sourceMappingURL=index.js.map
8005
8063
  //# sourceMappingURL=index.js.map