encodeAddress static method
String
encodeAddress(
{ - required List<int> hash,
- required int workChain,
- bool bounceable = true,
- bool testOnly = false,
- bool urlSafe = false,
})
Implementation
static String encodeAddress(
{required List<int> hash,
required int workChain,
bool bounceable = true,
bool testOnly = false,
bool urlSafe = false}) {
int tag = bounceable
? FriendlyAddressFlags.bounceable.flag
: FriendlyAddressFlags.nonBounceable.flag;
if (testOnly) {
tag |= FriendlyAddressFlags.test.flag;
}
final List<int> addr =
List<int>.unmodifiable([tag, workChain & mask8, ...hash]);
final addrBytes = [...addr, ...Crc16.quickIntDigest(addr)];
final encode = StringUtils.decode(addrBytes, type: StringEncoding.base64);
if (urlSafe) {
return encode.replaceAll('+', '-').replaceAll('/', '_');
}
return encode;
}