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(tx struct): add new api for tx struct to adapt to balance #189

Merged
merged 8 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
28 changes: 28 additions & 0 deletions bcos-c-sdk/bcos_sdk_c_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,23 @@ struct bcos_sdk_c_transaction_data
struct bcos_sdk_c_bytes* input;
};

struct bcos_sdk_c_transaction_data_v2
{
int32_t version;
int64_t block_limit;
char* chain_id;
char* group_id;
char* nonce;
char* to;
char* abi;
struct bcos_sdk_c_bytes* input;
char* value;
char* gas_price;
int64_t gas_limit;
char* max_fee_per_gas;
char* max_priority_fee_per_gas;
};

/**
* @brief: transaction
*
Expand All @@ -224,6 +241,17 @@ struct bcos_sdk_c_transaction
char* extra_data;
};

struct bcos_sdk_c_transaction_v2
{
struct bcos_sdk_c_transaction_data_v2* transaction_data;
struct bcos_sdk_c_bytes* data_hash;
struct bcos_sdk_c_bytes* signature;
struct bcos_sdk_c_bytes* sender;
int64_t import_time;
int32_t attribute;
char* extra_data;
};

//--------------- transaction end---------------------------------

#ifdef __cplusplus
Expand Down
852 changes: 852 additions & 0 deletions bcos-c-sdk/bcos_sdk_c_uti_tx_struct.cpp

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions bcos-c-sdk/bcos_sdk_c_uti_tx_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,52 @@ struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct(const char* tr
struct bcos_sdk_c_transaction* bcos_sdk_decode_transaction_struct_with_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);

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);

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_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(
const char* transaction_data_hex_str);

struct bcos_sdk_c_transaction_data_v2* bcos_sdk_decode_transaction_data_struct_with_json_v2(
const char* transaction_data_json_str);

const char* bcos_sdk_calc_transaction_data_struct_hash_v2(
int crypto_type, struct bcos_sdk_c_transaction_data_v2* transaction_data);

const char* bcos_sdk_calc_transaction_data_struct_hash_with_hex_v2(
int crypto_type, const char* transaction_data_hex);

struct bcos_sdk_c_transaction_v2* bcos_sdk_create_transaction_struct_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);

void bcos_sdk_destroy_transaction_struct_v2(struct bcos_sdk_c_transaction_v2* transaction);

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_json_v2(struct bcos_sdk_c_transaction_v2* transaction);

struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_v2(
const char* transaction_hex_str);

struct bcos_sdk_c_transaction_v2* bcos_sdk_decode_transaction_struct_with_json_v2(
const char* transaction_json_str);

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading