Proxy constructor

Proxy(
  1. Wallet wallet,
  2. List<String> endpoints
)

Implementation

Proxy(Wallet wallet, List<String> endpoints) {
  ffi.DynamicLibrary dylib = ffi.DynamicLibrary.open(
      path.join(Directory.current.path, "dylib/libmonetae_ffi.dylib"));

  _lib = NativeLibrary(dylib);

  // convert endpoints list into C layout
  final _endpoints = uint8ListToVecUint8Pointer(
      Uint8List.fromList(utf8.encode(endpoints.join(","))));

  _inner = _lib.proxy_connect(
      wallet.ptr(), _endpoints.ref, ffi.Pointer.fromFunction(receivePacket));
}