Skip to content

Commit

Permalink
Merge pull request #5 from metaloop-world/client-signer
Browse files Browse the repository at this point in the history
Client signer
  • Loading branch information
lxjhk authored Jan 22, 2024
2 parents ec32643 + c688a18 commit d9ab826
Showing 1 changed file with 66 additions and 50 deletions.
116 changes: 66 additions & 50 deletions mpcvault/platform/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,30 @@ service PlatformAPI {
// It will contain the signing request status and the transaction hash if the signing request was completed.
rpc GetSigningRequestDetails (GetSigningRequestDetailsRequest) returns (GetSigningRequestDetailsResponse);

// CreateBatchPayment creates a batch payment.
// CreateBatchPayment creates a batch payment. You will need to complete the batch payment using the MPCVault web app.
rpc CreateBatchPayment (CreateBatchPaymentRequest) returns (CreateBatchPaymentResponse);

// GetBatchPaymentDetails returns the details of a batch payment.
// GetBatchPaymentDetails returns the details of a batch payment including the signing requests.
rpc GetBatchPaymentDetails (GetBatchPaymentDetailsRequest) returns (GetBatchPaymentDetailsResponse);

// CreateWallet creates a wallet.
// CreateWallet creates a wallet. Wallets created will be EOA wallets. You are responsible for completing a sanity tests before using the wallet.
// While the response contains the public key, you are strongly discouraged from using it to generate the wallet address yourself. Instead, use the address returned in the response.
rpc CreateWallet (CreateWalletRequest) returns (CreateWalletResponse);

// ExecuteSigningRequests sign a signing request.
// ExecuteSigningRequests signs a signing request. The signing request can be created via the API or manually.
rpc ExecuteSigningRequests (ExecuteSigningRequestsRequest) returns (ExecuteSigningRequestsResponse);
}

