@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.cjs CHANGED
@@ -15,6 +15,7 @@ var os = require('os');
15
15
  var pythSuiJs = require('@pythnetwork/pyth-sui-js');
16
16
  var bcs$1 = require('@mysten/sui/bcs');
17
17
  var fs = require('fs');
18
+ var suins = require('@mysten/suins');
18
19
 
19
20
  var __create = Object.create;
20
21
  var __defProp = Object.defineProperty;
@@ -7996,6 +7997,63 @@ async function getSwapQuote(params) {
7996
7997
  init_cetus_swap();
7997
7998
  init_token_registry();
7998
7999
  init_volo();
8000
+ var AUDRIC_PARENT_NAME = "audric.sui";
8001
+ var AUDRIC_PARENT_NFT_ID = "0x070456e283ec988b6302bdd6cc5172bbdcb709998cf116586fb98d19b0870198";
8002
+ var LABEL_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
8003
+ function validateLabel(label) {
8004
+ if (typeof label !== "string") {
8005
+ return { valid: false, reason: "label must be a string" };
8006
+ }
8007
+ if (label.length < 3) {
8008
+ return { valid: false, reason: "label must be at least 3 characters" };
8009
+ }
8010
+ if (label.length > 63) {
8011
+ return { valid: false, reason: "label must be at most 63 characters" };
8012
+ }
8013
+ if (!LABEL_PATTERN.test(label)) {
8014
+ return {
8015
+ valid: false,
8016
+ reason: "label may only contain lowercase letters, digits, and hyphens, and may not start or end with a hyphen"
8017
+ };
8018
+ }
8019
+ if (label.includes("--")) {
8020
+ return { valid: false, reason: "label may not contain consecutive hyphens" };
8021
+ }
8022
+ return { valid: true };
8023
+ }
8024
+ function buildAddLeafTx(suinsClient, { label, targetAddress }) {
8025
+ const labelCheck = validateLabel(label);
8026
+ if (!labelCheck.valid) {
8027
+ throw new Error(`buildAddLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
8028
+ }
8029
+ if (typeof targetAddress !== "string" || !utils.isValidSuiAddress(utils.normalizeSuiAddress(targetAddress))) {
8030
+ throw new Error(`buildAddLeafTx: invalid targetAddress "${targetAddress}"`);
8031
+ }
8032
+ const tx = new transactions.Transaction();
8033
+ const suinsTx = new suins.SuinsTransaction(suinsClient, tx);
8034
+ suinsTx.createLeafSubName({
8035
+ parentNft: AUDRIC_PARENT_NFT_ID,
8036
+ name: `${label}.${AUDRIC_PARENT_NAME}`,
8037
+ targetAddress: utils.normalizeSuiAddress(targetAddress)
8038
+ });
8039
+ return tx;
8040
+ }
8041
+ function buildRevokeLeafTx(suinsClient, { label }) {
8042
+ const labelCheck = validateLabel(label);
8043
+ if (!labelCheck.valid) {
8044
+ throw new Error(`buildRevokeLeafTx: invalid label "${label}" \u2014 ${labelCheck.reason}`);
8045
+ }
8046
+ const tx = new transactions.Transaction();
8047
+ const suinsTx = new suins.SuinsTransaction(suinsClient, tx);
8048
+ suinsTx.removeLeafSubName({
8049
+ parentNft: AUDRIC_PARENT_NFT_ID,
8050
+ name: `${label}.${AUDRIC_PARENT_NAME}`
8051
+ });
8052
+ return tx;
8053
+ }
8054
+ function fullHandle(label) {
8055
+ return `${label}.${AUDRIC_PARENT_NAME}`;
8056
+ }
7999
8057
  /*! Bundled license information:
8000
8058
 
8001
8059
  @scure/base/index.js:
@@ -8003,6 +8061,8 @@ init_volo();
8003
8061
  */
8004
8062
 
8005
8063
  exports.ALL_NAVI_ASSETS = ALL_NAVI_ASSETS;
8064
+ exports.AUDRIC_PARENT_NAME = AUDRIC_PARENT_NAME;
8065
+ exports.AUDRIC_PARENT_NFT_ID = AUDRIC_PARENT_NFT_ID;
8006
8066
  exports.BORROW_FEE_BPS = BORROW_FEE_BPS;
8007
8067
  exports.BPS_DENOMINATOR = BPS_DENOMINATOR;
8008
8068
  exports.CETUS_USDC_SUI_POOL = CETUS_USDC_SUI_POOL;
@@ -8039,7 +8099,9 @@ exports.addSwapToTx = addSwapToTx;
8039
8099
  exports.addUnstakeVSuiToTx = addUnstakeVSuiToTx;
8040
8100
  exports.allDescriptors = allDescriptors;
8041
8101
  exports.assertAllowedAsset = assertAllowedAsset;
8102
+ exports.buildAddLeafTx = buildAddLeafTx;
8042
8103
  exports.buildClaimRewardsTx = buildClaimRewardsTx;
8104
+ exports.buildRevokeLeafTx = buildRevokeLeafTx;
8043
8105
  exports.buildSendTx = buildSendTx;
8044
8106
  exports.buildStakeVSuiTx = buildStakeVSuiTx;
8045
8107
  exports.buildSwapTx = buildSwapTx;
@@ -8060,6 +8122,7 @@ exports.findSwapRoute = findSwapRoute;
8060
8122
  exports.formatAssetAmount = formatAssetAmount;
8061
8123
  exports.formatSui = formatSui;
8062
8124
  exports.formatUsd = formatUsd;
8125
+ exports.fullHandle = fullHandle;
8063
8126
  exports.generateKeypair = generateKeypair;
8064
8127
  exports.getAddress = getAddress;
8065
8128
  exports.getCoinMeta = getCoinMeta;
@@ -8102,6 +8165,7 @@ exports.throwIfSimulationFailed = throwIfSimulationFailed;
8102
8165
  exports.truncateAddress = truncateAddress;
8103
8166
  exports.usdcToRaw = usdcToRaw;
8104
8167
  exports.validateAddress = validateAddress;
8168
+ exports.validateLabel = validateLabel;
8105
8169
  exports.walletExists = walletExists;
8106
8170
  //# sourceMappingURL=index.cjs.map
8107
8171
  //# sourceMappingURL=index.cjs.map