Skip to content

Commit

Permalink
Copying *.proto files
Browse files Browse the repository at this point in the history
  • Loading branch information
githubswisschain committed Aug 2, 2024
1 parent 1b751b1 commit bab4602
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 416 deletions.
246 changes: 40 additions & 206 deletions .proto/smart_contracts.proto
Original file line number Diff line number Diff line change
@@ -1,225 +1,59 @@
syntax = "proto3";
syntax = "proto3";

option csharp_namespace = "Swisschain.Sirius.Api.ApiContract.SmartContracts";
option csharp_namespace = "Swisschain.Sirius.Api.ApiContract.V2.SmartContracts";

import "common.proto";
import "smart_contracts.common.proto";
import "smart_connect.data_model.proto";
import "smart_connect.metamodel.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "smart_contracts.common.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";

package swisschain.sirius.api.smart_contracts;

service SmartContracts {
rpc Search (SmartContractSearchRequest) returns (SmartContractSearchResponse);
rpc GetCode (SmartContractGetCodeRequest) returns (SmartContractGetCodeResponse);
rpc Deploy (SmartContractDeployRequest) returns (SmartContractDeployResponse);
rpc Parse (SmartContractParseRequest) returns (SmartContractParseResponse);
rpc Estimate (SmartContractEstimateRequest) returns (SmartContractEstimateResponse);
rpc GetUpdates (SmartContractGetUpdatesRequest) returns (stream SmartContractGetUpdatesResponse);
}

// Search

message SmartContractSearchRequest {
google.protobuf.Int64Value smart_contract_id = 1;
google.protobuf.StringValue name = 2;
google.protobuf.StringValue address = 3;
google.protobuf.StringValue creator_address = 4;
google.protobuf.StringValue blockchain_id = 5;
google.protobuf.Int64Value broker_account_id = 6;
repeated SmartContractState state = 7;
api.common.PaginationInt64 pagination = 8;
}

message SmartContractSearchResponse {
oneof result {
SmartContractSearchResponseBody body = 1;
api.common.ErrorResponseBody error = 2;
}
}

message SmartContractSearchResponseBody {
api.common.PaginatedInt64Response pagination = 1;
repeated SmartContract items = 2;
}

message SmartContract {
int64 id = 1;
string blockchain_id = 2;
string blockchain_name = 3;
string name = 4;
google.protobuf.StringValue address = 5;
SmartContractAddingWay adding_way = 6;
google.protobuf.Int64Value deployer_broker_account_id = 7;
google.protobuf.StringValue deployer_broker_account_name = 8;
google.protobuf.Int64Value deployer_broker_account_details_id = 9;
string creator_address = 10;
smart_contracts.common.Payment payment = 11;
repeated smart_connect.data_model.Argument arguments = 12;
SmartContractState state = 13;
api.common.TransactionInfo transaction_info = 14;
SmartContractDeploymentContext contract_deployment_context = 15;
google.protobuf.Int64Value deployment_operation_id = 16;
api.common.ValidatorContext validator_context = 17;
int64 sequence = 18;
smart_contracts.common.SmartContractError error = 19;
google.protobuf.Timestamp created_at = 20;
google.protobuf.Timestamp updated_at = 21;
repeated swisschain.sirius.api.common.Fee expectedFees = 24;
repeated swisschain.sirius.api.common.Fee actualFees = 25;
}

// GetCode

message SmartContractGetCodeRequest {
int64 smart_contract_id = 1;
}

message SmartContractGetCodeResponse {
oneof result {
SmartContractGetCodeResponseBody body = 1;
api.common.ErrorResponseBody error = 2;
}
}

message SmartContractGetCodeResponseBody {
bytes code = 1;
}

// Deploy

message SmartContractDeployRequest {
string request_id = 1;
string document = 2;
string signature = 3;
bytes code = 4;
}

message SmartContractDeployResponse {
oneof result {
SmartContractDeployResponseBody body = 1;
api.common.ErrorResponseBody error = 2;
}
}

message SmartContractDeployResponseBody {
SmartContract smart_contract = 1;
}

// Parse

message SmartContractParseRequest {
string blockchain_id = 1;
bytes code = 2;
}

message SmartContractParseResponse {
oneof result {
SmartContractParseResponseBody body = 1;
api.common.ErrorResponseBody error = 2;
}
}

