encodeAddress static method

String encodeAddress({
  1. required List<int> hash,
  2. required int workChain,
  3. bool bounceable = true,
  4. bool testOnly = false,
  5. bool urlSafe = false,
  6. bool noPadding = false,
})

Implementation

static String encodeAddress({
  required List<int> hash,
  required int workChain,
  bool bounceable = true,
  bool testOnly = false,
  bool urlSafe = false,
  bool noPadding = false,
}) {
  hash = validateAddressHash(hash);
  int tag =
      bounceable
          ? FriendlyAddressFlags.bounceable.flag
          : FriendlyAddressFlags.nonBounceable.flag;
  if (testOnly) {
    tag |= FriendlyAddressFlags.test.flag;
  }
  final List<int> addr = List<int>.unmodifiable([
    tag,
    workChain & BinaryOps.mask8,
    ...hash,
  ]);
  final addrBytes = [...addr, ...Crc16.quickIntDigest(addr)];
  return B64Encoder.encode(addrBytes, urlSafe: urlSafe, noPadding: noPadding);
}