diff --git a/.github/workflows/syncrepo.yml b/.github/workflows/syncrepo.yml new file mode 100644 index 0000000..27a6d4b --- /dev/null +++ b/.github/workflows/syncrepo.yml @@ -0,0 +1,45 @@ +name: Repo Sync + +on: + push: + branches: [ main ] # or any branch you want to watch + +jobs: + repo-sync: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Pushes to another repository + run: | + SOURCE_DIRECTORY="$(pwd)" # Source directory path + DESTINATION_USERNAME="mpcvault" # Destination GitHub username + DESTINATION_REPOSITORY="mpcvaultapis" # Destination repository name + TARGET_BRANCH="main" # Target branch in the destination repository + USER_EMAIL="info@mpcvault.com" + USER_NAME="lxjhk" + + git rm -r --cached . + git reset --hard + + # Set user information + git config --global user.email "$USER_EMAIL" + git config --global user.name "$USER_NAME" + git config --unset http.https://github.com/.extraheader + + GIT_CMD_REPOSITORY="https://$USER_NAME:${{ secrets.MPCVAULT_EXTERN_SYNC_GITHUB_TOKEN }}@github.com/$DESTINATION_USERNAME/$DESTINATION_REPOSITORY.git" + + { + git clone --single-branch --depth 1 --branch "$TARGET_BRANCH" "$GIT_CMD_REPOSITORY" + } || { + echo "::error::Could not clone the destination repository. Command:" + echo "::error::git clone --single-branch --branch $TARGET_BRANCH $GIT_CMD_REPOSITORY" + exit 1 + } + + git remote remove origin + git remote add origin $GIT_CMD_REPOSITORY + git push -f origin main \ No newline at end of file diff --git a/mpcvault/platform/v1/api.proto b/mpcvault/platform/v1/api.proto index 73317ec..285bd01 100644 --- a/mpcvault/platform/v1/api.proto +++ b/mpcvault/platform/v1/api.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package mpcvault.platform.v1; import "google/protobuf/wrappers.proto"; +import "mpcvault/rpc/v1/status.proto"; option go_package = "go.mpcvault.com/genproto/mpcvaultapis/platform/v1;platform"; option java_multiple_files = true; @@ -39,6 +40,68 @@ service PlatformAPI { // GetBatchPaymentDetails returns the details of a batch payment. rpc GetBatchPaymentDetails (GetBatchPaymentDetailsRequest) returns (GetBatchPaymentDetailsResponse); + + // CreateWallet creates a wallet. + rpc CreateWallet (CreateWalletRequest) returns (CreateWalletResponse); + + // SignSigningRequest sign a signing request. + rpc SignSigningRequest (SignSigningRequestRequest) returns (SignSigningRequestResponse); +} + +message CreateWalletRequest { + string vault_uuid = 1; + string client_signer_public_key = 2; + AddressFormat address_format = 3; + string ref = 4; +} +enum AddressFormat { + ADDRESS_FORMAT_UNKNOWN = 0; + ADDRESS_FORMAT_EVM = 1; + ADDRESS_FORMAT_BITCOIN = 2; + ADDRESS_FORMAT_TRON = 3; + ADDRESS_FORMAT_APTOS = 4; + ADDRESS_FORMAT_SUI = 5; + ADDRESS_FORMAT_SOLANA = 6; +} +enum KeyType { + KEY_TYPE_UNSPECIFIED = 0; + KEY_TYPE_ECC_SECP256K1 = 1; + KEY_TYPE_ECC_ED25519 = 2; +} +message Wallet { + string vault_uuid = 1; + string client_signer_public_key = 2; + KeyType key_type = 3; + string key_path = 4; + string public_key = 5; + AddressFormat address_format = 6; + string address = 7; + string ref = 8; +} +message CreateWalletResponse { + Wallet details = 1; + mpcvault.rpc.v1.Status error = 2; +} + +message SignSigningRequestRequest { + string uuid = 1; +} +message SignSigningRequestError { + enum ErrorCode { + // Enum unspecified. + ERROR_CODE_UNSPECIFIED = 0; + // Insufficient funds + ERROR_CODE_INSUFFICIENT_FUNDS = 1; + // Denied + ERROR_CODE_ALREADY_DENIED = 2; + } + ErrorCode error_code = 1; + string message = 2; +} +message SignSigningRequestResponse { + mpcvault.rpc.v1.Status error = 1; + // tx_hash is the hash of the transaction, only set if status is STATUS_SUCCEEDED. + string tx_hash = 2; } // EVMGas is the gas fee settings for an EVM transaction. @@ -254,10 +317,13 @@ message CreateSigningRequestRequest { } // notes is the transaction notes for the signing request. google.protobuf.StringValue notes = 1000; + google.protobuf.StringValue vault_uuid = 1001; + google.protobuf.StringValue client_signer_public_key = 1002; } message CreateSigningRequestResponse { SigningRequest signing_request = 1; + mpcvault.rpc.v1.Status error = 2; } message RejectSigningRequestRequest { @@ -265,7 +331,7 @@ message RejectSigningRequestRequest { } message RejectSigningRequestResponse { - + mpcvault.rpc.v1.Status error = 1; } message GetSigningRequestDetailsRequest { @@ -274,6 +340,7 @@ message GetSigningRequestDetailsRequest { message GetSigningRequestDetailsResponse { SigningRequest signing_request = 1; + mpcvault.rpc.v1.Status error = 2; } message SigningRequest { @@ -309,7 +376,10 @@ message SigningRequest { SuiSendCustom sui_send_custom = 18; SolanaSendNative solana_send_native = 19; SolanaSendSPLToken solana_send_spl_token = 20; + CreateWalletRequest create_wallet = 21; } + google.protobuf.StringValue vault_uuid = 1000; + google.protobuf.StringValue client_signer_public_key = 1001; } message BatchPaymentRecipient { @@ -360,6 +430,7 @@ message CreateBatchPaymentRequest { message CreateBatchPaymentResponse { BatchPayment batch_payment = 1; + mpcvault.rpc.v1.Status error = 2; } message GetBatchPaymentDetailsRequest { @@ -368,6 +439,7 @@ message GetBatchPaymentDetailsRequest { message GetBatchPaymentDetailsResponse { BatchPayment batch_payment = 1; + mpcvault.rpc.v1.Status error = 2; } message BatchPayment { diff --git a/mpcvault/platform/v1/error.proto b/mpcvault/platform/v1/error.proto new file mode 100644 index 0000000..bc3a654 --- /dev/null +++ b/mpcvault/platform/v1/error.proto @@ -0,0 +1,34 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package mpcvault.platform.v1; + +option go_package = "go.mpcvault.com/genproto/mpcvaultapis/platform/v1;platform"; +option java_multiple_files = true; +option java_outer_classname = "ServiceErrorProto"; +option java_package = "com.mpcvault.platform.v1"; + + +message ServiceError { + enum ErrorCode { + ERROR_CODE_UNSPECIFIED = 0; + ERROR_CODE_ORG_SUBSCRIBED_PLAN_LIMIT_EXCEED = 1; + ERROR_CODE_ORG_SUBSCRIBED_PLAN_EXPIRED = 2; + ERROR_CODE_ORG_SUBSCRIBED_PLAN_NOT_SUPPORT = 3; + } + ErrorCode error_code = 1; + string message = 2; +} diff --git a/mpcvault/rpc/v1/status.proto b/mpcvault/rpc/v1/status.proto new file mode 100644 index 0000000..64a7f81 --- /dev/null +++ b/mpcvault/rpc/v1/status.proto @@ -0,0 +1,28 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package mpcvault.rpc.v1; + +import "google/protobuf/any.proto"; + +option go_package = "go.mpcvault.com/genproto/mpcvaultapis/rpc/v1;rpc"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.mpcvault.rpc.v1"; + +message Status { + repeated google.protobuf.Any details = 1; +} \ No newline at end of file