Skip to content

Commit

Permalink
Inline datum support
Browse files Browse the repository at this point in the history
  • Loading branch information
Sluder committed Dec 14, 2023
1 parent 535092d commit a722128
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/dex/minswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class Minswap extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
spendUtxos: spendUtxos,
}
)
Expand All @@ -230,6 +231,7 @@ export class Minswap extends BaseDex {
address: returnAddress,
addressType: AddressType.Base,
assetBalances: relevantUtxo.assetBalances,
isInlineDatum: false,
spendUtxos: [relevantUtxo],
}
];
Expand Down
2 changes: 2 additions & 0 deletions src/dex/muesliswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class MuesliSwap extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
spendUtxos: spendUtxos,
}
)
Expand All @@ -222,6 +223,7 @@ export class MuesliSwap extends BaseDex {
address: returnAddress,
addressType: AddressType.Base,
assetBalances: relevantUtxo.assetBalances,
isInlineDatum: false,
spendUtxos: [relevantUtxo],
}
];
Expand Down
2 changes: 2 additions & 0 deletions src/dex/sundaeswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export class SundaeSwap extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
spendUtxos: spendUtxos,
}
)
Expand All @@ -205,6 +206,7 @@ export class SundaeSwap extends BaseDex {
address: returnAddress,
addressType: AddressType.Base,
assetBalances: relevantUtxo.assetBalances,
isInlineDatum: false,
spendUtxos: [relevantUtxo],
}
];
Expand Down
1 change: 1 addition & 0 deletions src/dex/teddyswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export class TeddySwap extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: true,
spendUtxos: spendUtxos,
}),
];
Expand Down
2 changes: 2 additions & 0 deletions src/dex/vyfinance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class VyFinance extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
spendUtxos: spendUtxos,
}
)
Expand All @@ -123,6 +124,7 @@ export class VyFinance extends BaseDex {
address: returnAddress,
addressType: AddressType.Base,
assetBalances: relevantUtxo.assetBalances,
isInlineDatum: false,
spendUtxos: [relevantUtxo],
}
];
Expand Down
2 changes: 2 additions & 0 deletions src/dex/wingriders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export class WingRiders extends BaseDex {
},
],
datum: datumBuilder.getCbor(),
isInlineDatum: false,
spendUtxos: spendUtxos,
}
)
Expand All @@ -265,6 +266,7 @@ export class WingRiders extends BaseDex {
address: returnAddress,
addressType: AddressType.Base,
assetBalances: relevantUtxo.assetBalances,
isInlineDatum: false,
spendUtxos: [relevantUtxo],
}
];
Expand Down
8 changes: 6 additions & 2 deletions src/providers/wallet/lucid-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Assets,
Blockfrost,
Datum, Kupmios,
Lucid,
Lucid, OutputData,
TxComplete,
TxHash,
TxSigned,
Expand Down Expand Up @@ -108,7 +108,11 @@ export class LucidProvider extends BaseWalletProvider {
case AddressType.Contract:
transaction.providerData.tx.payToContract(
payToAddress.address,
payToAddress.datum as Datum,
payToAddress.isInlineDatum
? {
inline: payToAddress.datum as Datum,
}
: payToAddress.datum as Datum,
payment,
);
break;
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export type PayToAddress = {
assetBalances: AssetBalance[],
spendUtxos?: UTxO[],
datum?: string,
isInlineDatum: boolean,
};

export type SwapFee = {
Expand Down

0 comments on commit a722128

Please sign in to comment.