diff --git a/accounting/types.proto b/accounting/types.proto deleted file mode 100644 index 02fb691..0000000 --- a/accounting/types.proto +++ /dev/null @@ -1,125 +0,0 @@ -syntax = "proto3"; -package accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "decimal/decimal.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -message Account { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Address is identifier of accounting record - string Address = 2; - // ParentAddress is identifier of parent accounting record - string ParentAddress = 3; - // ActiveFunds is amount of active (non locked) funds for account - decimal.Decimal ActiveFunds = 4; - // Lifetime is time until account is valid (used for lock accounts) - Lifetime Lifetime = 5 [(gogoproto.nullable) = false]; - // LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) - LockTarget LockTarget = 6; - // LockAccounts contains child accounts with locked funds - repeated Account LockAccounts = 7; -} - -// LockTarget must be one of two options -message LockTarget { - oneof Target { - // WithdrawTarget used when user requested withdraw - WithdrawTarget WithdrawTarget = 1; - // ContainerCreateTarget used when user requested creation of container - ContainerCreateTarget ContainerCreateTarget = 2; - } -} - -message Balances { - // Accounts contains multiple account snapshots - repeated Account Accounts = 1 [(gogoproto.nullable) = false]; -} - -message PayIO { - // BlockID contains id of the NEO block where withdraw or deposit - // call was invoked - uint64 BlockID = 1; - // Transactions contains all transactions that founded in block - // and used for PayIO - repeated Tx Transactions = 2 [(gogoproto.nullable) = false]; -} - -message Lifetime { - // Unit can be Unlimited, based on NeoFS epoch or Neo block - enum Unit { - Unlimited = 0; - NeoFSEpoch = 1; - NeoBlock = 2; - } - - // Unit describes how lifetime is measured in account - Unit unit = 1 [(gogoproto.customname) = "Unit"]; - // Value describes how long lifetime will be valid - int64 Value = 2; -} - -message Tx { - // Type can be withdrawal, payIO or inner - enum Type { - Unknown = 0; - Withdraw = 1; - PayIO = 2; - Inner = 3; - } - - // Type describes target of transaction - Type type = 1 [(gogoproto.customname) = "Type"]; - // From describes sender of funds - string From = 2; - // To describes receiver of funds - string To = 3; - // Amount describes amount of funds - decimal.Decimal Amount = 4; - // PublicKeys contains public key of sender - bytes PublicKeys = 5; -} - -message Settlement { - message Receiver { - // To is the address of funds recipient - string To = 1; - // Amount is the amount of funds that will be sent - decimal.Decimal Amount = 2; - } - - message Container { - // CID is container identifier - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; - // SGIDs is a set of storage groups that successfully passed the audit - repeated bytes SGIDs = 2 [(gogoproto.customtype) = "SGID", (gogoproto.nullable) = false]; - } - - message Tx { - // From is the address of the sender of funds - string From = 1; - // Container that successfully had passed the audit - Container Container = 2 [(gogoproto.nullable) = false]; - // Receivers is a set of addresses of funds recipients - repeated Receiver Receivers = 3 [(gogoproto.nullable) = false]; - } - - // Epoch contains an epoch when settlement was accepted - uint64 Epoch = 1; - // Transactions is a set of transactions - repeated Tx Transactions = 2; -} - -message ContainerCreateTarget { - // CID is container identifier - bytes CID = 1 [(gogoproto.customtype) = "CID", (gogoproto.nullable) = false]; -} - -message WithdrawTarget { - // Cheque is a string representation of cheque id - string Cheque = 1; -} diff --git a/accounting/withdraw.proto b/accounting/withdraw.proto deleted file mode 100644 index 080a100..0000000 --- a/accounting/withdraw.proto +++ /dev/null @@ -1,101 +0,0 @@ -syntax = "proto3"; -package accounting; -option go_package = "github.com/nspcc-dev/neofs-api-go/accounting"; -option csharp_namespace = "NeoFS.API.Accounting"; - -import "service/meta.proto"; -import "service/verify.proto"; -import "decimal/decimal.proto"; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.stable_marshaler_all) = true; - -// Withdraw is a service that provides withdraw assets operations from the NeoFS -service Withdraw { - // Get returns cheque if it was signed by inner ring nodes - rpc Get(GetRequest) returns (GetResponse); - // Put ask inner ring nodes to sign a cheque for withdraw invoke - rpc Put(PutRequest) returns (PutResponse); - // List shows all user's checks - rpc List(ListRequest) returns (ListResponse); - // Delete allows user to remove unused cheque - rpc Delete(DeleteRequest) returns (DeleteResponse); -} - -message Item { - // ID is a cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Amount of funds - decimal.Decimal Amount = 3; - // Height is the neo blockchain height until the cheque is valid - uint64 Height = 4; - // Payload contains cheque representation in bytes - bytes Payload = 5; -} - -message GetRequest { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message GetResponse { - // Withdraw is cheque with meta information - Item Withdraw = 1; -} - -message PutRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // Amount of funds - decimal.Decimal Amount = 2; - // Height is the neo blockchain height until the cheque is valid - uint64 Height = 3; - // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 4 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} -message PutResponse { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; -} - -message ListRequest { - // OwnerID is a wallet address - bytes OwnerID = 1 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -message ListResponse { - // Items is a set of cheques with meta information - repeated Item Items = 1; -} - -message DeleteRequest { - // ID is cheque identifier - bytes ID = 1 [(gogoproto.customtype) = "ChequeID", (gogoproto.nullable) = false]; - // OwnerID is a wallet address - bytes OwnerID = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false]; - // MessageID is a nonce for uniq request (UUIDv4) - bytes MessageID = 3 [(gogoproto.customtype) = "MessageID", (gogoproto.nullable) = false]; - // RequestMetaHeader contains information about request meta headers (should be embedded into message) - service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) - service.RequestVerificationHeader Verify = 99 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; -} - -// DeleteResponse is empty -message DeleteResponse {} diff --git a/proto-docs/accounting.md b/proto-docs/accounting.md index e63afbb..7b31f60 100644 --- a/proto-docs/accounting.md +++ b/proto-docs/accounting.md @@ -12,39 +12,6 @@ - [BalanceResponse](#accounting.BalanceResponse) -- [accounting/types.proto](#accounting/types.proto) - - - Messages - - [Account](#accounting.Account) - - [Balances](#accounting.Balances) - - [ContainerCreateTarget](#accounting.ContainerCreateTarget) - - [Lifetime](#accounting.Lifetime) - - [LockTarget](#accounting.LockTarget) - - [PayIO](#accounting.PayIO) - - [Settlement](#accounting.Settlement) - - [Settlement.Container](#accounting.Settlement.Container) - - [Settlement.Receiver](#accounting.Settlement.Receiver) - - [Settlement.Tx](#accounting.Settlement.Tx) - - [Tx](#accounting.Tx) - - [WithdrawTarget](#accounting.WithdrawTarget) - - -- [accounting/withdraw.proto](#accounting/withdraw.proto) - - Services - - [Withdraw](#accounting.Withdraw) - - - Messages - - [DeleteRequest](#accounting.DeleteRequest) - - [DeleteResponse](#accounting.DeleteResponse) - - [GetRequest](#accounting.GetRequest) - - [GetResponse](#accounting.GetResponse) - - [Item](#accounting.Item) - - [ListRequest](#accounting.ListRequest) - - [ListResponse](#accounting.ListResponse) - - [PutRequest](#accounting.PutRequest) - - [PutResponse](#accounting.PutResponse) - - - [Scalar Value Types](#scalar-value-types) @@ -107,367 +74,6 @@ Balance returns current balance status of the NeoFS user - -
- -## accounting/types.proto - - - - - - - -### Message Account - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Address | [string](#string) | | Address is identifier of accounting record | -| ParentAddress | [string](#string) | | ParentAddress is identifier of parent accounting record | -| ActiveFunds | [decimal.Decimal](#decimal.Decimal) | | ActiveFunds is amount of active (non locked) funds for account | -| Lifetime | [Lifetime](#accounting.Lifetime) | | Lifetime is time until account is valid (used for lock accounts) | -| LockTarget | [LockTarget](#accounting.LockTarget) | | LockTarget is the purpose of lock funds (it might be withdraw or payment for storage) | -| LockAccounts | [Account](#accounting.Account) | repeated | LockAccounts contains child accounts with locked funds | - - - - -### Message Balances - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Accounts | [Account](#accounting.Account) | repeated | Accounts contains multiple account snapshots | - - - - -### Message ContainerCreateTarget - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID is container identifier | - - - - -### Message Lifetime - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| unit | [Lifetime.Unit](#accounting.Lifetime.Unit) | | Unit describes how lifetime is measured in account | -| Value | [int64](#int64) | | Value describes how long lifetime will be valid | - - - - -### Message LockTarget -LockTarget must be one of two options - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| WithdrawTarget | [WithdrawTarget](#accounting.WithdrawTarget) | | WithdrawTarget used when user requested withdraw | -| ContainerCreateTarget | [ContainerCreateTarget](#accounting.ContainerCreateTarget) | | ContainerCreateTarget used when user requested creation of container | - - - - -### Message PayIO - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| BlockID | [uint64](#uint64) | | BlockID contains id of the NEO block where withdraw or deposit call was invoked | -| Transactions | [Tx](#accounting.Tx) | repeated | Transactions contains all transactions that founded in block and used for PayIO | - - - - -### Message Settlement - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Epoch | [uint64](#uint64) | | Epoch contains an epoch when settlement was accepted | -| Transactions | [Settlement.Tx](#accounting.Settlement.Tx) | repeated | Transactions is a set of transactions | - - - - -### Message Settlement.Container - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| CID | [bytes](#bytes) | | CID is container identifier | -| SGIDs | [bytes](#bytes) | repeated | SGIDs is a set of storage groups that successfully passed the audit | - - - - -### Message Settlement.Receiver - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| To | [string](#string) | | To is the address of funds recipient | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount is the amount of funds that will be sent | - - - - -### Message Settlement.Tx - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| From | [string](#string) | | From is the address of the sender of funds | -| Container | [Settlement.Container](#accounting.Settlement.Container) | | Container that successfully had passed the audit | -| Receivers | [Settlement.Receiver](#accounting.Settlement.Receiver) | repeated | Receivers is a set of addresses of funds recipients | - - - - -### Message Tx - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| type | [Tx.Type](#accounting.Tx.Type) | | Type describes target of transaction | -| From | [string](#string) | | From describes sender of funds | -| To | [string](#string) | | To describes receiver of funds | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount describes amount of funds | -| PublicKeys | [bytes](#bytes) | | PublicKeys contains public key of sender | - - - - -### Message WithdrawTarget - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Cheque | [string](#string) | | Cheque is a string representation of cheque id | - - - - - - -### Lifetime.Unit -Unit can be Unlimited, based on NeoFS epoch or Neo block - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unlimited | 0 | | -| NeoFSEpoch | 1 | | -| NeoBlock | 2 | | - - - - - -### Tx.Type -Type can be withdrawal, payIO or inner - -| Name | Number | Description | -| ---- | ------ | ----------- | -| Unknown | 0 | | -| Withdraw | 1 | | -| PayIO | 2 | | -| Inner | 3 | | - - - - - - - - - -## accounting/withdraw.proto - - - - - - -### Service "accounting.Withdraw" -Withdraw is a service that provides withdraw assets operations from the NeoFS - -``` -rpc Get(GetRequest) returns (GetResponse); -rpc Put(PutRequest) returns (PutResponse); -rpc List(ListRequest) returns (ListResponse); -rpc Delete(DeleteRequest) returns (DeleteResponse); - -``` - -#### Method Get - -Get returns cheque if it was signed by inner ring nodes - -| Name | Input | Output | -| ---- | ----- | ------ | -| Get | [GetRequest](#accounting.GetRequest) | [GetResponse](#accounting.GetResponse) | -#### Method Put - -Put ask inner ring nodes to sign a cheque for withdraw invoke - -| Name | Input | Output | -| ---- | ----- | ------ | -| Put | [PutRequest](#accounting.PutRequest) | [PutResponse](#accounting.PutResponse) | -#### Method List - -List shows all user's checks - -| Name | Input | Output | -| ---- | ----- | ------ | -| List | [ListRequest](#accounting.ListRequest) | [ListResponse](#accounting.ListResponse) | -#### Method Delete - -Delete allows user to remove unused cheque - -| Name | Input | Output | -| ---- | ----- | ------ | -| Delete | [DeleteRequest](#accounting.DeleteRequest) | [DeleteResponse](#accounting.DeleteResponse) | - - - - - -### Message DeleteRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message DeleteResponse -DeleteResponse is empty - - - - - -### Message GetRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message GetResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Withdraw | [Item](#accounting.Item) | | Withdraw is cheque with meta information | - - - - -### Message Item - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is a cheque identifier | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | -| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | -| Payload | [bytes](#bytes) | | Payload contains cheque representation in bytes | - - - - -### Message ListRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message ListResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| Items | [Item](#accounting.Item) | repeated | Items is a set of cheques with meta information | - - - - -### Message PutRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address | -| Amount | [decimal.Decimal](#decimal.Decimal) | | Amount of funds | -| Height | [uint64](#uint64) | | Height is the neo blockchain height until the cheque is valid | -| MessageID | [bytes](#bytes) | | MessageID is a nonce for uniq request (UUIDv4) | -| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | -| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | - - - - -### Message PutResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| ID | [bytes](#bytes) | | ID is cheque identifier | - - - - - - - ## Scalar Value Types | .proto Type | Notes | C++ Type | Java Type | Python Type |