diff --git a/build-protobufs.sh b/build-protobufs.sh new file mode 100755 index 0000000..4e0b43b --- /dev/null +++ b/build-protobufs.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +docker run --rm -v $(pwd):$(pwd) -w $(pwd) znly/protoc \ + --proto_path=protobuf \ + --js_out=import_style=commonjs,binary:src/protocol \ + protobuf/core/*.proto protobuf/api/*.proto diff --git a/package.json b/package.json index b8e9407..92dcb81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tronscan/client", - "version": "0.2.26", + "version": "0.2.29", "description": "Tronscan API Client", "main": "src/index.js", "homepage": "https://api.tronscan.org/", diff --git a/protobuf/api/api.proto b/protobuf/api/api.proto new file mode 100644 index 0000000..2373631 --- /dev/null +++ b/protobuf/api/api.proto @@ -0,0 +1,977 @@ +syntax = "proto3"; +package protocol; + +import "core/Tron.proto"; +import "core/Contract.proto"; +import "google/api/annotations.proto"; + + +option java_package = "org.tron.api"; //Specify the name of the package that generated the Java file +option java_outer_classname = "GrpcAPI"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/api"; + +service Wallet { + + rpc GetAccount (Account) returns (Account) { + option (google.api.http) = { + post: "/wallet/getaccount" + body: "*" + additional_bindings { + get: "/wallet/getaccount" + } + }; + }; + + rpc GetAccountById (Account) returns (Account) { + option (google.api.http) = { + post: "/wallet/getaccountbyid" + body: "*" + additional_bindings { + get: "/wallet/getaccountbyid" + } + }; + }; + + //Please use CreateTransaction2 instead of this function. + rpc CreateTransaction (TransferContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createtransaction" + body: "*" + additional_bindings { + get: "/wallet/createtransaction" + } + }; + }; + //Use this function instead of CreateTransaction. + rpc CreateTransaction2 (TransferContract) returns (TransactionExtention) { + }; + + rpc BroadcastTransaction (Transaction) returns (Return) { + option (google.api.http) = { + post: "/wallet/broadcasttransaction" + body: "*" + additional_bindings { + get: "/wallet/broadcasttransaction" + } + }; + }; + //Please use UpdateAccount2 instead of this function. + rpc UpdateAccount (AccountUpdateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/updateaccount" + body: "*" + additional_bindings { + get: "/wallet/updateaccount" + } + }; + }; + + + rpc SetAccountId (SetAccountIdContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/setaccountid" + body: "*" + additional_bindings { + get: "/wallet/setaccountid" + } + }; + }; + + //Use this function instead of UpdateAccount. + rpc UpdateAccount2 (AccountUpdateContract) returns (TransactionExtention) { + }; + + //Please use VoteWitnessAccount2 instead of this function. + rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/votewitnessaccount" + body: "*" + additional_bindings { + get: "/wallet/votewitnessaccount" + } + }; + }; + + //modify the consume_user_resource_percent + rpc UpdateSetting (UpdateSettingContract) returns (TransactionExtention) { + }; + + //Use this function instead of VoteWitnessAccount. + rpc VoteWitnessAccount2 (VoteWitnessContract) returns (TransactionExtention) { + }; + //Please use CreateAssetIssue2 instead of this function. + rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createassetissue" + body: "*" + additional_bindings { + get: "/wallet/createassetissue" + } + }; + }; + //Use this function instead of CreateAssetIssue. + rpc CreateAssetIssue2 (AssetIssueContract) returns (TransactionExtention) { + }; + //Please use UpdateWitness2 instead of this function. + rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/updatewitness" + body: "*" + additional_bindings { + get: "/wallet/updatewitness" + } + }; + }; + //Use this function instead of UpdateWitness. + rpc UpdateWitness2 (WitnessUpdateContract) returns (TransactionExtention) { + }; + //Please use CreateAccount2 instead of this function. + rpc CreateAccount (AccountCreateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createaccount" + body: "*" + additional_bindings { + get: "/wallet/createaccount" + } + }; + }; + //Use this function instead of CreateAccount. + rpc CreateAccount2 (AccountCreateContract) returns (TransactionExtention) { + } + //Please use CreateWitness2 instead of this function. + rpc CreateWitness (WitnessCreateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createwitness" + body: "*" + additional_bindings { + get: "/wallet/createwitness" + } + }; + }; + //Use this function instead of CreateWitness. + rpc CreateWitness2 (WitnessCreateContract) returns (TransactionExtention) { + } + //Please use TransferAsset2 instead of this function. + rpc TransferAsset (TransferAssetContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/transferasset" + body: "*" + additional_bindings { + get: "/wallet/transferasset" + } + }; + } + //Use this function instead of TransferAsset. + rpc TransferAsset2 (TransferAssetContract) returns (TransactionExtention) { + } + //Please use ParticipateAssetIssue2 instead of this function. + rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/participateassetissue" + body: "*" + additional_bindings { + get: "/wallet/participateassetissue" + } + }; + } + //Use this function instead of ParticipateAssetIssue. + rpc ParticipateAssetIssue2 (ParticipateAssetIssueContract) returns (TransactionExtention) { + } + //Please use FreezeBalance2 instead of this function. + rpc FreezeBalance (FreezeBalanceContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/freezebalance" + body: "*" + additional_bindings { + get: "/wallet/freezebalance" + } + }; + } + //Use this function instead of FreezeBalance. + rpc FreezeBalance2 (FreezeBalanceContract) returns (TransactionExtention) { + } + //Please use UnfreezeBalance2 instead of this function. + rpc UnfreezeBalance (UnfreezeBalanceContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/unfreezebalance" + body: "*" + additional_bindings { + get: "/wallet/unfreezebalance" + } + }; + } + //Use this function instead of UnfreezeBalance. + rpc UnfreezeBalance2 (UnfreezeBalanceContract) returns (TransactionExtention) { + } + //Please use UnfreezeAsset2 instead of this function. + rpc UnfreezeAsset (UnfreezeAssetContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/unfreezeasset" + body: "*" + additional_bindings { + get: "/wallet/unfreezeasset" + } + }; + } + //Use this function instead of UnfreezeAsset. + rpc UnfreezeAsset2 (UnfreezeAssetContract) returns (TransactionExtention) { + } + //Please use WithdrawBalance2 instead of this function. + rpc WithdrawBalance (WithdrawBalanceContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/withdrawbalance" + body: "*" + additional_bindings { + get: "/wallet/withdrawbalance" + } + }; + } + //Use this function instead of WithdrawBalance. + rpc WithdrawBalance2 (WithdrawBalanceContract) returns (TransactionExtention) { + } + //Please use UpdateAsset2 instead of this function. + rpc UpdateAsset (UpdateAssetContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/updateasset" + body: "*" + additional_bindings { + get: "/wallet/updateasset" + } + }; + } + //Use this function instead of UpdateAsset. + rpc UpdateAsset2 (UpdateAssetContract) returns (TransactionExtention) { + } + + rpc ProposalCreate (ProposalCreateContract) returns (TransactionExtention) { + } + + rpc ProposalApprove (ProposalApproveContract) returns (TransactionExtention) { + } + + rpc ProposalDelete (ProposalDeleteContract) returns (TransactionExtention) { + } + + rpc BuyStorage (BuyStorageContract) returns (TransactionExtention) { + } + + rpc BuyStorageBytes (BuyStorageBytesContract) returns (TransactionExtention) { + } + + rpc SellStorage (SellStorageContract) returns (TransactionExtention) { + } + + rpc ExchangeCreate (ExchangeCreateContract) returns (TransactionExtention) { + } + + rpc ExchangeInject (ExchangeInjectContract) returns (TransactionExtention) { + } + + rpc ExchangeWithdraw (ExchangeWithdrawContract) returns (TransactionExtention) { + } + + rpc ExchangeTransaction (ExchangeTransactionContract) returns (TransactionExtention) { + } + + rpc ListNodes (EmptyMessage) returns (NodeList) { + option (google.api.http) = { + post: "/wallet/listnodes" + body: "*" + additional_bindings { + get: "/wallet/listnodes" + } + }; + } + + rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) { + option (google.api.http) = { + post: "/wallet/getassetissuebyaccount" + body: "*" + additional_bindings { + get: "/wallet/getassetissuebyaccount" + } + }; + } + rpc GetAccountNet (Account) returns (AccountNetMessage) { + option (google.api.http) = { + post: "/wallet/getaccountnet" + body: "*" + additional_bindings { + get: "/wallet/getaccountnet" + } + }; + }; + rpc GetAccountResource (Account) returns (AccountResourceMessage) { + }; + rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { + option (google.api.http) = { + post: "/wallet/getassetissuebyname" + body: "*" + additional_bindings { + get: "/wallet/getassetissuebyname" + } + }; + } + //Please use GetNowBlock2 instead of this function. + rpc GetNowBlock (EmptyMessage) returns (Block) { + option (google.api.http) = { + post: "/wallet/getnowblock" + body: "*" + additional_bindings { + get: "/wallet/getnowblock" + } + }; + } + //Use this function instead of GetNowBlock. + rpc GetNowBlock2 (EmptyMessage) returns (BlockExtention) { + } + //Please use GetBlockByNum2 instead of this function. + rpc GetBlockByNum (NumberMessage) returns (Block) { + option (google.api.http) = { + post: "/wallet/getblockbynum" + body: "*" + additional_bindings { + get: "/wallet/getblockbynum" + } + }; + } + //Use this function instead of GetBlockByNum. + rpc GetBlockByNum2 (NumberMessage) returns (BlockExtention) { + } + + rpc GetTransactionCountByBlockNum (NumberMessage) returns (NumberMessage) { + } + + rpc GetBlockById (BytesMessage) returns (Block) { + option (google.api.http) = { + post: "/wallet/getblockbyid" + body: "*" + additional_bindings { + get: "/wallet/getblockbyid" + } + }; + } + //Please use GetBlockByLimitNext2 instead of this function. + rpc GetBlockByLimitNext (BlockLimit) returns (BlockList) { + option (google.api.http) = { + post: "/wallet/getblockbylimitnext" + body: "*" + additional_bindings { + get: "/wallet/getblockbylimitnext" + } + }; + } + //Use this function instead of GetBlockByLimitNext. + rpc GetBlockByLimitNext2 (BlockLimit) returns (BlockListExtention) { + } + //Please use GetBlockByLatestNum2 instead of this function. + rpc GetBlockByLatestNum (NumberMessage) returns (BlockList) { + option (google.api.http) = { + post: "/wallet/getblockbylatestnum" + body: "*" + additional_bindings { + get: "/wallet/getblockbylatestnum" + } + }; + } + //Use this function instead of GetBlockByLatestNum. + rpc GetBlockByLatestNum2 (NumberMessage) returns (BlockListExtention) { + } + rpc GetTransactionById (BytesMessage) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/gettransactionbyid" + body: "*" + additional_bindings { + get: "/wallet/gettransactionbyid" + } + }; + } + + rpc DeployContract (CreateSmartContract) returns (TransactionExtention) { + } + + rpc GetContract (BytesMessage) returns (SmartContract) { + } + + rpc TriggerContract (TriggerSmartContract) returns (TransactionExtention) { + } + + rpc ListWitnesses (EmptyMessage) returns (WitnessList) { + option (google.api.http) = { + post: "/wallet/listwitnesses" + body: "*" + additional_bindings { + get: "/wallet/listwitnesses" + } + }; + }; + + rpc ListProposals (EmptyMessage) returns (ProposalList) { + option (google.api.http) = { + post: "/wallet/listproposals" + body: "*" + additional_bindings { + get: "/wallet/listproposals" + } + }; + }; + rpc GetPaginatedProposalList (PaginatedMessage) returns (ProposalList) { + option (google.api.http) = { + post: "/wallet/getpaginatedproposallist" + body: "*" + additional_bindings { + get: "/wallet/getpaginatedproposallist" + } + }; + } + rpc GetProposalById (BytesMessage) returns (Proposal) { + option (google.api.http) = { + post: "/wallet/getproposalbyid" + body: "*" + additional_bindings { + get: "/wallet/getproposalbyid" + } + }; + }; + + rpc ListExchanges (EmptyMessage) returns (ExchangeList) { + option (google.api.http) = { + post: "/wallet/listexchanges" + body: "*" + additional_bindings { + get: "/wallet/listexchanges" + } + }; + }; + rpc GetPaginatedExchangeList (PaginatedMessage) returns (ExchangeList) { + option (google.api.http) = { + post: "/wallet/getpaginatedexchangelist" + body: "*" + additional_bindings { + get: "/wallet/getpaginatedexchangelist" + } + }; + } + rpc GetExchangeById (BytesMessage) returns (Exchange) { + option (google.api.http) = { + post: "/wallet/getexchangebyid" + body: "*" + additional_bindings { + get: "/wallet/getexchangebyid" + } + }; + }; + + rpc GetChainParameters (EmptyMessage) returns (ChainParameters) { + option (google.api.http) = { + post: "/wallet/getchainparameters" + body: "*" + additional_bindings { + get: "/wallet/getchainparameters" + } + }; + }; + + rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { + option (google.api.http) = { + post: "/wallet/getassetissuelist" + body: "*" + additional_bindings { + get: "/wallet/getassetissuelist" + } + }; + } + rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) { + option (google.api.http) = { + post: "/wallet/getpaginatedassetissuelist" + body: "*" + additional_bindings { + get: "/wallet/getpaginatedassetissuelist" + } + }; + } + + + rpc TotalTransaction (EmptyMessage) returns (NumberMessage) { + option (google.api.http) = { + post: "/wallet/totaltransaction" + body: "*" + additional_bindings { + get: "/wallet/totaltransaction" + } + }; + } + rpc GetNextMaintenanceTime (EmptyMessage) returns (NumberMessage) { + option (google.api.http) = { + post: "/wallet/getnextmaintenancetime" + body: "*" + additional_bindings { + get: "/wallet/getnextmaintenancetime" + } + }; + } + //Warning: do not invoke this interface provided by others. + //Please use GetTransactionSign2 instead of this function. + rpc GetTransactionSign (TransactionSign) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/gettransactionsign" + body: "*" + additional_bindings { + get: "/wallet/gettransactionsign" + } + }; + }; + //Warning: do not invoke this interface provided by others. + //Use this function instead of GetTransactionSign. + rpc GetTransactionSign2 (TransactionSign) returns (TransactionExtention) { + }; + //Warning: do not invoke this interface provided by others. + rpc CreateAddress (BytesMessage) returns (BytesMessage) { + option (google.api.http) = { + post: "/wallet/createaddress" + body: "*" + additional_bindings { + get: "/wallet/createaddress" + } + }; + }; + //Warning: do not invoke this interface provided by others. + rpc EasyTransfer (EasyTransferMessage) returns (EasyTransferResponse) { + option (google.api.http) = { + post: "/wallet/easytransfer" + body: "*" + additional_bindings { + get: "/wallet/easytransfer" + } + }; + }; + //Warning: do not invoke this interface provided by others. + rpc EasyTransferByPrivate (EasyTransferByPrivateMessage) returns (EasyTransferResponse) { + option (google.api.http) = { + post: "/wallet/easytransferbyprivate" + body: "*" + additional_bindings { + get: "/wallet/easytransferbyprivate" + } + }; + }; + //Warning: do not invoke this interface provided by others. + rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) { + + option (google.api.http) = { + post: "/wallet/generateaddress" + body: "*" + additional_bindings { + get: "/wallet/generateaddress" + } + }; + } + + rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) { + option (google.api.http) = { + post: "/wallet/gettransactioninfobyid" + body: "*" + additional_bindings { + get: "/wallet/gettransactioninfobyid" + } + }; + } + + rpc AccountPermissionUpdate (AccountPermissionUpdateContract) returns (TransactionExtention) { + option (google.api.http) = { + post: "/wallet/accountpermissionupdate" + body: "*" + additional_bindings { + get: "/wallet/accountpermissionupdate" + } + }; + } + + rpc PermissionAddKey (PermissionAddKeyContract) returns (TransactionExtention) { + option (google.api.http) = { + post: "/wallet/permissionaddkey" + body: "*" + additional_bindings { + get: "/wallet/permissionaddkey" + } + }; + } + + rpc PermissionUpdateKey (PermissionUpdateKeyContract) returns (TransactionExtention) { + option (google.api.http) = { + post: "/wallet/permissionupdatekey" + body: "*" + additional_bindings { + get: "/wallet/permissionupdatekey" + } + }; + } + + rpc PermissionDeleteKey (PermissionDeleteKeyContract) returns (TransactionExtention) { + option (google.api.http) = { + post: "/wallet/permissiondeletekey" + body: "*" + additional_bindings { + get: "/wallet/permissiondeletekey" + } + }; + } + + rpc AddSign (TransactionSign) returns (TransactionExtention) { + + } + + rpc GetTransactionSignWeight (Transaction) returns (TransactionSignWeight) { + + } +}; + + +service WalletSolidity { + + rpc GetAccount (Account) returns (Account) { + option (google.api.http) = { + post: "/walletsolidity/getaccount" + body: "*" + additional_bindings { + get: "/walletsolidity/getaccount" + } + }; + }; + rpc GetAccountById (Account) returns (Account) { + option (google.api.http) = { + post: "/walletsolidity/getaccountbyid" + body: "*" + additional_bindings { + get: "/walletsolidity/getaccountbyid" + } + }; + }; + + rpc ListWitnesses (EmptyMessage) returns (WitnessList) { + option (google.api.http) = { + post: "/walletsolidity/listwitnesses" + body: "*" + additional_bindings { + get: "/walletsolidity/listwitnesses" + } + }; + }; + rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { + option (google.api.http) = { + post: "/walletsolidity/getassetissuelist" + body: "*" + additional_bindings { + get: "/walletsolidity/getassetissuelist" + } + }; + } + rpc GetPaginatedAssetIssueList (PaginatedMessage) returns (AssetIssueList) { + option (google.api.http) = { + post: "/walletsolidity/getpaginatedassetissuelist" + body: "*" + additional_bindings { + get: "/walletsolidity/getpaginatedassetissuelist" + } + }; + } + //Please use GetNowBlock2 instead of this function. + rpc GetNowBlock (EmptyMessage) returns (Block) { + option (google.api.http) = { + post: "/walletsolidity/getnowblock" + body: "*" + additional_bindings { + get: "/walletsolidity/getnowblock" + } + }; + } + //Use this function instead of GetNowBlock. + rpc GetNowBlock2 (EmptyMessage) returns (BlockExtention) { + } + //Please use GetBlockByNum2 instead of this function. + rpc GetBlockByNum (NumberMessage) returns (Block) { + option (google.api.http) = { + post: "/walletsolidity/getblockbynum" + body: "*" + additional_bindings { + get: "/walletsolidity/getblockbynum" + } + }; + } + //Use this function instead of GetBlockByNum. + rpc GetBlockByNum2 (NumberMessage) returns (BlockExtention) { + } + + rpc GetTransactionCountByBlockNum (NumberMessage) returns (NumberMessage) { + } + + rpc GetTransactionById (BytesMessage) returns (Transaction) { + option (google.api.http) = { + post: "/walletsolidity/gettransactionbyid" + body: "*" + additional_bindings { + get: "/walletsolidity/gettransactionbyid" + } + }; + } + rpc GetTransactionInfoById (BytesMessage) returns (TransactionInfo) { + option (google.api.http) = { + post: "/walletsolidity/gettransactioninfobyid" + body: "*" + additional_bindings { + get: "/walletsolidity/gettransactioninfobyid" + } + }; + } + //Warning: do not invoke this interface provided by others. + rpc GenerateAddress (EmptyMessage) returns (AddressPrKeyPairMessage) { + option (google.api.http) = { + post: "/walletsolidity/generateaddress" + body: "*" + additional_bindings { + get: "/walletsolidity/generateaddress" + } + }; + } +}; + +service WalletExtension { + //Please use GetTransactionsFromThis2 instead of this function. + rpc GetTransactionsFromThis (AccountPaginated) returns (TransactionList) { + option (google.api.http) = { + post: "/walletextension/gettransactionsfromthis" + body: "*" + additional_bindings { + get: "/walletextension/gettransactionsfromthis" + } + }; + } + //Use this function instead of GetTransactionsFromThis. + rpc GetTransactionsFromThis2 (AccountPaginated) returns (TransactionListExtention) { + } + //Please use GetTransactionsToThis2 instead of this function. + rpc GetTransactionsToThis (AccountPaginated) returns (TransactionList) { + option (google.api.http) = { + post: "/walletextension/gettransactionstothis" + body: "*" + additional_bindings { + get: "/walletextension/gettransactionstothis" + } + }; + } + //Use this function instead of GetTransactionsToThis. + rpc GetTransactionsToThis2 (AccountPaginated) returns (TransactionListExtention) { + } +}; + +// the api of tron's db +service Database { + // for tapos + rpc getBlockReference (EmptyMessage) returns (BlockReference) { + + } + rpc GetDynamicProperties (EmptyMessage) returns (DynamicProperties) { + + } + rpc GetNowBlock (EmptyMessage) returns (Block) { + + } + rpc GetBlockByNum (NumberMessage) returns (Block) { + + } +}; + +message Return { + enum response_code { + SUCCESS = 0; + SIGERROR = 1; // error in signature + CONTRACT_VALIDATE_ERROR = 2; + CONTRACT_EXE_ERROR = 3; + BANDWITH_ERROR = 4; + DUP_TRANSACTION_ERROR = 5; + TAPOS_ERROR = 6; + TOO_BIG_TRANSACTION_ERROR = 7; + TRANSACTION_EXPIRATION_ERROR = 8; + SERVER_BUSY = 9; + OTHER_ERROR = 20; + } + + bool result = 1; + response_code code = 2; + bytes message = 3; +} + +message BlockReference { + int64 block_num = 1; + bytes block_hash = 2; +} + +// the api of tron's network such as node list. +service Network { + +}; + +message WitnessList { + repeated Witness witnesses = 1; +} +message ProposalList { + repeated Proposal proposals = 1; +} +message ExchangeList { + repeated Exchange exchanges = 1; +} +message AssetIssueList { + repeated AssetIssueContract assetIssue = 1; +} +message BlockList { + repeated Block block = 1; +} +message TransactionList { + repeated Transaction transaction = 1; +} + +// Gossip node list +message NodeList { + repeated Node nodes = 1; +} + +// Gossip node +message Node { + Address address = 1; +} + +// Gossip node address +message Address { + bytes host = 1; + int32 port = 2; +} + +message EmptyMessage { +} +message NumberMessage { + int64 num = 1; +} +message BytesMessage { + bytes value = 1; +} +message TimeMessage { + int64 beginInMilliseconds = 1; + int64 endInMilliseconds = 2; +} +message BlockLimit { + int64 startNum = 1; + int64 endNum = 2; +} +message TransactionLimit { + bytes transactionId = 1; + int64 limitNum = 2; +} +message AccountPaginated { + Account account = 1; + int64 offset = 2; + int64 limit = 3; +} +message TimePaginatedMessage { + TimeMessage timeMessage = 1; + int64 offset = 2; + int64 limit = 3; +} +//deprecated +message AccountNetMessage { + int64 freeNetUsed = 1; + int64 freeNetLimit = 2; + int64 NetUsed = 3; + int64 NetLimit = 4; + map assetNetUsed = 5; + map assetNetLimit = 6; + int64 TotalNetLimit = 7; + int64 TotalNetWeight = 8; +} +message AccountResourceMessage { + int64 freeNetUsed = 1; + int64 freeNetLimit = 2; + int64 NetUsed = 3; + int64 NetLimit = 4; + map assetNetUsed = 5; + map assetNetLimit = 6; + int64 TotalNetLimit = 7; + int64 TotalNetWeight = 8; + + int64 EnergyUsed = 13; + int64 EnergyLimit = 14; + int64 TotalEnergyLimit = 15; + int64 TotalEnergyWeight = 16; + + int64 storageUsed = 21; + int64 storageLimit = 22; +} + +message PaginatedMessage { + int64 offset = 1; + int64 limit = 2; +} + +message EasyTransferMessage { + bytes passPhrase = 1; + bytes toAddress = 2; + int64 amount = 3; +} + +message EasyTransferByPrivateMessage { + bytes privateKey = 1; + bytes toAddress = 2; + int64 amount = 3; +} + +message EasyTransferResponse { + Transaction transaction = 1; + Return result = 2; + bytes txid = 3; //transaction id = sha256(transaction.rowdata) +} + +message AddressPrKeyPairMessage { + string address = 1; + string privateKey = 2; +} + +message TransactionExtention { + Transaction transaction = 1; + bytes txid = 2; //transaction id = sha256(transaction.rowdata) + repeated bytes constant_result = 3; + Return result = 4; +} + +message BlockExtention { + repeated TransactionExtention transactions = 1; + BlockHeader block_header = 2; + bytes blockid = 3; +} + +message BlockListExtention { + repeated BlockExtention block = 1; +} + +message TransactionListExtention { + repeated TransactionExtention transaction = 1; +} + +message TransactionSignWeight { + message Result { + enum response_code { + ENOUGH_PERMISSION = 0; + NOT_ENOUGH_PERMISSION = 1; // error in + SIGNATURE_FORMAT_ERROR = 2; + COMPUTE_ADDRESS_ERROR = 3; + PERMISSION_ERROR = 4; //The key is not in permission + OTHER_ERROR = 20; + } + response_code code = 1; + string message = 2; + } + + Permission permission = 1; + repeated bytes approved_list = 2; + int64 current_weight = 3; + Result result = 4; + TransactionExtention transaction = 5; +} \ No newline at end of file diff --git a/protobuf/core/Contract.proto b/protobuf/core/Contract.proto new file mode 100644 index 0000000..6704bbf --- /dev/null +++ b/protobuf/core/Contract.proto @@ -0,0 +1,252 @@ +/* + * java-tron is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * java-tron is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file +option java_outer_classname = "Contract"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +import "core/Tron.proto"; + +message AccountCreateContract { + bytes owner_address = 1; + bytes account_address = 2; + AccountType type = 3; +} + +// Update account name. Account name is not unique now. +message AccountUpdateContract { + bytes account_name = 1; + bytes owner_address = 2; +} + +// Set account id if the account has no id. Account id is unique and case insensitive. +message SetAccountIdContract { + bytes account_id = 1; + bytes owner_address = 2; +} + +message TransferContract { + bytes owner_address = 1; + bytes to_address = 2; + int64 amount = 3; +} + +message TransferAssetContract { + bytes asset_name = 1; + bytes owner_address = 2; + bytes to_address = 3; + int64 amount = 4; +} + + +message VoteAssetContract { + bytes owner_address = 1; + repeated bytes vote_address = 2; + bool support = 3; + int32 count = 5; +} + +message VoteWitnessContract { + message Vote { + bytes vote_address = 1; + int64 vote_count = 2; + } + bytes owner_address = 1; + repeated Vote votes = 2; + bool support = 3; +} + +message UpdateSettingContract { + bytes owner_address = 1; + bytes contract_address = 2; + int64 consume_user_resource_percent = 3; +} + +message WitnessCreateContract { + bytes owner_address = 1; + bytes url = 2; +} + +message WitnessUpdateContract { + bytes owner_address = 1; + bytes update_url = 12; +} + +message AssetIssueContract { + message FrozenSupply { + int64 frozen_amount = 1; + int64 frozen_days = 2; + } + bytes owner_address = 1; + bytes name = 2; + bytes abbr = 3; + int64 total_supply = 4; + repeated FrozenSupply frozen_supply = 5; + int32 trx_num = 6; + int32 num = 8; + int64 start_time = 9; + int64 end_time = 10; + int64 order = 11; // the order of tokens of the same name + int32 vote_score = 16; + bytes description = 20; + bytes url = 21; + int64 free_asset_net_limit = 22; + int64 public_free_asset_net_limit = 23; + int64 public_free_asset_net_usage = 24; + int64 public_latest_free_net_time = 25; +} + +message ParticipateAssetIssueContract { + bytes owner_address = 1; + bytes to_address = 2; + bytes asset_name = 3; // the namekey of target asset, include name and order + int64 amount = 4; // the amount of drops +} + + +enum ResourceCode { + BANDWIDTH = 0x00; + ENERGY = 0x01; +} + +message FreezeBalanceContract { + bytes owner_address = 1; + int64 frozen_balance = 2; + int64 frozen_duration = 3; + + ResourceCode resource = 10; +} + +message UnfreezeBalanceContract { + bytes owner_address = 1; + + ResourceCode resource = 10; +} + +message UnfreezeAssetContract { + bytes owner_address = 1; +} + +message WithdrawBalanceContract { + bytes owner_address = 1; +} + +message UpdateAssetContract { + bytes owner_address = 1; + bytes description = 2; + bytes url = 3; + int64 new_limit = 4; + int64 new_public_limit = 5; +} + +message ProposalCreateContract { + bytes owner_address = 1; + map parameters = 2; +} + +message ProposalApproveContract { + bytes owner_address = 1; + int64 proposal_id = 2; + bool is_add_approval = 3; // add or remove approval +} + +message ProposalDeleteContract { + bytes owner_address = 1; + int64 proposal_id = 2; +} + +message CreateSmartContract { + bytes owner_address = 1; + SmartContract new_contract = 2; +} + +message TriggerSmartContract { + bytes owner_address = 1; + bytes contract_address = 2; + int64 call_value = 3; + bytes data = 4; +} + +message BuyStorageContract { + bytes owner_address = 1; + int64 quant = 2; // trx quantity for buy storage (sun) +} + +message BuyStorageBytesContract { + bytes owner_address = 1; + int64 bytes = 2; // storage bytes for buy +} + +message SellStorageContract { + bytes owner_address = 1; + int64 storage_bytes = 2; +} + +message ExchangeCreateContract { + bytes owner_address = 1; + bytes first_token_id = 2; + int64 first_token_balance = 3; + bytes second_token_id = 4; + int64 second_token_balance = 5; +} + +message ExchangeInjectContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; +} + +message ExchangeWithdrawContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; +} + +message ExchangeTransactionContract { + bytes owner_address = 1; + int64 exchange_id = 2; + bytes token_id = 3; + int64 quant = 4; + int64 expected = 5; +} + +message AccountPermissionUpdateContract { + bytes owner_address = 1; + repeated Permission permissions = 2; +} + +message PermissionAddKeyContract { + bytes owner_address = 1; + Key key = 2; + string permission_name = 3; +} + +message PermissionUpdateKeyContract { + bytes owner_address = 1; + Key key = 2; + string permission_name = 3; +} + +message PermissionDeleteKeyContract { + bytes owner_address = 1; + bytes key_address = 2; + string permission_name = 3; +} \ No newline at end of file diff --git a/protobuf/core/Discover.proto b/protobuf/core/Discover.proto new file mode 100644 index 0000000..4cc0d83 --- /dev/null +++ b/protobuf/core/Discover.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package protocol; + + +option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file +option java_outer_classname = "Discover"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message Endpoint { + bytes address = 1; + int32 port = 2; + bytes nodeId = 3; +} + +message PingMessage { + Endpoint from = 1; + Endpoint to = 2; + int32 version = 3; + int64 timestamp = 4; +} + +message PongMessage { + Endpoint from = 1; + int32 echo = 2; + int64 timestamp = 3; +} + +message FindNeighbours { + Endpoint from = 1; + bytes targetId = 2; + int64 timestamp = 3; +} + +message Neighbours { + Endpoint from = 1; + repeated Endpoint neighbours = 2; + int64 timestamp = 3; +} + +message BackupMessage { + bool flag = 1; + int32 priority = 2; +} \ No newline at end of file diff --git a/protobuf/core/Tron.proto b/protobuf/core/Tron.proto new file mode 100644 index 0000000..a9543cf --- /dev/null +++ b/protobuf/core/Tron.proto @@ -0,0 +1,521 @@ +syntax = "proto3"; + +import "google/protobuf/any.proto"; +import "core/Discover.proto"; + +package protocol; + + +option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file +option java_outer_classname = "Protocol"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +enum AccountType { + Normal = 0; + AssetIssue = 1; + Contract = 2; +} + +// AccountId, (name, address) use name, (null, address) use address, (name, null) use name, +message AccountId { + bytes name = 1; + bytes address = 2; +} + +// vote message +message Vote { + // the super rep address + bytes vote_address = 1; + // the vote num to this super rep. + int64 vote_count = 2; +} + +// Proposal +message Proposal { + int64 proposal_id = 1; + bytes proposer_address = 2; + map parameters = 3; + int64 expiration_time = 4; + int64 create_time = 5; + repeated bytes approvals = 6; + enum State { + PENDING = 0; + DISAPPROVED = 1; + APPROVED = 2; + CANCELED = 3; + } + State state = 7; +} + +// Exchange +message Exchange { + int64 exchange_id = 1; + bytes creator_address = 2; + int64 create_time = 3; + bytes first_token_id = 6; + int64 first_token_balance = 7; + bytes second_token_id = 8; + int64 second_token_balance = 9; +} + +message ChainParameters { + repeated ChainParameter chainParameter = 1; + message ChainParameter { + string key = 1; + int64 value = 2; + } +} + +/* Account */ +message Account { + /* frozen balance */ + message Frozen { + int64 frozen_balance = 1; // the frozen trx balance + int64 expire_time = 2; // the expire time + } + // account nick name + bytes account_name = 1; + AccountType type = 2; + // the create address + bytes address = 3; + // the trx balance + int64 balance = 4; + // the votes + repeated Vote votes = 5; + // the other asset owned by this account + map asset = 6; + + // the frozen balance + repeated Frozen frozen = 7; + // bandwidth, get from frozen + int64 net_usage = 8; + + // this account create time + int64 create_time = 0x09; + // this last operation time, including transfer, voting and so on. //FIXME fix grammar + int64 latest_opration_time = 10; + // witness block producing allowance + int64 allowance = 0x0B; + // last withdraw time + int64 latest_withdraw_time = 0x0C; + // not used so far + bytes code = 13; + bool is_witness = 14; + bool is_committee = 15; + // frozen asset(for asset issuer) + repeated Frozen frozen_supply = 16; + // asset_issued_name + bytes asset_issued_name = 17; + map latest_asset_operation_time = 18; + + int64 free_net_usage = 19; + map free_asset_net_usage = 20; + int64 latest_consume_time = 21; + int64 latest_consume_free_time = 22; + + // the identity of this account, case insensitive + bytes account_id = 23; + + message AccountResource { + // energy resource, get from frozen + int64 energy_usage = 1; + // the frozen balance for energy + Frozen frozen_balance_for_energy = 2; + int64 latest_consume_time_for_energy = 3; + + // storage resource, get from market + int64 storage_limit = 6; + int64 storage_usage = 7; + int64 latest_exchange_storage_time = 8; + } + AccountResource account_resource = 26; + bytes codeHash = 30; + repeated Permission permissions = 31; +} + +message Key { + bytes address = 1; + int64 weight = 2; +} + +message Permission { + string name = 1; + int64 threshold = 2; + string parent = 3; + repeated Key keys = 4; +} + +message authority { + AccountId account = 1; + bytes permission_name = 2; +} +// +//message permission { +// AccountId account = 1; +//} + +// Witness +message Witness { + bytes address = 1; + int64 voteCount = 2; + bytes pubKey = 3; + string url = 4; + int64 totalProduced = 5; + int64 totalMissed = 6; + int64 latestBlockNum = 7; + int64 latestSlotNum = 8; + bool isJobs = 9; +} + +// Vote Change +message Votes { + bytes address = 1; + repeated Vote old_votes = 2; + repeated Vote new_votes = 3; +} + +// Transcation + +message TXOutput { + int64 value = 1; + bytes pubKeyHash = 2; +} + +message TXInput { + message raw { + bytes txID = 1; + int64 vout = 2; + bytes pubKey = 3; + } + raw raw_data = 1; + bytes signature = 4; +} + +message TXOutputs { + repeated TXOutput outputs = 1; +} + +message ResourceReceipt { + int64 energy_usage = 1; + int64 energy_fee = 2; + int64 origin_energy_usage = 3; + int64 energy_usage_total = 4; + int64 net_usage = 5; + int64 net_fee = 6; + Transaction.Result.contractResult result = 7; +} + +message Transaction { + message Contract { + enum ContractType { + AccountCreateContract = 0; + TransferContract = 1; + TransferAssetContract = 2; + VoteAssetContract = 3; + VoteWitnessContract = 4; + WitnessCreateContract = 5; + AssetIssueContract = 6; + WitnessUpdateContract = 8; + ParticipateAssetIssueContract = 9; + AccountUpdateContract = 10; + FreezeBalanceContract = 11; + UnfreezeBalanceContract = 12; + WithdrawBalanceContract = 13; + UnfreezeAssetContract = 14; + UpdateAssetContract = 15; + ProposalCreateContract = 16; + ProposalApproveContract = 17; + ProposalDeleteContract = 18; + SetAccountIdContract = 19; + CustomContract = 20; + // BuyStorageContract = 21; + // BuyStorageBytesContract = 22; + // SellStorageContract = 23; + CreateSmartContract = 30; + TriggerSmartContract = 31; + GetContract = 32; + UpdateSettingContract = 33; + ExchangeCreateContract = 41; + ExchangeInjectContract = 42; + ExchangeWithdrawContract = 43; + ExchangeTransactionContract = 44; + AccountPermissionUpdateContract = 45; + PermissionAddKeyContract = 46; + PermissionUpdateKeyContract = 47; + PermissionDeleteKeyContract = 48; + } + ContractType type = 1; + google.protobuf.Any parameter = 2; + bytes provider = 3; + bytes ContractName = 4; + } + + message Result { + enum code { + SUCESS = 0; + FAILED = 1; + } + enum contractResult { + DEFAULT = 0; + SUCCESS = 1; + REVERT = 2; + BAD_JUMP_DESTINATION = 3; + OUT_OF_MEMORY = 4; + PRECOMPILED_CONTRACT = 5; + STACK_TOO_SMALL = 6; + STACK_TOO_LARGE = 7; + ILLEGAL_OPERATION = 8; + STACK_OVERFLOW = 9; + OUT_OF_ENERGY = 10; + OUT_OF_TIME = 11; + JVM_STACK_OVER_FLOW = 12; + UNKNOWN = 13; + } + int64 fee = 1; + code ret = 2; + contractResult contractRet = 3; + + int64 withdraw_amount = 15; + int64 unfreeze_amount = 16; + } + + message raw { + bytes ref_block_bytes = 1; + int64 ref_block_num = 3; + bytes ref_block_hash = 4; + int64 expiration = 8; + repeated authority auths = 9; + // data not used + bytes data = 10; + //only support size = 1, repeated list here for extension + repeated Contract contract = 11; + // scripts not used + bytes scripts = 12; + int64 timestamp = 14; + int64 fee_limit = 18; + } + + raw raw_data = 1; + // only support size = 1, repeated list here for muti-sig extension + repeated bytes signature = 2; + repeated Result ret = 5; +} + +message TransactionInfo { + enum code { + SUCESS = 0; + FAILED = 1; + } + message Log { + bytes address = 1; + repeated bytes topics = 2; + bytes data = 3; + } + bytes id = 1; + int64 fee = 2; + int64 blockNumber = 3; + int64 blockTimeStamp = 4; + repeated bytes contractResult = 5; + bytes contract_address = 6; + ResourceReceipt receipt = 7; + repeated Log log = 8; + code result = 9; + bytes resMessage = 10; + + int64 withdraw_amount = 15; + int64 unfreeze_amount = 16; + repeated InternalTransaction internal_transactions = 17; +} + +message Transactions { + repeated Transaction transactions = 1; +} + +message TransactionSign { + Transaction transaction = 1; + bytes privateKey = 2; +} + +message BlockHeader { + message raw { + int64 timestamp = 1; + bytes txTrieRoot = 2; + bytes parentHash = 3; + //bytes nonce = 5; + //bytes difficulty = 6; + int64 number = 7; + int64 witness_id = 8; + bytes witness_address = 9; + int32 version = 10; + } + raw raw_data = 1; + bytes witness_signature = 2; +} + +// block +message Block { + repeated Transaction transactions = 1; + BlockHeader block_header = 2; +} + +message ChainInventory { + message BlockId { + bytes hash = 1; + int64 number = 2; + } + repeated BlockId ids = 1; + int64 remain_num = 2; +} + +// Inventory +message BlockInventory { + enum Type { + SYNC = 0; + ADVTISE = 1; + FETCH = 2; + } + + message BlockId { + bytes hash = 1; + int64 number = 2; + } + repeated BlockId ids = 1; + Type type = 2; +} + +message Inventory { + enum InventoryType { + TRX = 0; + BLOCK = 1; + } + InventoryType type = 1; + repeated bytes ids = 2; +} + +message Items { + enum ItemType { + ERR = 0; + TRX = 1; + BLOCK = 2; + BLOCKHEADER = 3; + } + + ItemType type = 1; + repeated Block blocks = 2; + repeated BlockHeader block_headers = 3; + repeated Transaction transactions = 4; +} + +// DynamicProperties +message DynamicProperties { + int64 last_solidity_block_num = 1; +} + +enum ReasonCode { + REQUESTED = 0x00; + BAD_PROTOCOL = 0x02; + TOO_MANY_PEERS = 0x04; + DUPLICATE_PEER = 0x05; + INCOMPATIBLE_PROTOCOL = 0x06; + NULL_IDENTITY = 0x07; + PEER_QUITING = 0x08; + UNEXPECTED_IDENTITY = 0x09; + LOCAL_IDENTITY = 0x0A; + PING_TIMEOUT = 0x0B; + USER_REASON = 0x10; + RESET = 0x11; + SYNC_FAIL = 0x12; + FETCH_FAIL = 0x13; + BAD_TX = 0x14; + BAD_BLOCK = 0x15; + FORKED = 0x16; + UNLINKABLE = 0x17; + INCOMPATIBLE_VERSION = 0x18; + INCOMPATIBLE_CHAIN = 0x19; + TIME_OUT = 0x20; + CONNECT_FAIL = 0x21; + TOO_MANY_PEERS_WITH_SAME_IP = 0x22; + UNKNOWN = 0xFF; +} + +message DisconnectMessage { + ReasonCode reason = 1; +} + +message HelloMessage { + message BlockId { + bytes hash = 1; + int64 number = 2; + } + + Endpoint from = 1; + int32 version = 2; + int64 timestamp = 3; + BlockId genesisBlockId = 4; + BlockId solidBlockId = 5; + BlockId headBlockId = 6; +} + +message SmartContract { + message ABI { + message Entry { + enum EntryType { + UnknownEntryType = 0; + Constructor = 1; + Function = 2; + Event = 3; + Fallback = 4; + } + message Param { + bool indexed = 1; + string name = 2; + string type = 3; + // SolidityType type = 3; + } + enum StateMutabilityType { + UnknownMutabilityType = 0; + Pure = 1; + View = 2; + Nonpayable = 3; + Payable = 4; + } + + bool anonymous = 1; + bool constant = 2; + string name = 3; + repeated Param inputs = 4; + repeated Param outputs = 5; + EntryType type = 6; + bool payable = 7; + StateMutabilityType stateMutability = 8; + } + repeated Entry entrys = 1; + } + bytes origin_address = 1; + bytes contract_address = 2; + ABI abi = 3; + bytes bytecode = 4; + int64 call_value = 5; + int64 consume_user_resource_percent = 6; + string name = 7; + +} + +message InternalTransaction { + // internalTransaction identity, the root InternalTransaction hash + // should equals to root transaction id. + bytes hash = 1; + // the one send trx (TBD: or token) via function + bytes caller_address = 2; + // the one recieve trx (TBD: or token) via function + bytes transferTo_address = 3; + message CallValueInfo{ + // trx (TBD: or token) value + int64 callValue = 1; + // TBD: tokenName, trx should be empty + bytes tokenName = 2; + } + repeated CallValueInfo callValueInfo = 4; + bytes note = 5; + bool rejected = 6; +} \ No newline at end of file diff --git a/protobuf/core/TronInventoryItems.proto b/protobuf/core/TronInventoryItems.proto new file mode 100644 index 0000000..a82d2de --- /dev/null +++ b/protobuf/core/TronInventoryItems.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package protocol; + +option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file +option java_outer_classname = "TronInventoryItems"; //Specify the class name of the generated Java file +option go_package = "github.com/tronprotocol/grpc-gateway/core"; + +message InventoryItems { + int32 type = 1; + repeated bytes items = 2; +} \ No newline at end of file diff --git a/src/protocol/core/Contract_pb.js b/src/protocol/core/Contract_pb.js index bf81b5b..11d6be9 100644 --- a/src/protocol/core/Contract_pb.js +++ b/src/protocol/core/Contract_pb.js @@ -13,6 +13,7 @@ var global = Function('return this')(); var core_Tron_pb = require('../core/Tron_pb.js'); goog.exportSymbol('proto.protocol.AccountCreateContract', null, global); +goog.exportSymbol('proto.protocol.AccountPermissionUpdateContract', null, global); goog.exportSymbol('proto.protocol.AccountUpdateContract', null, global); goog.exportSymbol('proto.protocol.AssetIssueContract', null, global); goog.exportSymbol('proto.protocol.AssetIssueContract.FrozenSupply', null, global); @@ -25,6 +26,9 @@ goog.exportSymbol('proto.protocol.ExchangeTransactionContract', null, global); goog.exportSymbol('proto.protocol.ExchangeWithdrawContract', null, global); goog.exportSymbol('proto.protocol.FreezeBalanceContract', null, global); goog.exportSymbol('proto.protocol.ParticipateAssetIssueContract', null, global); +goog.exportSymbol('proto.protocol.PermissionAddKeyContract', null, global); +goog.exportSymbol('proto.protocol.PermissionDeleteKeyContract', null, global); +goog.exportSymbol('proto.protocol.PermissionUpdateKeyContract', null, global); goog.exportSymbol('proto.protocol.ProposalApproveContract', null, global); goog.exportSymbol('proto.protocol.ProposalCreateContract', null, global); goog.exportSymbol('proto.protocol.ProposalDeleteContract', null, global); @@ -230,7 +234,7 @@ proto.protocol.AccountCreateContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountCreateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -269,7 +273,7 @@ proto.protocol.AccountCreateContract.prototype.getAccountAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountCreateContract.prototype.setAccountAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -284,7 +288,7 @@ proto.protocol.AccountCreateContract.prototype.getType = function() { /** @param {!proto.protocol.AccountType} value */ proto.protocol.AccountCreateContract.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -462,7 +466,7 @@ proto.protocol.AccountUpdateContract.prototype.getAccountName_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountUpdateContract.prototype.setAccountName = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -501,7 +505,7 @@ proto.protocol.AccountUpdateContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountUpdateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -679,7 +683,7 @@ proto.protocol.SetAccountIdContract.prototype.getAccountId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.SetAccountIdContract.prototype.setAccountId = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -718,7 +722,7 @@ proto.protocol.SetAccountIdContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.SetAccountIdContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -908,7 +912,7 @@ proto.protocol.TransferContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransferContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -947,7 +951,7 @@ proto.protocol.TransferContract.prototype.getToAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransferContract.prototype.setToAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -962,7 +966,7 @@ proto.protocol.TransferContract.prototype.getAmount = function() { /** @param {number} value */ proto.protocol.TransferContract.prototype.setAmount = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -1164,7 +1168,7 @@ proto.protocol.TransferAssetContract.prototype.getAssetName_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransferAssetContract.prototype.setAssetName = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1203,7 +1207,7 @@ proto.protocol.TransferAssetContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.TransferAssetContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -1242,7 +1246,7 @@ proto.protocol.TransferAssetContract.prototype.getToAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransferAssetContract.prototype.setToAddress = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -1257,7 +1261,7 @@ proto.protocol.TransferAssetContract.prototype.getAmount = function() { /** @param {number} value */ proto.protocol.TransferAssetContract.prototype.setAmount = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -1466,7 +1470,7 @@ proto.protocol.VoteAssetContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.VoteAssetContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1536,7 +1540,7 @@ proto.protocol.VoteAssetContract.prototype.getSupport = function() { /** @param {boolean} value */ proto.protocol.VoteAssetContract.prototype.setSupport = function(value) { - jspb.Message.setProto3BooleanField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -1551,7 +1555,7 @@ proto.protocol.VoteAssetContract.prototype.getCount = function() { /** @param {number} value */ proto.protocol.VoteAssetContract.prototype.setCount = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -1890,7 +1894,7 @@ proto.protocol.VoteWitnessContract.Vote.prototype.getVoteAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.VoteWitnessContract.Vote.prototype.setVoteAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1905,7 +1909,7 @@ proto.protocol.VoteWitnessContract.Vote.prototype.getVoteCount = function() { /** @param {number} value */ proto.protocol.VoteWitnessContract.Vote.prototype.setVoteCount = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -1944,7 +1948,7 @@ proto.protocol.VoteWitnessContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.VoteWitnessContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1992,7 +1996,7 @@ proto.protocol.VoteWitnessContract.prototype.getSupport = function() { /** @param {boolean} value */ proto.protocol.VoteWitnessContract.prototype.setSupport = function(value) { - jspb.Message.setProto3BooleanField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -2182,7 +2186,7 @@ proto.protocol.UpdateSettingContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.UpdateSettingContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2221,7 +2225,7 @@ proto.protocol.UpdateSettingContract.prototype.getContractAddress_asU8 = functio /** @param {!(string|Uint8Array)} value */ proto.protocol.UpdateSettingContract.prototype.setContractAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -2236,7 +2240,7 @@ proto.protocol.UpdateSettingContract.prototype.getConsumeUserResourcePercent = f /** @param {number} value */ proto.protocol.UpdateSettingContract.prototype.setConsumeUserResourcePercent = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -2414,7 +2418,7 @@ proto.protocol.WitnessCreateContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.WitnessCreateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2453,7 +2457,7 @@ proto.protocol.WitnessCreateContract.prototype.getUrl_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.WitnessCreateContract.prototype.setUrl = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -2631,7 +2635,7 @@ proto.protocol.WitnessUpdateContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.WitnessUpdateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2670,7 +2674,7 @@ proto.protocol.WitnessUpdateContract.prototype.getUpdateUrl_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.WitnessUpdateContract.prototype.setUpdateUrl = function(value) { - jspb.Message.setProto3BytesField(this, 12, value); + jspb.Message.setField(this, 12, value); }; @@ -3153,7 +3157,7 @@ proto.protocol.AssetIssueContract.FrozenSupply.prototype.getFrozenAmount = funct /** @param {number} value */ proto.protocol.AssetIssueContract.FrozenSupply.prototype.setFrozenAmount = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -3168,7 +3172,7 @@ proto.protocol.AssetIssueContract.FrozenSupply.prototype.getFrozenDays = functio /** @param {number} value */ proto.protocol.AssetIssueContract.FrozenSupply.prototype.setFrozenDays = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -3207,7 +3211,7 @@ proto.protocol.AssetIssueContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AssetIssueContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -3246,7 +3250,7 @@ proto.protocol.AssetIssueContract.prototype.getName_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AssetIssueContract.prototype.setName = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -3285,7 +3289,7 @@ proto.protocol.AssetIssueContract.prototype.getAbbr_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AssetIssueContract.prototype.setAbbr = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -3300,7 +3304,7 @@ proto.protocol.AssetIssueContract.prototype.getTotalSupply = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setTotalSupply = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -3346,7 +3350,7 @@ proto.protocol.AssetIssueContract.prototype.getTrxNum = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setTrxNum = function(value) { - jspb.Message.setProto3IntField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -3361,7 +3365,7 @@ proto.protocol.AssetIssueContract.prototype.getNum = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setNum = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -3376,7 +3380,7 @@ proto.protocol.AssetIssueContract.prototype.getStartTime = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setStartTime = function(value) { - jspb.Message.setProto3IntField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -3391,7 +3395,7 @@ proto.protocol.AssetIssueContract.prototype.getEndTime = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setEndTime = function(value) { - jspb.Message.setProto3IntField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -3406,7 +3410,7 @@ proto.protocol.AssetIssueContract.prototype.getOrder = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setOrder = function(value) { - jspb.Message.setProto3IntField(this, 11, value); + jspb.Message.setField(this, 11, value); }; @@ -3421,7 +3425,7 @@ proto.protocol.AssetIssueContract.prototype.getVoteScore = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setVoteScore = function(value) { - jspb.Message.setProto3IntField(this, 16, value); + jspb.Message.setField(this, 16, value); }; @@ -3460,7 +3464,7 @@ proto.protocol.AssetIssueContract.prototype.getDescription_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AssetIssueContract.prototype.setDescription = function(value) { - jspb.Message.setProto3BytesField(this, 20, value); + jspb.Message.setField(this, 20, value); }; @@ -3499,7 +3503,7 @@ proto.protocol.AssetIssueContract.prototype.getUrl_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AssetIssueContract.prototype.setUrl = function(value) { - jspb.Message.setProto3BytesField(this, 21, value); + jspb.Message.setField(this, 21, value); }; @@ -3514,7 +3518,7 @@ proto.protocol.AssetIssueContract.prototype.getFreeAssetNetLimit = function() { /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setFreeAssetNetLimit = function(value) { - jspb.Message.setProto3IntField(this, 22, value); + jspb.Message.setField(this, 22, value); }; @@ -3529,7 +3533,7 @@ proto.protocol.AssetIssueContract.prototype.getPublicFreeAssetNetLimit = functio /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setPublicFreeAssetNetLimit = function(value) { - jspb.Message.setProto3IntField(this, 23, value); + jspb.Message.setField(this, 23, value); }; @@ -3544,7 +3548,7 @@ proto.protocol.AssetIssueContract.prototype.getPublicFreeAssetNetUsage = functio /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setPublicFreeAssetNetUsage = function(value) { - jspb.Message.setProto3IntField(this, 24, value); + jspb.Message.setField(this, 24, value); }; @@ -3559,7 +3563,7 @@ proto.protocol.AssetIssueContract.prototype.getPublicLatestFreeNetTime = functio /** @param {number} value */ proto.protocol.AssetIssueContract.prototype.setPublicLatestFreeNetTime = function(value) { - jspb.Message.setProto3IntField(this, 25, value); + jspb.Message.setField(this, 25, value); }; @@ -3761,7 +3765,7 @@ proto.protocol.ParticipateAssetIssueContract.prototype.getOwnerAddress_asU8 = fu /** @param {!(string|Uint8Array)} value */ proto.protocol.ParticipateAssetIssueContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -3800,7 +3804,7 @@ proto.protocol.ParticipateAssetIssueContract.prototype.getToAddress_asU8 = funct /** @param {!(string|Uint8Array)} value */ proto.protocol.ParticipateAssetIssueContract.prototype.setToAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -3839,7 +3843,7 @@ proto.protocol.ParticipateAssetIssueContract.prototype.getAssetName_asU8 = funct /** @param {!(string|Uint8Array)} value */ proto.protocol.ParticipateAssetIssueContract.prototype.setAssetName = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -3854,7 +3858,7 @@ proto.protocol.ParticipateAssetIssueContract.prototype.getAmount = function() { /** @param {number} value */ proto.protocol.ParticipateAssetIssueContract.prototype.setAmount = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -4056,7 +4060,7 @@ proto.protocol.FreezeBalanceContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.FreezeBalanceContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4071,7 +4075,7 @@ proto.protocol.FreezeBalanceContract.prototype.getFrozenBalance = function() { /** @param {number} value */ proto.protocol.FreezeBalanceContract.prototype.setFrozenBalance = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -4086,7 +4090,7 @@ proto.protocol.FreezeBalanceContract.prototype.getFrozenDuration = function() { /** @param {number} value */ proto.protocol.FreezeBalanceContract.prototype.setFrozenDuration = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -4101,7 +4105,7 @@ proto.protocol.FreezeBalanceContract.prototype.getResource = function() { /** @param {!proto.protocol.ResourceCode} value */ proto.protocol.FreezeBalanceContract.prototype.setResource = function(value) { - jspb.Message.setProto3EnumField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -4279,7 +4283,7 @@ proto.protocol.UnfreezeBalanceContract.prototype.getOwnerAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.UnfreezeBalanceContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4294,7 +4298,7 @@ proto.protocol.UnfreezeBalanceContract.prototype.getResource = function() { /** @param {!proto.protocol.ResourceCode} value */ proto.protocol.UnfreezeBalanceContract.prototype.setResource = function(value) { - jspb.Message.setProto3EnumField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -4460,7 +4464,7 @@ proto.protocol.UnfreezeAssetContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.UnfreezeAssetContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4626,7 +4630,7 @@ proto.protocol.WithdrawBalanceContract.prototype.getOwnerAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.WithdrawBalanceContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4840,7 +4844,7 @@ proto.protocol.UpdateAssetContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.UpdateAssetContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4879,7 +4883,7 @@ proto.protocol.UpdateAssetContract.prototype.getDescription_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.UpdateAssetContract.prototype.setDescription = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -4918,7 +4922,7 @@ proto.protocol.UpdateAssetContract.prototype.getUrl_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.UpdateAssetContract.prototype.setUrl = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -4933,7 +4937,7 @@ proto.protocol.UpdateAssetContract.prototype.getNewLimit = function() { /** @param {number} value */ proto.protocol.UpdateAssetContract.prototype.setNewLimit = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -4948,7 +4952,7 @@ proto.protocol.UpdateAssetContract.prototype.getNewPublicLimit = function() { /** @param {number} value */ proto.protocol.UpdateAssetContract.prototype.setNewPublicLimit = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -5125,7 +5129,7 @@ proto.protocol.ProposalCreateContract.prototype.getOwnerAddress_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ProposalCreateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5333,7 +5337,7 @@ proto.protocol.ProposalApproveContract.prototype.getOwnerAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.ProposalApproveContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5348,7 +5352,7 @@ proto.protocol.ProposalApproveContract.prototype.getProposalId = function() { /** @param {number} value */ proto.protocol.ProposalApproveContract.prototype.setProposalId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -5365,7 +5369,7 @@ proto.protocol.ProposalApproveContract.prototype.getIsAddApproval = function() { /** @param {boolean} value */ proto.protocol.ProposalApproveContract.prototype.setIsAddApproval = function(value) { - jspb.Message.setProto3BooleanField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -5543,7 +5547,7 @@ proto.protocol.ProposalDeleteContract.prototype.getOwnerAddress_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ProposalDeleteContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5558,7 +5562,7 @@ proto.protocol.ProposalDeleteContract.prototype.getProposalId = function() { /** @param {number} value */ proto.protocol.ProposalDeleteContract.prototype.setProposalId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -5738,7 +5742,7 @@ proto.protocol.CreateSmartContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.CreateSmartContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5970,7 +5974,7 @@ proto.protocol.TriggerSmartContract.prototype.getOwnerAddress_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.TriggerSmartContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6009,7 +6013,7 @@ proto.protocol.TriggerSmartContract.prototype.getContractAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.TriggerSmartContract.prototype.setContractAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -6024,7 +6028,7 @@ proto.protocol.TriggerSmartContract.prototype.getCallValue = function() { /** @param {number} value */ proto.protocol.TriggerSmartContract.prototype.setCallValue = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -6063,7 +6067,7 @@ proto.protocol.TriggerSmartContract.prototype.getData_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TriggerSmartContract.prototype.setData = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -6241,7 +6245,7 @@ proto.protocol.BuyStorageContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BuyStorageContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6256,7 +6260,7 @@ proto.protocol.BuyStorageContract.prototype.getQuant = function() { /** @param {number} value */ proto.protocol.BuyStorageContract.prototype.setQuant = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -6434,7 +6438,7 @@ proto.protocol.BuyStorageBytesContract.prototype.getOwnerAddress_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.BuyStorageBytesContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6449,7 +6453,7 @@ proto.protocol.BuyStorageBytesContract.prototype.getBytes = function() { /** @param {number} value */ proto.protocol.BuyStorageBytesContract.prototype.setBytes = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -6627,7 +6631,7 @@ proto.protocol.SellStorageContract.prototype.getOwnerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.SellStorageContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6642,7 +6646,7 @@ proto.protocol.SellStorageContract.prototype.getStorageBytes = function() { /** @param {number} value */ proto.protocol.SellStorageContract.prototype.setStorageBytes = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -6856,7 +6860,7 @@ proto.protocol.ExchangeCreateContract.prototype.getOwnerAddress_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeCreateContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6895,7 +6899,7 @@ proto.protocol.ExchangeCreateContract.prototype.getFirstTokenId_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeCreateContract.prototype.setFirstTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -6910,7 +6914,7 @@ proto.protocol.ExchangeCreateContract.prototype.getFirstTokenBalance = function( /** @param {number} value */ proto.protocol.ExchangeCreateContract.prototype.setFirstTokenBalance = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -6949,7 +6953,7 @@ proto.protocol.ExchangeCreateContract.prototype.getSecondTokenId_asU8 = function /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeCreateContract.prototype.setSecondTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -6964,7 +6968,7 @@ proto.protocol.ExchangeCreateContract.prototype.getSecondTokenBalance = function /** @param {number} value */ proto.protocol.ExchangeCreateContract.prototype.setSecondTokenBalance = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -7166,7 +7170,7 @@ proto.protocol.ExchangeInjectContract.prototype.getOwnerAddress_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeInjectContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -7181,7 +7185,7 @@ proto.protocol.ExchangeInjectContract.prototype.getExchangeId = function() { /** @param {number} value */ proto.protocol.ExchangeInjectContract.prototype.setExchangeId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -7220,7 +7224,7 @@ proto.protocol.ExchangeInjectContract.prototype.getTokenId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeInjectContract.prototype.setTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -7235,7 +7239,7 @@ proto.protocol.ExchangeInjectContract.prototype.getQuant = function() { /** @param {number} value */ proto.protocol.ExchangeInjectContract.prototype.setQuant = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -7437,7 +7441,7 @@ proto.protocol.ExchangeWithdrawContract.prototype.getOwnerAddress_asU8 = functio /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeWithdrawContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -7452,7 +7456,7 @@ proto.protocol.ExchangeWithdrawContract.prototype.getExchangeId = function() { /** @param {number} value */ proto.protocol.ExchangeWithdrawContract.prototype.setExchangeId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -7491,7 +7495,7 @@ proto.protocol.ExchangeWithdrawContract.prototype.getTokenId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeWithdrawContract.prototype.setTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -7506,7 +7510,7 @@ proto.protocol.ExchangeWithdrawContract.prototype.getQuant = function() { /** @param {number} value */ proto.protocol.ExchangeWithdrawContract.prototype.setQuant = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -7720,7 +7724,7 @@ proto.protocol.ExchangeTransactionContract.prototype.getOwnerAddress_asU8 = func /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeTransactionContract.prototype.setOwnerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -7735,7 +7739,7 @@ proto.protocol.ExchangeTransactionContract.prototype.getExchangeId = function() /** @param {number} value */ proto.protocol.ExchangeTransactionContract.prototype.setExchangeId = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -7774,7 +7778,7 @@ proto.protocol.ExchangeTransactionContract.prototype.getTokenId_asU8 = function( /** @param {!(string|Uint8Array)} value */ proto.protocol.ExchangeTransactionContract.prototype.setTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -7789,7 +7793,7 @@ proto.protocol.ExchangeTransactionContract.prototype.getQuant = function() { /** @param {number} value */ proto.protocol.ExchangeTransactionContract.prototype.setQuant = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -7804,7 +7808,944 @@ proto.protocol.ExchangeTransactionContract.prototype.getExpected = function() { /** @param {number} value */ proto.protocol.ExchangeTransactionContract.prototype.setExpected = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.AccountPermissionUpdateContract = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.AccountPermissionUpdateContract.repeatedFields_, null); +}; +goog.inherits(proto.protocol.AccountPermissionUpdateContract, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.AccountPermissionUpdateContract.displayName = 'proto.protocol.AccountPermissionUpdateContract'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.protocol.AccountPermissionUpdateContract.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.AccountPermissionUpdateContract.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.AccountPermissionUpdateContract} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.AccountPermissionUpdateContract.toObject = function(includeInstance, msg) { + var f, obj = { + ownerAddress: msg.getOwnerAddress_asB64(), + permissionsList: jspb.Message.toObjectList(msg.getPermissionsList(), + core_Tron_pb.Permission.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.AccountPermissionUpdateContract} + */ +proto.protocol.AccountPermissionUpdateContract.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.AccountPermissionUpdateContract; + return proto.protocol.AccountPermissionUpdateContract.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.AccountPermissionUpdateContract} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.AccountPermissionUpdateContract} + */ +proto.protocol.AccountPermissionUpdateContract.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOwnerAddress(value); + break; + case 2: + var value = new core_Tron_pb.Permission; + reader.readMessage(value,core_Tron_pb.Permission.deserializeBinaryFromReader); + msg.addPermissions(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.AccountPermissionUpdateContract.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.AccountPermissionUpdateContract} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.AccountPermissionUpdateContract.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOwnerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getPermissionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + core_Tron_pb.Permission.serializeBinaryToWriter + ); + } +}; + + +/** + * optional bytes owner_address = 1; + * @return {!(string|Uint8Array)} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.getOwnerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes owner_address = 1; + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {string} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.getOwnerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOwnerAddress())); +}; + + +/** + * optional bytes owner_address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {!Uint8Array} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.getOwnerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOwnerAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.AccountPermissionUpdateContract.prototype.setOwnerAddress = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * repeated Permission permissions = 2; + * @return {!Array.} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.getPermissionsList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, core_Tron_pb.Permission, 2)); +}; + + +/** @param {!Array.} value */ +proto.protocol.AccountPermissionUpdateContract.prototype.setPermissionsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.protocol.Permission=} opt_value + * @param {number=} opt_index + * @return {!proto.protocol.Permission} + */ +proto.protocol.AccountPermissionUpdateContract.prototype.addPermissions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.protocol.Permission, opt_index); +}; + + +proto.protocol.AccountPermissionUpdateContract.prototype.clearPermissionsList = function() { + this.setPermissionsList([]); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.PermissionAddKeyContract = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.PermissionAddKeyContract, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.PermissionAddKeyContract.displayName = 'proto.protocol.PermissionAddKeyContract'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.PermissionAddKeyContract.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.PermissionAddKeyContract.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.PermissionAddKeyContract} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionAddKeyContract.toObject = function(includeInstance, msg) { + var f, obj = { + ownerAddress: msg.getOwnerAddress_asB64(), + key: (f = msg.getKey()) && core_Tron_pb.Key.toObject(includeInstance, f), + permissionName: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.PermissionAddKeyContract} + */ +proto.protocol.PermissionAddKeyContract.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.PermissionAddKeyContract; + return proto.protocol.PermissionAddKeyContract.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.PermissionAddKeyContract} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.PermissionAddKeyContract} + */ +proto.protocol.PermissionAddKeyContract.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOwnerAddress(value); + break; + case 2: + var value = new core_Tron_pb.Key; + reader.readMessage(value,core_Tron_pb.Key.deserializeBinaryFromReader); + msg.setKey(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPermissionName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.PermissionAddKeyContract.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.PermissionAddKeyContract.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.PermissionAddKeyContract} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionAddKeyContract.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOwnerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKey(); + if (f != null) { + writer.writeMessage( + 2, + f, + core_Tron_pb.Key.serializeBinaryToWriter + ); + } + f = message.getPermissionName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional bytes owner_address = 1; + * @return {!(string|Uint8Array)} + */ +proto.protocol.PermissionAddKeyContract.prototype.getOwnerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes owner_address = 1; + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {string} + */ +proto.protocol.PermissionAddKeyContract.prototype.getOwnerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOwnerAddress())); +}; + + +/** + * optional bytes owner_address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {!Uint8Array} + */ +proto.protocol.PermissionAddKeyContract.prototype.getOwnerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOwnerAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.PermissionAddKeyContract.prototype.setOwnerAddress = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional Key key = 2; + * @return {?proto.protocol.Key} + */ +proto.protocol.PermissionAddKeyContract.prototype.getKey = function() { + return /** @type{?proto.protocol.Key} */ ( + jspb.Message.getWrapperField(this, core_Tron_pb.Key, 2)); +}; + + +/** @param {?proto.protocol.Key|undefined} value */ +proto.protocol.PermissionAddKeyContract.prototype.setKey = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.protocol.PermissionAddKeyContract.prototype.clearKey = function() { + this.setKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.protocol.PermissionAddKeyContract.prototype.hasKey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string permission_name = 3; + * @return {string} + */ +proto.protocol.PermissionAddKeyContract.prototype.getPermissionName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.protocol.PermissionAddKeyContract.prototype.setPermissionName = function(value) { + jspb.Message.setField(this, 3, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.PermissionUpdateKeyContract = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.PermissionUpdateKeyContract, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.PermissionUpdateKeyContract.displayName = 'proto.protocol.PermissionUpdateKeyContract'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.PermissionUpdateKeyContract.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.PermissionUpdateKeyContract} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionUpdateKeyContract.toObject = function(includeInstance, msg) { + var f, obj = { + ownerAddress: msg.getOwnerAddress_asB64(), + key: (f = msg.getKey()) && core_Tron_pb.Key.toObject(includeInstance, f), + permissionName: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.PermissionUpdateKeyContract} + */ +proto.protocol.PermissionUpdateKeyContract.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.PermissionUpdateKeyContract; + return proto.protocol.PermissionUpdateKeyContract.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.PermissionUpdateKeyContract} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.PermissionUpdateKeyContract} + */ +proto.protocol.PermissionUpdateKeyContract.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOwnerAddress(value); + break; + case 2: + var value = new core_Tron_pb.Key; + reader.readMessage(value,core_Tron_pb.Key.deserializeBinaryFromReader); + msg.setKey(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPermissionName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.PermissionUpdateKeyContract.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.PermissionUpdateKeyContract} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionUpdateKeyContract.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOwnerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKey(); + if (f != null) { + writer.writeMessage( + 2, + f, + core_Tron_pb.Key.serializeBinaryToWriter + ); + } + f = message.getPermissionName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional bytes owner_address = 1; + * @return {!(string|Uint8Array)} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.getOwnerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes owner_address = 1; + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {string} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.getOwnerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOwnerAddress())); +}; + + +/** + * optional bytes owner_address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {!Uint8Array} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.getOwnerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOwnerAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.PermissionUpdateKeyContract.prototype.setOwnerAddress = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional Key key = 2; + * @return {?proto.protocol.Key} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.getKey = function() { + return /** @type{?proto.protocol.Key} */ ( + jspb.Message.getWrapperField(this, core_Tron_pb.Key, 2)); +}; + + +/** @param {?proto.protocol.Key|undefined} value */ +proto.protocol.PermissionUpdateKeyContract.prototype.setKey = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.protocol.PermissionUpdateKeyContract.prototype.clearKey = function() { + this.setKey(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.hasKey = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string permission_name = 3; + * @return {string} + */ +proto.protocol.PermissionUpdateKeyContract.prototype.getPermissionName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.protocol.PermissionUpdateKeyContract.prototype.setPermissionName = function(value) { + jspb.Message.setField(this, 3, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.PermissionDeleteKeyContract = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.PermissionDeleteKeyContract, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.PermissionDeleteKeyContract.displayName = 'proto.protocol.PermissionDeleteKeyContract'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.PermissionDeleteKeyContract.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.PermissionDeleteKeyContract} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionDeleteKeyContract.toObject = function(includeInstance, msg) { + var f, obj = { + ownerAddress: msg.getOwnerAddress_asB64(), + keyAddress: msg.getKeyAddress_asB64(), + permissionName: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.PermissionDeleteKeyContract} + */ +proto.protocol.PermissionDeleteKeyContract.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.PermissionDeleteKeyContract; + return proto.protocol.PermissionDeleteKeyContract.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.PermissionDeleteKeyContract} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.PermissionDeleteKeyContract} + */ +proto.protocol.PermissionDeleteKeyContract.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setOwnerAddress(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setKeyAddress(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPermissionName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.PermissionDeleteKeyContract.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.PermissionDeleteKeyContract} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.PermissionDeleteKeyContract.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOwnerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getKeyAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getPermissionName(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional bytes owner_address = 1; + * @return {!(string|Uint8Array)} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getOwnerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes owner_address = 1; + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {string} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getOwnerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getOwnerAddress())); +}; + + +/** + * optional bytes owner_address = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getOwnerAddress()` + * @return {!Uint8Array} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getOwnerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getOwnerAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.PermissionDeleteKeyContract.prototype.setOwnerAddress = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional bytes key_address = 2; + * @return {!(string|Uint8Array)} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getKeyAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes key_address = 2; + * This is a type-conversion wrapper around `getKeyAddress()` + * @return {string} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getKeyAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getKeyAddress())); +}; + + +/** + * optional bytes key_address = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getKeyAddress()` + * @return {!Uint8Array} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getKeyAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getKeyAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.PermissionDeleteKeyContract.prototype.setKeyAddress = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional string permission_name = 3; + * @return {string} + */ +proto.protocol.PermissionDeleteKeyContract.prototype.getPermissionName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.protocol.PermissionDeleteKeyContract.prototype.setPermissionName = function(value) { + jspb.Message.setField(this, 3, value); }; diff --git a/src/protocol/core/Discover_pb.js b/src/protocol/core/Discover_pb.js index 2f1745d..2cb157a 100644 --- a/src/protocol/core/Discover_pb.js +++ b/src/protocol/core/Discover_pb.js @@ -203,7 +203,7 @@ proto.protocol.Endpoint.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Endpoint.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -218,7 +218,7 @@ proto.protocol.Endpoint.prototype.getPort = function() { /** @param {number} value */ proto.protocol.Endpoint.prototype.setPort = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -257,7 +257,7 @@ proto.protocol.Endpoint.prototype.getNodeid_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Endpoint.prototype.setNodeid = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -499,7 +499,7 @@ proto.protocol.PingMessage.prototype.getVersion = function() { /** @param {number} value */ proto.protocol.PingMessage.prototype.setVersion = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -514,7 +514,7 @@ proto.protocol.PingMessage.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.PingMessage.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -712,7 +712,7 @@ proto.protocol.PongMessage.prototype.getEcho = function() { /** @param {number} value */ proto.protocol.PongMessage.prototype.setEcho = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -727,7 +727,7 @@ proto.protocol.PongMessage.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.PongMessage.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -949,7 +949,7 @@ proto.protocol.FindNeighbours.prototype.getTargetid_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.FindNeighbours.prototype.setTargetid = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -964,7 +964,7 @@ proto.protocol.FindNeighbours.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.FindNeighbours.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -1203,7 +1203,178 @@ proto.protocol.Neighbours.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.Neighbours.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.BackupMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.BackupMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.BackupMessage.displayName = 'proto.protocol.BackupMessage'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.BackupMessage.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.BackupMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.BackupMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.BackupMessage.toObject = function(includeInstance, msg) { + var f, obj = { + flag: jspb.Message.getFieldWithDefault(msg, 1, false), + priority: jspb.Message.getFieldWithDefault(msg, 2, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.BackupMessage} + */ +proto.protocol.BackupMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.BackupMessage; + return proto.protocol.BackupMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.BackupMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.BackupMessage} + */ +proto.protocol.BackupMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFlag(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setPriority(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.BackupMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.BackupMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.BackupMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.BackupMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFlag(); + if (f) { + writer.writeBool( + 1, + f + ); + } + f = message.getPriority(); + if (f !== 0) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * optional bool flag = 1; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.protocol.BackupMessage.prototype.getFlag = function() { + return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 1, false)); +}; + + +/** @param {boolean} value */ +proto.protocol.BackupMessage.prototype.setFlag = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional int32 priority = 2; + * @return {number} + */ +proto.protocol.BackupMessage.prototype.getPriority = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.protocol.BackupMessage.prototype.setPriority = function(value) { + jspb.Message.setField(this, 2, value); }; diff --git a/src/protocol/core/TronInventoryItems_pb.js b/src/protocol/core/TronInventoryItems_pb.js index d2744d7..81dfb00 100644 --- a/src/protocol/core/TronInventoryItems_pb.js +++ b/src/protocol/core/TronInventoryItems_pb.js @@ -169,7 +169,7 @@ proto.protocol.InventoryItems.prototype.getType = function() { /** @param {number} value */ proto.protocol.InventoryItems.prototype.setType = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; diff --git a/src/protocol/core/Tron_pb.js b/src/protocol/core/Tron_pb.js index 22703cf..6425585 100644 --- a/src/protocol/core/Tron_pb.js +++ b/src/protocol/core/Tron_pb.js @@ -33,10 +33,14 @@ goog.exportSymbol('proto.protocol.DynamicProperties', null, global); goog.exportSymbol('proto.protocol.Exchange', null, global); goog.exportSymbol('proto.protocol.HelloMessage', null, global); goog.exportSymbol('proto.protocol.HelloMessage.BlockId', null, global); +goog.exportSymbol('proto.protocol.InternalTransaction', null, global); +goog.exportSymbol('proto.protocol.InternalTransaction.CallValueInfo', null, global); goog.exportSymbol('proto.protocol.Inventory', null, global); goog.exportSymbol('proto.protocol.Inventory.InventoryType', null, global); goog.exportSymbol('proto.protocol.Items', null, global); goog.exportSymbol('proto.protocol.Items.ItemType', null, global); +goog.exportSymbol('proto.protocol.Key', null, global); +goog.exportSymbol('proto.protocol.Permission', null, global); goog.exportSymbol('proto.protocol.Proposal', null, global); goog.exportSymbol('proto.protocol.Proposal.State', null, global); goog.exportSymbol('proto.protocol.ReasonCode', null, global); @@ -67,7 +71,6 @@ goog.exportSymbol('proto.protocol.Vote', null, global); goog.exportSymbol('proto.protocol.Votes', null, global); goog.exportSymbol('proto.protocol.Witness', null, global); goog.exportSymbol('proto.protocol.authority', null, global); -goog.exportSymbol('proto.protocol.permission', null, global); /** * Generated by JsPbCodeGenerator. @@ -242,7 +245,7 @@ proto.protocol.AccountId.prototype.getName_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountId.prototype.setName = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -281,7 +284,7 @@ proto.protocol.AccountId.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.AccountId.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -459,7 +462,7 @@ proto.protocol.Vote.prototype.getVoteAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Vote.prototype.setVoteAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -474,7 +477,7 @@ proto.protocol.Vote.prototype.getVoteCount = function() { /** @param {number} value */ proto.protocol.Vote.prototype.setVoteCount = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -704,7 +707,7 @@ proto.protocol.Proposal.prototype.getProposalId = function() { /** @param {number} value */ proto.protocol.Proposal.prototype.setProposalId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -743,7 +746,7 @@ proto.protocol.Proposal.prototype.getProposerAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Proposal.prototype.setProposerAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -776,7 +779,7 @@ proto.protocol.Proposal.prototype.getExpirationTime = function() { /** @param {number} value */ proto.protocol.Proposal.prototype.setExpirationTime = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -791,7 +794,7 @@ proto.protocol.Proposal.prototype.getCreateTime = function() { /** @param {number} value */ proto.protocol.Proposal.prototype.setCreateTime = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -859,7 +862,7 @@ proto.protocol.Proposal.prototype.getState = function() { /** @param {!proto.protocol.Proposal.State} value */ proto.protocol.Proposal.prototype.setState = function(value) { - jspb.Message.setProto3EnumField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -1073,7 +1076,7 @@ proto.protocol.Exchange.prototype.getExchangeId = function() { /** @param {number} value */ proto.protocol.Exchange.prototype.setExchangeId = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1112,7 +1115,7 @@ proto.protocol.Exchange.prototype.getCreatorAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Exchange.prototype.setCreatorAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -1127,7 +1130,7 @@ proto.protocol.Exchange.prototype.getCreateTime = function() { /** @param {number} value */ proto.protocol.Exchange.prototype.setCreateTime = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -1166,7 +1169,7 @@ proto.protocol.Exchange.prototype.getFirstTokenId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Exchange.prototype.setFirstTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -1181,7 +1184,7 @@ proto.protocol.Exchange.prototype.getFirstTokenBalance = function() { /** @param {number} value */ proto.protocol.Exchange.prototype.setFirstTokenBalance = function(value) { - jspb.Message.setProto3IntField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -1220,7 +1223,7 @@ proto.protocol.Exchange.prototype.getSecondTokenId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Exchange.prototype.setSecondTokenId = function(value) { - jspb.Message.setProto3BytesField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -1235,7 +1238,7 @@ proto.protocol.Exchange.prototype.getSecondTokenBalance = function() { /** @param {number} value */ proto.protocol.Exchange.prototype.setSecondTokenBalance = function(value) { - jspb.Message.setProto3IntField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -1526,7 +1529,7 @@ proto.protocol.ChainParameters.ChainParameter.prototype.getKey = function() { /** @param {string} value */ proto.protocol.ChainParameters.ChainParameter.prototype.setKey = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1541,7 +1544,7 @@ proto.protocol.ChainParameters.ChainParameter.prototype.getValue = function() { /** @param {number} value */ proto.protocol.ChainParameters.ChainParameter.prototype.setValue = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -1599,7 +1602,7 @@ if (goog.DEBUG && !COMPILED) { * @private {!Array} * @const */ -proto.protocol.Account.repeatedFields_ = [5,7,16]; +proto.protocol.Account.repeatedFields_ = [5,7,16,31]; @@ -1657,7 +1660,9 @@ proto.protocol.Account.toObject = function(includeInstance, msg) { latestConsumeFreeTime: jspb.Message.getFieldWithDefault(msg, 22, 0), accountId: msg.getAccountId_asB64(), accountResource: (f = msg.getAccountResource()) && proto.protocol.Account.AccountResource.toObject(includeInstance, f), - codehash: msg.getCodehash_asB64() + codehash: msg.getCodehash_asB64(), + permissionsList: jspb.Message.toObjectList(msg.getPermissionsList(), + proto.protocol.Permission.toObject, includeInstance) }; if (includeInstance) { @@ -1804,6 +1809,11 @@ proto.protocol.Account.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {!Uint8Array} */ (reader.readBytes()); msg.setCodehash(value); break; + case 31: + var value = new proto.protocol.Permission; + reader.readMessage(value,proto.protocol.Permission.deserializeBinaryFromReader); + msg.addPermissions(value); + break; default: reader.skipField(); break; @@ -2003,6 +2013,14 @@ proto.protocol.Account.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getPermissionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 31, + f, + proto.protocol.Permission.serializeBinaryToWriter + ); + } }; @@ -2156,7 +2174,7 @@ proto.protocol.Account.Frozen.prototype.getFrozenBalance = function() { /** @param {number} value */ proto.protocol.Account.Frozen.prototype.setFrozenBalance = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2171,7 +2189,7 @@ proto.protocol.Account.Frozen.prototype.getExpireTime = function() { /** @param {number} value */ proto.protocol.Account.Frozen.prototype.setExpireTime = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -2375,7 +2393,7 @@ proto.protocol.Account.AccountResource.prototype.getEnergyUsage = function() { /** @param {number} value */ proto.protocol.Account.AccountResource.prototype.setEnergyUsage = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2420,7 +2438,7 @@ proto.protocol.Account.AccountResource.prototype.getLatestConsumeTimeForEnergy = /** @param {number} value */ proto.protocol.Account.AccountResource.prototype.setLatestConsumeTimeForEnergy = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -2435,7 +2453,7 @@ proto.protocol.Account.AccountResource.prototype.getStorageLimit = function() { /** @param {number} value */ proto.protocol.Account.AccountResource.prototype.setStorageLimit = function(value) { - jspb.Message.setProto3IntField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -2450,7 +2468,7 @@ proto.protocol.Account.AccountResource.prototype.getStorageUsage = function() { /** @param {number} value */ proto.protocol.Account.AccountResource.prototype.setStorageUsage = function(value) { - jspb.Message.setProto3IntField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -2465,7 +2483,7 @@ proto.protocol.Account.AccountResource.prototype.getLatestExchangeStorageTime = /** @param {number} value */ proto.protocol.Account.AccountResource.prototype.setLatestExchangeStorageTime = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -2504,7 +2522,7 @@ proto.protocol.Account.prototype.getAccountName_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setAccountName = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -2519,7 +2537,7 @@ proto.protocol.Account.prototype.getType = function() { /** @param {!proto.protocol.AccountType} value */ proto.protocol.Account.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -2558,7 +2576,7 @@ proto.protocol.Account.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -2573,7 +2591,7 @@ proto.protocol.Account.prototype.getBalance = function() { /** @param {number} value */ proto.protocol.Account.prototype.setBalance = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -2668,7 +2686,7 @@ proto.protocol.Account.prototype.getNetUsage = function() { /** @param {number} value */ proto.protocol.Account.prototype.setNetUsage = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -2683,7 +2701,7 @@ proto.protocol.Account.prototype.getCreateTime = function() { /** @param {number} value */ proto.protocol.Account.prototype.setCreateTime = function(value) { - jspb.Message.setProto3IntField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -2698,7 +2716,7 @@ proto.protocol.Account.prototype.getLatestOprationTime = function() { /** @param {number} value */ proto.protocol.Account.prototype.setLatestOprationTime = function(value) { - jspb.Message.setProto3IntField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -2713,7 +2731,7 @@ proto.protocol.Account.prototype.getAllowance = function() { /** @param {number} value */ proto.protocol.Account.prototype.setAllowance = function(value) { - jspb.Message.setProto3IntField(this, 11, value); + jspb.Message.setField(this, 11, value); }; @@ -2728,7 +2746,7 @@ proto.protocol.Account.prototype.getLatestWithdrawTime = function() { /** @param {number} value */ proto.protocol.Account.prototype.setLatestWithdrawTime = function(value) { - jspb.Message.setProto3IntField(this, 12, value); + jspb.Message.setField(this, 12, value); }; @@ -2767,7 +2785,7 @@ proto.protocol.Account.prototype.getCode_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setCode = function(value) { - jspb.Message.setProto3BytesField(this, 13, value); + jspb.Message.setField(this, 13, value); }; @@ -2784,7 +2802,7 @@ proto.protocol.Account.prototype.getIsWitness = function() { /** @param {boolean} value */ proto.protocol.Account.prototype.setIsWitness = function(value) { - jspb.Message.setProto3BooleanField(this, 14, value); + jspb.Message.setField(this, 14, value); }; @@ -2801,7 +2819,7 @@ proto.protocol.Account.prototype.getIsCommittee = function() { /** @param {boolean} value */ proto.protocol.Account.prototype.setIsCommittee = function(value) { - jspb.Message.setProto3BooleanField(this, 15, value); + jspb.Message.setField(this, 15, value); }; @@ -2871,7 +2889,7 @@ proto.protocol.Account.prototype.getAssetIssuedName_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setAssetIssuedName = function(value) { - jspb.Message.setProto3BytesField(this, 17, value); + jspb.Message.setField(this, 17, value); }; @@ -2904,7 +2922,7 @@ proto.protocol.Account.prototype.getFreeNetUsage = function() { /** @param {number} value */ proto.protocol.Account.prototype.setFreeNetUsage = function(value) { - jspb.Message.setProto3IntField(this, 19, value); + jspb.Message.setField(this, 19, value); }; @@ -2937,7 +2955,7 @@ proto.protocol.Account.prototype.getLatestConsumeTime = function() { /** @param {number} value */ proto.protocol.Account.prototype.setLatestConsumeTime = function(value) { - jspb.Message.setProto3IntField(this, 21, value); + jspb.Message.setField(this, 21, value); }; @@ -2952,7 +2970,7 @@ proto.protocol.Account.prototype.getLatestConsumeFreeTime = function() { /** @param {number} value */ proto.protocol.Account.prototype.setLatestConsumeFreeTime = function(value) { - jspb.Message.setProto3IntField(this, 22, value); + jspb.Message.setField(this, 22, value); }; @@ -2991,7 +3009,7 @@ proto.protocol.Account.prototype.getAccountId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setAccountId = function(value) { - jspb.Message.setProto3BytesField(this, 23, value); + jspb.Message.setField(this, 23, value); }; @@ -3060,7 +3078,38 @@ proto.protocol.Account.prototype.getCodehash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Account.prototype.setCodehash = function(value) { - jspb.Message.setProto3BytesField(this, 30, value); + jspb.Message.setField(this, 30, value); +}; + + +/** + * repeated Permission permissions = 31; + * @return {!Array.} + */ +proto.protocol.Account.prototype.getPermissionsList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.protocol.Permission, 31)); +}; + + +/** @param {!Array.} value */ +proto.protocol.Account.prototype.setPermissionsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 31, value); +}; + + +/** + * @param {!proto.protocol.Permission=} opt_value + * @param {number=} opt_index + * @return {!proto.protocol.Permission} + */ +proto.protocol.Account.prototype.addPermissions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 31, opt_value, proto.protocol.Permission, opt_index); +}; + + +proto.protocol.Account.prototype.clearPermissionsList = function() { + this.setPermissionsList([]); }; @@ -3075,12 +3124,12 @@ proto.protocol.Account.prototype.setCodehash = function(value) { * @extends {jspb.Message} * @constructor */ -proto.protocol.authority = function(opt_data) { +proto.protocol.Key = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.protocol.authority, jspb.Message); +goog.inherits(proto.protocol.Key, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.protocol.authority.displayName = 'proto.protocol.authority'; + proto.protocol.Key.displayName = 'proto.protocol.Key'; } @@ -3095,8 +3144,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ -proto.protocol.authority.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.authority.toObject(opt_includeInstance, this); +proto.protocol.Key.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.Key.toObject(opt_includeInstance, this); }; @@ -3105,14 +3154,14 @@ proto.protocol.authority.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.protocol.authority} msg The msg instance to transform. + * @param {!proto.protocol.Key} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.protocol.authority.toObject = function(includeInstance, msg) { +proto.protocol.Key.toObject = function(includeInstance, msg) { var f, obj = { - account: (f = msg.getAccount()) && proto.protocol.AccountId.toObject(includeInstance, f), - permissionName: msg.getPermissionName_asB64() + address: msg.getAddress_asB64(), + weight: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { @@ -3126,23 +3175,23 @@ proto.protocol.authority.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.authority} + * @return {!proto.protocol.Key} */ -proto.protocol.authority.deserializeBinary = function(bytes) { +proto.protocol.Key.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.protocol.authority; - return proto.protocol.authority.deserializeBinaryFromReader(msg, reader); + var msg = new proto.protocol.Key; + return proto.protocol.Key.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.protocol.authority} msg The message object to deserialize into. + * @param {!proto.protocol.Key} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.authority} + * @return {!proto.protocol.Key} */ -proto.protocol.authority.deserializeBinaryFromReader = function(msg, reader) { +proto.protocol.Key.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3150,13 +3199,12 @@ proto.protocol.authority.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.protocol.AccountId; - reader.readMessage(value,proto.protocol.AccountId.deserializeBinaryFromReader); - msg.setAccount(value); + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setAddress(value); break; case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setPermissionName(value); + var value = /** @type {number} */ (reader.readInt64()); + msg.setWeight(value); break; default: reader.skipField(); @@ -3171,9 +3219,9 @@ proto.protocol.authority.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.protocol.authority.prototype.serializeBinary = function() { +proto.protocol.Key.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.protocol.authority.serializeBinaryToWriter(this, writer); + proto.protocol.Key.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3181,23 +3229,22 @@ proto.protocol.authority.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.protocol.authority} message + * @param {!proto.protocol.Key} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.protocol.authority.serializeBinaryToWriter = function(message, writer) { +proto.protocol.Key.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAccount(); - if (f != null) { - writer.writeMessage( + f = message.getAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( 1, - f, - proto.protocol.AccountId.serializeBinaryToWriter + f ); } - f = message.getPermissionName_asU8(); - if (f.length > 0) { - writer.writeBytes( + f = message.getWeight(); + if (f !== 0) { + writer.writeInt64( 2, f ); @@ -3206,71 +3253,56 @@ proto.protocol.authority.serializeBinaryToWriter = function(message, writer) { /** - * optional AccountId account = 1; - * @return {?proto.protocol.AccountId} - */ -proto.protocol.authority.prototype.getAccount = function() { - return /** @type{?proto.protocol.AccountId} */ ( - jspb.Message.getWrapperField(this, proto.protocol.AccountId, 1)); -}; - - -/** @param {?proto.protocol.AccountId|undefined} value */ -proto.protocol.authority.prototype.setAccount = function(value) { - jspb.Message.setWrapperField(this, 1, value); -}; - - -proto.protocol.authority.prototype.clearAccount = function() { - this.setAccount(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {!boolean} - */ -proto.protocol.authority.prototype.hasAccount = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional bytes permission_name = 2; + * optional bytes address = 1; * @return {!(string|Uint8Array)} */ -proto.protocol.authority.prototype.getPermissionName = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.protocol.Key.prototype.getAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** - * optional bytes permission_name = 2; - * This is a type-conversion wrapper around `getPermissionName()` + * optional bytes address = 1; + * This is a type-conversion wrapper around `getAddress()` * @return {string} */ -proto.protocol.authority.prototype.getPermissionName_asB64 = function() { +proto.protocol.Key.prototype.getAddress_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getPermissionName())); + this.getAddress())); }; /** - * optional bytes permission_name = 2; + * optional bytes address = 1; * Note that Uint8Array is not supported on all browsers. * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getPermissionName()` + * This is a type-conversion wrapper around `getAddress()` * @return {!Uint8Array} */ -proto.protocol.authority.prototype.getPermissionName_asU8 = function() { +proto.protocol.Key.prototype.getAddress_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getPermissionName())); + this.getAddress())); }; /** @param {!(string|Uint8Array)} value */ -proto.protocol.authority.prototype.setPermissionName = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); +proto.protocol.Key.prototype.setAddress = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional int64 weight = 2; + * @return {number} + */ +proto.protocol.Key.prototype.getWeight = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.protocol.Key.prototype.setWeight = function(value) { + jspb.Message.setField(this, 2, value); }; @@ -3285,13 +3317,20 @@ proto.protocol.authority.prototype.setPermissionName = function(value) { * @extends {jspb.Message} * @constructor */ -proto.protocol.permission = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.protocol.Permission = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.Permission.repeatedFields_, null); }; -goog.inherits(proto.protocol.permission, jspb.Message); +goog.inherits(proto.protocol.Permission, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.protocol.permission.displayName = 'proto.protocol.permission'; + proto.protocol.Permission.displayName = 'proto.protocol.Permission'; } +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.protocol.Permission.repeatedFields_ = [4]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3305,8 +3344,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ -proto.protocol.permission.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.permission.toObject(opt_includeInstance, this); +proto.protocol.Permission.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.Permission.toObject(opt_includeInstance, this); }; @@ -3315,13 +3354,17 @@ proto.protocol.permission.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.protocol.permission} msg The msg instance to transform. + * @param {!proto.protocol.Permission} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.protocol.permission.toObject = function(includeInstance, msg) { +proto.protocol.Permission.toObject = function(includeInstance, msg) { var f, obj = { - account: (f = msg.getAccount()) && proto.protocol.AccountId.toObject(includeInstance, f) + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + threshold: jspb.Message.getFieldWithDefault(msg, 2, 0), + parent: jspb.Message.getFieldWithDefault(msg, 3, ""), + keysList: jspb.Message.toObjectList(msg.getKeysList(), + proto.protocol.Key.toObject, includeInstance) }; if (includeInstance) { @@ -3335,23 +3378,23 @@ proto.protocol.permission.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.permission} + * @return {!proto.protocol.Permission} */ -proto.protocol.permission.deserializeBinary = function(bytes) { +proto.protocol.Permission.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.protocol.permission; - return proto.protocol.permission.deserializeBinaryFromReader(msg, reader); + var msg = new proto.protocol.Permission; + return proto.protocol.Permission.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.protocol.permission} msg The message object to deserialize into. + * @param {!proto.protocol.Permission} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.permission} + * @return {!proto.protocol.Permission} */ -proto.protocol.permission.deserializeBinaryFromReader = function(msg, reader) { +proto.protocol.Permission.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3359,9 +3402,21 @@ proto.protocol.permission.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.protocol.AccountId; - reader.readMessage(value,proto.protocol.AccountId.deserializeBinaryFromReader); - msg.setAccount(value); + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = /** @type {number} */ (reader.readInt64()); + msg.setThreshold(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setParent(value); + break; + case 4: + var value = new proto.protocol.Key; + reader.readMessage(value,proto.protocol.Key.deserializeBinaryFromReader); + msg.addKeys(value); break; default: reader.skipField(); @@ -3376,9 +3431,9 @@ proto.protocol.permission.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.protocol.permission.prototype.serializeBinary = function() { +proto.protocol.Permission.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.protocol.permission.serializeBinaryToWriter(this, writer); + proto.protocol.Permission.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3386,50 +3441,117 @@ proto.protocol.permission.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.protocol.permission} message + * @param {!proto.protocol.Permission} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.protocol.permission.serializeBinaryToWriter = function(message, writer) { +proto.protocol.Permission.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getAccount(); - if (f != null) { - writer.writeMessage( + f = message.getName(); + if (f.length > 0) { + writer.writeString( 1, + f + ); + } + f = message.getThreshold(); + if (f !== 0) { + writer.writeInt64( + 2, + f + ); + } + f = message.getParent(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getKeysList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, f, - proto.protocol.AccountId.serializeBinaryToWriter + proto.protocol.Key.serializeBinaryToWriter ); } }; /** - * optional AccountId account = 1; - * @return {?proto.protocol.AccountId} + * optional string name = 1; + * @return {string} */ -proto.protocol.permission.prototype.getAccount = function() { - return /** @type{?proto.protocol.AccountId} */ ( - jspb.Message.getWrapperField(this, proto.protocol.AccountId, 1)); +proto.protocol.Permission.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; -/** @param {?proto.protocol.AccountId|undefined} value */ -proto.protocol.permission.prototype.setAccount = function(value) { - jspb.Message.setWrapperField(this, 1, value); +/** @param {string} value */ +proto.protocol.Permission.prototype.setName = function(value) { + jspb.Message.setField(this, 1, value); }; -proto.protocol.permission.prototype.clearAccount = function() { - this.setAccount(undefined); +/** + * optional int64 threshold = 2; + * @return {number} + */ +proto.protocol.Permission.prototype.getThreshold = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.protocol.Permission.prototype.setThreshold = function(value) { + jspb.Message.setField(this, 2, value); }; /** - * Returns whether this field is set. - * @return {!boolean} + * optional string parent = 3; + * @return {string} */ -proto.protocol.permission.prototype.hasAccount = function() { - return jspb.Message.getField(this, 1) != null; +proto.protocol.Permission.prototype.getParent = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.protocol.Permission.prototype.setParent = function(value) { + jspb.Message.setField(this, 3, value); +}; + + +/** + * repeated Key keys = 4; + * @return {!Array.} + */ +proto.protocol.Permission.prototype.getKeysList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.protocol.Key, 4)); +}; + + +/** @param {!Array.} value */ +proto.protocol.Permission.prototype.setKeysList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.protocol.Key=} opt_value + * @param {number=} opt_index + * @return {!proto.protocol.Key} + */ +proto.protocol.Permission.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.protocol.Key, opt_index); +}; + + +proto.protocol.Permission.prototype.clearKeysList = function() { + this.setKeysList([]); }; @@ -3444,12 +3566,12 @@ proto.protocol.permission.prototype.hasAccount = function() { * @extends {jspb.Message} * @constructor */ -proto.protocol.Witness = function(opt_data) { +proto.protocol.authority = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.protocol.Witness, jspb.Message); +goog.inherits(proto.protocol.authority, jspb.Message); if (goog.DEBUG && !COMPILED) { - proto.protocol.Witness.displayName = 'proto.protocol.Witness'; + proto.protocol.authority.displayName = 'proto.protocol.authority'; } @@ -3464,8 +3586,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ -proto.protocol.Witness.prototype.toObject = function(opt_includeInstance) { - return proto.protocol.Witness.toObject(opt_includeInstance, this); +proto.protocol.authority.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.authority.toObject(opt_includeInstance, this); }; @@ -3474,21 +3596,14 @@ proto.protocol.Witness.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.protocol.Witness} msg The msg instance to transform. + * @param {!proto.protocol.authority} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.protocol.Witness.toObject = function(includeInstance, msg) { +proto.protocol.authority.toObject = function(includeInstance, msg) { var f, obj = { - address: msg.getAddress_asB64(), - votecount: jspb.Message.getFieldWithDefault(msg, 2, 0), - pubkey: msg.getPubkey_asB64(), - url: jspb.Message.getFieldWithDefault(msg, 4, ""), - totalproduced: jspb.Message.getFieldWithDefault(msg, 5, 0), - totalmissed: jspb.Message.getFieldWithDefault(msg, 6, 0), - latestblocknum: jspb.Message.getFieldWithDefault(msg, 7, 0), - latestslotnum: jspb.Message.getFieldWithDefault(msg, 8, 0), - isjobs: jspb.Message.getFieldWithDefault(msg, 9, false) + account: (f = msg.getAccount()) && proto.protocol.AccountId.toObject(includeInstance, f), + permissionName: msg.getPermissionName_asB64() }; if (includeInstance) { @@ -3502,23 +3617,240 @@ proto.protocol.Witness.toObject = function(includeInstance, msg) { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.protocol.Witness} + * @return {!proto.protocol.authority} */ -proto.protocol.Witness.deserializeBinary = function(bytes) { +proto.protocol.authority.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.protocol.Witness; - return proto.protocol.Witness.deserializeBinaryFromReader(msg, reader); + var msg = new proto.protocol.authority; + return proto.protocol.authority.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.protocol.Witness} msg The message object to deserialize into. + * @param {!proto.protocol.authority} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.protocol.Witness} + * @return {!proto.protocol.authority} */ -proto.protocol.Witness.deserializeBinaryFromReader = function(msg, reader) { +proto.protocol.authority.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.protocol.AccountId; + reader.readMessage(value,proto.protocol.AccountId.deserializeBinaryFromReader); + msg.setAccount(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setPermissionName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.authority.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.authority.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.authority} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.authority.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAccount(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.protocol.AccountId.serializeBinaryToWriter + ); + } + f = message.getPermissionName_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional AccountId account = 1; + * @return {?proto.protocol.AccountId} + */ +proto.protocol.authority.prototype.getAccount = function() { + return /** @type{?proto.protocol.AccountId} */ ( + jspb.Message.getWrapperField(this, proto.protocol.AccountId, 1)); +}; + + +/** @param {?proto.protocol.AccountId|undefined} value */ +proto.protocol.authority.prototype.setAccount = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.protocol.authority.prototype.clearAccount = function() { + this.setAccount(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {!boolean} + */ +proto.protocol.authority.prototype.hasAccount = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes permission_name = 2; + * @return {!(string|Uint8Array)} + */ +proto.protocol.authority.prototype.getPermissionName = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes permission_name = 2; + * This is a type-conversion wrapper around `getPermissionName()` + * @return {string} + */ +proto.protocol.authority.prototype.getPermissionName_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getPermissionName())); +}; + + +/** + * optional bytes permission_name = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getPermissionName()` + * @return {!Uint8Array} + */ +proto.protocol.authority.prototype.getPermissionName_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getPermissionName())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.authority.prototype.setPermissionName = function(value) { + jspb.Message.setField(this, 2, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.Witness = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.Witness, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.Witness.displayName = 'proto.protocol.Witness'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.Witness.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.Witness.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.Witness} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.Witness.toObject = function(includeInstance, msg) { + var f, obj = { + address: msg.getAddress_asB64(), + votecount: jspb.Message.getFieldWithDefault(msg, 2, 0), + pubkey: msg.getPubkey_asB64(), + url: jspb.Message.getFieldWithDefault(msg, 4, ""), + totalproduced: jspb.Message.getFieldWithDefault(msg, 5, 0), + totalmissed: jspb.Message.getFieldWithDefault(msg, 6, 0), + latestblocknum: jspb.Message.getFieldWithDefault(msg, 7, 0), + latestslotnum: jspb.Message.getFieldWithDefault(msg, 8, 0), + isjobs: jspb.Message.getFieldWithDefault(msg, 9, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.Witness} + */ +proto.protocol.Witness.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.Witness; + return proto.protocol.Witness.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.Witness} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.Witness} + */ +proto.protocol.Witness.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3691,7 +4023,7 @@ proto.protocol.Witness.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Witness.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -3706,7 +4038,7 @@ proto.protocol.Witness.prototype.getVotecount = function() { /** @param {number} value */ proto.protocol.Witness.prototype.setVotecount = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -3745,7 +4077,7 @@ proto.protocol.Witness.prototype.getPubkey_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Witness.prototype.setPubkey = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -3760,7 +4092,7 @@ proto.protocol.Witness.prototype.getUrl = function() { /** @param {string} value */ proto.protocol.Witness.prototype.setUrl = function(value) { - jspb.Message.setProto3StringField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -3775,7 +4107,7 @@ proto.protocol.Witness.prototype.getTotalproduced = function() { /** @param {number} value */ proto.protocol.Witness.prototype.setTotalproduced = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -3790,7 +4122,7 @@ proto.protocol.Witness.prototype.getTotalmissed = function() { /** @param {number} value */ proto.protocol.Witness.prototype.setTotalmissed = function(value) { - jspb.Message.setProto3IntField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -3805,7 +4137,7 @@ proto.protocol.Witness.prototype.getLatestblocknum = function() { /** @param {number} value */ proto.protocol.Witness.prototype.setLatestblocknum = function(value) { - jspb.Message.setProto3IntField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -3820,7 +4152,7 @@ proto.protocol.Witness.prototype.getLatestslotnum = function() { /** @param {number} value */ proto.protocol.Witness.prototype.setLatestslotnum = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -3837,7 +4169,7 @@ proto.protocol.Witness.prototype.getIsjobs = function() { /** @param {boolean} value */ proto.protocol.Witness.prototype.setIsjobs = function(value) { - jspb.Message.setProto3BooleanField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -4040,7 +4372,7 @@ proto.protocol.Votes.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Votes.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4256,7 +4588,7 @@ proto.protocol.TXOutput.prototype.getValue = function() { /** @param {number} value */ proto.protocol.TXOutput.prototype.setValue = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4295,7 +4627,7 @@ proto.protocol.TXOutput.prototype.getPubkeyhash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TXOutput.prototype.setPubkeyhash = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -4626,7 +4958,7 @@ proto.protocol.TXInput.raw.prototype.getTxid_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TXInput.raw.prototype.setTxid = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -4641,7 +4973,7 @@ proto.protocol.TXInput.raw.prototype.getVout = function() { /** @param {number} value */ proto.protocol.TXInput.raw.prototype.setVout = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -4680,7 +5012,7 @@ proto.protocol.TXInput.raw.prototype.getPubkey_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TXInput.raw.prototype.setPubkey = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -4749,7 +5081,7 @@ proto.protocol.TXInput.prototype.getSignature_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TXInput.prototype.setSignature = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -5131,7 +5463,7 @@ proto.protocol.ResourceReceipt.prototype.getEnergyUsage = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setEnergyUsage = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5146,7 +5478,7 @@ proto.protocol.ResourceReceipt.prototype.getEnergyFee = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setEnergyFee = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -5161,7 +5493,7 @@ proto.protocol.ResourceReceipt.prototype.getOriginEnergyUsage = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setOriginEnergyUsage = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -5176,7 +5508,7 @@ proto.protocol.ResourceReceipt.prototype.getEnergyUsageTotal = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setEnergyUsageTotal = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -5191,7 +5523,7 @@ proto.protocol.ResourceReceipt.prototype.getNetUsage = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setNetUsage = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -5206,7 +5538,7 @@ proto.protocol.ResourceReceipt.prototype.getNetFee = function() { /** @param {number} value */ proto.protocol.ResourceReceipt.prototype.setNetFee = function(value) { - jspb.Message.setProto3IntField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -5221,7 +5553,7 @@ proto.protocol.ResourceReceipt.prototype.getResult = function() { /** @param {!proto.protocol.Transaction.Result.contractResult} value */ proto.protocol.ResourceReceipt.prototype.setResult = function(value) { - jspb.Message.setProto3EnumField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -5584,7 +5916,11 @@ proto.protocol.Transaction.Contract.ContractType = { EXCHANGECREATECONTRACT: 41, EXCHANGEINJECTCONTRACT: 42, EXCHANGEWITHDRAWCONTRACT: 43, - EXCHANGETRANSACTIONCONTRACT: 44 + EXCHANGETRANSACTIONCONTRACT: 44, + ACCOUNTPERMISSIONUPDATECONTRACT: 45, + PERMISSIONADDKEYCONTRACT: 46, + PERMISSIONUPDATEKEYCONTRACT: 47, + PERMISSIONDELETEKEYCONTRACT: 48 }; /** @@ -5598,7 +5934,7 @@ proto.protocol.Transaction.Contract.prototype.getType = function() { /** @param {!proto.protocol.Transaction.Contract.ContractType} value */ proto.protocol.Transaction.Contract.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5667,7 +6003,7 @@ proto.protocol.Transaction.Contract.prototype.getProvider_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.Contract.prototype.setProvider = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -5706,7 +6042,7 @@ proto.protocol.Transaction.Contract.prototype.getContractname_asU8 = function() /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.Contract.prototype.setContractname = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -5924,7 +6260,7 @@ proto.protocol.Transaction.Result.prototype.getFee = function() { /** @param {number} value */ proto.protocol.Transaction.Result.prototype.setFee = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -5939,7 +6275,7 @@ proto.protocol.Transaction.Result.prototype.getRet = function() { /** @param {!proto.protocol.Transaction.Result.code} value */ proto.protocol.Transaction.Result.prototype.setRet = function(value) { - jspb.Message.setProto3EnumField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -5954,7 +6290,7 @@ proto.protocol.Transaction.Result.prototype.getContractret = function() { /** @param {!proto.protocol.Transaction.Result.contractResult} value */ proto.protocol.Transaction.Result.prototype.setContractret = function(value) { - jspb.Message.setProto3EnumField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -5969,7 +6305,7 @@ proto.protocol.Transaction.Result.prototype.getWithdrawAmount = function() { /** @param {number} value */ proto.protocol.Transaction.Result.prototype.setWithdrawAmount = function(value) { - jspb.Message.setProto3IntField(this, 15, value); + jspb.Message.setField(this, 15, value); }; @@ -5984,7 +6320,7 @@ proto.protocol.Transaction.Result.prototype.getUnfreezeAmount = function() { /** @param {number} value */ proto.protocol.Transaction.Result.prototype.setUnfreezeAmount = function(value) { - jspb.Message.setProto3IntField(this, 16, value); + jspb.Message.setField(this, 16, value); }; @@ -6271,7 +6607,7 @@ proto.protocol.Transaction.raw.prototype.getRefBlockBytes_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.raw.prototype.setRefBlockBytes = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -6286,7 +6622,7 @@ proto.protocol.Transaction.raw.prototype.getRefBlockNum = function() { /** @param {number} value */ proto.protocol.Transaction.raw.prototype.setRefBlockNum = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -6325,7 +6661,7 @@ proto.protocol.Transaction.raw.prototype.getRefBlockHash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.raw.prototype.setRefBlockHash = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -6340,7 +6676,7 @@ proto.protocol.Transaction.raw.prototype.getExpiration = function() { /** @param {number} value */ proto.protocol.Transaction.raw.prototype.setExpiration = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -6410,7 +6746,7 @@ proto.protocol.Transaction.raw.prototype.getData_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.raw.prototype.setData = function(value) { - jspb.Message.setProto3BytesField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -6480,7 +6816,7 @@ proto.protocol.Transaction.raw.prototype.getScripts_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.Transaction.raw.prototype.setScripts = function(value) { - jspb.Message.setProto3BytesField(this, 12, value); + jspb.Message.setField(this, 12, value); }; @@ -6495,7 +6831,7 @@ proto.protocol.Transaction.raw.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.Transaction.raw.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 14, value); + jspb.Message.setField(this, 14, value); }; @@ -6510,7 +6846,7 @@ proto.protocol.Transaction.raw.prototype.getFeeLimit = function() { /** @param {number} value */ proto.protocol.Transaction.raw.prototype.setFeeLimit = function(value) { - jspb.Message.setProto3IntField(this, 18, value); + jspb.Message.setField(this, 18, value); }; @@ -6651,7 +6987,7 @@ if (goog.DEBUG && !COMPILED) { * @private {!Array} * @const */ -proto.protocol.TransactionInfo.repeatedFields_ = [5,8]; +proto.protocol.TransactionInfo.repeatedFields_ = [5,8,17]; @@ -6694,7 +7030,9 @@ proto.protocol.TransactionInfo.toObject = function(includeInstance, msg) { result: jspb.Message.getFieldWithDefault(msg, 9, 0), resmessage: msg.getResmessage_asB64(), withdrawAmount: jspb.Message.getFieldWithDefault(msg, 15, 0), - unfreezeAmount: jspb.Message.getFieldWithDefault(msg, 16, 0) + unfreezeAmount: jspb.Message.getFieldWithDefault(msg, 16, 0), + internalTransactionsList: jspb.Message.toObjectList(msg.getInternalTransactionsList(), + proto.protocol.InternalTransaction.toObject, includeInstance) }; if (includeInstance) { @@ -6781,6 +7119,11 @@ proto.protocol.TransactionInfo.deserializeBinaryFromReader = function(msg, reade var value = /** @type {number} */ (reader.readInt64()); msg.setUnfreezeAmount(value); break; + case 17: + var value = new proto.protocol.InternalTransaction; + reader.readMessage(value,proto.protocol.InternalTransaction.deserializeBinaryFromReader); + msg.addInternalTransactions(value); + break; default: reader.skipField(); break; @@ -6896,6 +7239,14 @@ proto.protocol.TransactionInfo.serializeBinaryToWriter = function(message, write f ); } + f = message.getInternalTransactionsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 17, + f, + proto.protocol.InternalTransaction.serializeBinaryToWriter + ); + } }; @@ -7100,7 +7451,7 @@ proto.protocol.TransactionInfo.Log.prototype.getAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionInfo.Log.prototype.setAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -7192,7 +7543,7 @@ proto.protocol.TransactionInfo.Log.prototype.getData_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionInfo.Log.prototype.setData = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -7231,7 +7582,7 @@ proto.protocol.TransactionInfo.prototype.getId_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionInfo.prototype.setId = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -7246,7 +7597,7 @@ proto.protocol.TransactionInfo.prototype.getFee = function() { /** @param {number} value */ proto.protocol.TransactionInfo.prototype.setFee = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -7261,7 +7612,7 @@ proto.protocol.TransactionInfo.prototype.getBlocknumber = function() { /** @param {number} value */ proto.protocol.TransactionInfo.prototype.setBlocknumber = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -7276,7 +7627,7 @@ proto.protocol.TransactionInfo.prototype.getBlocktimestamp = function() { /** @param {number} value */ proto.protocol.TransactionInfo.prototype.setBlocktimestamp = function(value) { - jspb.Message.setProto3IntField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -7368,7 +7719,7 @@ proto.protocol.TransactionInfo.prototype.getContractAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionInfo.prototype.setContractAddress = function(value) { - jspb.Message.setProto3BytesField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -7444,7 +7795,7 @@ proto.protocol.TransactionInfo.prototype.getResult = function() { /** @param {!proto.protocol.TransactionInfo.code} value */ proto.protocol.TransactionInfo.prototype.setResult = function(value) { - jspb.Message.setProto3EnumField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -7483,7 +7834,7 @@ proto.protocol.TransactionInfo.prototype.getResmessage_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionInfo.prototype.setResmessage = function(value) { - jspb.Message.setProto3BytesField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -7498,7 +7849,7 @@ proto.protocol.TransactionInfo.prototype.getWithdrawAmount = function() { /** @param {number} value */ proto.protocol.TransactionInfo.prototype.setWithdrawAmount = function(value) { - jspb.Message.setProto3IntField(this, 15, value); + jspb.Message.setField(this, 15, value); }; @@ -7513,7 +7864,38 @@ proto.protocol.TransactionInfo.prototype.getUnfreezeAmount = function() { /** @param {number} value */ proto.protocol.TransactionInfo.prototype.setUnfreezeAmount = function(value) { - jspb.Message.setProto3IntField(this, 16, value); + jspb.Message.setField(this, 16, value); +}; + + +/** + * repeated InternalTransaction internal_transactions = 17; + * @return {!Array.} + */ +proto.protocol.TransactionInfo.prototype.getInternalTransactionsList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.protocol.InternalTransaction, 17)); +}; + + +/** @param {!Array.} value */ +proto.protocol.TransactionInfo.prototype.setInternalTransactionsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 17, value); +}; + + +/** + * @param {!proto.protocol.InternalTransaction=} opt_value + * @param {number=} opt_index + * @return {!proto.protocol.InternalTransaction} + */ +proto.protocol.TransactionInfo.prototype.addInternalTransactions = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 17, opt_value, proto.protocol.InternalTransaction, opt_index); +}; + + +proto.protocol.TransactionInfo.prototype.clearInternalTransactionsList = function() { + this.setInternalTransactionsList([]); }; @@ -7891,7 +8273,7 @@ proto.protocol.TransactionSign.prototype.getPrivatekey_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.TransactionSign.prototype.setPrivatekey = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -8246,7 +8628,7 @@ proto.protocol.BlockHeader.raw.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.BlockHeader.raw.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -8285,7 +8667,7 @@ proto.protocol.BlockHeader.raw.prototype.getTxtrieroot_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BlockHeader.raw.prototype.setTxtrieroot = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -8324,7 +8706,7 @@ proto.protocol.BlockHeader.raw.prototype.getParenthash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BlockHeader.raw.prototype.setParenthash = function(value) { - jspb.Message.setProto3BytesField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -8339,7 +8721,7 @@ proto.protocol.BlockHeader.raw.prototype.getNumber = function() { /** @param {number} value */ proto.protocol.BlockHeader.raw.prototype.setNumber = function(value) { - jspb.Message.setProto3IntField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -8354,7 +8736,7 @@ proto.protocol.BlockHeader.raw.prototype.getWitnessId = function() { /** @param {number} value */ proto.protocol.BlockHeader.raw.prototype.setWitnessId = function(value) { - jspb.Message.setProto3IntField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -8393,7 +8775,7 @@ proto.protocol.BlockHeader.raw.prototype.getWitnessAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BlockHeader.raw.prototype.setWitnessAddress = function(value) { - jspb.Message.setProto3BytesField(this, 9, value); + jspb.Message.setField(this, 9, value); }; @@ -8408,7 +8790,7 @@ proto.protocol.BlockHeader.raw.prototype.getVersion = function() { /** @param {number} value */ proto.protocol.BlockHeader.raw.prototype.setVersion = function(value) { - jspb.Message.setProto3IntField(this, 10, value); + jspb.Message.setField(this, 10, value); }; @@ -8477,7 +8859,7 @@ proto.protocol.BlockHeader.prototype.getWitnessSignature_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BlockHeader.prototype.setWitnessSignature = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -9016,7 +9398,7 @@ proto.protocol.ChainInventory.BlockId.prototype.getHash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.ChainInventory.BlockId.prototype.setHash = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -9031,7 +9413,7 @@ proto.protocol.ChainInventory.BlockId.prototype.getNumber = function() { /** @param {number} value */ proto.protocol.ChainInventory.BlockId.prototype.setNumber = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -9077,7 +9459,7 @@ proto.protocol.ChainInventory.prototype.getRemainNum = function() { /** @param {number} value */ proto.protocol.ChainInventory.prototype.setRemainNum = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -9413,7 +9795,7 @@ proto.protocol.BlockInventory.BlockId.prototype.getHash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.BlockInventory.BlockId.prototype.setHash = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -9428,7 +9810,7 @@ proto.protocol.BlockInventory.BlockId.prototype.getNumber = function() { /** @param {number} value */ proto.protocol.BlockInventory.BlockId.prototype.setNumber = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -9474,7 +9856,7 @@ proto.protocol.BlockInventory.prototype.getType = function() { /** @param {!proto.protocol.BlockInventory.Type} value */ proto.protocol.BlockInventory.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -9643,7 +10025,7 @@ proto.protocol.Inventory.prototype.getType = function() { /** @param {!proto.protocol.Inventory.InventoryType} value */ proto.protocol.Inventory.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -9900,7 +10282,7 @@ proto.protocol.Items.prototype.getType = function() { /** @param {!proto.protocol.Items.ItemType} value */ proto.protocol.Items.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -10135,7 +10517,7 @@ proto.protocol.DynamicProperties.prototype.getLastSolidityBlockNum = function() /** @param {number} value */ proto.protocol.DynamicProperties.prototype.setLastSolidityBlockNum = function(value) { - jspb.Message.setProto3IntField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -10277,7 +10659,7 @@ proto.protocol.DisconnectMessage.prototype.getReason = function() { /** @param {!proto.protocol.ReasonCode} value */ proto.protocol.DisconnectMessage.prototype.setReason = function(value) { - jspb.Message.setProto3EnumField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -10650,7 +11032,7 @@ proto.protocol.HelloMessage.BlockId.prototype.getHash_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.HelloMessage.BlockId.prototype.setHash = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -10665,7 +11047,7 @@ proto.protocol.HelloMessage.BlockId.prototype.getNumber = function() { /** @param {number} value */ proto.protocol.HelloMessage.BlockId.prototype.setNumber = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -10710,7 +11092,7 @@ proto.protocol.HelloMessage.prototype.getVersion = function() { /** @param {number} value */ proto.protocol.HelloMessage.prototype.setVersion = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -10725,7 +11107,7 @@ proto.protocol.HelloMessage.prototype.getTimestamp = function() { /** @param {number} value */ proto.protocol.HelloMessage.prototype.setTimestamp = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -11567,7 +11949,7 @@ proto.protocol.SmartContract.ABI.Entry.Param.prototype.getIndexed = function() { /** @param {boolean} value */ proto.protocol.SmartContract.ABI.Entry.Param.prototype.setIndexed = function(value) { - jspb.Message.setProto3BooleanField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -11582,7 +11964,7 @@ proto.protocol.SmartContract.ABI.Entry.Param.prototype.getName = function() { /** @param {string} value */ proto.protocol.SmartContract.ABI.Entry.Param.prototype.setName = function(value) { - jspb.Message.setProto3StringField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -11597,7 +11979,7 @@ proto.protocol.SmartContract.ABI.Entry.Param.prototype.getType = function() { /** @param {string} value */ proto.protocol.SmartContract.ABI.Entry.Param.prototype.setType = function(value) { - jspb.Message.setProto3StringField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -11614,7 +11996,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getAnonymous = function() { /** @param {boolean} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setAnonymous = function(value) { - jspb.Message.setProto3BooleanField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -11631,7 +12013,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getConstant = function() { /** @param {boolean} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setConstant = function(value) { - jspb.Message.setProto3BooleanField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -11646,7 +12028,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getName = function() { /** @param {string} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setName = function(value) { - jspb.Message.setProto3StringField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -11723,7 +12105,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getType = function() { /** @param {!proto.protocol.SmartContract.ABI.Entry.EntryType} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setType = function(value) { - jspb.Message.setProto3EnumField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -11740,7 +12122,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getPayable = function() { /** @param {boolean} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setPayable = function(value) { - jspb.Message.setProto3BooleanField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -11755,7 +12137,7 @@ proto.protocol.SmartContract.ABI.Entry.prototype.getStatemutability = function() /** @param {!proto.protocol.SmartContract.ABI.Entry.StateMutabilityType} value */ proto.protocol.SmartContract.ABI.Entry.prototype.setStatemutability = function(value) { - jspb.Message.setProto3EnumField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -11825,7 +12207,7 @@ proto.protocol.SmartContract.prototype.getOriginAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.SmartContract.prototype.setOriginAddress = function(value) { - jspb.Message.setProto3BytesField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -11864,7 +12246,7 @@ proto.protocol.SmartContract.prototype.getContractAddress_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.SmartContract.prototype.setContractAddress = function(value) { - jspb.Message.setProto3BytesField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -11933,7 +12315,7 @@ proto.protocol.SmartContract.prototype.getBytecode_asU8 = function() { /** @param {!(string|Uint8Array)} value */ proto.protocol.SmartContract.prototype.setBytecode = function(value) { - jspb.Message.setProto3BytesField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -11948,7 +12330,7 @@ proto.protocol.SmartContract.prototype.getCallValue = function() { /** @param {number} value */ proto.protocol.SmartContract.prototype.setCallValue = function(value) { - jspb.Message.setProto3IntField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -11963,7 +12345,7 @@ proto.protocol.SmartContract.prototype.getConsumeUserResourcePercent = function( /** @param {number} value */ proto.protocol.SmartContract.prototype.setConsumeUserResourcePercent = function(value) { - jspb.Message.setProto3IntField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -11978,7 +12360,601 @@ proto.protocol.SmartContract.prototype.getName = function() { /** @param {string} value */ proto.protocol.SmartContract.prototype.setName = function(value) { - jspb.Message.setProto3StringField(this, 7, value); + jspb.Message.setField(this, 7, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.InternalTransaction = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.protocol.InternalTransaction.repeatedFields_, null); +}; +goog.inherits(proto.protocol.InternalTransaction, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.InternalTransaction.displayName = 'proto.protocol.InternalTransaction'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.protocol.InternalTransaction.repeatedFields_ = [4]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.InternalTransaction.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.InternalTransaction.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.InternalTransaction} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.InternalTransaction.toObject = function(includeInstance, msg) { + var f, obj = { + hash: msg.getHash_asB64(), + callerAddress: msg.getCallerAddress_asB64(), + transfertoAddress: msg.getTransfertoAddress_asB64(), + callvalueinfoList: jspb.Message.toObjectList(msg.getCallvalueinfoList(), + proto.protocol.InternalTransaction.CallValueInfo.toObject, includeInstance), + note: msg.getNote_asB64(), + rejected: jspb.Message.getFieldWithDefault(msg, 6, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.InternalTransaction} + */ +proto.protocol.InternalTransaction.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.InternalTransaction; + return proto.protocol.InternalTransaction.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.InternalTransaction} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.InternalTransaction} + */ +proto.protocol.InternalTransaction.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setHash(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setCallerAddress(value); + break; + case 3: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTransfertoAddress(value); + break; + case 4: + var value = new proto.protocol.InternalTransaction.CallValueInfo; + reader.readMessage(value,proto.protocol.InternalTransaction.CallValueInfo.deserializeBinaryFromReader); + msg.addCallvalueinfo(value); + break; + case 5: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setNote(value); + break; + case 6: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRejected(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.InternalTransaction.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.InternalTransaction} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.InternalTransaction.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getHash_asU8(); + if (f.length > 0) { + writer.writeBytes( + 1, + f + ); + } + f = message.getCallerAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } + f = message.getTransfertoAddress_asU8(); + if (f.length > 0) { + writer.writeBytes( + 3, + f + ); + } + f = message.getCallvalueinfoList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.protocol.InternalTransaction.CallValueInfo.serializeBinaryToWriter + ); + } + f = message.getNote_asU8(); + if (f.length > 0) { + writer.writeBytes( + 5, + f + ); + } + f = message.getRejected(); + if (f) { + writer.writeBool( + 6, + f + ); + } +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.protocol.InternalTransaction.CallValueInfo = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.protocol.InternalTransaction.CallValueInfo, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.protocol.InternalTransaction.CallValueInfo.displayName = 'proto.protocol.InternalTransaction.CallValueInfo'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.toObject = function(opt_includeInstance) { + return proto.protocol.InternalTransaction.CallValueInfo.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.protocol.InternalTransaction.CallValueInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.InternalTransaction.CallValueInfo.toObject = function(includeInstance, msg) { + var f, obj = { + callvalue: jspb.Message.getFieldWithDefault(msg, 1, 0), + tokenname: msg.getTokenname_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.protocol.InternalTransaction.CallValueInfo} + */ +proto.protocol.InternalTransaction.CallValueInfo.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.protocol.InternalTransaction.CallValueInfo; + return proto.protocol.InternalTransaction.CallValueInfo.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.protocol.InternalTransaction.CallValueInfo} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.protocol.InternalTransaction.CallValueInfo} + */ +proto.protocol.InternalTransaction.CallValueInfo.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setCallvalue(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setTokenname(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.protocol.InternalTransaction.CallValueInfo.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.protocol.InternalTransaction.CallValueInfo} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.protocol.InternalTransaction.CallValueInfo.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getCallvalue(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getTokenname_asU8(); + if (f.length > 0) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional int64 callValue = 1; + * @return {number} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.getCallvalue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.setCallvalue = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional bytes tokenName = 2; + * @return {!(string|Uint8Array)} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.getTokenname = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes tokenName = 2; + * This is a type-conversion wrapper around `getTokenname()` + * @return {string} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.getTokenname_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTokenname())); +}; + + +/** + * optional bytes tokenName = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTokenname()` + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.getTokenname_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTokenname())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.InternalTransaction.CallValueInfo.prototype.setTokenname = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional bytes hash = 1; + * @return {!(string|Uint8Array)} + */ +proto.protocol.InternalTransaction.prototype.getHash = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * optional bytes hash = 1; + * This is a type-conversion wrapper around `getHash()` + * @return {string} + */ +proto.protocol.InternalTransaction.prototype.getHash_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getHash())); +}; + + +/** + * optional bytes hash = 1; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getHash()` + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.prototype.getHash_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getHash())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.InternalTransaction.prototype.setHash = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional bytes caller_address = 2; + * @return {!(string|Uint8Array)} + */ +proto.protocol.InternalTransaction.prototype.getCallerAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes caller_address = 2; + * This is a type-conversion wrapper around `getCallerAddress()` + * @return {string} + */ +proto.protocol.InternalTransaction.prototype.getCallerAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getCallerAddress())); +}; + + +/** + * optional bytes caller_address = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getCallerAddress()` + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.prototype.getCallerAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getCallerAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.InternalTransaction.prototype.setCallerAddress = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional bytes transferTo_address = 3; + * @return {!(string|Uint8Array)} + */ +proto.protocol.InternalTransaction.prototype.getTransfertoAddress = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * optional bytes transferTo_address = 3; + * This is a type-conversion wrapper around `getTransfertoAddress()` + * @return {string} + */ +proto.protocol.InternalTransaction.prototype.getTransfertoAddress_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getTransfertoAddress())); +}; + + +/** + * optional bytes transferTo_address = 3; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getTransfertoAddress()` + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.prototype.getTransfertoAddress_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getTransfertoAddress())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.InternalTransaction.prototype.setTransfertoAddress = function(value) { + jspb.Message.setField(this, 3, value); +}; + + +/** + * repeated CallValueInfo callValueInfo = 4; + * @return {!Array.} + */ +proto.protocol.InternalTransaction.prototype.getCallvalueinfoList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.protocol.InternalTransaction.CallValueInfo, 4)); +}; + + +/** @param {!Array.} value */ +proto.protocol.InternalTransaction.prototype.setCallvalueinfoList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.protocol.InternalTransaction.CallValueInfo=} opt_value + * @param {number=} opt_index + * @return {!proto.protocol.InternalTransaction.CallValueInfo} + */ +proto.protocol.InternalTransaction.prototype.addCallvalueinfo = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.protocol.InternalTransaction.CallValueInfo, opt_index); +}; + + +proto.protocol.InternalTransaction.prototype.clearCallvalueinfoList = function() { + this.setCallvalueinfoList([]); +}; + + +/** + * optional bytes note = 5; + * @return {!(string|Uint8Array)} + */ +proto.protocol.InternalTransaction.prototype.getNote = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * optional bytes note = 5; + * This is a type-conversion wrapper around `getNote()` + * @return {string} + */ +proto.protocol.InternalTransaction.prototype.getNote_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getNote())); +}; + + +/** + * optional bytes note = 5; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getNote()` + * @return {!Uint8Array} + */ +proto.protocol.InternalTransaction.prototype.getNote_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getNote())); +}; + + +/** @param {!(string|Uint8Array)} value */ +proto.protocol.InternalTransaction.prototype.setNote = function(value) { + jspb.Message.setField(this, 5, value); +}; + + +/** + * optional bool rejected = 6; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.protocol.InternalTransaction.prototype.getRejected = function() { + return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 6, false)); +}; + + +/** @param {boolean} value */ +proto.protocol.InternalTransaction.prototype.setRejected = function(value) { + jspb.Message.setField(this, 6, value); }; diff --git a/src/utils/transactionBuilder.js b/src/utils/transactionBuilder.js index 232e921..ee8115e 100644 --- a/src/utils/transactionBuilder.js +++ b/src/utils/transactionBuilder.js @@ -325,6 +325,7 @@ function buildTransactionExchange(address,exchange_id, token_id, quant, expected module.exports = { + buildTransferContract, buildTransferTransaction, buildAccountUpdate, buildAssetParticipate, diff --git a/src/utils/tronWeb.js b/src/utils/tronWeb.js new file mode 100644 index 0000000..bd7d12b --- /dev/null +++ b/src/utils/tronWeb.js @@ -0,0 +1,202 @@ +const { buildTransferContract } = require("./transactionBuilder"); +const {Block, Transaction, Account} = require("../protocol/core/Tron_pb"); + +const { + TransferContract, + TransferAssetContract, + AccountUpdateContract, + VoteWitnessContract, + ParticipateAssetIssueContract, + AssetIssueContract, + FreezeBalanceContract, + UnfreezeBalanceContract, + WitnessUpdateContract, + WithdrawBalanceContract, + WitnessCreateContract, + UnfreezeAssetContract, +} = require("../protocol/core/Contract_pb"); + +const fromHexString = hexString => + new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16))); + +export function transactionJsonToProtoBuf(transaction) { + + const rawData = transaction.raw_data; + const contractJson = rawData.contract[0]; + const transactionObj = contractJsonToProtobuf(contractJson); + + const rawDataObj = transactionObj.getRawData(); + + rawDataObj.setRefBlockBytes(fromHexString(rawData.ref_block_bytes)); + rawDataObj.setRefBlockHash(fromHexString(rawData.ref_block_hash)); + if (rawData.expiration) { + rawDataObj.setExpiration(rawData.expiration); + } + + if (rawData.timestamp) { + rawDataObj.setTimestamp(rawData.timestamp); + } + + transactionObj.setRawData(rawDataObj); + + return transactionObj; +} + +export function contractJsonToProtobuf(contract) { + + const value = contract.parameter.value; + + switch (contract.type) { + + case "TransferContract": { + const {to_address, owner_address, amount} = value; + let transferContract = new TransferContract(); + transferContract.setToAddress(fromHexString(to_address)); + transferContract.setOwnerAddress(fromHexString(owner_address)); + transferContract.setAmount(amount); + + return buildTransferContract( + transferContract, + Transaction.Contract.ContractType.TRANSFERCONTRACT, + contract.type); + } + + case "TransferAssetContract": { + const {to_address, owner_address, amount, asset_name} = value; + let transferContract = new TransferAssetContract(); + transferContract.setToAddress(fromHexString(to_address)); + transferContract.setOwnerAddress(fromHexString(owner_address)); + transferContract.setAssetName(asset_name); + transferContract.setAmount(amount); + + return buildTransferContract( + transferContract, + Transaction.Contract.ContractType.TRANSFERASSETCONTRACT, + contract.type); + } + + case "AccountUpdateContract": { + + let contract = new AccountUpdateContract(); + contract.setOwnerAddress(Uint8Array.from(fromHexString(value.owner_address))); + contract.setAccountName(value.account_name); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.ACCOUNTUPDATECONTRACT, + "AccountUpdateContract"); + } + + case "WitnessCreateContract": { + + let contract = new WitnessCreateContract(); + contract.setOwnerAddress(fromHexString(value.owner_address)); + contract.setUrl(value.url); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.WITNESSCREATECONTRACT, + "WitnessCreateContract"); + } + + + case "WitnessUpdateContract": { + + let contract = new WitnessUpdateContract(); + contract.setOwnerAddress(fromHexString(value.owner_address)); + contract.setUpdateUrl(value.url); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.WITNESSUPDATECONTRACT, + "WitnessUpdateContract"); + } + + case "WithdrawBalanceContract": { + + let contract = new WithdrawBalanceContract(); + contract.setOwnerAddress(fromHexString(value.owner_address)); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.WITHDRAWBALANCECONTRACT, + "WithdrawBalanceContract"); + } + + case "FreezeBalanceContract": { + + // TODO ADD ENERGY SWITCH + + let contract = new FreezeBalanceContract(); + + contract.setOwnerAddress(fromHexString(value.owner_address)); + contract.setFrozenBalance(value.frozen_balance); + contract.setFrozenDuration(value.frozen_duration); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.FREEZEBALANCECONTRACT, + "FreezeBalanceContract"); + } + + + case "VoteWitnessContract": { + + let contract = new VoteWitnessContract(); + contract.setOwnerAddress(fromHexString(value.owner_address)); + + for (let address of value.votes) { + let vote = new VoteWitnessContract.Vote(); + vote.setVoteAddress(fromHexString(address.vote_address)); + vote.setVoteCount(address.vote_count); + contract.addVotes(vote); + } + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.VOTEWITNESSCONTRACT, + "VoteWitnessContract"); + } + + case "ParticipateAssetIssueContract": { + + let contract = new ParticipateAssetIssueContract(); + contract.setToAddress(fromHexString(value.to_address)); + contract.setOwnerAddress(fromHexString(value.owner_address)); + contract.setAssetName(value.asset_name); + contract.setAmount(value.amount); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.PARTICIPATEASSETISSUECONTRACT, + "ParticipateAssetIssueContract"); + } + + case "UnfreezeBalanceContract": { + + // TODO ADD ENERGY SWITCH + + let contract = new UnfreezeBalanceContract(); + + contract.setOwnerAddress(fromHexString(value.owner_address)); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.UNFREEZEBALANCECONTRACT, + "UnfreezeBalanceContract"); + } + + case "UnfreezeAssetContract": { + + let contract = new UnfreezeAssetContract(); + + contract.setOwnerAddress(fromHexString(value.owner_address)); + + return buildTransferContract( + contract, + Transaction.Contract.ContractType.UNFREEZEASSETCONTRACT, + "UnfreezeAssetContract"); + } + + } +}