initiateTransaction method

Future<Status> initiateTransaction({
  1. required String gateway,
  2. required String accessToken,
  3. required RequestTransactionPayloadReq initiatePayload,
  4. required String imagePath,
  5. required String privateKeyString,
  6. Duration idleTimeout = const Duration(minutes: 15),
})

Implementation

Future<Status> initiateTransaction(
    {required String gateway,
    required String accessToken,
    required RequestTransactionPayloadReq initiatePayload,
    required String imagePath,
    required String privateKeyString,
    Duration idleTimeout = const Duration(minutes: 15)}) async {
  RubixServiceClient stub = getConnection(
      gateway: gateway, accessToken: accessToken, idleTimeout: idleTimeout);
  RequestTransactionPayloadRes response =
      await stub.initiateTransaction(RequestTransactionPayloadReq(
    receiver: initiatePayload.receiver,
    tokenCount: initiatePayload.tokenCount,
    comment: initiatePayload.comment,
    type: initiatePayload.type,
  ));
  var privateKey = KeyPair().privateKeyFromPem(privateKeyString);
  print("Initiate Transaction Response: ${response}");
  var signResp = signResponse(
      initiateTransactionResponse: response,
      imagePath: imagePath,
      privateKey: privateKey,
      stub: stub,onlyPrivateKey: false);
  return signResp;
}