Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/tools/cdp-liquidation-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ export function registerCdpLiquidationTools(server: McpServer): void {
findTreasuryUtxo(params, lucid),
]);

const txBuilder = await liquidateCdp(
return liquidateCdp(
cdpOutRef,
stabilityPoolUtxo,
collectorUtxo,
treasuryUtxo,
params,
lucid
);
return txBuilder.complete();
},
{
type: 'liquidate_cdp',
Expand Down Expand Up @@ -187,7 +186,7 @@ export function registerCdpLiquidationTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await redeemCdp(
return redeemCdp(
BigInt(amount),
cdpOutRef,
iAssetResult.utxo,
Expand All @@ -199,7 +198,6 @@ export function registerCdpLiquidationTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'redeem_cdp',
Expand Down Expand Up @@ -250,7 +248,7 @@ export function registerCdpLiquidationTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await freezeCdp(
return freezeCdp(
cdpOutRef,
iAssetResult.utxo,
priceOracleUtxo,
Expand All @@ -259,7 +257,6 @@ export function registerCdpLiquidationTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'freeze_cdp',
Expand Down Expand Up @@ -307,8 +304,7 @@ export function registerCdpLiquidationTools(server: McpServer): void {
async (lucid) => {
const params = await getSystemParams();

const txBuilder = await mergeCdps(cdpOutRefs, params, lucid);
return txBuilder.complete();
return mergeCdps(cdpOutRefs, params, lucid);
},
{
type: 'merge_cdps',
Expand Down
6 changes: 2 additions & 4 deletions src/tools/cdp-mint-burn-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function registerCdpMintBurnTools(server: McpServer): void {
findInterestOracleUtxo(iAssetUtxo, lucid),
]);

const txBuilder = await mintCdp(
return mintCdp(
BigInt(amount),
cdpOutRef,
iAssetUtxo,
Expand All @@ -144,7 +144,6 @@ export function registerCdpMintBurnTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'mint_cdp',
Expand Down Expand Up @@ -201,7 +200,7 @@ export function registerCdpMintBurnTools(server: McpServer): void {
findInterestOracleUtxo(iAssetUtxo, lucid),
]);

const txBuilder = await burnCdp(
return burnCdp(
BigInt(amount),
cdpOutRef,
iAssetUtxo,
Expand All @@ -214,7 +213,6 @@ export function registerCdpMintBurnTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'burn_cdp',
Expand Down
12 changes: 4 additions & 8 deletions src/tools/cdp-write-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function registerCdpWriteTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await openCdp(
return openCdp(
BigInt(collateralAmount),
BigInt(mintAmount),
params,
Expand All @@ -169,7 +169,6 @@ export function registerCdpWriteTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'open_cdp',
Expand Down Expand Up @@ -226,7 +225,7 @@ export function registerCdpWriteTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await depositCdp(
return depositCdp(
BigInt(amount),
cdpOutRef,
iAssetResult.utxo,
Expand All @@ -239,7 +238,6 @@ export function registerCdpWriteTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'deposit_cdp',
Expand Down Expand Up @@ -296,7 +294,7 @@ export function registerCdpWriteTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await withdrawCdp(
return withdrawCdp(
BigInt(amount),
cdpOutRef,
iAssetResult.utxo,
Expand All @@ -309,7 +307,6 @@ export function registerCdpWriteTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'withdraw_cdp',
Expand Down Expand Up @@ -365,7 +362,7 @@ export function registerCdpWriteTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await closeCdp(
return closeCdp(
cdpOutRef,
iAssetResult.utxo,
priceOracleUtxo,
Expand All @@ -377,7 +374,6 @@ export function registerCdpWriteTools(server: McpServer): void {
lucid,
currentSlot
);
return txBuilder.complete();
},
{
type: 'close_cdp',
Expand Down
3 changes: 1 addition & 2 deletions src/tools/leverage-cdp-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function registerLeverageCdpTools(server: McpServer): void {
findInterestOracleUtxo(iAssetResult.datum, lucid),
]);

const txBuilder = await leverageCdpWithLrp(
return leverageCdpWithLrp(
leverage,
BigInt(baseCollateral),
priceOracleUtxo,
Expand All @@ -164,7 +164,6 @@ export function registerLeverageCdpTools(server: McpServer): void {
allLrps,
currentSlot
);
return txBuilder.complete();
},
{
type: 'leverage_cdp',
Expand Down
27 changes: 5 additions & 22 deletions src/tools/rob-write-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ export function registerRobWriteTools(server: McpServer): void {
const params = await getSystemParams();
const assetTokenName = fromText(asset);
const maxPriceDecimal = parseMaxPrice(maxPrice);
const txBuilder = await openLrp(
assetTokenName,
BigInt(lovelacesAmount),
maxPriceDecimal,
lucid,
params
);
return txBuilder.complete();
return openLrp(assetTokenName, BigInt(lovelacesAmount), maxPriceDecimal, lucid, params);
},
{
type: 'open_rob',
Expand Down Expand Up @@ -81,8 +74,7 @@ export function registerRobWriteTools(server: McpServer): void {
async (lucid) => {
const params = await getSystemParams();
const robOutRef = { txHash: robTxHash, outputIndex: robOutputIndex };
const txBuilder = await cancelLrp(robOutRef, params, lucid);
return txBuilder.complete();
return cancelLrp(robOutRef, params, lucid);
},
{
type: 'cancel_rob',
Expand Down Expand Up @@ -131,14 +123,13 @@ export function registerRobWriteTools(server: McpServer): void {
const robOutRef = { txHash: robTxHash, outputIndex: robOutputIndex };
const newMaxPriceDecimal =
newMaxPrice !== undefined ? parseMaxPrice(newMaxPrice) : undefined;
const txBuilder = await adjustLrp(
return adjustLrp(
lucid,
robOutRef,
BigInt(lovelacesAdjustAmount),
newMaxPriceDecimal,
params
);
return txBuilder.complete();
},
{
type: 'adjust_rob',
Expand Down Expand Up @@ -184,8 +175,7 @@ export function registerRobWriteTools(server: McpServer): void {
async (lucid) => {
const params = await getSystemParams();
const robOutRef = { txHash: robTxHash, outputIndex: robOutputIndex };
const txBuilder = await claimLrp(lucid, robOutRef, params);
return txBuilder.complete();
return claimLrp(lucid, robOutRef, params);
},
{
type: 'claim_rob',
Expand Down Expand Up @@ -255,14 +245,7 @@ export function registerRobWriteTools(server: McpServer): void {
txHash: iassetTxHash,
outputIndex: iassetOutputIndex,
};
const txBuilder = await redeemLrp(
redemptionRobsData,
priceOracleOutRef,
iassetOutRef,
lucid,
params
);
return txBuilder.complete();
return redeemLrp(redemptionRobsData, priceOracleOutRef, iassetOutRef, lucid, params);
},
{
type: 'redeem_rob',
Expand Down
6 changes: 2 additions & 4 deletions src/tools/sp-request-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function registerSpRequestTools(server: McpServer): void {
findCollectorUtxo(params, lucid),
]);

const txBuilder = await processSpRequest(
return processSpRequest(
asset,
stabilityPoolUtxo,
accountUtxo,
Expand All @@ -117,7 +117,6 @@ export function registerSpRequestTools(server: McpServer): void {
lucid,
collectorUtxo
);
return txBuilder.complete();
},
{
type: 'process_sp_request',
Expand Down Expand Up @@ -169,8 +168,7 @@ export function registerSpRequestTools(server: McpServer): void {
if (!accountUtxo) throw new Error('Account UTxO not found on chain');

const params = await getSystemParams();
const txBuilder = await annulRequest(accountUtxo, params, lucid);
return txBuilder.complete();
return annulRequest(accountUtxo, params, lucid);
},
{
type: 'annul_sp_request',
Expand Down
15 changes: 3 additions & 12 deletions src/tools/stability-pool-write-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export function registerStabilityPoolWriteTools(server: McpServer): void {
address,
async (lucid) => {
const params = await getSystemParams();
const txBuilder = await createSpAccount(asset, BigInt(amount), params, lucid);
return txBuilder.complete();
return createSpAccount(asset, BigInt(amount), params, lucid);
},
{
type: 'create_sp_account',
Expand Down Expand Up @@ -70,14 +69,7 @@ export function registerStabilityPoolWriteTools(server: McpServer): void {
if (!accountUtxo) throw new Error('Account UTxO not found on chain');

const params = await getSystemParams();
const txBuilder = await adjustSpAccount(
asset,
BigInt(amount),
accountUtxo,
params,
lucid
);
return txBuilder.complete();
return adjustSpAccount(asset, BigInt(amount), accountUtxo, params, lucid);
},
{
type: 'adjust_sp_account',
Expand Down Expand Up @@ -128,8 +120,7 @@ export function registerStabilityPoolWriteTools(server: McpServer): void {
if (!accountUtxo) throw new Error('Account UTxO not found on chain');

const params = await getSystemParams();
const txBuilder = await closeSpAccount(accountUtxo, params, lucid);
return txBuilder.complete();
return closeSpAccount(accountUtxo, params, lucid);
},
{
type: 'close_sp_account',
Expand Down
8 changes: 1 addition & 7 deletions src/tools/staking-reward-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ export function registerStakingRewardTools(server: McpServer): void {
async (lucid) => {
const params = await getSystemParams();
const stakingManagerOutput = await findStakingManager(params, lucid);
const txBuilder = await distributeAda(
stakingManagerOutput.utxo,
collectorTxHashes,
params,
lucid
);
return txBuilder.complete();
return distributeAda(stakingManagerOutput.utxo, collectorTxHashes, params, lucid);
},
{
type: 'distribute_staking_rewards',
Expand Down
14 changes: 3 additions & 11 deletions src/tools/staking-write-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ export function registerStakingWriteTools(server: McpServer): void {
async (lucid) => {
const params = await getSystemParams();
const stakingManagerOutput = await findStakingManager(params, lucid);
const txBuilder = await openStakingPosition(
BigInt(amount),
params,
lucid,
stakingManagerOutput.utxo
);
return txBuilder.complete();
return openStakingPosition(BigInt(amount), params, lucid, stakingManagerOutput.utxo);
},
{
type: 'open_staking_position',
Expand Down Expand Up @@ -78,15 +72,14 @@ export function registerStakingWriteTools(server: McpServer): void {
outputIndex: positionOutputIndex,
};
const currentSlot = lucid.currentSlot();
const txBuilder = await adjustStakingPosition(
return adjustStakingPosition(
positionOutRef,
BigInt(amount),
params,
lucid,
currentSlot,
stakingManagerOutput.utxo
);
return txBuilder.complete();
},
{
type: 'adjust_staking_position',
Expand Down Expand Up @@ -136,14 +129,13 @@ export function registerStakingWriteTools(server: McpServer): void {
outputIndex: positionOutputIndex,
};
const currentSlot = lucid.currentSlot();
const txBuilder = await closeStakingPosition(
return closeStakingPosition(
positionOutRef,
params,
lucid,
currentSlot,
stakingManagerOutput.utxo
);
return txBuilder.complete();
},
{
type: 'close_staking_position',
Expand Down
Loading
Loading