Skip to content

Commit 4ce756d

Browse files
committed
feat(stake): add new protobuf
1. modify api.proto 2. modify smart_contract.proto 3. modify Tron.proto
1 parent 0c3abf9 commit 4ce756d

File tree

3 files changed

+452
-148
lines changed

3 files changed

+452
-148
lines changed

src/main/protos/api/api.proto

Lines changed: 148 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import "core/contract/balance_contract.proto";
1111
import "core/contract/proposal_contract.proto";
1212
import "core/contract/storage_contract.proto";
1313
import "core/contract/exchange_contract.proto";
14+
import "core/contract/market_contract.proto";
1415
import "core/contract/smart_contract.proto";
1516
import "core/contract/shield_contract.proto";
16-
import "core/contract/market_contract.proto";
1717

1818
option java_package = "org.tron.api"; //Specify the name of the package that generated the Java file
1919
option java_outer_classname = "GrpcAPI"; //Specify the class name of the generated Java file
@@ -41,7 +41,6 @@ service Wallet {
4141
};
4242
};
4343

44-
4544
rpc GetAccountBalance (AccountBalanceRequest) returns (AccountBalanceResponse) {
4645
option (google.api.http) = {
4746
post: "/wallet/getaccountbalance"
@@ -62,7 +61,6 @@ service Wallet {
6261
};
6362
};
6463

65-
6664
//Please use CreateTransaction2 instead of this function.
6765
rpc CreateTransaction (TransferContract) returns (Transaction) {
6866
option (google.api.http) = {
@@ -226,6 +224,10 @@ service Wallet {
226224
//Use this function instead of FreezeBalance.
227225
rpc FreezeBalance2 (FreezeBalanceContract) returns (TransactionExtention) {
228226
}
227+
//Use this function when FreezeBalanceV2.
228+
rpc FreezeBalanceV2 (FreezeBalanceV2Contract) returns (TransactionExtention) {
229+
}
230+
229231
//Please use UnfreezeBalance2 instead of this function.
230232
rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) {
231233
option (google.api.http) = {
@@ -239,6 +241,10 @@ service Wallet {
239241
//Use this function instead of UnfreezeBalance.
240242
rpc UnfreezeBalance2 (UnfreezeBalanceContract) returns (TransactionExtention) {
241243
}
244+
//Use this function when UnfreezeBalanceV2.
245+
rpc UnfreezeBalanceV2 (UnfreezeBalanceV2Contract) returns (TransactionExtention) {
246+
}
247+
242248
//Please use UnfreezeAsset2 instead of this function.
243249
rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) {
244250
option (google.api.http) = {
@@ -265,6 +271,16 @@ service Wallet {
265271
//Use this function instead of WithdrawBalance.
266272
rpc WithdrawBalance2 (WithdrawBalanceContract) returns (TransactionExtention) {
267273
}
274+
275+
rpc WithdrawExpireUnfreeze (WithdrawExpireUnfreezeContract) returns (TransactionExtention) {
276+
}
277+
278+
rpc DelegateResource (DelegateResourceContract) returns (TransactionExtention) {
279+
}
280+
281+
rpc UnDelegateResource (UnDelegateResourceContract) returns (TransactionExtention) {
282+
}
283+
268284
//Please use UpdateAsset2 instead of this function.
269285
rpc UpdateAsset (UpdateAssetContract) returns (Transaction) {
270286
option (google.api.http) = {
@@ -309,6 +325,28 @@ service Wallet {
309325
rpc ExchangeTransaction (ExchangeTransactionContract) returns (TransactionExtention) {
310326
}
311327

328+
rpc MarketSellAsset (MarketSellAssetContract) returns (TransactionExtention) {
329+
}
330+
331+
rpc MarketCancelOrder (MarketCancelOrderContract) returns (TransactionExtention) {
332+
}
333+
334+
rpc GetMarketOrderById (BytesMessage) returns (MarketOrder) {
335+
}
336+
337+
rpc GetMarketOrderByAccount (BytesMessage) returns (MarketOrderList) {
338+
}
339+
340+
rpc GetMarketPriceByPair (MarketOrderPair) returns (MarketPriceList) {
341+
}
342+
343+
rpc GetMarketOrderListByPair (MarketOrderPair) returns (MarketOrderList) {
344+
}
345+
346+
rpc GetMarketPairList (EmptyMessage) returns (MarketOrderPairList) {
347+
}
348+
349+
312350
rpc ListNodes (EmptyMessage) returns (NodeList) {
313351
option (google.api.http) = {
314352
post: "/wallet/listnodes"
@@ -442,6 +480,9 @@ service Wallet {
442480
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
443481
}
444482

483+
rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
484+
}
485+
445486
rpc ClearContractABI (ClearABIContract) returns (TransactionExtention) {
446487
}
447488

@@ -459,6 +500,26 @@ service Wallet {
459500
rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) {
460501
};
461502

503+
rpc GetDelegatedResourceV2 (DelegatedResourceMessage) returns (DelegatedResourceList) {
504+
};
505+
506+
rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) {
507+
};
508+
509+
rpc GetDelegatedResourceAccountIndexV2 (BytesMessage) returns (DelegatedResourceAccountIndex) {
510+
};
511+
512+
rpc GetCanDelegatedMaxSize (CanDelegatedMaxSizeRequestMessage) returns (CanDelegatedMaxSizeResponseMessage) {
513+
};
514+
515+
rpc GetAvailableUnfreezeCount (GetAvailableUnfreezeCountRequestMessage)
516+
returns (GetAvailableUnfreezeCountResponseMessage) {
517+
};
518+
519+
rpc GetCanWithdrawUnfreezeAmount (CanWithdrawUnfreezeAmountRequestMessage)
520+
returns (CanWithdrawUnfreezeAmountResponseMessage) {
521+
}
522+
462523
rpc ListProposals (EmptyMessage) returns (ProposalList) {
463524
option (google.api.http) = {
464525
post: "/wallet/listproposals"
@@ -728,7 +789,6 @@ service Wallet {
728789

729790
rpc CreateShieldNullifier (NfParameters) returns (BytesMessage) {
730791
};
731-
// end for shiededTransaction
732792

733793
//for shielded contract
734794
rpc CreateShieldedContractParameters (PrivateShieldedTRC20Parameters) returns (ShieldedTRC20Parameters) {
@@ -748,36 +808,26 @@ service Wallet {
748808

749809
rpc GetTriggerInputForShieldedTRC20Contract (ShieldedTRC20TriggerContractParameters) returns (BytesMessage) {
750810
};
751-
// end for shieldedTransaction
811+
// end for shiededTransaction
752812

753813
rpc CreateCommonTransaction (Transaction) returns (TransactionExtention) {
754814
};
755815

756816
rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
757817
}
758818

759-
// for market
760-
rpc MarketSellAsset (MarketSellAssetContract) returns (TransactionExtention) {
819+
rpc GetBurnTrx (EmptyMessage) returns (NumberMessage) {
761820
}
762821

763-
rpc MarketCancelOrder (MarketCancelOrderContract) returns (TransactionExtention) {
822+
rpc GetTransactionFromPending (BytesMessage) returns (Transaction) {
764823
}
765824

766-
rpc GetMarketOrderByAccount (BytesMessage) returns (MarketOrderList) {
825+
rpc GetTransactionListFromPending (EmptyMessage) returns (TransactionIdList) {
767826
}
768827

769-
rpc GetMarketOrderById (BytesMessage) returns (MarketOrder) {
828+
rpc GetPendingSize (EmptyMessage) returns (NumberMessage) {
770829
}
771830

772-
rpc GetMarketPriceByPair (MarketOrderPair) returns (MarketPriceList) {
773-
}
774-
775-
rpc GetMarketOrderListByPair (MarketOrderPair) returns (MarketOrderList) {
776-
}
777-
778-
rpc GetMarketPairList (EmptyMessage) returns (MarketOrderPairList) {
779-
}
780-
// end for market
781831
rpc GetBlock (BlockReq) returns (BlockExtention) {
782832
}
783833
};
@@ -871,9 +921,26 @@ service WalletSolidity {
871921
rpc GetDelegatedResource (DelegatedResourceMessage) returns (DelegatedResourceList) {
872922
};
873923

924+
rpc GetDelegatedResourceV2 (DelegatedResourceMessage) returns (DelegatedResourceList) {
925+
};
926+
874927
rpc GetDelegatedResourceAccountIndex (BytesMessage) returns (DelegatedResourceAccountIndex) {
875928
};
876929

930+
rpc GetDelegatedResourceAccountIndexV2 (BytesMessage) returns (DelegatedResourceAccountIndex) {
931+
};
932+
933+
rpc GetCanDelegatedMaxSize (CanDelegatedMaxSizeRequestMessage) returns (CanDelegatedMaxSizeResponseMessage) {
934+
};
935+
936+
rpc GetAvailableUnfreezeCount (GetAvailableUnfreezeCountRequestMessage)
937+
returns (GetAvailableUnfreezeCountResponseMessage) {
938+
};
939+
940+
rpc GetCanWithdrawUnfreezeAmount (CanWithdrawUnfreezeAmountRequestMessage)
941+
returns (CanWithdrawUnfreezeAmountResponseMessage) {
942+
}
943+
877944
rpc GetExchangeById (BytesMessage) returns (Exchange) {
878945
};
879946

@@ -945,15 +1012,18 @@ service WalletSolidity {
9451012
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {
9461013
}
9471014

948-
rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
1015+
rpc EstimateEnergy (TriggerSmartContract) returns (EstimateEnergyMessage) {
9491016
}
9501017

951-
rpc GetMarketOrderByAccount (BytesMessage) returns (MarketOrderList) {
1018+
rpc GetTransactionInfoByBlockNum (NumberMessage) returns (TransactionInfoList) {
9521019
}
9531020

9541021
rpc GetMarketOrderById (BytesMessage) returns (MarketOrder) {
9551022
}
9561023

1024+
rpc GetMarketOrderByAccount (BytesMessage) returns (MarketOrderList) {
1025+
}
1026+
9571027
rpc GetMarketPriceByPair (MarketOrderPair) returns (MarketPriceList) {
9581028
}
9591029

@@ -962,6 +1032,9 @@ service WalletSolidity {
9621032

9631033
rpc GetMarketPairList (EmptyMessage) returns (MarketOrderPairList) {
9641034
}
1035+
1036+
rpc GetBurnTrx (EmptyMessage) returns (NumberMessage) {
1037+
}
9651038
rpc GetBlock (BlockReq) returns (BlockExtention) {
9661039
}
9671040
};
@@ -1012,6 +1085,18 @@ service Database {
10121085
}
10131086
};
10141087

1088+
service Monitor {
1089+
rpc GetStatsInfo (EmptyMessage) returns (MetricsInfo) {
1090+
option (google.api.http) = {
1091+
post: "/monitor/getstatsinfo"
1092+
body: "*"
1093+
additional_bindings {
1094+
get: "/monitor/getstatsinfo"
1095+
}
1096+
};
1097+
}
1098+
}
1099+
10151100
message Return {
10161101
enum response_code {
10171102
SUCCESS = 0;
@@ -1062,6 +1147,9 @@ message BlockList {
10621147
message TransactionList {
10631148
repeated Transaction transaction = 1;
10641149
}
1150+
message TransactionIdList {
1151+
repeated string txId = 1;
1152+
}
10651153
message DelegatedResourceMessage {
10661154
bytes fromAddress = 1;
10671155
bytes toAddress = 2;
@@ -1070,6 +1158,31 @@ message DelegatedResourceList {
10701158
repeated DelegatedResource delegatedResource = 1;
10711159
}
10721160

1161+
message GetAvailableUnfreezeCountRequestMessage {
1162+
bytes owner_address = 1;
1163+
}
1164+
message GetAvailableUnfreezeCountResponseMessage {
1165+
int64 count = 1;
1166+
}
1167+
1168+
//GetCanDelegatedMaxSize
1169+
message CanDelegatedMaxSizeRequestMessage {
1170+
int32 type = 1;
1171+
bytes owner_address = 2;
1172+
}
1173+
message CanDelegatedMaxSizeResponseMessage {
1174+
int64 max_size = 1;
1175+
}
1176+
1177+
//GetCanWithdrawUnfreezeAmount
1178+
message CanWithdrawUnfreezeAmountRequestMessage {
1179+
bytes owner_address = 1;
1180+
int64 timestamp = 2;
1181+
}
1182+
message CanWithdrawUnfreezeAmountResponseMessage {
1183+
int64 amount = 1;
1184+
}
1185+
10731186
// Gossip node list
10741187
message NodeList {
10751188
repeated Node nodes = 1;
@@ -1187,7 +1300,7 @@ message EasyTransferAssetByPrivateMessage {
11871300
message EasyTransferResponse {
11881301
Transaction transaction = 1;
11891302
Return result = 2;
1190-
bytes txid = 3; //transaction id = sha256(transaction.raw_data)
1303+
bytes txid = 3; //transaction id = sha256(transaction.rowdata)
11911304
}
11921305

11931306
message AddressPrKeyPairMessage {
@@ -1197,12 +1310,18 @@ message AddressPrKeyPairMessage {
11971310

11981311
message TransactionExtention {
11991312
Transaction transaction = 1;
1200-
bytes txid = 2; //transaction id = sha256(transaction.raw_data)
1313+
bytes txid = 2; //transaction id = sha256(transaction.rowdata)
12011314
repeated bytes constant_result = 3;
12021315
Return result = 4;
12031316
int64 energy_used = 5;
12041317
repeated TransactionInfo.Log logs = 6;
12051318
repeated InternalTransaction internal_transactions = 7;
1319+
int64 energy_penalty = 8;
1320+
}
1321+
1322+
message EstimateEnergyMessage {
1323+
Return result = 1;
1324+
int64 energy_required = 2;
12061325
}
12071326

12081327
message BlockExtention {
@@ -1285,7 +1404,7 @@ message OvkDecryptParameters {
12851404
message DecryptNotes {
12861405
message NoteTx {
12871406
Note note = 1;
1288-
bytes txid = 2; //transaction id = sha256(transaction.raw_data)
1407+
bytes txid = 2; //transaction id = sha256(transaction.rowdata)
12891408
int32 index = 3; //the index of note in receive
12901409
}
12911410
repeated NoteTx noteTxs = 1;
@@ -1294,7 +1413,7 @@ message DecryptNotes {
12941413
message DecryptNotesMarked {
12951414
message NoteTx {
12961415
Note note = 1;
1297-
bytes txid = 2; //transaction id = sha256(transaction.raw_data)
1416+
bytes txid = 2; //transaction id = sha256(transaction.rowdata)
12981417
int32 index = 3; //the index of note in receive
12991418
bool is_spend = 4;
13001419
}
@@ -1329,7 +1448,7 @@ message PrivateParameters {
13291448
repeated ReceiveNote shielded_receives = 7;
13301449
bytes transparent_to_address = 8;
13311450
int64 to_amount = 9;
1332-
int64 timeout = 10; // timeout in seconds, it works only when it bigger than 0
1451+
int64 timeout = 10; // timeout in seconds, it works only when it bigger than 0
13331452
}
13341453

13351454
message PrivateParametersWithoutAsk {
@@ -1342,7 +1461,7 @@ message PrivateParametersWithoutAsk {
13421461
repeated ReceiveNote shielded_receives = 7;
13431462
bytes transparent_to_address = 8;
13441463
int64 to_amount = 9;
1345-
int64 timeout = 10; // timeout in seconds, it works only when it bigger than 0
1464+
int64 timeout = 10; // timeout in seconds, it works only when it bigger than 0
13461465
}
13471466

13481467
message SpendAuthSigParameters {
@@ -1388,7 +1507,7 @@ message PaymentAddressMessage {
13881507
string payment_address = 3;
13891508
}
13901509

1391-
message ShieldedAddressInfo{
1510+
message ShieldedAddressInfo {
13921511
bytes sk = 1;
13931512
bytes ask = 2;
13941513
bytes nsk = 3;
@@ -1507,4 +1626,4 @@ message ShieldedTRC20TriggerContractParameters {
15071626
repeated BytesMessage spend_authority_signature = 2;
15081627
string amount = 3;
15091628
bytes transparent_to_address = 4;
1510-
}
1629+
}

0 commit comments

Comments
 (0)