fromBorsh static method

AddressLookupTableState fromBorsh(
  1. Iterable<int> buffer
)

Creates an instance of this class from a buffer.

Implementation

static AddressLookupTableState fromBorsh(final Iterable<int> buffer) {
  const int metaLength = 56;
  const String addressesKey = 'addresses';
  final metaSchema = metaCodec.schema;
  final int addressesLength = (buffer.length - metaLength) ~/ 32;
  final addressesSchema = { addressesKey: borsh.arraySized(borsh.pubkey, addressesLength) };
  final Map<String, dynamic> json = borsh.decode(metaSchema, buffer);
  json.addAll(borsh.decode(addressesSchema, buffer.skip(metaLength)));
  return AddressLookupTableState.fromJson(json);
}