Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
lisicky committed Sep 10, 2024
1 parent 714c88c commit 3f1c5ab
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4272,6 +4272,28 @@ public final void csl_bridge_fixedTransactionRawAuxiliaryData(String self, Promi
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTransactionTransactionHash(String self, Promise promise) {
Native.I
.csl_bridge_fixedTransactionTransactionHash(new RPtr(self))
.map(RPtr::toJs)
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTransactionAddVkeyWitness(String self, String vkeyWitness, Promise promise) {
Native.I
.csl_bridge_fixedTransactionAddVkeyWitness(new RPtr(self), new RPtr(vkeyWitness))
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTransactionAddBootstrapWitness(String self, String bootstrapWitness, Promise promise) {
Native.I
.csl_bridge_fixedTransactionAddBootstrapWitness(new RPtr(self), new RPtr(bootstrapWitness))
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTransactionSignAndAddVkeySignature(String self, String privateKey, Promise promise) {
Native.I
Expand Down Expand Up @@ -4383,6 +4405,45 @@ public final void csl_bridge_fixedTransactionBodyOriginalBytes(String self, Prom
}


@ReactMethod
public final void csl_bridge_fixedTxWitnessesSetTxWitnessesSet(String self, Promise promise) {
Native.I
.csl_bridge_fixedTxWitnessesSetTxWitnessesSet(new RPtr(self))
.map(RPtr::toJs)
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTxWitnessesSetAddVkeyWitness(String self, String vkeyWitness, Promise promise) {
Native.I
.csl_bridge_fixedTxWitnessesSetAddVkeyWitness(new RPtr(self), new RPtr(vkeyWitness))
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTxWitnessesSetAddBootstrapWitness(String self, String bootstrapWitness, Promise promise) {
Native.I
.csl_bridge_fixedTxWitnessesSetAddBootstrapWitness(new RPtr(self), new RPtr(bootstrapWitness))
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTxWitnessesSetToBytes(String self, Promise promise) {
Native.I
.csl_bridge_fixedTxWitnessesSetToBytes(new RPtr(self))
.map(bytes -> Base64.encodeToString(bytes, Base64.DEFAULT))
.pour(promise);
}

@ReactMethod
public final void csl_bridge_fixedTxWitnessesSetFromBytes(String data, Promise promise) {
Native.I
.csl_bridge_fixedTxWitnessesSetFromBytes(Base64.decode(data, Base64.DEFAULT))
.map(RPtr::toJs)
.pour(promise);
}


@ReactMethod
public final void csl_bridge_fixedVersionedBlockFromBytes(String bytes, Promise promise) {
Native.I
Expand Down
9 changes: 9 additions & 0 deletions android/src/main/java/io/emurgo/rnhaskellshelley/Native.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ private Native() { }
public final native Result<Void> csl_bridge_fixedTransactionSetAuxiliaryData(RPtr self, byte[] rawAuxiliaryData);
public final native Result<RPtr> csl_bridge_fixedTransactionAuxiliaryData(RPtr self);
public final native Result<byte[]> csl_bridge_fixedTransactionRawAuxiliaryData(RPtr self);
public final native Result<RPtr> csl_bridge_fixedTransactionTransactionHash(RPtr self);
public final native Result<Void> csl_bridge_fixedTransactionAddVkeyWitness(RPtr self, RPtr vkeyWitness);
public final native Result<Void> csl_bridge_fixedTransactionAddBootstrapWitness(RPtr self, RPtr bootstrapWitness);
public final native Result<Void> csl_bridge_fixedTransactionSignAndAddVkeySignature(RPtr self, RPtr privateKey);
public final native Result<Void> csl_bridge_fixedTransactionSignAndAddIcarusBootstrapSignature(RPtr self, RPtr addr, RPtr privateKey);
public final native Result<Void> csl_bridge_fixedTransactionSignAndAddDaedalusBootstrapSignature(RPtr self, RPtr addr, RPtr privateKey);
Expand All @@ -623,6 +626,12 @@ private Native() { }
public final native Result<RPtr> csl_bridge_fixedTransactionBodyTxHash(RPtr self);
public final native Result<byte[]> csl_bridge_fixedTransactionBodyOriginalBytes(RPtr self);

public final native Result<RPtr> csl_bridge_fixedTxWitnessesSetTxWitnessesSet(RPtr self);
public final native Result<Void> csl_bridge_fixedTxWitnessesSetAddVkeyWitness(RPtr self, RPtr vkeyWitness);
public final native Result<Void> csl_bridge_fixedTxWitnessesSetAddBootstrapWitness(RPtr self, RPtr bootstrapWitness);
public final native Result<byte[]> csl_bridge_fixedTxWitnessesSetToBytes(RPtr self);
public final native Result<RPtr> csl_bridge_fixedTxWitnessesSetFromBytes(byte[] data);

public final native Result<RPtr> csl_bridge_fixedVersionedBlockFromBytes(byte[] bytes);
public final native Result<RPtr> csl_bridge_fixedVersionedBlockFromHex(String hexStr);
public final native Result<RPtr> csl_bridge_fixedVersionedBlockBlock(RPtr self);
Expand Down
45 changes: 45 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3195,6 +3195,21 @@ export class FixedTransaction extends Ptr {
*/
raw_auxiliary_data: () => Promise<Optional<Uint8Array>>;

/**
* @returns {Promise<TransactionHash>}
*/
transaction_hash: () => Promise<TransactionHash>;

/**
* @param {Vkeywitness} vkey_witness
*/
add_vkey_witness: (vkey_witness: Vkeywitness) => Promise<void>;

/**
* @param {BootstrapWitness} bootstrap_witness
*/
add_bootstrap_witness: (bootstrap_witness: BootstrapWitness) => Promise<void>;

/**
* @param {PrivateKey} private_key
* @returns {Promise<void>}
Expand Down Expand Up @@ -3286,6 +3301,36 @@ export class FixedTransactionBody extends Ptr {
}


export class FixedTxWitnessesSet extends Ptr {
/**
* @returns {Promise<TransactionWitnessSet>}
*/
tx_witnesses_set: () => Promise<TransactionWitnessSet>;

/**
* @param {Vkeywitness} vkey_witness
*/
add_vkey_witness: (vkey_witness: Vkeywitness) => Promise<void>;

/**
* @param {BootstrapWitness} bootstrap_witness
*/
add_bootstrap_witness: (bootstrap_witness: BootstrapWitness) => Promise<void>;

/**
* @returns {Promise<Uint8Array>}
*/
to_bytes: () => Promise<Uint8Array>;

/**
* @param {Uint8Array} data
* @returns {Promise<FixedTxWitnessesSet>}
*/
static from_bytes: (data: Uint8Array) => Promise<FixedTxWitnessesSet>;

}


export class FixedVersionedBlock extends Ptr {
/**
* @param {Uint8Array} bytes
Expand Down
48 changes: 48 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3127,6 +3127,23 @@ export class FixedTransaction extends Ptr {
return uint8ArrayFromB64(ret);
}

async transaction_hash() {
const ret = await HaskellShelley.csl_bridge_fixedTransactionTransactionHash(this.ptr);
return Ptr._wrap(ret, TransactionHash);
}

add_vkey_witness(vkey_witness) {
const vkey_witnessPtr = Ptr._assertClass(vkey_witness, Vkeywitness);
const ret = HaskellShelley.csl_bridge_fixedTransactionAddVkeyWitness(this.ptr, vkey_witnessPtr);
return ret;
}

add_bootstrap_witness(bootstrap_witness) {
const bootstrap_witnessPtr = Ptr._assertClass(bootstrap_witness, BootstrapWitness);
const ret = HaskellShelley.csl_bridge_fixedTransactionAddBootstrapWitness(this.ptr, bootstrap_witnessPtr);
return ret;
}

sign_and_add_vkey_signature(private_key) {
const private_keyPtr = Ptr._assertClass(private_key, PrivateKey);
const ret = HaskellShelley.csl_bridge_fixedTransactionSignAndAddVkeySignature(this.ptr, private_keyPtr);
Expand Down Expand Up @@ -3214,6 +3231,37 @@ export class FixedTransactionBody extends Ptr {
}


export class FixedTxWitnessesSet extends Ptr {
async tx_witnesses_set() {
const ret = await HaskellShelley.csl_bridge_fixedTxWitnessesSetTxWitnessesSet(this.ptr);
return Ptr._wrap(ret, TransactionWitnessSet);
}

add_vkey_witness(vkey_witness) {
const vkey_witnessPtr = Ptr._assertClass(vkey_witness, Vkeywitness);
const ret = HaskellShelley.csl_bridge_fixedTxWitnessesSetAddVkeyWitness(this.ptr, vkey_witnessPtr);
return ret;
}

add_bootstrap_witness(bootstrap_witness) {
const bootstrap_witnessPtr = Ptr._assertClass(bootstrap_witness, BootstrapWitness);
const ret = HaskellShelley.csl_bridge_fixedTxWitnessesSetAddBootstrapWitness(this.ptr, bootstrap_witnessPtr);
return ret;
}

async to_bytes() {
const ret = await HaskellShelley.csl_bridge_fixedTxWitnessesSetToBytes(this.ptr);
return uint8ArrayFromB64(ret);
}

static async from_bytes(data) {
const ret = await HaskellShelley.csl_bridge_fixedTxWitnessesSetFromBytes(b64FromUint8Array(data));
return Ptr._wrap(ret, FixedTxWitnessesSet);
}

}


export class FixedVersionedBlock extends Ptr {
static async from_bytes(bytes) {
const ret = await HaskellShelley.csl_bridge_fixedVersionedBlockFromBytes(b64FromUint8Array(bytes));
Expand Down
85 changes: 85 additions & 0 deletions ios/HaskellShelley.m
Original file line number Diff line number Diff line change
Expand Up @@ -6076,6 +6076,37 @@ + (void)csl_bridge_initialize
}] exec:selfPtr andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTransactionTransactionHash:(nonnull NSString *)selfPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSString* selfPtr, CharPtr* error) {
RPtr result;
RPtr self = [selfPtr rPtr];
return csl_bridge_fixed_transaction_transaction_hash(self, &result, error)
? [NSString stringFromPtr:result]
: nil;
}] exec:selfPtr andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTransactionAddVkeyWitness:(nonnull NSString *)selfPtr withVkeyWitness:(nonnull NSString *)vkeyWitnessPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSArray* params, CharPtr* error) {
RPtr self = [[params objectAtIndex:0] rPtr];
RPtr vkeyWitness = [[params objectAtIndex:1] rPtr];
csl_bridge_fixed_transaction_add_vkey_witness(self, vkeyWitness, error);
return nil;
}] exec:@[selfPtr, vkeyWitnessPtr] andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTransactionAddBootstrapWitness:(nonnull NSString *)selfPtr withBootstrapWitness:(nonnull NSString *)bootstrapWitnessPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSArray* params, CharPtr* error) {
RPtr self = [[params objectAtIndex:0] rPtr];
RPtr bootstrapWitness = [[params objectAtIndex:1] rPtr];
csl_bridge_fixed_transaction_add_bootstrap_witness(self, bootstrapWitness, error);
return nil;
}] exec:@[selfPtr, bootstrapWitnessPtr] andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTransactionSignAndAddVkeySignature:(nonnull NSString *)selfPtr withPrivateKey:(nonnull NSString *)privateKeyPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSArray* params, CharPtr* error) {
Expand Down Expand Up @@ -6231,6 +6262,60 @@ + (void)csl_bridge_initialize
}


RCT_EXPORT_METHOD(csl_bridge_fixedTxWitnessesSetTxWitnessesSet:(nonnull NSString *)selfPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSString* selfPtr, CharPtr* error) {
RPtr result;
RPtr self = [selfPtr rPtr];
return csl_bridge_fixed_tx_witnesses_set_tx_witnesses_set(self, &result, error)
? [NSString stringFromPtr:result]
: nil;
}] exec:selfPtr andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTxWitnessesSetAddVkeyWitness:(nonnull NSString *)selfPtr withVkeyWitness:(nonnull NSString *)vkeyWitnessPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSArray* params, CharPtr* error) {
RPtr self = [[params objectAtIndex:0] rPtr];
RPtr vkeyWitness = [[params objectAtIndex:1] rPtr];
csl_bridge_fixed_tx_witnesses_set_add_vkey_witness(self, vkeyWitness, error);
return nil;
}] exec:@[selfPtr, vkeyWitnessPtr] andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTxWitnessesSetAddBootstrapWitness:(nonnull NSString *)selfPtr withBootstrapWitness:(nonnull NSString *)bootstrapWitnessPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSArray* params, CharPtr* error) {
RPtr self = [[params objectAtIndex:0] rPtr];
RPtr bootstrapWitness = [[params objectAtIndex:1] rPtr];
csl_bridge_fixed_tx_witnesses_set_add_bootstrap_witness(self, bootstrapWitness, error);
return nil;
}] exec:@[selfPtr, bootstrapWitnessPtr] andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTxWitnessesSetToBytes:(nonnull NSString *)selfPtr withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSString* selfPtr, CharPtr* error) {
DataPtr result;
RPtr self = [selfPtr rPtr];
return csl_bridge_fixed_tx_witnesses_set_to_bytes(self, &result, error)
? [[NSData fromDataPtr:&result] base64]
: nil;
}] exec:selfPtr andResolve:resolve orReject:reject];
}

RCT_EXPORT_METHOD(csl_bridge_fixedTxWitnessesSetFromBytes:(nonnull NSString *)dataVal withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSString* dataVal, CharPtr* error) {
RPtr result;
NSData* dataData = [NSData fromBase64:dataVal];
return csl_bridge_fixed_tx_witnesses_set_from_bytes((uint8_t*)dataData.bytes, dataData.length, &result, error)
? [NSString stringFromPtr:result]
: nil;
}] exec:dataVal andResolve:resolve orReject:reject];
}


RCT_EXPORT_METHOD(csl_bridge_fixedVersionedBlockFromBytes:(nonnull NSString *)bytesVal withResolve:(RCTPromiseResolveBlock)resolve andReject:(RCTPromiseRejectBlock)reject)
{
[[CSLCSafeOperation new:^NSString*(NSString* bytesVal, CharPtr* error) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@emurgo/csl-mobile-bridge",
"title": "CSL mobile bridge",
"version": "6.1.0-beta.1",
"version": "6.1.0",
"description": "React-native bindings for Emurgo's cardano-serialization-lib (Cardano haskell Shelley)",
"main": "index.js",
"files": [
Expand Down
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cbindgen = "=0.14.1"
cryptoxide = { git = "https://github.com/emurgo/cryptoxide", tag="0.4.4"}

[dependencies]
cardano-serialization-lib = "=12.1.0-beta.1"
cardano-serialization-lib = "=12.1.0"
byteorder = "1.4.3"
base64 = "0.20.0"
# tag = "2.3.1"
Expand Down
Loading

0 comments on commit 3f1c5ab

Please sign in to comment.