SolAddress.withSeed constructor

SolAddress.withSeed({
  1. required SolAddress fromPublicKey,
  2. required String seed,
  3. required SolAddress programId,
})

Constructs a Solana address with a seed.

Implementation

factory SolAddress.withSeed(
    {required SolAddress fromPublicKey,
    required String seed,
    required SolAddress programId}) {
  final toBytes = List<int>.from([
    ...fromPublicKey.toBytes(),
    ...StringUtils.encode(seed),
    ...programId.toBytes()
  ]);
  return SolAddress.uncheckBytes(QuickCrypto.sha256Hash(toBytes));
}