Skip to content

Commit

Permalink
rename function+check empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
m1n999999 committed Sep 18, 2024
1 parent 0fca8cc commit 7504688
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ async function _swapStableExample(
feeDenominator: config.feeDenominator,
});

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand Down Expand Up @@ -923,7 +923,7 @@ async function _depositStableExample(
feeDenominator: config.feeDenominator,
});

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand Down Expand Up @@ -966,7 +966,7 @@ async function _withdrawStableExample(
totalLiquidity: pool.totalLiquidity,
});

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand Down Expand Up @@ -1009,7 +1009,7 @@ async function _withdrawImbalanceStableExample(
feeDenominator: config.feeDenominator,
});

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand Down Expand Up @@ -1053,7 +1053,7 @@ async function _zapOutStableExample(
feeDenominator: config.feeDenominator,
});

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand All @@ -1079,7 +1079,7 @@ async function _bulkOrderStableExample(
const lpAmount = 12345n;
const outIndex = 0;

return new Stableswap(lucid).buildCreateTx({
return new Stableswap(lucid).createBulkOrdersTx({
sender: address,
availableUtxos: availableUtxos,
options: [
Expand Down
7 changes: 5 additions & 2 deletions src/stableswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class Stableswap {
}
}

async buildCreateTx(options: BulkOrdersOption): Promise<TxComplete> {
async createBulkOrdersTx(options: BulkOrdersOption): Promise<TxComplete> {
const { sender, availableUtxos, options: orderOptions } = options;

invariant(
Expand Down Expand Up @@ -335,7 +335,10 @@ export class Stableswap {
inline: Data.to(StableOrder.Datum.toPlutusData(datum)),
},
orderAssets
).payToAddress(sender, reductionAssets);
);
if (Object.keys(reductionAssets).length !== 0) {
tx.payToAddress(sender, reductionAssets);
}

if (customReceiver && customReceiver.receiverDatum) {
const utxoForStoringDatum = buildUtxoToStoreDatum(
Expand Down

0 comments on commit 7504688

Please sign in to comment.