Skip to content

Commit

Permalink
Merge pull request #215 from tronprotocol/release_v4.7.0
Browse files Browse the repository at this point in the history
Release v4.7.0
  • Loading branch information
forfreeday authored Jan 16, 2023
2 parents b9acb61 + 2ed8f8c commit 393732a
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 2 deletions.
91 changes: 90 additions & 1 deletion api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ service Wallet {
};

rpc GetAccountBalance (AccountBalanceRequest) returns (AccountBalanceResponse) {
option (google.api.http) = {
option (google.api.http) = {
post: "/wallet/getaccountbalance"
body: "*"
additional_bindings {
Expand Down Expand Up @@ -224,6 +224,10 @@ service Wallet {
//Use this function instead of FreezeBalance.
rpc FreezeBalance2 (FreezeBalanceContract) returns (TransactionExtention) {
}
//Use this function when FreezeBalanceV2.
rpc FreezeBalanceV2 (FreezeBalanceV2Contract) returns (TransactionExtention) {
}

//Please use UnfreezeBalance2 instead of this function.
rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) {
option (google.api.http) = {
Expand All @@ -237,6 +241,10 @@ service Wallet {
//Use this function instead of UnfreezeBalance.
rpc UnfreezeBalance2 (UnfreezeBalanceContract) returns (TransactionExtention) {
}
//Use this function when UnfreezeBalanceV2.
rpc UnfreezeBalanceV2 (UnfreezeBalanceV2Contract) returns (TransactionExtention) {
}

//Please use UnfreezeAsset2 instead of this function.
rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) {
option (google.api.http) = {
Expand All @@ -263,6 +271,16 @@ service Wallet {
//Use this function instead of WithdrawBalance.
rpc WithdrawBalance2 (WithdrawBalanceContract) returns (TransactionExtention) {
}

rpc WithdrawExpireUnfreeze (WithdrawExpireUnfreezeContract) returns (TransactionExtention) {
}

rpc DelegateResource (DelegateResourceContract) returns (TransactionExtention) {
}

rpc UnDelegateResource (UnDelegateResourceContract) returns (TransactionExtention) {
}

//Please use UpdateAsset2 instead of this function.
rpc UpdateAsset (UpdateAssetContract) returns (Transaction) {
option (google.api.http) = {
Expand Down Expand Up @@ -462,6 +480,9 @@ service Wallet {
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
}

rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
}

rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) {
}

Expand All @@ -479,9 +500,26 @@ service Wallet {
rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) {
};

rpc GetDelegatedResourceV2 (DelegatedResourceMessage) returns (DelegatedResourceList) {
};

rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) {
};

rpc GetDelegatedResourceAccountIndexV2 (BytesMessage) returns (DelegatedResourceAccountIndex) {
};

rpc GetCanDelegatedMaxSize (CanDelegatedMaxSizeRequestMessage) returns (CanDelegatedMaxSizeResponseMessage) {
};

rpc GetAvailableUnfreezeCount (GetAvailableUnfreezeCountRequestMessage)
returns (GetAvailableUnfreezeCountResponseMessage) {
};

rpc GetCanWithdrawUnfreezeAmount (CanWithdrawUnfreezeAmountRequestMessage)
returns (CanWithdrawUnfreezeAmountResponseMessage) {
}

rpc ListProposals (EmptyMessage) returns (ProposalList) {
option (google.api.http) = {
post: "/wallet/listproposals"
Expand Down Expand Up @@ -883,9 +921,26 @@ service WalletSolidity {
rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) {
};

rpc GetDelegatedResourceV2 (DelegatedResourceMessage) returns (DelegatedResourceList) {
};

rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) {
};

rpc GetDelegatedResourceAccountIndexV2 (BytesMessage) returns (DelegatedResourceAccountIndex) {
};

rpc GetCanDelegatedMaxSize (CanDelegatedMaxSizeRequestMessage) returns (CanDelegatedMaxSizeResponseMessage) {
};

rpc GetAvailableUnfreezeCount (GetAvailableUnfreezeCountRequestMessage)
returns (GetAvailableUnfreezeCountResponseMessage) {
};

rpc GetCanWithdrawUnfreezeAmount (CanWithdrawUnfreezeAmountRequestMessage)
returns (CanWithdrawUnfreezeAmountResponseMessage) {
}

rpc GetExchangeById (BytesMessage) returns (Exchange) {
};

Expand Down Expand Up @@ -957,6 +1012,9 @@ service WalletSolidity {
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
}

rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
}

rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
}

Expand Down Expand Up @@ -1100,6 +1158,31 @@ message DelegatedResourceList {
repeated DelegatedResource delegatedResource = 1;
}

message GetAvailableUnfreezeCountRequestMessage {
bytes owner_address = 1;
}
message GetAvailableUnfreezeCountResponseMessage {
int64 count = 1;
}

//GetCanDelegatedMaxSize
message CanDelegatedMaxSizeRequestMessage {
int32 type = 1;
bytes owner_address = 2;
}
message CanDelegatedMaxSizeResponseMessage {
int64 max_size = 1;
}

//GetCanWithdrawUnfreezeAmount
message CanWithdrawUnfreezeAmountRequestMessage {
bytes owner_address = 1;
int64 timestamp = 2;
}
message CanWithdrawUnfreezeAmountResponseMessage {
int64 amount = 1;
}

// Gossip node list
message NodeList {
repeated Node nodes = 1;
Expand Down Expand Up @@ -1233,6 +1316,12 @@ message TransactionExtention {
int64 energy_used = 5;
repeated TransactionInfo.Log logs = 6;
repeated InternalTransaction internal_transactions = 7;
int64 energy_penalty = 8;
}

message EstimateEnergyMessage {
Return result = 1;
int64 energy_required = 2;
}

message BlockExtention {
Expand Down
33 changes: 32 additions & 1 deletion core/Tron.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

import "google/protobuf/any.proto";
import "core/Discover.proto";
import "core/contract/common.proto";

package protocol;

Expand Down Expand Up @@ -191,6 +192,8 @@ message Account {
// the identity of this account, case insensitive
bytes account_id = 23;

int64 net_window_size = 24;

message AccountResource {
// energy resource, get from frozen
int64 energy_usage = 1;
Expand All @@ -208,12 +211,31 @@ message Account {
int64 storage_usage = 7;
int64 latest_exchange_storage_time = 8;

int64 energy_window_size = 9;

int64 delegated_frozenV2_balance_for_energy = 10;
int64 acquired_delegated_frozenV2_balance_for_energy = 11;
}
AccountResource account_resource = 26;
bytes codeHash = 30;
Permission owner_permission = 31;
Permission witness_permission = 32;
repeated Permission active_permission = 33;

message FreezeV2 {
ResourceCode type = 1;
int64 amount = 2;
}
message UnFreezeV2 {
ResourceCode type = 1;
int64 unfreeze_amount = 3;
int64 unfreeze_expire_time = 4;
}
repeated FreezeV2 frozenV2 = 34;
repeated UnFreezeV2 unfrozenV2 = 35;

int64 delegated_frozenV2_balance_for_bandwidth = 36;
int64 acquired_delegated_frozenV2_balance_for_bandwidth = 37;
}

message Key {
Expand Down Expand Up @@ -299,6 +321,7 @@ message ResourceReceipt {
int64 net_usage = 5;
int64 net_fee = 6;
Transaction.Result.contractResult result = 7;
int64 energy_penalty_total = 8;
}

message MarketOrderDetail {
Expand Down Expand Up @@ -346,6 +369,11 @@ message Transaction {
ShieldedTransferContract = 51;
MarketSellAssetContract = 52;
MarketCancelOrderContract = 53;
FreezeBalanceV2Contract = 54;
UnfreezeBalanceV2Contract = 55;
WithdrawExpireUnfreezeContract = 56;
DelegateResourceContract = 57;
UnDelegateResourceContract = 58;
}
ContractType type = 1;
google.protobuf.Any parameter = 2;
Expand Down Expand Up @@ -393,6 +421,7 @@ message Transaction {

bytes orderId = 25;
repeated MarketOrderDetail orderDetails = 26;
int64 withdraw_expire_amount = 27;
}

message raw {
Expand Down Expand Up @@ -451,6 +480,8 @@ message TransactionInfo {
bytes orderId = 25;
repeated MarketOrderDetail orderDetails = 26;
int64 packingFee = 27;

int64 withdraw_expire_amount = 28;
}

message TransactionRet {
Expand Down Expand Up @@ -550,7 +581,7 @@ enum ReasonCode {
TOO_MANY_PEERS = 0x04;
DUPLICATE_PEER = 0x05;
INCOMPATIBLE_PROTOCOL = 0x06;
NULL_IDENTITY = 0x07;
RANDOM_ELIMINATION = 0x07;
PEER_QUITING = 0x08;
UNEXPECTED_IDENTITY = 0x09;
LOCAL_IDENTITY = 0x0A;
Expand Down
31 changes: 31 additions & 0 deletions core/contract/balance_contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,34 @@ message AccountBalanceResponse {
int64 balance = 1;
BlockBalanceTrace.BlockIdentifier block_identifier = 2;
}

message FreezeBalanceV2Contract {
bytes owner_address = 1;
int64 frozen_balance = 2;
ResourceCode resource = 3;
}

message UnfreezeBalanceV2Contract {
bytes owner_address = 1;
int64 unfreeze_balance = 2;
ResourceCode resource = 3;
}

message WithdrawExpireUnfreezeContract {
bytes owner_address = 1;
}

message DelegateResourceContract {
bytes owner_address = 1;
ResourceCode resource = 2;
int64 balance = 3;
bytes receiver_address = 4;
bool lock = 5;
}

message UnDelegateResourceContract {
bytes owner_address = 1;
ResourceCode resource = 2;
int64 balance = 3;
bytes receiver_address = 4;
}
8 changes: 8 additions & 0 deletions core/contract/smart_contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ message SmartContract {
int64 origin_energy_limit = 8;
bytes code_hash = 9;
bytes trx_hash = 10;
int32 version = 11;
}

message ContractState {
int64 energy_usage = 1;
int64 energy_factor = 2;
int64 update_cycle = 3;
}

message CreateSmartContract {
Expand Down Expand Up @@ -93,4 +100,5 @@ message UpdateEnergyLimitContract {
message SmartContractDataWrapper {
SmartContract smart_contract = 1;
bytes runtimecode = 2;
ContractState contract_state = 3;
}

0 comments on commit 393732a

Please sign in to comment.