createTonTransferBody method

Cell createTonTransferBody({
  1. required BigInt tonAmount,
  2. required InternalAddress refundAddress,
  3. Cell? forwardPayload,
  4. BigInt? queryId,
})

Implementation

Cell createTonTransferBody({
  required BigInt tonAmount,
  required InternalAddress refundAddress,
  Cell? forwardPayload,
  BigInt? queryId,
}) {
  Builder b = beginCell()
      .storeUint(PtonOpCodes.TON_TRANSFER.op, 32)
      .storeUint(queryId ?? BigInt.zero, 64)
      .storeCoins(tonAmount)
      .storeAddress(refundAddress);

  if (forwardPayload != null) {
    b.storeBool(true).storeRef(forwardPayload);
  }

  return b.endCell();
}