|
| 1 | +// Copyright © 2017-2019 Trust. |
| 2 | +// |
| 3 | +// This file is part of Trust. The full Trust copyright notice, including |
| 4 | +// terms governing use, modification, and redistribution, is contained in the |
| 5 | +// file LICENSE at the root of the source code distribution tree. |
| 6 | +// |
| 7 | +// This is a GENERATED FILE, changes made here WILL BE LOST. |
| 8 | +// |
| 9 | + |
| 10 | +#include <jni.h> |
| 11 | +#include <stdio.h> |
| 12 | +#include <string.h> |
| 13 | + |
| 14 | +#include <TrustWalletCore/TWPublicKey.h> |
| 15 | +#include <TrustWalletCore/TWRippleAddress.h> |
| 16 | + |
| 17 | +#include "TWJNI.h" |
| 18 | +#include "RippleAddress.h" |
| 19 | + |
| 20 | +jlong JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_nativeCreateWithString(JNIEnv *env, jclass thisClass, jstring string) { |
| 21 | + TWString *stringString = TWStringCreateWithJString(env, string); |
| 22 | + struct TWRippleAddress *instance = TWRippleAddressCreateWithString(stringString); |
| 23 | + TWStringDelete(stringString); |
| 24 | + return (jlong) instance; |
| 25 | +} |
| 26 | + |
| 27 | +jlong JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_nativeCreateWithData(JNIEnv *env, jclass thisClass, jbyteArray data) { |
| 28 | + TWData *dataData = TWDataCreateWithJByteArray(env, data); |
| 29 | + struct TWRippleAddress *instance = TWRippleAddressCreateWithData(dataData); |
| 30 | + TWDataDelete(dataData); |
| 31 | + return (jlong) instance; |
| 32 | +} |
| 33 | + |
| 34 | +jlong JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_nativeCreateWithPublicKey(JNIEnv *env, jclass thisClass, jobject publicKey) { |
| 35 | + jclass publicKeyClass = (*env)->GetObjectClass(env, publicKey); |
| 36 | + jfieldID publicKeyBytesFieldID = (*env)->GetFieldID(env, publicKeyClass, "bytes", "[B"); |
| 37 | + jbyteArray publicKeyBytesArray = (*env)->GetObjectField(env, publicKey, publicKeyBytesFieldID); |
| 38 | + jbyte* publicKeyBytesBuffer = (*env)->GetByteArrayElements(env, publicKeyBytesArray, NULL); |
| 39 | + struct TWPublicKey *publicKeyInstance = (struct TWPublicKey *) publicKeyBytesBuffer; |
| 40 | + struct TWRippleAddress *instance = TWRippleAddressCreateWithPublicKey(*publicKeyInstance); |
| 41 | + (*env)->ReleaseByteArrayElements(env, publicKeyBytesArray, publicKeyBytesBuffer, JNI_ABORT); |
| 42 | + (*env)->DeleteLocalRef(env, publicKeyBytesArray); |
| 43 | + (*env)->DeleteLocalRef(env, publicKeyClass); |
| 44 | + return (jlong) instance; |
| 45 | +} |
| 46 | + |
| 47 | +void JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_nativeDelete(JNIEnv *env, jclass thisClass, jlong handle) { |
| 48 | + TWRippleAddressDelete((struct TWRippleAddress *) handle); |
| 49 | +} |
| 50 | + |
| 51 | +jboolean JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_equals(JNIEnv *env, jclass thisClass, jobject lhs, jobject rhs) { |
| 52 | + jclass lhsClass = (*env)->GetObjectClass(env, lhs); |
| 53 | + jfieldID lhsHandleFieldID = (*env)->GetFieldID(env, lhsClass, "nativeHandle", "J"); |
| 54 | + struct TWRippleAddress *lhsInstance = (struct TWRippleAddress *) (*env)->GetLongField(env, lhs, lhsHandleFieldID); |
| 55 | + jclass rhsClass = (*env)->GetObjectClass(env, rhs); |
| 56 | + jfieldID rhsHandleFieldID = (*env)->GetFieldID(env, rhsClass, "nativeHandle", "J"); |
| 57 | + struct TWRippleAddress *rhsInstance = (struct TWRippleAddress *) (*env)->GetLongField(env, rhs, rhsHandleFieldID); |
| 58 | + jboolean resultValue = (jboolean) TWRippleAddressEqual(lhsInstance, rhsInstance); |
| 59 | + |
| 60 | + (*env)->DeleteLocalRef(env, lhsClass); |
| 61 | + (*env)->DeleteLocalRef(env, rhsClass); |
| 62 | + |
| 63 | + return resultValue; |
| 64 | +} |
| 65 | + |
| 66 | +jboolean JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_isValidString(JNIEnv *env, jclass thisClass, jstring string) { |
| 67 | + TWString *stringString = TWStringCreateWithJString(env, string); |
| 68 | + jboolean resultValue = (jboolean) TWRippleAddressIsValidString(stringString); |
| 69 | + |
| 70 | + TWStringDelete(stringString); |
| 71 | + |
| 72 | + return resultValue; |
| 73 | +} |
| 74 | + |
| 75 | +jstring JNICALL Java_com_wallet_crypto_trustapp_jni_RippleAddress_description(JNIEnv *env, jobject thisObject) { |
| 76 | + jclass thisClass = (*env)->GetObjectClass(env, thisObject); |
| 77 | + jfieldID handleFieldID = (*env)->GetFieldID(env, thisClass, "nativeHandle", "J"); |
| 78 | + struct TWRippleAddress *instance = (struct TWRippleAddress *) (*env)->GetLongField(env, thisObject, handleFieldID); |
| 79 | + |
| 80 | + jstring result = TWStringJString(TWRippleAddressDescription(instance), env); |
| 81 | + |
| 82 | + |
| 83 | + (*env)->DeleteLocalRef(env, thisClass); |
| 84 | + |
| 85 | + return result; |
| 86 | +} |
| 87 | + |
0 commit comments