@t2000/sdk 10.5.0 → 10.6.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 +28 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -19
- package/dist/index.d.ts +22 -19
- package/dist/index.js +27 -19
- 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";
|
|
@@ -4110,7 +4111,7 @@ function assertDeployed() {
|
|
|
4110
4111
|
);
|
|
4111
4112
|
}
|
|
4112
4113
|
}
|
|
4113
|
-
var
|
|
4114
|
+
var MIN_LP_USDC = 5000000n;
|
|
4114
4115
|
var REGISTRY_MODULE = "registry";
|
|
4115
4116
|
var LP_LOCK_MODULE = "lp_lock";
|
|
4116
4117
|
async function buildPublishAgentCoinTx(args) {
|
|
@@ -4136,8 +4137,8 @@ async function buildPublishAgentCoinTx(args) {
|
|
|
4136
4137
|
});
|
|
4137
4138
|
return { tx, moduleName: mod.moduleName, otw: mod.otw };
|
|
4138
4139
|
}
|
|
4139
|
-
var
|
|
4140
|
-
function buildTokenizeTx(args) {
|
|
4140
|
+
var USDC_COIN_METADATA_ID = "0x75cfbbf8c962d542e99a1d15731e6069f60a00db895407785b15d14f606f2b4a";
|
|
4141
|
+
async function buildTokenizeTx(args) {
|
|
4141
4142
|
assertDeployed();
|
|
4142
4143
|
if (!utils.isValidSuiAddress(args.agent)) {
|
|
4143
4144
|
throw new exports.T2000Error("INVALID_ADDRESS", `bad agent: ${args.agent}`);
|
|
@@ -4145,10 +4146,10 @@ function buildTokenizeTx(args) {
|
|
|
4145
4146
|
if (!utils.isValidSuiAddress(args.launcher)) {
|
|
4146
4147
|
throw new exports.T2000Error("INVALID_ADDRESS", `bad launcher: ${args.launcher}`);
|
|
4147
4148
|
}
|
|
4148
|
-
if (args.
|
|
4149
|
+
if (args.lpUsdcAmount < MIN_LP_USDC) {
|
|
4149
4150
|
throw new exports.T2000Error(
|
|
4150
4151
|
"INVALID_AMOUNT",
|
|
4151
|
-
`
|
|
4152
|
+
`lpUsdcAmount ${args.lpUsdcAmount} < minimum ${MIN_LP_USDC} raw (5 USDC)`
|
|
4152
4153
|
);
|
|
4153
4154
|
}
|
|
4154
4155
|
const tx = new transactions.Transaction();
|
|
@@ -4172,18 +4173,25 @@ function buildTokenizeTx(args) {
|
|
|
4172
4173
|
const [lpCoin] = tx.splitCoins(supplyCoin, [
|
|
4173
4174
|
tx.pure.u64(AGENT_TOKEN_LP_ALLOCATION)
|
|
4174
4175
|
]);
|
|
4175
|
-
const
|
|
4176
|
-
|
|
4177
|
-
|
|
4176
|
+
const { coin: lpUsdc } = await selectAndSplitCoin(
|
|
4177
|
+
tx,
|
|
4178
|
+
args.client,
|
|
4179
|
+
args.launcher,
|
|
4180
|
+
exports.USDC_TYPE,
|
|
4181
|
+
args.lpUsdcAmount
|
|
4182
|
+
);
|
|
4183
|
+
const usdcFirst = args.usdcFirst ?? false;
|
|
4184
|
+
const sqrtPrice = usdcFirst ? sqrtPriceX64FromAmounts(args.lpUsdcAmount, AGENT_TOKEN_LP_ALLOCATION) : sqrtPriceX64FromAmounts(AGENT_TOKEN_LP_ALLOCATION, args.lpUsdcAmount);
|
|
4185
|
+
const usdcMeta = args.usdcMetadataId ?? USDC_COIN_METADATA_ID;
|
|
4178
4186
|
const poolResult = createPoolV2(tx, {
|
|
4179
|
-
coinTypeA:
|
|
4180
|
-
coinTypeB:
|
|
4181
|
-
metadataA:
|
|
4182
|
-
metadataB:
|
|
4183
|
-
coinA:
|
|
4184
|
-
coinB:
|
|
4187
|
+
coinTypeA: usdcFirst ? exports.USDC_TYPE : args.coinType,
|
|
4188
|
+
coinTypeB: usdcFirst ? args.coinType : exports.USDC_TYPE,
|
|
4189
|
+
metadataA: usdcFirst ? usdcMeta : args.coinMetadataId,
|
|
4190
|
+
metadataB: usdcFirst ? args.coinMetadataId : usdcMeta,
|
|
4191
|
+
coinA: usdcFirst ? lpUsdc : lpCoin,
|
|
4192
|
+
coinB: usdcFirst ? lpCoin : lpUsdc,
|
|
4185
4193
|
sqrtPriceX64: sqrtPrice,
|
|
4186
|
-
fixAmountA: !
|
|
4194
|
+
fixAmountA: !usdcFirst,
|
|
4187
4195
|
// always fix the AGENT side
|
|
4188
4196
|
url: args.poolUrl
|
|
4189
4197
|
});
|
|
@@ -4208,10 +4216,10 @@ function buildTokenizeTx(args) {
|
|
|
4208
4216
|
tx.object.clock()
|
|
4209
4217
|
]
|
|
4210
4218
|
});
|
|
4211
|
-
const agentRefund =
|
|
4212
|
-
const
|
|
4219
|
+
const agentRefund = usdcFirst ? refundB : refundA;
|
|
4220
|
+
const usdcRefund = usdcFirst ? refundA : refundB;
|
|
4213
4221
|
tx.transferObjects([supplyCoin, agentRefund], tx.pure.address(args.agent));
|
|
4214
|
-
tx.transferObjects([
|
|
4222
|
+
tx.transferObjects([usdcRefund], tx.pure.address(args.launcher));
|
|
4215
4223
|
return tx;
|
|
4216
4224
|
}
|
|
4217
4225
|
|
|
@@ -4254,7 +4262,7 @@ exports.LimitExceededError = LimitExceededError;
|
|
|
4254
4262
|
exports.MAX_DELIVER_HORIZON_MS = MAX_DELIVER_HORIZON_MS;
|
|
4255
4263
|
exports.MAX_JOB_USDC = MAX_JOB_USDC;
|
|
4256
4264
|
exports.MAX_REVIEW_WINDOW_MS = MAX_REVIEW_WINDOW_MS;
|
|
4257
|
-
exports.
|
|
4265
|
+
exports.MIN_LP_USDC = MIN_LP_USDC;
|
|
4258
4266
|
exports.MIST_PER_SUI = MIST_PER_SUI;
|
|
4259
4267
|
exports.OPERATION_ASSETS = OPERATION_ASSETS;
|
|
4260
4268
|
exports.SENDABLE_ASSETS = SENDABLE_ASSETS;
|
|
@@ -4263,7 +4271,6 @@ exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
|
4263
4271
|
exports.SUINS_NAME_REGEX = SUINS_NAME_REGEX;
|
|
4264
4272
|
exports.SUI_ADDRESS_REGEX = SUI_ADDRESS_REGEX;
|
|
4265
4273
|
exports.SUI_ADDRESS_STRICT_REGEX = SUI_ADDRESS_STRICT_REGEX;
|
|
4266
|
-
exports.SUI_COIN_METADATA_ID = SUI_COIN_METADATA_ID;
|
|
4267
4274
|
exports.SUI_DECIMALS = SUI_DECIMALS;
|
|
4268
4275
|
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
4269
4276
|
exports.SYMBOL_BLOCKLIST = SYMBOL_BLOCKLIST;
|
|
@@ -4271,6 +4278,7 @@ exports.SuinsNotRegisteredError = SuinsNotRegisteredError;
|
|
|
4271
4278
|
exports.SuinsRpcError = SuinsRpcError;
|
|
4272
4279
|
exports.T2000 = T2000;
|
|
4273
4280
|
exports.T2000_OVERLAY_FEE_WALLET = T2000_OVERLAY_FEE_WALLET;
|
|
4281
|
+
exports.USDC_COIN_METADATA_ID = USDC_COIN_METADATA_ID;
|
|
4274
4282
|
exports.USDC_DECIMALS = USDC_DECIMALS;
|
|
4275
4283
|
exports.WRITE_APPENDER_REGISTRY = WRITE_APPENDER_REGISTRY;
|
|
4276
4284
|
exports.ZkLoginSigner = ZkLoginSigner;
|