message SmartContractParseResponseBody {
smart_connect.metamodel.SmartContractInfo metamodel = 1;
}

// Estimate

message SmartContractEstimateRequest {
string request_id = 1;
bytes code = 2;
string blockchain_id = 3;
int64 broker_account_id = 4;
repeated smart_connect.data_model.Argument arguments = 5;
smart_contracts.common.Payment payment = 6;
}

message SmartContractEstimateResponse {
oneof body {
SmartContractEstimateResponseBody result = 1;
api.common.ErrorResponseBody error = 2;
}
}

message SmartContractEstimateResponseBody {
api.common.Fee fee = 1;
}

// GetUpdates
package swisschain.sirius.api.v2.smart_contracts;

message SmartContractGetUpdatesRequest {
google.protobuf.Int64Value smart_contract_id = 1;
google.protobuf.StringValue address = 2;
google.protobuf.StringValue blockchain_id = 3;
google.protobuf.Int64Value deployer_broker_account_id = 4;
NullableSmartContractState state = 5;
google.protobuf.Int64Value cursor = 6;
google.protobuf.StringValue stream_id = 7;
service SmartContractService {
rpc Invoke (SmartContractInvokeRequest) returns (SmartContractInvokeResponse);
}

message SmartContractGetUpdatesResponse {
repeated SmartContractUpdate items = 1;
// Invoke
message SmartContractInvokeRequest {
string idempotency_id = 1;
SmartContractInvocationDocument document = 2;
bytes signature = 3;
int64 smart_contract_id = 4;
string name = 5;
}

message SmartContractUpdate {
int64 id = 1;
int64 smart_contract_id = 2;
string blockchain_id = 3;
string blockchain_name = 4;
string name = 5;
google.protobuf.StringValue address = 6;
SmartContractAddingWay adding_way = 7;
google.protobuf.Int64Value deployer_broker_account_id = 8;
google.protobuf.StringValue deployer_broker_account_name = 9;
google.protobuf.Int64Value deployer_broker_account_details_id = 10;
string creator_address = 11;
smart_contracts.common.Payment payment = 12;
repeated smart_connect.data_model.Argument arguments = 13;
SmartContractState state = 14;
api.common.TransactionShortInfo transaction_info = 15;
SmartContractDeploymentContext contract_deployment_context = 16;
google.protobuf.Int64Value deployment_operation_id = 17;
api.common.ValidatorContext validator_context = 18;
int64 sequence = 19;
smart_contracts.common.SmartContractError error = 20;
google.protobuf.Timestamp created_at = 21;
google.protobuf.Timestamp updated_at = 22;
message SmartContractInvocationDocument {
int64 broker_account_id = 1;
string method_name = 2;
google.protobuf.StringValue method_address = 3;
repeated swisschain.sirius.api.smart_connect.data_model.Argument arguments = 4;
swisschain.sirius.api.smart_contracts.common.Payment payment = 5;
google.protobuf.StringValue reference_id = 6;
map<string,string> properties = 7;
}

// Common

enum SmartContractState {
PROCESSING = 0;
VALIDATING = 1;
SIGNING = 2;
SENT = 3;
ON_CHAIN = 4;
COMPLETED = 5;
FAILED = 6;
REJECTED = 7;
OUT_OF_GAS = 8;
message SmartContractInvokeResponse {
oneof kind {
SmartContractInvokePayload payload = 1;
SmartContractInvokeError error = 2;
}
}

message NullableSmartContractState {
oneof kind {
google.protobuf.NullValue null = 1;
SmartContractState state = 2;
}
message SmartContractInvokePayload {
int64 id = 1;
}

enum SmartContractAddingWay {
DEPLOYMENT = 0;
REGISTRATION = 1;
}
message SmartContractInvokeError {
enum ErrorCode {
UNKNOWN = 0;
INVALID_PARAMETERS = 1;
DOMAIN_PROBLEM = 2;
TECHNICAL_PROBLEM = 3;
NOT_AUTHORIZED = 4;
NOT_ENOUGH_BALANCE = 5;
}

message SmartContractDeploymentContext {
google.protobuf.StringValue reference_id = 1;
string document = 2;
string signature = 3;
string code_hash = 4;
api.common.RequestContext request_context = 5;
ErrorCode code = 1;
string message = 2;
}
Loading

0 comments on commit bab4602

Please sign in to comment.