@candledottv/cli 0.11.29 → 0.11.30
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.js +107 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8898,10 +8898,12 @@ function createEvmRpc(url, fetchFn) {
|
|
|
8898
8898
|
if (r === null || r === undefined)
|
|
8899
8899
|
return null;
|
|
8900
8900
|
const status = asQuantity(r.status, "eth_getTransactionReceipt");
|
|
8901
|
+
const logs = (Array.isArray(r.logs) ? r.logs : []).flatMap((log) => typeof log?.address === "string" && Array.isArray(log.topics) && log.topics.every((topic) => typeof topic === "string") ? [{ address: log.address, topics: log.topics }] : []);
|
|
8901
8902
|
return {
|
|
8902
8903
|
status: status === 1n ? 1 : 0,
|
|
8903
8904
|
blockNumber: asQuantity(r.blockNumber, "eth_getTransactionReceipt"),
|
|
8904
|
-
transactionHash: typeof r.transactionHash === "string" ? r.transactionHash : hash
|
|
8905
|
+
transactionHash: typeof r.transactionHash === "string" ? r.transactionHash : hash,
|
|
8906
|
+
logs
|
|
8905
8907
|
};
|
|
8906
8908
|
},
|
|
8907
8909
|
async getTransactionByHash(hash) {
|
|
@@ -11575,6 +11577,7 @@ async function runSequencedLegs(ctx, key, opts) {
|
|
|
11575
11577
|
const signed = await relaySignEvmLeg(ctx, key, opts.wallet, leg);
|
|
11576
11578
|
signedCount += 1;
|
|
11577
11579
|
signedKinds.add(current.legKind);
|
|
11580
|
+
opts.onSigned?.(current.legKind, signed.hash);
|
|
11578
11581
|
if (opts.clientId !== undefined && opts.kind !== undefined)
|
|
11579
11582
|
await saveOperationHash(ctx, key, opts.clientId, opts.kind, signed.hash, current.operationId);
|
|
11580
11583
|
const posted = await apiRequest(opts.submitPath, {
|
|
@@ -12952,7 +12955,7 @@ function feeLegOk(leg, fee) {
|
|
|
12952
12955
|
return false;
|
|
12953
12956
|
if (BigInt(leg.value) > fee.cap)
|
|
12954
12957
|
return false;
|
|
12955
|
-
return
|
|
12958
|
+
return sameEvmAddress(leg.to, fee.treasury);
|
|
12956
12959
|
}
|
|
12957
12960
|
if (leg.value !== "0" || !sameEvmAddress(leg.to, HOOD_USDG_ADDRESS))
|
|
12958
12961
|
return false;
|
|
@@ -12960,7 +12963,37 @@ function feeLegOk(leg, fee) {
|
|
|
12960
12963
|
const decoded = data ? decodeErc20Transfer(data) : undefined;
|
|
12961
12964
|
if (!decoded || decoded.amount > fee.cap)
|
|
12962
12965
|
return false;
|
|
12963
|
-
return
|
|
12966
|
+
return sameEvmAddress(decoded.recipient, fee.treasury);
|
|
12967
|
+
}
|
|
12968
|
+
async function hoodFeeTreasury(rpc) {
|
|
12969
|
+
try {
|
|
12970
|
+
const answer = await rpc.call({ to: HOOD_SPLITTER_FACTORY, data: hexToBytes2(SPLITTER_PLATFORM_VAULT_SELECTOR) });
|
|
12971
|
+
const vault = wordAddress2(word2(answer, 0, 0));
|
|
12972
|
+
return vault !== undefined && BigInt(vault) !== 0n ? vault : undefined;
|
|
12973
|
+
} catch {
|
|
12974
|
+
return;
|
|
12975
|
+
}
|
|
12976
|
+
}
|
|
12977
|
+
function curveCreatedBy(receipt, wallet) {
|
|
12978
|
+
if (!receipt || receipt.status !== 1)
|
|
12979
|
+
return;
|
|
12980
|
+
const created = (receipt.logs ?? []).filter((log) => sameEvmAddress(log.address, HOOD_CURVE_FACTORY) && log.topics[0]?.toLowerCase() === CURVE_CREATED_TOPIC);
|
|
12981
|
+
if (created.length !== 1)
|
|
12982
|
+
return;
|
|
12983
|
+
const topics = created[0].topics;
|
|
12984
|
+
const topicAddress = (topic) => {
|
|
12985
|
+
const bytes = topic === undefined ? undefined : bytesOf(topic);
|
|
12986
|
+
return bytes?.length === 32 ? wordAddress2(bytes) : undefined;
|
|
12987
|
+
};
|
|
12988
|
+
const curve = topicAddress(topics[1]);
|
|
12989
|
+
const creator = topicAddress(topics[3]);
|
|
12990
|
+
if (curve === undefined || BigInt(curve) === 0n || creator === undefined)
|
|
12991
|
+
return;
|
|
12992
|
+
return sameEvmAddress(creator, wallet) ? curve : undefined;
|
|
12993
|
+
}
|
|
12994
|
+
function launchBuyLegOk(leg, buyRaw, curve) {
|
|
12995
|
+
const data = bytesOf(leg.data);
|
|
12996
|
+
return data !== undefined && leg.value === buyRaw && sameEvmAddress(leg.to, curve) && data.length === 36 && selectorOf(data) === CURVE_BUY_SELECTOR;
|
|
12964
12997
|
}
|
|
12965
12998
|
function hoodTradeLegCheck(terms) {
|
|
12966
12999
|
let curve;
|
|
@@ -12970,6 +13003,13 @@ function hoodTradeLegCheck(terms) {
|
|
|
12970
13003
|
}) : Promise.resolve(undefined);
|
|
12971
13004
|
return curve;
|
|
12972
13005
|
};
|
|
13006
|
+
let treasury;
|
|
13007
|
+
const chainTreasury = () => {
|
|
13008
|
+
treasury ??= terms.treasury ? terms.treasury().catch(() => {
|
|
13009
|
+
return;
|
|
13010
|
+
}) : Promise.resolve(undefined);
|
|
13011
|
+
return treasury;
|
|
13012
|
+
};
|
|
12973
13013
|
const spenderOk = async (spender) => {
|
|
12974
13014
|
if (terms.venue !== "curve")
|
|
12975
13015
|
return among(spender, DEX_SPENDERS);
|
|
@@ -12982,8 +13022,12 @@ function hoodTradeLegCheck(terms) {
|
|
|
12982
13022
|
const data = bytesOf(leg.data);
|
|
12983
13023
|
if (!data)
|
|
12984
13024
|
return false;
|
|
12985
|
-
if (kind === "feeTransfer")
|
|
12986
|
-
|
|
13025
|
+
if (kind === "feeTransfer") {
|
|
13026
|
+
if (terms.fee === undefined)
|
|
13027
|
+
return false;
|
|
13028
|
+
const named = await chainTreasury();
|
|
13029
|
+
return named !== undefined && feeLegOk(leg, { ...terms.fee, treasury: named });
|
|
13030
|
+
}
|
|
12987
13031
|
if (kind === "approval") {
|
|
12988
13032
|
if (terms.inputToken === undefined || leg.value !== "0" || !sameEvmAddress(leg.to, terms.inputToken))
|
|
12989
13033
|
return false;
|
|
@@ -13044,7 +13088,7 @@ async function registeredCurveFor(rpc, token) {
|
|
|
13044
13088
|
}
|
|
13045
13089
|
return;
|
|
13046
13090
|
}
|
|
13047
|
-
var HOOD_CURVE_FACTORY = "0xD08f8489F026957EdeD3Bb8Ef8A9d151A7B1DF22", HOOD_CURVE_REGISTRIES, HOOD_UNIV2_ROUTER = "0x89e5db8b5aa49aa85ac63f691524311aeb649eba", HOOD_UNIV3_ROUTER = "0xCaf681a66D020601342297493863E78C959E5cb2", HOOD_V4_UNIVERSAL_ROUTER = "0x8876789976decbfcbbbe364623c63652db8c0904", HOOD_KYBER_ROUTER = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", HOOD_PERMIT2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3", HOOD_SPLITTER_FACTORY = "0x9318bD328Ac32DBAe08bbD85B634E6B6B06683BF", KYBER_NATIVE = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", ADDRESS_THIS = "0x0000000000000000000000000000000000000002", DEX_SPENDERS, CREATE_CURVE_SELECTOR = "0xe5ab9610", ERC20_APPROVE_SELECTOR = "0x095ea7b3", PERMIT2_APPROVE_SELECTOR = "0x87517c45", CURVE_BUY_SELECTOR = "0xd96a094a", CURVE_BUY_WITH_QUOTE_SELECTOR = "0x6818735c", CURVE_SELL_SELECTOR = "0xd79875eb", V2_SWAP_ETH_FOR_TOKENS_SELECTOR = "0xb6f9de95", V2_SWAP_TOKENS_FOR_ETH_SELECTOR = "0x791ac947", V3_MULTICALL_SELECTOR = "0x5ae401dc", V3_EXACT_INPUT_SINGLE_SELECTOR = "0x04e45aaf", V3_EXACT_INPUT_SELECTOR = "0xb858183f", V3_UNWRAP_WETH9_SELECTOR = "0x49404b7c", V3_REFUND_ETH_SELECTOR = "0x12210e8a", UNIVERSAL_EXECUTE_SELECTOR = "0x3593564c", KYBER_SWAP_SELECTOR = "0xe21fd0e9", KYBER_SWAP_GENERIC_SELECTOR = "0x59e50fed", KYBER_SWAP_SIMPLE_SELECTOR = "0x8af033fb", SPLITTER_DEV_SELECTOR = "0x91cca3db", SPLITTER_IS_SPLITTER_SELECTOR = "0xa4c597d1", CURVE_FOR_BASE_TOKEN_SELECTOR = "0x446b9253", LAUNCH_FEE_MAX_BPS = 1000n, MAX_ABI_ARRAY = 64, ADDRESSES, V3_SINGLE, V3_PATH, KYBER_DESC, KYBER_EXECUTION, V4_POOL_KEY, V4_SWAP_PARAMS, asBytes = (value) => value, asAddress = (value) => value, asNumber = (value) => value, asList = (value) => value, routedInput = (terms) => terms.inputToken ?? HOOD_WETH_ADDRESS, routedOutput = (terms) => terms.outputToken ?? HOOD_WETH_ADDRESS, UR_V3_SWAP_EXACT_IN = 0, UR_WRAP_ETH = 11, UR_UNWRAP_WETH = 12, UR_V4_SWAP = 16, V4_SWAP_EXACT_IN_SINGLE = 6, V4_SETTLE = 11, V4_SETTLE_ALL = 12, V4_TAKE = 14, V4_TAKE_ALL = 15, NATIVE_CURRENCY = "0x0000000000000000000000000000000000000000";
|
|
13091
|
+
var HOOD_CURVE_FACTORY = "0xD08f8489F026957EdeD3Bb8Ef8A9d151A7B1DF22", HOOD_CURVE_REGISTRIES, HOOD_UNIV2_ROUTER = "0x89e5db8b5aa49aa85ac63f691524311aeb649eba", HOOD_UNIV3_ROUTER = "0xCaf681a66D020601342297493863E78C959E5cb2", HOOD_V4_UNIVERSAL_ROUTER = "0x8876789976decbfcbbbe364623c63652db8c0904", HOOD_KYBER_ROUTER = "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5", HOOD_PERMIT2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3", HOOD_SPLITTER_FACTORY = "0x9318bD328Ac32DBAe08bbD85B634E6B6B06683BF", KYBER_NATIVE = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", ADDRESS_THIS = "0x0000000000000000000000000000000000000002", DEX_SPENDERS, CREATE_CURVE_SELECTOR = "0xe5ab9610", ERC20_APPROVE_SELECTOR = "0x095ea7b3", PERMIT2_APPROVE_SELECTOR = "0x87517c45", CURVE_BUY_SELECTOR = "0xd96a094a", CURVE_BUY_WITH_QUOTE_SELECTOR = "0x6818735c", CURVE_SELL_SELECTOR = "0xd79875eb", V2_SWAP_ETH_FOR_TOKENS_SELECTOR = "0xb6f9de95", V2_SWAP_TOKENS_FOR_ETH_SELECTOR = "0x791ac947", V3_MULTICALL_SELECTOR = "0x5ae401dc", V3_EXACT_INPUT_SINGLE_SELECTOR = "0x04e45aaf", V3_EXACT_INPUT_SELECTOR = "0xb858183f", V3_UNWRAP_WETH9_SELECTOR = "0x49404b7c", V3_REFUND_ETH_SELECTOR = "0x12210e8a", UNIVERSAL_EXECUTE_SELECTOR = "0x3593564c", KYBER_SWAP_SELECTOR = "0xe21fd0e9", KYBER_SWAP_GENERIC_SELECTOR = "0x59e50fed", KYBER_SWAP_SIMPLE_SELECTOR = "0x8af033fb", SPLITTER_DEV_SELECTOR = "0x91cca3db", SPLITTER_IS_SPLITTER_SELECTOR = "0xa4c597d1", CURVE_FOR_BASE_TOKEN_SELECTOR = "0x446b9253", SPLITTER_PLATFORM_VAULT_SELECTOR = "0x20f094f8", CURVE_CREATED_TOPIC = "0xed3a740542131b3621499825e40efbcaf096e3b1608de865c08a2109378bb36b", LAUNCH_FEE_MAX_BPS = 1000n, MAX_ABI_ARRAY = 64, ADDRESSES, V3_SINGLE, V3_PATH, KYBER_DESC, KYBER_EXECUTION, V4_POOL_KEY, V4_SWAP_PARAMS, asBytes = (value) => value, asAddress = (value) => value, asNumber = (value) => value, asList = (value) => value, routedInput = (terms) => terms.inputToken ?? HOOD_WETH_ADDRESS, routedOutput = (terms) => terms.outputToken ?? HOOD_WETH_ADDRESS, UR_V3_SWAP_EXACT_IN = 0, UR_WRAP_ETH = 11, UR_UNWRAP_WETH = 12, UR_V4_SWAP = 16, V4_SWAP_EXACT_IN_SINGLE = 6, V4_SETTLE = 11, V4_SETTLE_ALL = 12, V4_TAKE = 14, V4_TAKE_ALL = 15, NATIVE_CURRENCY = "0x0000000000000000000000000000000000000000";
|
|
13048
13092
|
var init_hood_legs = __esm(() => {
|
|
13049
13093
|
init_evm_lite();
|
|
13050
13094
|
HOOD_CURVE_REGISTRIES = [
|
|
@@ -13856,7 +13900,6 @@ async function hoodSwap(ctx, args) {
|
|
|
13856
13900
|
const recorded = kind === "trade" ? token : HOOD_USDG_ADDRESS;
|
|
13857
13901
|
const notices = [];
|
|
13858
13902
|
const feeRaw = BigInt(data.fee.feeRaw);
|
|
13859
|
-
const treasury = data.fee.treasury;
|
|
13860
13903
|
const feeAsset = artifacts.quoteAsset === "usdg" ? "usdg" : "eth";
|
|
13861
13904
|
const checkLeg = hoodTradeLegCheck({
|
|
13862
13905
|
wallet: wallet.address,
|
|
@@ -13865,7 +13908,8 @@ async function hoodSwap(ctx, args) {
|
|
|
13865
13908
|
outputToken: to.asset === "ETH" ? undefined : to.asset === "USDG" ? HOOD_USDG_ADDRESS : to.asset,
|
|
13866
13909
|
minOutRaw: BigInt(data.minOutRaw),
|
|
13867
13910
|
venue: kind === "trade" && artifacts.venue === "curve" ? "curve" : "dex",
|
|
13868
|
-
...kind === "trade" && feeRaw > 0n
|
|
13911
|
+
...kind === "trade" && feeRaw > 0n ? { fee: { cap: feeRaw, asset: feeAsset } } : {},
|
|
13912
|
+
treasury: () => hoodFeeTreasury(rpc()),
|
|
13869
13913
|
curve: () => registeredCurveFor(rpc(), token)
|
|
13870
13914
|
});
|
|
13871
13915
|
const run = await runSequencedLegs(ctx, key, {
|
|
@@ -62104,7 +62148,7 @@ var init_convert = __esm(() => {
|
|
|
62104
62148
|
});
|
|
62105
62149
|
|
|
62106
62150
|
// ../mcp/src/version.ts
|
|
62107
|
-
var SERVER_VERSION = "0.10.
|
|
62151
|
+
var SERVER_VERSION = "0.10.18";
|
|
62108
62152
|
|
|
62109
62153
|
// ../mcp/src/update-notice.ts
|
|
62110
62154
|
function newer(a, b) {
|
|
@@ -63039,6 +63083,12 @@ function checkActionIntent2(action, intent) {
|
|
|
63039
63083
|
const trigger = leg.t?.trigger;
|
|
63040
63084
|
if (leg.a !== first.a || leg.b !== !buy || leg.r !== true || decimal2(leg.s) !== decimal2(p.size) || trigger?.tpsl !== kind || trigger.isMarket !== true || decimal2(trigger.triggerPx) !== decimal2(p[field]))
|
|
63041
63085
|
return "trigger side, size, reduce-only flag or price does not match the request";
|
|
63086
|
+
const px = decimal2(leg.p) ?? 0n;
|
|
63087
|
+
const triggerPx = decimal2(trigger.triggerPx) ?? 0n;
|
|
63088
|
+
const bound = BigInt(HYPERLIQUID_TPSL_SLIPPAGE_BPS2 + HYPERLIQUID_MID_DRIFT_BPS2);
|
|
63089
|
+
const within = leg.b === true ? px * 10000n <= triggerPx * (10000n + bound) : px * 10000n >= triggerPx * (10000n - bound);
|
|
63090
|
+
if (triggerPx <= 0n || !within)
|
|
63091
|
+
return "trigger order price is outside its slippage of the trigger price";
|
|
63042
63092
|
}
|
|
63043
63093
|
} else {
|
|
63044
63094
|
if (list.length !== 1)
|
|
@@ -63228,7 +63278,7 @@ function hyperliquidExchangeBody2(action, nonce, signature) {
|
|
|
63228
63278
|
function hyperliquidRelayBody2(typedData) {
|
|
63229
63279
|
return { method: "eth_signTypedData_v4", params: { typed_data: typedData } };
|
|
63230
63280
|
}
|
|
63231
|
-
var HYPERLIQUID_ALLOWED_ACTION_TYPES2, HYPERLIQUID_EXCHANGE_URLS2, HYPERLIQUID_INFO_URLS2, CANDLE_HYPERLIQUID_BUILDER_ADDRESS2 = null, HYPERLIQUID_MAX_BUILDER_FEE_TENTHS_BPS2 = 100, HYPERLIQUID_MAX_BUILDER_FEE_RATE2 = "0.1%", HYPERLIQUID_SIGNATURE_CHAIN_ID2 = "0xa4b1", ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000", UINT64_MAX2, INT64_MIN2, EVM_ADDRESS_RE2, HYPERLIQUID_DEFAULT_SLIPPAGE_BPS2 = 100, HYPERLIQUID_MID_DRIFT_BPS2 = 100;
|
|
63281
|
+
var HYPERLIQUID_ALLOWED_ACTION_TYPES2, HYPERLIQUID_EXCHANGE_URLS2, HYPERLIQUID_INFO_URLS2, CANDLE_HYPERLIQUID_BUILDER_ADDRESS2 = null, HYPERLIQUID_MAX_BUILDER_FEE_TENTHS_BPS2 = 100, HYPERLIQUID_MAX_BUILDER_FEE_RATE2 = "0.1%", HYPERLIQUID_SIGNATURE_CHAIN_ID2 = "0xa4b1", ZERO_ADDRESS2 = "0x0000000000000000000000000000000000000000", UINT64_MAX2, INT64_MIN2, EVM_ADDRESS_RE2, HYPERLIQUID_DEFAULT_SLIPPAGE_BPS2 = 100, HYPERLIQUID_MID_DRIFT_BPS2 = 100, HYPERLIQUID_TPSL_SLIPPAGE_BPS2 = 500;
|
|
63232
63282
|
var init_hyperliquid = __esm(() => {
|
|
63233
63283
|
init_sha3();
|
|
63234
63284
|
HYPERLIQUID_ALLOWED_ACTION_TYPES2 = [
|
|
@@ -64978,7 +65028,7 @@ init_render();
|
|
|
64978
65028
|
init_secret_store();
|
|
64979
65029
|
|
|
64980
65030
|
// src/version.ts
|
|
64981
|
-
var CLI_VERSION = "0.11.
|
|
65031
|
+
var CLI_VERSION = "0.11.30";
|
|
64982
65032
|
|
|
64983
65033
|
// src/commands/auth.ts
|
|
64984
65034
|
init_keys_embedded_wallet();
|
|
@@ -72736,6 +72786,8 @@ async function hoodLaunch(ctx, key, args) {
|
|
|
72736
72786
|
}
|
|
72737
72787
|
const confirmedPlan = buy ? first.plannedLegCount === 3 ? ["createCurve", "feeTransfer", "trade"] : ["createCurve", "trade"] : undefined;
|
|
72738
72788
|
let position = 0;
|
|
72789
|
+
let createCurveHash;
|
|
72790
|
+
let quotedCurve;
|
|
72739
72791
|
const evm = lazyEvmRpc(ctx, flags["--rpc-url"]);
|
|
72740
72792
|
const run2 = await runSequencedLegs(ctx, key, {
|
|
72741
72793
|
wallet,
|
|
@@ -72747,14 +72799,33 @@ async function hoodLaunch(ctx, key, args) {
|
|
|
72747
72799
|
kind: "launch",
|
|
72748
72800
|
primaryLeg: "createCurve",
|
|
72749
72801
|
allowedLegs,
|
|
72802
|
+
onSigned: (kind, hash) => {
|
|
72803
|
+
if (kind === "createCurve")
|
|
72804
|
+
createCurveHash = hash;
|
|
72805
|
+
},
|
|
72750
72806
|
checkLeg: async (kind, leg2) => {
|
|
72807
|
+
const buyCurve = () => {
|
|
72808
|
+
if (createCurveHash === undefined)
|
|
72809
|
+
return Promise.resolve(undefined);
|
|
72810
|
+
quotedCurve ??= launchedCurve(ctx, evm(), createCurveHash, wallet.address).then((created2) => created2 !== undefined && sameEvmAddress(created2, curve.address) ? created2 : undefined);
|
|
72811
|
+
return quotedCurve;
|
|
72812
|
+
};
|
|
72751
72813
|
if (confirmedPlan && confirmedPlan[position++] !== kind)
|
|
72752
72814
|
return false;
|
|
72753
72815
|
if (kind === "createCurve")
|
|
72754
72816
|
return await createCurveLegOk(leg2, wallet.address, evm());
|
|
72755
|
-
if (kind === "feeTransfer")
|
|
72756
|
-
|
|
72757
|
-
|
|
72817
|
+
if (kind === "feeTransfer") {
|
|
72818
|
+
if (feeCap === undefined)
|
|
72819
|
+
return false;
|
|
72820
|
+
if (buy !== undefined && await buyCurve() === undefined)
|
|
72821
|
+
return false;
|
|
72822
|
+
const treasury = await hoodFeeTreasury(evm());
|
|
72823
|
+
return treasury !== undefined && feeLegOk(leg2, { cap: feeCap, asset: "eth", treasury });
|
|
72824
|
+
}
|
|
72825
|
+
if (kind !== "trade" || buy === undefined)
|
|
72826
|
+
return false;
|
|
72827
|
+
const created = await buyCurve();
|
|
72828
|
+
return created !== undefined && launchBuyLegOk(leg2, buy.raw, created);
|
|
72758
72829
|
},
|
|
72759
72830
|
onLanded: async () => {}
|
|
72760
72831
|
});
|
|
@@ -72773,6 +72844,21 @@ async function hoodLaunch(ctx, key, args) {
|
|
|
72773
72844
|
...args.used
|
|
72774
72845
|
});
|
|
72775
72846
|
}
|
|
72847
|
+
var RECEIPT_ATTEMPTS = 5;
|
|
72848
|
+
var RECEIPT_RETRY_MS = 1000;
|
|
72849
|
+
async function launchedCurve(ctx, rpc, hash, wallet) {
|
|
72850
|
+
for (let attempt = 1;; attempt++) {
|
|
72851
|
+
let receipt = null;
|
|
72852
|
+
try {
|
|
72853
|
+
receipt = await rpc.getTransactionReceipt(hash);
|
|
72854
|
+
} catch {}
|
|
72855
|
+
if (receipt !== null)
|
|
72856
|
+
return curveCreatedBy(receipt, wallet);
|
|
72857
|
+
if (attempt >= RECEIPT_ATTEMPTS)
|
|
72858
|
+
return;
|
|
72859
|
+
await ctx.deps.sleep(RECEIPT_RETRY_MS);
|
|
72860
|
+
}
|
|
72861
|
+
}
|
|
72776
72862
|
function hoodLaterLegsGas(count, buys) {
|
|
72777
72863
|
return count < 2 || !buys ? "" : "; the later legs are priced by Candle when each becomes next";
|
|
72778
72864
|
}
|
|
@@ -73633,6 +73719,12 @@ function checkActionIntent(action, intent) {
|
|
|
73633
73719
|
const trigger = leg.t?.trigger;
|
|
73634
73720
|
if (leg.a !== first.a || leg.b !== !buy || leg.r !== true || decimal(leg.s) !== decimal(p.size) || trigger?.tpsl !== kind || trigger.isMarket !== true || decimal(trigger.triggerPx) !== decimal(p[field]))
|
|
73635
73721
|
return "trigger side, size, reduce-only flag or price does not match the request";
|
|
73722
|
+
const px = decimal(leg.p) ?? 0n;
|
|
73723
|
+
const triggerPx = decimal(trigger.triggerPx) ?? 0n;
|
|
73724
|
+
const bound = BigInt(HYPERLIQUID_TPSL_SLIPPAGE_BPS + HYPERLIQUID_MID_DRIFT_BPS);
|
|
73725
|
+
const within = leg.b === true ? px * 10000n <= triggerPx * (10000n + bound) : px * 10000n >= triggerPx * (10000n - bound);
|
|
73726
|
+
if (triggerPx <= 0n || !within)
|
|
73727
|
+
return "trigger order price is outside its slippage of the trigger price";
|
|
73636
73728
|
}
|
|
73637
73729
|
} else {
|
|
73638
73730
|
if (list.length !== 1)
|
|
@@ -73674,6 +73766,7 @@ async function hyperliquidCloseOrder(fetcher, network, address, params) {
|
|
|
73674
73766
|
}
|
|
73675
73767
|
var HYPERLIQUID_DEFAULT_SLIPPAGE_BPS = 100;
|
|
73676
73768
|
var HYPERLIQUID_MID_DRIFT_BPS = 100;
|
|
73769
|
+
var HYPERLIQUID_TPSL_SLIPPAGE_BPS = 500;
|
|
73677
73770
|
async function hyperliquidOrderMarket(fetcher, network, address, method, params) {
|
|
73678
73771
|
const read = async (body) => {
|
|
73679
73772
|
const res = await fetcher(HYPERLIQUID_INFO_URLS[network], {
|
package/package.json
CHANGED