forApplication static method

Address forApplication(
  1. int applicationId
)

Get the escrow address of an application. Returns the address corresponding to that application's escrow account.

Implementation

static Address forApplication(int applicationId) {
  // Prepend the prefix
  final prefix = utf8.encode(APP_ID_PREFIX);

  // Merge the byte arrays
  final buffer = Uint8List.fromList([
    ...prefix,
    ...BigIntEncoder.encodeUint64(BigInt.from(applicationId)),
  ]);

  final digest = sha512256.convert(buffer);

  return Address(publicKey: Uint8List.fromList(digest.bytes));
}