hyperledger-archives/indy-sdk-react-native

Android: buildGetAcceptanceMechanismsRequest throws CommonInvalidParam4 Error

Opened this issue · 0 comments

This has been copied from AbsaOSS/rn-indy-sdk#36

@TheArhaam wrote:

buildGetAcceptanceMechanismsRequest throws CommonInvalidParam4 , caused by Invalid pointer has been passed

IndySdkModule.java

@ReactMethod
    public void buildGetAcceptanceMechanismsRequest(String submitterDid, int timestamp, String version, Promise promise) {
        try {
            String request = Ledger.buildGetAcceptanceMechanismsRequest(submitterDid, timestamp, version).get();
            promise.resolve(request);
        } catch (Exception e) {
            IndySdkRejectResponse rejectResponse = new IndySdkRejectResponse(e);
            promise.reject(rejectResponse.getCode(), rejectResponse.toJson(), e);
        }
    }

index.js

async buildGetAcceptanceMechanismsRequest(submitterDid: Did, timestamp: number, version: string): Promise<string> {
    if (Platform.OS === 'ios') {
      throw new Error(`Unsupported operation! Platform: ${Platform.OS}`)
    }
    return JSON.parse(await IndySdk.buildGetAcceptanceMechanismsRequest(submitterDid, typeof timestamp == 'undefined' ? -1 : timestamp, typeof version == 'undefined' ? null : version))
  },