createSwapBody method
Cell
createSwapBody({
- required InternalAddress askJettonWalletAddress,
- required InternalAddress receiverAddress,
- required BigInt minAskAmount,
- required InternalAddress refundAddress,
- InternalAddress? excessesAddress,
- Cell? customPayload,
- BigInt? customPayloadForwardGasAmount,
- Cell? refundPayload,
- BigInt? refundForwardGasAmount,
- InternalAddress? referralAddress,
- BigInt? referralValue,
Implementation
Cell createSwapBody({
required InternalAddress askJettonWalletAddress,
required InternalAddress receiverAddress,
required BigInt minAskAmount,
required InternalAddress refundAddress,
InternalAddress? excessesAddress,
Cell? customPayload,
BigInt? customPayloadForwardGasAmount,
Cell? refundPayload,
BigInt? refundForwardGasAmount,
InternalAddress? referralAddress,
BigInt? referralValue,
}) {
if (referralValue != null &&
(referralValue < BigInt.zero || referralValue > BigInt.from(100))) {
throw Exception("'referralValue' should be in range [0, 100] BPS");
}
return beginCell()
.storeUint(DexOpCodes.SWAP.op, 32)
.storeAddress(askJettonWalletAddress)
.storeAddress(refundAddress)
.storeAddress(excessesAddress ?? refundAddress)
.storeRef(beginCell()
.storeCoins(minAskAmount)
.storeAddress(receiverAddress)
.storeCoins(customPayloadForwardGasAmount ?? BigInt.zero)
.storeMaybeRef(customPayload)
.storeCoins(refundForwardGasAmount ?? BigInt.zero)
.storeMaybeRef(refundPayload)
.storeUint(referralValue ?? BigInt.from(10), 16)
.storeAddress(referralAddress)
.endCell())
.endCell();
}