createJettonTransferMessage function

dynamic createJettonTransferMessage({
  1. required BigInt queryId,
  2. required BigInt amount,
  3. required InternalAddress destination,
  4. InternalAddress? responseDestination,
  5. Cell? customPayload,
  6. required BigInt forwardTonAmount,
  7. Cell? forwardPayload,
})

Implementation

createJettonTransferMessage({
  required BigInt queryId,
  required BigInt amount,
  required InternalAddress destination,
  InternalAddress? responseDestination,
  Cell? customPayload,
  required BigInt forwardTonAmount,
  Cell? forwardPayload,
}) {
  final builder = Builder();
  builder.storeUint(BigInt.from(0xf8a7ea5), 32);
  builder.storeUint(queryId, 64);
  builder.storeCoins(amount);
  builder.storeAddress(destination);
  builder.storeAddress(responseDestination);

  if(customPayload != null) {
    builder.storeBool(true);
    builder.storeRef(customPayload);
  } else {
    builder.storeBool(false);
  }

  builder.storeCoins(forwardTonAmount);

  if (forwardPayload != null) {
    builder.storeBool(true);
    builder.storeRef(forwardPayload);
  } else {
    builder.storeBool(false);
  }

  return builder.endCell();
}