@t2000/sdk 10.5.0 → 10.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.cjs +29 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -23
- package/dist/index.d.ts +22 -23
- package/dist/index.js +29 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3892,6 +3892,7 @@ init_preflight();
|
|
|
3892
3892
|
// src/capital/launch.ts
|
|
3893
3893
|
init_errors();
|
|
3894
3894
|
init_token_registry();
|
|
3895
|
+
init_coinSelection();
|
|
3895
3896
|
|
|
3896
3897
|
// src/protocols/cetus-clmm.ts
|
|
3897
3898
|
var CETUS_CLMM_PACKAGE_ID = process.env.CETUS_CLMM_PACKAGE_ID ?? "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb";
|
|
@@ -3917,10 +3918,10 @@ function bigintSqrt(n) {
|
|
|
3917
3918
|
}
|
|
3918
3919
|
return prev;
|
|
3919
3920
|
}
|
|
3920
|
-
function
|
|
3921
|
+
function createPoolV3(tx, args) {
|
|
3921
3922
|
const [tickLower, tickUpper] = fullRangeTickRange(tx);
|
|
3922
3923
|
return tx.moveCall({
|
|
3923
|
-
target: `${CETUS_CLMM_PUBLISHED_AT}::pool_creator::
|
|
3924
|
+
target: `${CETUS_CLMM_PUBLISHED_AT}::pool_creator::create_pool_v3`,
|
|
3924
3925
|
typeArguments: [args.coinTypeA, args.coinTypeB],
|
|
3925
3926
|
arguments: [
|
|
3926
3927
|
tx.object(CETUS_GLOBAL_CONFIG_ID),
|
|
@@ -3932,8 +3933,6 @@ function createPoolV2(tx, args) {
|
|
|
3932
3933
|
tickUpper,
|
|
3933
3934
|
args.coinA,
|
|
3934
3935
|
args.coinB,
|
|
3935
|
-
tx.object(args.metadataA),
|
|
3936
|
-
tx.object(args.metadataB),
|
|
3937
3936
|
tx.pure.bool(args.fixAmountA),
|
|
3938
3937
|
tx.object.clock()
|
|
3939
3938
|
]
|
|
@@ -4097,10 +4096,10 @@ async function buildAgentCoinModule(params) {
|
|
|
4097
4096
|
}
|
|
4098
4097
|
|
|
4099
4098
|
// src/capital/launch.ts
|
|
4100
|
-
var AGENT_CAPITAL_PACKAGE_ID = process.env.AGENT_CAPITAL_PACKAGE_ID ?? "
|
|
4101
|
-
var CAPITAL_REGISTRY_ID = process.env.CAPITAL_REGISTRY_ID ?? "
|
|
4099
|
+
var AGENT_CAPITAL_PACKAGE_ID = process.env.AGENT_CAPITAL_PACKAGE_ID ?? "0xa83ecc4e530594f8e184faf6a4c3da6791267f6791a653644d59e2e603c055b8";
|
|
4100
|
+
var CAPITAL_REGISTRY_ID = process.env.CAPITAL_REGISTRY_ID ?? "0xef4057baac856d65b47f14a1ba14211299637955ea5bc15d7708f6eef27ee0df";
|
|
4102
4101
|
var CAPITAL_REGISTRY_VERSION = Number(
|
|
4103
|
-
process.env.CAPITAL_REGISTRY_VERSION ??
|
|
4102
|
+
process.env.CAPITAL_REGISTRY_VERSION ?? 931861908
|
|
4104
4103
|
);
|
|
4105
4104
|
function assertDeployed() {
|
|
4106
4105
|
if (!AGENT_CAPITAL_PACKAGE_ID || !CAPITAL_REGISTRY_ID) {
|
|
@@ -4110,7 +4109,7 @@ function assertDeployed() {
|
|
|
4110
4109
|
);
|
|
4111
4110
|
}
|
|
4112
4111
|
}
|
|
4113
|
-
var
|
|
4112
|
+
var MIN_LP_USDC = 5000000n;
|
|
4114
4113
|
var REGISTRY_MODULE = "registry";
|
|
4115
4114
|
var LP_LOCK_MODULE = "lp_lock";
|
|
4116
4115
|
async function buildPublishAgentCoinTx(args) {
|
|
@@ -4136,8 +4135,7 @@ async function buildPublishAgentCoinTx(args) {
|
|
|
4136
4135
|
});
|
|
4137
4136
|
return { tx, moduleName: mod.moduleName, otw: mod.otw };
|
|
4138
4137
|
}
|
|
4139
|
-
|
|
4140
|
-
function buildTokenizeTx(args) {
|
|
4138
|
+
async function buildTokenizeTx(args) {
|
|
4141
4139
|
assertDeployed();
|
|
4142
4140
|
if (!utils.isValidSuiAddress(args.agent)) {
|
|
4143
4141
|
throw new exports.T2000Error("INVALID_ADDRESS", `bad agent: ${args.agent}`);
|
|
@@ -4145,10 +4143,10 @@ function buildTokenizeTx(args) {
|
|
|
4145
4143
|
if (!utils.isValidSuiAddress(args.launcher)) {
|
|
4146
4144
|
throw new exports.T2000Error("INVALID_ADDRESS", `bad launcher: ${args.launcher}`);
|
|
4147
4145
|
}
|
|
4148
|
-
if (args.
|
|
4146
|
+
if (args.lpUsdcAmount < MIN_LP_USDC) {
|
|
4149
4147
|
throw new exports.T2000Error(
|
|
4150
4148
|
"INVALID_AMOUNT",
|
|
4151
|
-
`
|
|
4149
|
+
`lpUsdcAmount ${args.lpUsdcAmount} < minimum ${MIN_LP_USDC} raw (5 USDC)`
|
|
4152
4150
|
);
|
|
4153
4151
|
}
|
|
4154
4152
|
const tx = new transactions.Transaction();
|
|
@@ -4172,18 +4170,22 @@ function buildTokenizeTx(args) {
|
|
|
4172
4170
|
const [lpCoin] = tx.splitCoins(supplyCoin, [
|
|
4173
4171
|
tx.pure.u64(AGENT_TOKEN_LP_ALLOCATION)
|
|
4174
4172
|
]);
|
|
4175
|
-
const
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4173
|
+
const { coin: lpUsdc } = await selectAndSplitCoin(
|
|
4174
|
+
tx,
|
|
4175
|
+
args.client,
|
|
4176
|
+
args.launcher,
|
|
4177
|
+
exports.USDC_TYPE,
|
|
4178
|
+
args.lpUsdcAmount
|
|
4179
|
+
);
|
|
4180
|
+
const usdcFirst = args.usdcFirst ?? false;
|
|
4181
|
+
const sqrtPrice = usdcFirst ? sqrtPriceX64FromAmounts(args.lpUsdcAmount, AGENT_TOKEN_LP_ALLOCATION) : sqrtPriceX64FromAmounts(AGENT_TOKEN_LP_ALLOCATION, args.lpUsdcAmount);
|
|
4182
|
+
const poolResult = createPoolV3(tx, {
|
|
4183
|
+
coinTypeA: usdcFirst ? exports.USDC_TYPE : args.coinType,
|
|
4184
|
+
coinTypeB: usdcFirst ? args.coinType : exports.USDC_TYPE,
|
|
4185
|
+
coinA: usdcFirst ? lpUsdc : lpCoin,
|
|
4186
|
+
coinB: usdcFirst ? lpCoin : lpUsdc,
|
|
4185
4187
|
sqrtPriceX64: sqrtPrice,
|
|
4186
|
-
fixAmountA: !
|
|
4188
|
+
fixAmountA: !usdcFirst,
|
|
4187
4189
|
// always fix the AGENT side
|
|
4188
4190
|
url: args.poolUrl
|
|
4189
4191
|
});
|
|
@@ -4208,10 +4210,10 @@ function buildTokenizeTx(args) {
|
|
|
4208
4210
|
tx.object.clock()
|
|
4209
4211
|
]
|
|
4210
4212
|
});
|
|
4211
|
-
const agentRefund =
|
|
4212
|
-
const
|
|
4213
|
+
const agentRefund = usdcFirst ? refundB : refundA;
|
|
4214
|
+
const usdcRefund = usdcFirst ? refundA : refundB;
|
|
4213
4215
|
tx.transferObjects([supplyCoin, agentRefund], tx.pure.address(args.agent));
|
|
4214
|
-
tx.transferObjects([
|
|
4216
|
+
tx.transferObjects([usdcRefund], tx.pure.address(args.launcher));
|
|
4215
4217
|
return tx;
|
|
4216
4218
|
}
|
|
4217
4219
|
|
|
@@ -4254,7 +4256,7 @@ exports.LimitExceededError = LimitExceededError;
|
|
|
4254
4256
|
exports.MAX_DELIVER_HORIZON_MS = MAX_DELIVER_HORIZON_MS;
|
|
4255
4257
|
exports.MAX_JOB_USDC = MAX_JOB_USDC;
|
|
4256
4258
|
exports.MAX_REVIEW_WINDOW_MS = MAX_REVIEW_WINDOW_MS;
|
|
4257
|
-
exports.
|
|
4259
|
+
exports.MIN_LP_USDC = MIN_LP_USDC;
|
|
4258
4260
|
exports.MIST_PER_SUI = MIST_PER_SUI;
|
|
4259
4261
|
exports.OPERATION_ASSETS = OPERATION_ASSETS;
|
|
4260
4262
|
exports.SENDABLE_ASSETS = SENDABLE_ASSETS;
|
|
@@ -4263,7 +4265,6 @@ exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
|
4263
4265
|
exports.SUINS_NAME_REGEX = SUINS_NAME_REGEX;
|
|
4264
4266
|
exports.SUI_ADDRESS_REGEX = SUI_ADDRESS_REGEX;
|
|
4265
4267
|
exports.SUI_ADDRESS_STRICT_REGEX = SUI_ADDRESS_STRICT_REGEX;
|
|
4266
|
-
exports.SUI_COIN_METADATA_ID = SUI_COIN_METADATA_ID;
|
|
4267
4268
|
exports.SUI_DECIMALS = SUI_DECIMALS;
|
|
4268
4269
|
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
4269
4270
|
exports.SYMBOL_BLOCKLIST = SYMBOL_BLOCKLIST;
|