Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add API in jni for tx struct adapt to balance #199

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 33 additions & 57 deletions bcos-c-sdk/bcos_sdk_c_uti_tx_struct.cpp

Large diffs are not rendered by default.

44 changes: 27 additions & 17 deletions bcos-c-sdk/bcos_sdk_c_uti_tx_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void bcos_sdk_destroy_transaction_data_struct(struct bcos_sdk_c_transaction_data
* @param transaction_data: struct bcos_sdk_c_transaction_data*
* @return const char*
*/
const char* bcos_sdk_encode_transaction_data_struct(
const char* bcos_sdk_encode_transaction_data_struct_to_hex(
struct bcos_sdk_c_transaction_data* transaction_data);

/**
Expand All @@ -89,7 +89,7 @@ const char* bcos_sdk_encode_transaction_data_struct_to_json(
* @param transaction_data_hex_str
* @return struct bcos_sdk_c_transaction_data*
*/
struct bcos_sdk_c_transaction_data* bcos_sdk_decode_transaction_data_struct(
struct bcos_sdk_c_transaction_data* bcos_sdk_decode_transaction_data_struct_from_hex(
const char* transaction_data_hex_str);

/**
Expand All @@ -104,7 +104,7 @@ struct bcos_sdk_c_transaction_data* bcos_sdk_decode_transaction_data_struct(
* nonce:string
* @return struct bcos_sdk_c_transaction_data*
*/
struct bcos_sdk_c_transaction_data* bcos_sdk_decode_transaction_data_struct_with_json(
struct bcos_sdk_c_transaction_data* bcos_sdk_decode_transaction_data_struct_from_json(
const char* transaction_data_json_str);

/**
Expand Down Expand Up @@ -166,7 +166,7 @@ const char* bcos_sdk_create_encoded_transaction(
* @param transaction: struct bcos_sdk_c_transaction*
* @return const char*
*/
const char* bcos_sdk_encode_transaction_struct(struct bcos_sdk_c_transaction* transaction);
const char* bcos_sdk_encode_transaction_struct_to_hex(struct bcos_sdk_c_transaction* transaction);

/**
* @brief convert transaction into json format
Expand All @@ -182,35 +182,43 @@ const char* bcos_sdk_encode_transaction_struct_to_json(struct bcos_sdk_c_transac
* @param transaction_hex_str
* @return struct bcos_sdk_c_transaction*
*/
struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct(const char* transaction_hex_str);
struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct_from_hex(
const char* transaction_hex_str);

/**
* @brief
*
* @param transaction_json_str
* @return struct bcos_sdk_c_transaction*
*/
struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct_with_json(
struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct_from_json(
const char* transaction_json_str);

struct bcos_sdk_c_transaction_data_v2* bcos_sdk_create_transaction_data_struct_with_hex_input_v2(
const char* group_id, const char* chain_id, const char* to, const char* input, const char* abi,
int64_t block_limit, const char* value, const char* gas_price, int64_t gas_limit, const char* max_fee_per_gas, const char* max_priority_fee_per_gas);
int64_t block_limit, const char* value, const char* gas_price, int64_t gas_limit,
const char* max_fee_per_gas, const char* max_priority_fee_per_gas);

struct bcos_sdk_c_transaction_data_v2* bcos_sdk_create_transaction_data_struct_with_bytes_v2(
const char* group_id, const char* chain_id, const char* to, const unsigned char* bytes_input,
uint32_t bytes_input_length, const char* abi, int64_t block_limit, const char* value, const char* gas_price, int64_t gas_limit, const char* max_fee_per_gas, const char* max_priority_fee_per_gas);
uint32_t bytes_input_length, const char* abi, int64_t block_limit, const char* value,
const char* gas_price, int64_t gas_limit, const char* max_fee_per_gas,
const char* max_priority_fee_per_gas);


void bcos_sdk_destroy_transaction_data_struct_v2(struct bcos_sdk_c_transaction_data_v2* transaction_data);
void bcos_sdk_destroy_transaction_data_struct_v2(
struct bcos_sdk_c_transaction_data_v2* transaction_data);

const char* bcos_sdk_encode_transaction_data_struct_v2(struct bcos_sdk_c_transaction_data_v2* transaction_data);
const char* bcos_sdk_encode_transaction_data_struct_to_hex_v2(
struct bcos_sdk_c_transaction_data_v2* transaction_data);

const char* bcos_sdk_encode_transaction_data_struct_to_json_v2(struct bcos_sdk_c_transaction_data_v2* transaction_data);
const char* bcos_sdk_encode_transaction_data_struct_to_json_v2(
struct bcos_sdk_c_transaction_data_v2* transaction_data);

struct bcos_sdk_c_transaction_data_v2* bcos_sdk_decode_transaction_data_struct_v2(
struct bcos_sdk_c_transaction_data_v2* bcos_sdk_decode_transaction_data_struct_from_hex_v2(
const char* transaction_data_hex_str);

struct bcos_sdk_c_transaction_data_v2* bcos_sdk_decode_transaction_data_struct_with_json_v2(
struct bcos_sdk_c_transaction_data_v2* bcos_sdk_decode_transaction_data_struct_from_json_v2(
const char* transaction_data_json_str);

const char* bcos_sdk_calc_transaction_data_struct_hash_v2(
Expand All @@ -229,14 +237,16 @@ const char* bcos_sdk_create_encoded_transaction_v2(
struct bcos_sdk_c_transaction_data_v2* transaction_data, const char* signature,
const char* transaction_data_hash, int32_t attribute, const char* extra_data);

const char* bcos_sdk_encode_transaction_struct_v2(struct bcos_sdk_c_transaction_v2* transaction);
const char* bcos_sdk_encode_transaction_struct_to_hex_v2(
struct bcos_sdk_c_transaction_v2* transaction);

const char* bcos_sdk_encode_transaction_struct_to_json_v2(struct bcos_sdk_c_transaction_v2* transaction);
const char* bcos_sdk_encode_transaction_struct_to_json_v2(
struct bcos_sdk_c_transaction_v2* transaction);

struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_v2(
struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_from_hex_v2(
const char* transaction_hex_str);

struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_with_json_v2(
struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_from_json_v2(
const char* transaction_json_str);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion bindings/java/jni/scripts/java2jni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function convert_java_to_jni() {
# convert_java_to_jni ${JAVA_SOURCE_PATH}

# classes="rpc.RpcJniObj amop.AmopJniObj event.EventSubJniObj BcosSDKJniObj"
classes="BcosSDKJniObj utilities.keypair.KeyPairJniObj utilities.tx.TransactionBuilderJniObj utilities.tx.TransactionBuilderV2JniObj utilities.tx.TransactionStructBuilderJniObj utilities.receipt.ReceiptBuilderJniObj utilities.signature.SignatureJniObj"
classes="BcosSDKJniObj utilities.keypair.KeyPairJniObj utilities.tx.TransactionBuilderJniObj utilities.tx.TransactionBuilderV2JniObj utilities.tx.TransactionStructBuilderJniObj utilities.tx.TransactionStructBuilderV2JniObj utilities.receipt.ReceiptBuilderJniObj utilities.signature.SignatureJniObj"

for class in ${classes}
do
Expand Down
Loading
Loading