message CreateWalletRequest {
// vault_uuid is the UUID of the vault to create the wallet in.
// vault_uuid is the UUID of the vault that the wallet will be created in.
// You can find it in the settings page of your vault on the web.
string vault_uuid = 1;
// callback_client_signer_public_key is the public key of the api client signer.
// It is used to identify the call back.
// It is used to identify the where we should send the callback to.
string callback_client_signer_public_key = 2;
// network_type is the type of the network.
NetworkType network_type = 3;
// (optional) ref is the unique identifier for the wallet.
// (optional) ref is the customer reference field for the wallet. It has to be unique if not empty.
string ref = 4;
}
enum NetworkType {
Expand All @@ -76,22 +77,20 @@ enum KeyType {
KEY_TYPE_ECC_ED25519 = 2;
}
message Wallet {
// vault_uuid is the UUID of the vault that the wallet is in.
// vault_uuid is the UUID of the vault that the wallet was created in.
string vault_uuid = 1;
// callback_client_signer_public_key is the public key of the api client signer.
string callback_client_signer_public_key = 2;
// key_type is the type of the key in the wallet.
KeyType key_type = 3;
// key_path is the path of the key in the wallet.
string key_path = 4;
// public_key is the public key of the wallet.
bytes public_key = 5;
// key_type is the type of the key.
KeyType key_type = 2;
// key_path is the path of the key.
string key_path = 3;
// public_key is the public key of the key.
bytes public_key = 4;
// network_type is the type of the network.
NetworkType network_type = 6;
// address is the address of the wallet.
string address = 7;
// ref is unique identifier for the wallet.
string ref = 8;
NetworkType network_type = 5;
// address is the address of the wallet in the network.
string address = 6;
// ref is unique identifier for the wallet as configured by the user.
string ref = 7;
}
message CreateWalletResponse {
Wallet details = 1;
Expand All @@ -100,12 +99,13 @@ message CreateWalletResponse {

message ExecuteSigningRequestsRequest {
// uuid is the UUID of the signing request.
// Currently only signing requests created by wallets created by the API are supported.
// Currently only signing requests of API wallets are supported.
string uuid = 1;
}
message ExecuteSigningRequestsResponse {
Error error = 1;
// tx_hash is the hash of the transaction, only set if status is STATUS_SUCCEEDED.
// tx_hash is the hash of the signed transaction, only set if status is STATUS_SUCCEEDED.
// This does not mean that the transaction it self is successful. It only means that the signing request has been signed.
string tx_hash = 2;
// signatures is the signatures of the raw message, only set if status is STATUS_SUCCEEDED.
SignatureContainer signatures = 3;
Expand Down Expand Up @@ -135,6 +135,7 @@ message EVMMessage {
TYPE_SIGN_TYPED_DATA = 2;
}
uint64 chain_id = 1;
// from is the address of the sender. It has to be in this vault.
string from = 2;
Type type = 3;
bytes content = 4;
Expand All @@ -152,6 +153,7 @@ message AptosMessage {
string message = 4;
string nonce = 5;
}
// from is the sender wallet address. It has to be in this vault.
string from = 1;
Type type = 2;
Message content = 3;
Expand All @@ -162,14 +164,17 @@ message SolanaMessage {
TYPE_UNSPECIFIED = 0;
TYPE_DEFAULT = 1;
}
// from is the sender wallet address. It has to be in this vault.
string from = 1;
Type type = 2;
bytes content = 3;
}

message RawMessage {
// from is the wallet address of the key pair that we uses to sign the message. The wallet has to be in this vault.
// We will use the key's algorithm to sign the message.
string from = 1;
// content is the raw message content.
// content is the raw message content in bytes.
bytes content = 2;
}

Expand All @@ -178,14 +183,16 @@ message EVMGas {
// max_fee is the maximum fee that the user is willing to pay, denominated in wei.
google.protobuf.StringValue max_fee = 1;
// max_priority_fee is the maximum priority fee that the user is willing to pay for EIP-1559 transactions, denominated in wei.
// leave this field empty if you do not want to use EIP-1559.
google.protobuf.StringValue max_priority_fee = 2;
// gas_limit is the maximum amount of gas that the tx is allowed to consume.
google.protobuf.StringValue gas_limit = 3;
}

message EVMSendNative {
// chain_id is the chain id of the network.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// to is the address of the recipient.
string to = 3;
Expand All @@ -195,21 +202,24 @@ message EVMSendNative {
}

message EVMSendERC20 {
// chain_id is the chain id of the network.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// to is the address of the recipient.
string to = 3;
// token_contract_address is the address of the ERC20 token contract.
string token_contract_address = 4;
// amount is the amount of tokens to send. You should use whole integer representation. [amount * 10^decimals]
// We will use the contract's decimals to convert the amount.
string amount = 5;
EVMGas gas_fee = 6;
}

message EVMSendCustom {
// chain_id is the chain id of the network.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// to is the address of the recipient.
string to = 3;
Expand All @@ -220,7 +230,7 @@ message EVMSendCustom {
}

message BTCSendNative {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -231,7 +241,7 @@ message BTCSendNative {
}

message TronSendNative {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -240,7 +250,7 @@ message TronSendNative {
}

message TronSendTRC10 {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -251,7 +261,7 @@ message TronSendTRC10 {
}

message TronSendTRC20 {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -272,9 +282,9 @@ message AptosGas {
}

message AptosSendNative {
// please use 1 for mainnet. MPCVault does not support Aptos testnet at the moment
// please use 1 for mainnet. MPCVault does not support Aptos testnet at the moment.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// to is the address of the recipient.
string to = 3;
Expand All @@ -285,8 +295,9 @@ message AptosSendNative {
}

message AptosSendCoin {
// please use 1 for mainnet. MPCVault does not support Aptos testnet at the moment.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// to is the address of the recipient.
string to = 3;
Expand All @@ -299,8 +310,9 @@ message AptosSendCoin {
}

message AptosSendCustom {
// please use 1 for mainnet. MPCVault does not support Aptos testnet at the moment.
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// payload can be JSON or the bcs-serialized bytes of the transaction.
bytes payload = 3;
Expand All @@ -316,7 +328,7 @@ message SuiGas {
}

message SuiSendNative {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -327,7 +339,7 @@ message SuiSendNative {
}

message SuiSendCoin {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the address of the recipient.
string to = 2;
Expand All @@ -340,14 +352,14 @@ message SuiSendCoin {
}

message SuiSendCustom {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// payload can be JSON or the bcs-serialized bytes of the transaction.
bytes payload = 2;
}

message SolanaSendNative {
// from is the account address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the account address of the recipient.
string to = 2;
Expand All @@ -356,7 +368,7 @@ message SolanaSendNative {
}

message SolanaSendSPLToken {
// from is the account address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
// to is the account address of the recipient.
string to = 2;
Expand All @@ -367,6 +379,7 @@ message SolanaSendSPLToken {
}

message CreateSigningRequestRequest {
// type is the type of the signing request. It is a oneof field.
oneof type {
EVMSendNative evm_send_native = 1;
EVMSendERC20 evm_send_erc20 = 2;
Expand All @@ -390,15 +403,16 @@ message CreateSigningRequestRequest {
}
// notes is the transaction notes for the signing request.
google.protobuf.StringValue notes = 1000;
// vault_uuid is the UUID of the vault that will sign the transaction.
// If it is from an api wallet, it must.
// vault_uuid is the UUID of the vault that the signing request will be created in.
google.protobuf.StringValue vault_uuid = 1001;
// callback_client_signer_public_key is the public key of the api client signer.
// If it is from an api wallet, it must.
// callback_client_signer_public_key is the public key of the api client signer for callback
// It is used to identify the where we should send the callback to. If empty, we will show the signing request in the MPCVault mobile app for manual signing.
// Note that if the signing request is created by an api wallet, this field must be set as api wallets can only be signed by the api client signer at the moment.
google.protobuf.StringValue callback_client_signer_public_key = 1002;
}

message CreateSigningRequestResponse {
// signing_request is the signing request that was created.
SigningRequest signing_request = 1;
Error error = 2;
}
Expand Down Expand Up @@ -429,11 +443,13 @@ message SigningRequest {
}
// uuid is the unique identifier of the signing request.
string uuid = 1;
// status is the status of the signing request.
// status is the status of the signing request. STATUS_SUCCEEDED only means that the signing request has been signed.
// it does not mean that the transaction itself is successful.
Status status = 2;
// failed_reason is the reason why the signing request failed, only set if status is STATUS_FAILED.
string failed_reason = 3;
// tx_hash is the hash of the transaction, only set if status is STATUS_SUCCEEDED.
// This does not mean that the transaction it self is successful. It only means that the signing request has been signed.
string tx_hash = 4;
// creation_timestamp is the timestamp when the signing request was created.
uint64 creation_timestamp = 5;
Expand All @@ -459,9 +475,9 @@ message SigningRequest {
SolanaMessage solana_message = 24;
RawMessage raw_message = 25;
}
// If it is from an api wallet, it must.
// vault_uuid is the UUID of the vault that the signing request was created in.
google.protobuf.StringValue vault_uuid = 1000;
// If it is from an api wallet, it must.
// callback_client_signer_public_key is the public key of the api client signer for callback. This field can be empty.
google.protobuf.StringValue callback_client_signer_public_key = 1001;
}

Expand All @@ -479,22 +495,22 @@ message BatchPaymentRecipient {

message EVMBatchSendNative {
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
repeated BatchPaymentRecipient recipients = 3;
}

message EVMBatchSendERC20 {
uint64 chain_id = 1;
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 2;
// token_contract_address is the address of the ERC20 token contract.
string token_contract_address = 3;
repeated BatchPaymentRecipient recipients = 4;
}

message BTCBatchSendNative {
// from is the address of the sender.
// from is the sender wallet address. It has to be in this vault.
string from = 1;
repeated BatchPaymentRecipient recipients = 2;
}
Expand Down

0 comments on commit d9ab826

Please sign in to comment.