OpenBazaar

openbazaar-go/pb/protos at master · OpenBazaar/openbazaar-go

如何生成 Google Protocol Buffers 文件

pseudomuto/protoc-gen-doc: Documentation generator plugin for Google Protocol Buffers

git clone https://github.com/OpenBazaar/openbazaar-go.git /tmp/src/openbazaar-go
bash tc.sh --gen-proto-doc /tmp/src/openbazaar-go/pb/protos /tmp/output.md

Generated Date:2019-09-12T11:21:43+08:00

Protocol Documentation

Table of Contents

Top

contracts.proto

BitcoinSignature

FieldTypeLabelDescription
inputIndexuint32
signaturebytes

Dispute

FieldTypeLabelDescription
timestampgoogle.protobuf.Timestamp
claimstring
payoutAddressstring
outpointsOutpointrepeated
serializedContractbytes

DisputeAcceptance

FieldTypeLabelDescription
timestampgoogle.protobuf.Timestamp
closedBystring

DisputeResolution

FieldTypeLabelDescription
timestampgoogle.protobuf.Timestamp
orderIdstring
proposedBystring
resolutionstring
payoutDisputeResolution.Payout
moderatorRatingSigsbytesrepeatedUsed in ratings

DisputeResolution.Payout

FieldTypeLabelDescription
sigsBitcoinSignaturerepeated
inputsOutpointrepeated
buyerOutputDisputeResolution.Payout.Output
vendorOutputDisputeResolution.Payout.Output
moderatorOutputDisputeResolution.Payout.Output

DisputeResolution.Payout.Output

FieldTypeLabelDescription
scriptstring
addressstring
amountuint64

ID

FieldTypeLabelDescription
peerIDstring
handlestring
pubkeysID.Pubkeys
bitcoinSigbytesBitcoin signature covering peerID

ID.Pubkeys

FieldTypeLabelDescription
identitybytesIPFS public key
bitcoinbytesBitcoin public key

Listing

FieldTypeLabelDescription
slugstring
vendorIDID
metadataListing.Metadata
itemListing.Item
shippingOptionsListing.ShippingOptionrepeated
taxesListing.Taxrepeated
couponsListing.Couponrepeated
moderatorsstringrepeated
termsAndConditionsstring
refundPolicystring

Listing.Coupon

FieldTypeLabelDescription
titlestring
hashstring
discountCodestring
percentDiscountfloat
priceDiscountuint64

Listing.Item

FieldTypeLabelDescription
titlestring
descriptionstring
processingTimestring
priceuint64
nsfwbool
tagsstringrepeated
imagesListing.Item.Imagerepeated
categoriesstringrepeated
gramsfloat
conditionstring
optionsListing.Item.Optionrepeated
skusListing.Item.Skurepeated

Listing.Item.Image

FieldTypeLabelDescription
filenamestring
originalstring
largestring
mediumstring
smallstring
tinystring

Listing.Item.Option

FieldTypeLabelDescription
namestring
descriptionstring
variantsListing.Item.Option.Variantrepeated

Listing.Item.Option.Variant

FieldTypeLabelDescription
namestring
imageListing.Item.Image

Listing.Item.Sku

FieldTypeLabelDescription
variantCombouint32repeated
productIDstring
surchargeint64
quantityint64Not saved with listing

Listing.Metadata

FieldTypeLabelDescription
versionuint32
contractTypeListing.Metadata.ContractType
formatListing.Metadata.Format
expirygoogle.protobuf.Timestamp
acceptedCurrenciesstringrepeated
pricingCurrencystring
languagestring
escrowTimeoutHoursuint32
coinTypestring
coinDivisibilityuint32
priceModifierfloat

Listing.ShippingOption

FieldTypeLabelDescription
namestring
typeListing.ShippingOption.ShippingType
regionsCountryCoderepeated
servicesListing.ShippingOption.Servicerepeated

Listing.ShippingOption.Service

FieldTypeLabelDescription
namestring
priceuint64
estimatedDeliverystring
additionalItemPriceuint64

Listing.Tax

FieldTypeLabelDescription
taxTypestring
taxRegionsCountryCoderepeated
taxShippingbool
percentagefloat

Order

FieldTypeLabelDescription
refundAddressstring
refundFeeuint64
shippingOrder.Shipping
buyerIDID
timestampgoogle.protobuf.Timestamp
itemsOrder.Itemrepeated
paymentOrder.Payment
ratingKeysbytesrepeated
alternateContactInfostring
versionuint32

Order.Item

FieldTypeLabelDescription
listingHashstring
quantityuint32order version < 2 used with listing version < 3
quantity64uint64order version >= 2 used with listing version >= 3
optionsOrder.Item.Optionrepeated
shippingOptionOrder.Item.ShippingOption
memostring
couponCodesstringrepeated
paymentAddressstring

Order.Item.Option

FieldTypeLabelDescription
namestring
valuestring

Order.Item.ShippingOption

FieldTypeLabelDescription
namestring
servicestring

Order.Payment

FieldTypeLabelDescription
methodOrder.Payment.Method
moderatorstring
amountuint64Satoshis
chaincodestringHex encoded
addressstringB58check encoded
redeemScriptstringHex encoded
moderatorKeybytes
coinstring

Order.Shipping

FieldTypeLabelDescription
shipTostring
addressstring
citystring
statestring
postalCodestring
countryCountryCode
addressNotesstring

OrderCompletion

FieldTypeLabelDescription
orderIdstring
timestampgoogle.protobuf.Timestamp
payoutSigsBitcoinSignaturerepeated
ratingsRatingrepeated

OrderConfirmation

FieldTypeLabelDescription
orderIDstring
timestampgoogle.protobuf.Timestamp
paymentAddressstringDirect payments only
requestedAmountuint64
ratingSignaturesRatingSignaturerepeated

OrderFulfillment

FieldTypeLabelDescription
orderIdstring
slugstring
timestampgoogle.protobuf.Timestamp
physicalDeliveryOrderFulfillment.PhysicalDeliveryrepeatedPhysical goods only
digitalDeliveryOrderFulfillment.DigitalDeliveryrepeatedDigital goods only
payoutOrderFulfillment.PayoutModerated payments only
ratingSignatureRatingSignature
notestring
cryptocurrencyDeliveryOrderFulfillment.CryptocurrencyDeliveryrepeatedCryptocurrencies only

OrderFulfillment.CryptocurrencyDelivery

FieldTypeLabelDescription
transactionIDstring

OrderFulfillment.DigitalDelivery

FieldTypeLabelDescription
urlstring
passwordstring

OrderFulfillment.Payout

FieldTypeLabelDescription
sigsBitcoinSignaturerepeated
payoutAddressstring
payoutFeePerByteuint64

OrderFulfillment.PhysicalDelivery

FieldTypeLabelDescription
shipperstring
trackingNumberstring

OrderProcessingFailure

FieldTypeLabelDescription
orderIDstring
attemptedMessageTypeMessage.MessageType
contractRicardianContract

OrderReject

FieldTypeLabelDescription
orderIDstring
timestampgoogle.protobuf.Timestamp
sigsBitcoinSignaturerepeated

Outpoint

FieldTypeLabelDescription
hashstringHex encoded
indexuint32
valueuint64

Rating

FieldTypeLabelDescription
ratingDataRating.RatingData
signaturebytes

Rating.RatingData

FieldTypeLabelDescription
ratingKeybytes
vendorIDID
vendorSigRatingSignature
buyerIDIDoptional
buyerNamestringoptional
buyerSigbytesoptional
moderatorSigbytesonly if a dispute was won
timestampgoogle.protobuf.Timestamp
overalluint32
qualityuint32
descriptionuint32
deliverySpeeduint32
customerServiceuint32
reviewstring

RatingSignature

FieldTypeLabelDescription
metadataRatingSignature.TransactionMetadata
signaturebytes

RatingSignature.TransactionMetadata

FieldTypeLabelDescription
listingSlugstring
ratingKeybytes
moderatorKeybytesOnly if moderated
listingTitlestring
thumbnailRatingSignature.TransactionMetadata.Image

RatingSignature.TransactionMetadata.Image

FieldTypeLabelDescription
tinystring
smallstring
mediumstring
largestring
originalstring

Refund

FieldTypeLabelDescription
orderIDstring
timestampgoogle.protobuf.Timestamp
sigsBitcoinSignaturerepeated
refundTransactionRefund.TransactionInfo
memostring

Refund.TransactionInfo

FieldTypeLabelDescription
txidstring
valueuint64

RicardianContract

FieldTypeLabelDescription
vendorListingsListingrepeated
buyerOrderOrder
vendorOrderConfirmationOrderConfirmation
vendorOrderFulfillmentOrderFulfillmentrepeated
buyerOrderCompletionOrderCompletion
disputeDispute
disputeResolutionDisputeResolution
disputeAcceptanceDisputeAcceptance
refundRefund
signaturesSignaturerepeated
errorsstringrepeated

Signature

FieldTypeLabelDescription
sectionSignature.Section
signatureBytesbytes

SignedListing

FieldTypeLabelDescription
listingListing
hashstring
signaturebytes

VendorFinalizedPayment

FieldTypeLabelDescription
orderIDstringOrderID which has its funds released to the vendor

Listing.Metadata.ContractType

NameNumberDescription
PHYSICAL_GOOD0
DIGITAL_GOOD1
SERVICE2
CROWD_FUND3
CRYPTOCURRENCY4

Listing.Metadata.Format

NameNumberDescription
FIXED_PRICE0
MARKET_PRICE2

Listing.ShippingOption.ShippingType

NameNumberDescription
LOCAL_PICKUP0
FIXED_PRICE1

Order.Payment.Method

NameNumberDescription
ADDRESS_REQUEST0
DIRECT1
MODERATED2

Signature.Section

NameNumberDescription
LISTING0
ORDER1
ORDER_CONFIRMATION2
ORDER_FULFILLMENT3
ORDER_COMPLETION4
DISPUTE5
DISPUTE_RESOLUTION6
REFUND7

Top

posts.proto

Post

FieldTypeLabelDescription
slugstring
vendorIDID
statusstring
longFormstring
imagesPost.Imagerepeated
tagsstringrepeated
channelsstringrepeated
postTypePost.PostType
referencestring
timestampgoogle.protobuf.Timestamp

Post.Image

FieldTypeLabelDescription
filenamestring
originalstring
largestring
mediumstring
smallstring
tinystring

SignedPost

FieldTypeLabelDescription
postPost
hashstring
signaturebytes

Post.PostType

NameNumberDescription
POST0
COMMENT1
REPOST2

Top

message.proto

Block

FieldTypeLabelDescription
rawDatabytes
cidstring

Chat

FieldTypeLabelDescription
messageIdstring
subjectstring
messagestring
timestampgoogle.protobuf.Timestamp
flagChat.Flag

CidList

FieldTypeLabelDescription
cidsstringrepeated

Envelope

FieldTypeLabelDescription
messageMessage
pubkeybytes
signaturebytes

Error

FieldTypeLabelDescription
codeuint32
errorMessagestring
orderIDstring

Message

FieldTypeLabelDescription
messageTypeMessage.MessageType
payloadgoogle.protobuf.Any
requestIdint32optional
isResponsebooloptional

OrderPaymentTxn

FieldTypeLabelDescription
coinstring
orderIDstring
transactionIDstring
withInputbool

SignedData

FieldTypeLabelDescription
senderPubkeybytes
serializedDatabytes
signaturebytes

SignedData.Command

FieldTypeLabelDescription
peerIDstring
typeMessage.MessageType
timestampgoogle.protobuf.Timestamp

Chat.Flag

NameNumberDescription
MESSAGE0
TYPING1
READ2

Message.MessageType

NameNumberDescription
PING0
CHAT1
FOLLOW2
UNFOLLOW3
ORDER4
ORDER_REJECT5
ORDER_CANCEL6
ORDER_CONFIRMATION7
ORDER_FULFILLMENT8
ORDER_COMPLETION9
DISPUTE_OPEN10
DISPUTE_UPDATE11
DISPUTE_CLOSE12
REFUND13
OFFLINE_ACK14
OFFLINE_RELAY15
MODERATOR_ADD16
MODERATOR_REMOVE17
STORE18
BLOCK19
VENDOR_FINALIZED_PAYMENT20
ORDER_PAYMENT21
ERROR500
ORDER_PROCESSING_FAILURE501

Top

countrycodes.proto

CountryCode

NameNumberDescription
NA0
AFGHANISTAN1
ALAND_ISLANDS2
ALBANIA3
ALGERIA4
AMERICAN_SAMOA5
ANDORRA6
ANGOLA7
ANGUILLA8
ANTIGUA9
ARGENTINA10
ARMENIA11
ARUBA12
AUSTRALIA13
AUSTRIA14
AZERBAIJAN15
BAHAMAS16
BAHRAIN17
BANGLADESH18
BARBADOS19
BELARUS20
BELGIUM21
BELIZE22
BENIN23
BERMUDA24
BHUTAN25
BOLIVIA26
BONAIRE_SINT_EUSTATIUS_SABA27
BOSNIA28
BOTSWANA29
BOUVET_ISLAND30
BRAZIL31
BRITISH_INDIAN_OCEAN_TERRITORY32
BRUNEI_DARUSSALAM33
BULGARIA34
BURKINA_FASO35
BURUNDI36
CABO_VERDE37
CAMBODIA38
CAMEROON39
CANADA40
CAYMAN_ISLANDS41
CENTRAL_AFRICAN_REPUBLIC42
CHAD43
CHILE44
CHINA45
CHRISTMAS_ISLAND46
COCOS_ISLANDS47
COLOMBIA48
COMOROS49
CONGO_REPUBLIC50
CONGO51
COOK_ISLANDS52
COSTA_RICA53
COTE_DIVOIRE54
CROATIA55
CUBA56
CURACAO57
CYPRUS58
CZECH_REPUBLIC59
DENMARK60
DJIBOUTI61
DOMINICA62
DOMINICAN_REPUBLIC63
ECUADOR64
EGYPT65
EL_SALVADOR66
EQUATORIAL_GUINEA67
ERITREA68
ESTONIA69
ETHIOPIA70
FALKLAND_ISLANDS71
FAROE_ISLANDS72
FIJI73
FINLAND74
FRANCE75
FRENCH_GUIANA76
FRENCH_POLYNESIA77
FRENCH_SOUTHERN_TERRITORIES78
GABON79
GAMBIA80
GEORGIA81
GERMANY82
GHANA83
GIBRALTAR84
GREECE85
GREENLAND86
GRENADA87
GUADELOUPE88
GUAM89
GUATEMALA90
GUERNSEY91
GUINEA92
GUINEA_BISSAU93
GUYANA94
HAITI95
HEARD_ISLAND96
HOLY_SEE97
HONDURAS98
HONG_KONG99
HUNGARY100
ICELAND101
INDIA102
INDONESIA103
IRAN104
IRAQ105
IRELAND106
ISLE_OF_MAN107
ISRAEL108
ITALY109
JAMAICA110
JAPAN111
JERSEY112
JORDAN113
KAZAKHSTAN114
KENYA115
KIRIBATI116
NORTH_KOREA117
SOUTH_KOREA118
KUWAIT119
KYRGYZSTAN120
LAO121
LATVIA122
LEBANON123
LESOTHO124
LIBERIA125
LIBYA126
LIECHTENSTEIN127
LITHUANIA128
LUXEMBOURG129
MACAO130
MACEDONIA131
MADAGASCAR132
MALAWI133
MALAYSIA134
MALDIVES135
MALI136
MALTA137
MARSHALL_ISLANDS138
MARTINIQUE139
MAURITANIA140
MAURITIUS141
MAYOTTE142
MEXICO143
MICRONESIA144
MOLDOVA145
MONACO146
MONGOLIA147
MONTENEGRO148
MONTSERRAT149
MOROCCO150
MOZAMBIQUE151
MYANMAR152
NAMIBIA153
NAURU154
NEPAL155
NETHERLANDS156
NEW_CALEDONIA157
NEW_ZEALAND158
NICARAGUA159
NIGER160
NIGERIA161
NIUE162
NORFOLK_ISLAND163
NORTHERN_MARIANA_ISLANDS164
NORWAY165
OMAN166
PAKISTAN167
PALAU168
PANAMA169
PAPUA_NEW_GUINEA170
PARAGUAY171
PERU172
PHILIPPINES173
PITCAIRN174
POLAND175
PORTUGAL176
PUERTO_RICO177
QATAR178
REUNION179
ROMANIA180
RUSSIA181
RWANDA182
SAINT_BARTHELEMY183
SAINT_HELENA184
SAINT_KITTS185
SAINT_LUCIA186
SAINT_MARTIN187
SAINT_PIERRE188
SAINT_VINCENT189
SAMOA190
SAN_MARINO191
SAO_TOME192
SAUDI_ARABIA193
SENEGAL194
SERBIA195
SEYCHELLES196
SIERRA_LEONE197
SINGAPORE198
SINT_MAARTEN199
SUCRE200
SLOVAKIA201
SLOVENIA202
SOLOMON_ISLANDS203
SOMALIA204
SOUTH_AFRICA205
SOUTH_SUDAN206
SPAIN207
SRI_LANKA208
SUDAN209
SURINAME210
SVALBARD211
ESWATINI212
SWAZILAND212
SWEDEN213
SWITZERLAND214
SYRIAN_ARAB_REPUBLIC215
TAIWAN216
TAJIKISTAN217
TANZANIA218
THAILAND219
TIMOR_LESTE220
TOGO221
TOKELAU222
TONGA223
TRINIDAD224
TUNISIA225
TURKEY226
TURKMENISTAN227
TURKS_AND_CAICOS_ISLANDS228
TUVALU229
UGANDA230
UKRAINE231
UNITED_ARAB_EMIRATES232
UNITED_KINGDOM233
UNITED_STATES234
URUGUAY235
UZBEKISTAN236
VANUATU237
VENEZUELA238
VIETNAM239
VIRGIN_ISLANDS_BRITISH240
VIRGIN_ISLANDS_US241
WALLIS_AND_FUTUNA242
WESTERN_SAHARA243
YEMEN244
ZAMBIA245
ZIMBABWE246
UNITED_STATES_MINOR_ISLANDS247
ALL500
AFRICA501
ASIA502
CENTRAL_AMERICA503
EUROPE504
MIDDLE_EAST505
NORTH_AMERICA506
SOUTH_AMERICA507
OCEANIA508

Top

profile.proto

Profile

FieldTypeLabelDescription
peerIDstring
handlestring
namestring
locationstring
aboutstring
shortDescriptionstring
nsfwbool
vendorbool
moderatorbool
moderatorInfoModerator
contactInfoProfile.Contact
colorsProfile.Colors
avatarHashesProfile.Image
headerHashesProfile.Image
statsProfile.Stats
bitcoinPubkeystring
lastModifiedgoogle.protobuf.Timestamp
currenciesstringrepeated

Profile.Colors

FieldTypeLabelDescription
primarystring
secondarystring
textstring
highlightstring
highlightTextstring

Profile.Contact

FieldTypeLabelDescription
websitestring
emailstring
phoneNumberstring
socialProfile.SocialAccountrepeated

Profile.Image

FieldTypeLabelDescription
tinystring
smallstring
mediumstring
largestring
originalstring

Profile.SocialAccount

FieldTypeLabelDescription
typestring
usernamestring
proofstring

Profile.Stats

FieldTypeLabelDescription
followerCountuint32
followingCountuint32
listingCountuint32
ratingCountuint32
postCountuint32
averageRatingfloat

Top

moderator.proto

DisputeUpdate

FieldTypeLabelDescription
orderIdstring
payoutAddressstring
outpointsOutpointrepeated
serializedContractbytes

Moderator

FieldTypeLabelDescription
descriptionstring
termsAndConditionsstring
languagesstringrepeated
acceptedCurrenciesstringrepeated
feeModerator.Fee

Moderator.Fee

FieldTypeLabelDescription
fixedFeeModerator.Price
percentagefloat
feeTypeModerator.Fee.FeeType

Moderator.Price

FieldTypeLabelDescription
currencyCodestring
amountuint64Bitcoins must be in satoshi

Moderator.Fee.FeeType

NameNumberDescription
FIXED0
PERCENTAGE1
FIXED_PLUS_PERCENTAGE2

Top

orders.proto

OrderState

NameNumberDescription
PENDING0Order has been funded and sent to the vendor but vendor has not yet responded
AWAITING_PAYMENT1Waiting for the buyer to fund the payment address
AWAITING_PICKUP2Waiting for the customer to pick up the order (customer pickup option only)
AWAITING_FULFILLMENT3Order has been fully funded and we're waiting for the vendor to fulfill
PARTIALLY_FULFILLED4Vendor has fulfilled part of the order
FULFILLED5Vendor has fulfilled the order
COMPLETED6Buyer has completed the order and left a review
CANCELED7Buyer canceled the order (offline order only)
DECLINED8Vendor declined to confirm the order (offline order only)
REFUNDED9Vendor refunded the order
DISPUTED10Contract is under active dispute
DECIDED11The moderator has resolved the dispute and we are waiting for the winning party to accept the payout.
RESOLVED12The winning party has accepted the dispute and it is now complete. After the buyer leaves a review the state should be set to COMPLETE.
PAYMENT_FINALIZED13Escrow has been released after waiting the timeout period. After the buyer leaves a review the state should be set to COMPLETE.
PROCESSING_ERROR14We screwed up and produced a order which didn't validate. This state is only used for offline orders. If a processing error occurred with an open connection between buyer and vendor the vendor just rejects the order on the spot neither party commits the order to the database.

Top

api.proto

CaseRespApi

FieldTypeLabelDescription
timestampgoogle.protobuf.Timestamp
buyerContractRicardianContract
vendorContractRicardianContract
buyerContractValidationErrorsstringrepeated
vendorContractValidationErrorsstringrepeated
stateOrderState
readbool
buyerOpenedbool
claimstring
unreadChatMessagesuint64
resolutionDisputeResolution

Coupon

FieldTypeLabelDescription
hashstring
codestring

OrderRespApi

FieldTypeLabelDescription
contractRicardianContract
stateOrderState
readbool
fundedbool
unreadChatMessagesuint64
paymentAddressTransactionsTransactionRecordrepeated
refundAddressTransactionTransactionRecord

PeerAndProfile

FieldTypeLabelDescription
peerIdstring
profileProfile

PeerAndProfileWithID

FieldTypeLabelDescription
idstring
peerIdstring
profileProfile

RatingWithID

FieldTypeLabelDescription
idstring
ratingIdstring
ratingRating

TransactionRecord

FieldTypeLabelDescription
txidstring
valueint64
confirmationsuint32
heightuint32
timestampgoogle.protobuf.Timestamp

Scalar Value Types

.proto TypeNotesC++ TypeJava TypePython Type
doubledoubledoublefloat
floatfloatfloatfloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intint
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/long
uint32Uses variable-length encoding.uint32intint/long
uint64Uses variable-length encoding.uint64longint/long
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intint
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/long
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intint
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/long
sfixed32Always four bytes.int32intint
sfixed64Always eight bytes.int64longint/long
boolboolbooleanboolean
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicode
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr

Protos File Tree


.
├── api.proto
├── contracts.proto
├── countrycodes.proto
├── message.proto
├── moderator.proto
├── orders.proto
├── posts.proto
└── profile.proto

0 directories, 8 files

Protobuf sources

src:./contracts.proto


syntax = "proto3";
option go_package = "pb";


import "countrycodes.proto";
import "message.proto";
import "google/protobuf/timestamp.proto";

message RicardianContract {
    repeated Listing vendorListings                    = 1;
    Order buyerOrder                                   = 2;
    OrderConfirmation vendorOrderConfirmation          = 3;
    repeated OrderFulfillment vendorOrderFulfillment   = 4;
    OrderCompletion buyerOrderCompletion               = 5;
    Dispute dispute                                    = 6;
    DisputeResolution disputeResolution                = 7;
    DisputeAcceptance disputeAcceptance                = 8;
    Refund refund                                      = 9;
    repeated Signature signatures                      = 10;
    repeated string errors                             = 11;
}

message Listing {
    string slug                             = 1;
    ID vendorID                             = 2;
    Metadata metadata                       = 3;
    Item item                               = 4;
    repeated ShippingOption shippingOptions = 5;
    repeated Tax taxes                      = 6;
    repeated Coupon coupons                 = 7;
    repeated string moderators              = 8;
    string termsAndConditions               = 9;
    string refundPolicy                     = 10;

    message Metadata {
        uint32 version                     = 1;
        ContractType contractType          = 2;
        Format format                      = 3;
        google.protobuf.Timestamp expiry   = 4;
        repeated string acceptedCurrencies = 5;
        string pricingCurrency             = 6;
        string language                    = 7;
        uint32 escrowTimeoutHours          = 8;
        string coinType                    = 9;
        uint32 coinDivisibility            = 10;
        float priceModifier                = 11;

        enum ContractType {
            PHYSICAL_GOOD  = 0;
            DIGITAL_GOOD   = 1;
            SERVICE        = 2;
            CROWD_FUND     = 3;
            CRYPTOCURRENCY = 4;
        }

        enum Format {
            FIXED_PRICE  = 0;
            MARKET_PRICE = 2;
        }
    }

    message Item {
        string title               = 1;
        string description         = 2;
        string processingTime      = 3;
        uint64 price               = 4;
        bool nsfw                  = 5;
        repeated string tags       = 6;
        repeated Image images      = 7;
        repeated string categories = 8;
        float grams                = 9;
        string condition           = 10;
        repeated Option options    = 11;
        repeated Sku skus          = 12;

        message Option {
            string name                = 1;
            string description         = 2;
            repeated Variant variants  = 3;

            message Variant {
                string name = 1;
                Image image = 2;
            }
        }

        message Sku {
            repeated uint32 variantCombo = 1;
            string productID             = 2;
            int64 surcharge              = 3;
            int64 quantity               = 4; // Not saved with listing
        }

        message Image {
            string filename = 1;
            string original = 2;
            string large    = 3;
            string medium   = 4;
            string small    = 5;
            string tiny     = 6;
        }
    }

    message ShippingOption {
        string name                         = 1;
        ShippingType type                   = 2;
        repeated CountryCode regions        = 3;
        repeated Service services           = 5;

        enum ShippingType {
            LOCAL_PICKUP = 0;
            FIXED_PRICE  = 1;
        }

        message Service {
            string name                = 1;
            uint64 price               = 2;
            string estimatedDelivery   = 3;
            uint64 additionalItemPrice = 4;
        }
    }

    message Tax {
        string taxType                  = 1;
        repeated CountryCode taxRegions = 2;
        bool taxShipping                = 3;
        float percentage                = 4;
    }

    message Coupon {
        string title = 1;
        oneof code {
            string hash         = 2;
            string discountCode = 3;
        }
        oneof discount {
            float percentDiscount = 5;
            uint64 priceDiscount  = 6;
        }
    }
}

message Order {
    string refundAddress                 = 1;
    uint64 refundFee                     = 2;
    Shipping shipping                    = 3;
    ID buyerID                           = 4;
    google.protobuf.Timestamp timestamp  = 5;
    repeated Item items                  = 6;
    Payment payment                      = 7;
    repeated bytes ratingKeys            = 8;
    string alternateContactInfo          = 9;
    uint32 version                       = 10;

    message Shipping {
        string shipTo       = 1;
        string address      = 2;
        string city         = 3;
        string state        = 4;
        string postalCode   = 5;
        CountryCode country = 6;
        string addressNotes = 7;
    }

    message Item {
        string listingHash            = 1;
        uint32 quantity               = 2; // order version < 2 used with listing version < 3
        uint64 quantity64             = 8; // order version >= 2 used with listing version >= 3
        repeated Option options       = 3;
        ShippingOption shippingOption = 4;
        string memo                   = 5;
        repeated string couponCodes   = 6;
        string paymentAddress         = 7;

        message Option {
            string name  = 1;
            string value = 2;
        }

        message ShippingOption {
            string name    = 1;
            string service = 2;
        }
    }

    message Payment {
        Method method       = 1;
        string moderator    = 2;
        uint64 amount       = 3; // Satoshis
        string chaincode    = 4; // Hex encoded
        string address      = 5; // B58check encoded
        string redeemScript = 6; // Hex encoded
        bytes  moderatorKey = 7;
        string coin         = 8;

        enum Method {
            ADDRESS_REQUEST = 0;
            DIRECT          = 1;
            MODERATED       = 2;
        }
    }
}

message OrderConfirmation {
    string orderID                            = 1;
    google.protobuf.Timestamp timestamp       = 2;
    // Direct payments only
    string paymentAddress                     = 3;
    uint64 requestedAmount                    = 4;

    repeated RatingSignature ratingSignatures = 5;
}

message OrderReject {
    string orderID                      = 1;
    google.protobuf.Timestamp timestamp = 2;
    repeated BitcoinSignature sigs      = 3;
}

message RatingSignature {
    TransactionMetadata metadata = 1;
    bytes signature              = 2;

    message TransactionMetadata {
        string listingSlug   = 1;
        bytes  ratingKey     = 2;
        bytes  moderatorKey  = 3; // Only if moderated
        string listingTitle  = 4;
        Image  thumbnail     = 5;

        message Image {
                string tiny     = 1;
                string small    = 2;
                string medium   = 3;
                string large    = 4;
                string original = 5;
        }
    }
}

message BitcoinSignature {
    uint32 inputIndex = 1;
    bytes signature   = 2;
}

message OrderFulfillment {
    string orderId                             = 1;

    string slug                                = 2;

    google.protobuf.Timestamp timestamp        = 3;

    // Physical goods only
    repeated PhysicalDelivery physicalDelivery = 4;

    //Digital goods only
    repeated DigitalDelivery digitalDelivery   = 5;

    // Moderated payments only
    Payout payout                              = 6;

    RatingSignature ratingSignature            = 7;

    string note                                = 8;

    // Cryptocurrencies only
    repeated CryptocurrencyDelivery cryptocurrencyDelivery = 9;

    message PhysicalDelivery {
        string shipper            = 1;
        string trackingNumber     = 2;
    }

    message DigitalDelivery {
        string url                = 1;
        string password           = 2;
    }

    message CryptocurrencyDelivery {
        string transactionID      = 1;
    }

    message Payout {
        repeated BitcoinSignature sigs = 1;
        string payoutAddress           = 2;
        uint64 payoutFeePerByte        = 3;
    }
}

message OrderCompletion {
    string orderId                       = 1;
    google.protobuf.Timestamp timestamp  = 2;
    repeated BitcoinSignature payoutSigs = 3;
    repeated Rating ratings              = 4;
}

message OrderProcessingFailure {
  string orderID                           = 1;
  Message.MessageType attemptedMessageType = 2;
  RicardianContract contract               = 3;
}

message Rating {
    RatingData ratingData = 1;
    bytes signature       = 2;

    message RatingData {
        bytes ratingKey                     = 1;
        ID vendorID                         = 2;
        RatingSignature vendorSig           = 3;
        ID buyerID                          = 4; // optional
        string buyerName                    = 5; // optional
        bytes buyerSig                      = 6; // optional
        bytes moderatorSig                  = 7; // only if a dispute was won


        google.protobuf.Timestamp timestamp = 8;

        uint32 overall                      = 9;
        uint32 quality                      = 10;
        uint32 description                  = 11;
        uint32 deliverySpeed                = 12;
        uint32 customerService              = 13;
        string review                       = 14;
    }
}

message Dispute {
    google.protobuf.Timestamp timestamp = 1;
    string claim                        = 2;
    string payoutAddress                = 3;
    repeated Outpoint outpoints         = 4;
    bytes serializedContract            = 5;
}

message DisputeResolution {
    google.protobuf.Timestamp timestamp = 1;
    string orderId                      = 2;
    string proposedBy                   = 3;
    string resolution                   = 4;
    Payout payout                       = 5;
    repeated bytes moderatorRatingSigs  = 6; // Used in ratings

    message Payout {
            repeated BitcoinSignature sigs = 1;
            repeated Outpoint inputs       = 2;
            Output buyerOutput             = 3;
            Output vendorOutput            = 4;
            Output moderatorOutput         = 5;

            message Output {
              oneof scriptOrAddress {
                string script  = 1;
                string address = 3;
              }
              uint64 amount  = 2;
            }
    }
}

message DisputeAcceptance {
    google.protobuf.Timestamp timestamp = 1;
    string closedBy                     = 2;
}

message Outpoint {
        string hash  = 1; // Hex encoded
        uint32 index = 2;
        uint64 value = 3;
}

message Refund {
    string orderID                      = 1;
    google.protobuf.Timestamp timestamp = 2;
    repeated BitcoinSignature sigs      = 3;
    TransactionInfo refundTransaction   = 4;
    string memo                         = 5;

    message TransactionInfo {
        string txid  = 1;
        uint64 value = 2;
    }
}

message VendorFinalizedPayment {
  string orderID = 1; // OrderID which has its funds released to the vendor
}

message ID {
    string peerID       = 1;
    string handle       = 2;
    Pubkeys pubkeys     = 3;
    bytes bitcoinSig    = 4; // Bitcoin signature covering peerID

    message Pubkeys {
        bytes identity = 1; // IPFS public key
        bytes bitcoin  = 2; // Bitcoin public key
    }
}

message Signature {
    Section section      = 1;
    bytes signatureBytes = 2;

    enum Section {
        LISTING            = 0;
        ORDER              = 1;
        ORDER_CONFIRMATION = 2;
        ORDER_FULFILLMENT  = 3;
        ORDER_COMPLETION   = 4;
        DISPUTE            = 5;
        DISPUTE_RESOLUTION = 6;
        REFUND             = 7;
    }
}

message SignedListing {
    Listing listing     = 1;
    string hash         = 2;
    bytes signature     = 3;
}

src:./posts.proto


syntax = "proto3";
option go_package = "pb";


import "google/protobuf/timestamp.proto";
import "contracts.proto";

message Post {
    string slug                         = 1;
    ID vendorID                         = 2;
    string status                       = 3;
    string longForm                     = 4;
    repeated Image images               = 5;
    repeated string tags                = 6;
    repeated string channels            = 7;
    PostType postType                   = 8;
    string reference                    = 9;
    google.protobuf.Timestamp timestamp = 10;

    message Image {
        string filename = 1;
        string original = 2;
        string large    = 3;
        string medium   = 4;
        string small    = 5;
        string tiny     = 6;
    }

    enum PostType {
        POST        = 0;
        COMMENT     = 1;
        REPOST      = 2;
    }
}

message SignedPost {
    Post post           = 1;
    string hash         = 2;
    bytes signature     = 3;
}

src:./message.proto


syntax = "proto3";
option go_package = "pb";


import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";

message Message {
    MessageType messageType     = 1;
    google.protobuf.Any payload = 2;
    int32 requestId             = 3; // optional
    bool isResponse             = 4; // optional

    enum MessageType {
        PING                     = 0;
        CHAT                     = 1;
        FOLLOW                   = 2;
        UNFOLLOW                 = 3;
        ORDER                    = 4;
        ORDER_REJECT             = 5;
        ORDER_CANCEL             = 6;
        ORDER_CONFIRMATION       = 7;
        ORDER_FULFILLMENT        = 8;
        ORDER_COMPLETION         = 9;
        DISPUTE_OPEN             = 10;
        DISPUTE_UPDATE           = 11;
        DISPUTE_CLOSE            = 12;
        REFUND                   = 13;
        OFFLINE_ACK              = 14;
        OFFLINE_RELAY            = 15;
        MODERATOR_ADD            = 16;
        MODERATOR_REMOVE         = 17;
        STORE                    = 18;
        BLOCK                    = 19;
        VENDOR_FINALIZED_PAYMENT = 20;
        ORDER_PAYMENT            = 21;
        ERROR                    = 500;
        ORDER_PROCESSING_FAILURE = 501;
    }
}

message Envelope {
    Message message = 1;
    bytes pubkey    = 2;
    bytes signature = 3;
}

message Chat  {
    string messageId                    = 1;
    string subject                      = 2;
    string message                      = 3;
    google.protobuf.Timestamp timestamp = 4;
    Flag flag                           = 5;

    enum Flag {
        MESSAGE = 0;
        TYPING  = 1;
        READ    = 2;
    }
}

message SignedData {
    bytes senderPubkey        = 1;
    bytes serializedData      = 2;
    bytes signature           = 3;

    message Command {
        string peerID                       = 1;
        Message.MessageType type            = 2;
        google.protobuf.Timestamp timestamp = 3;
    }
}

message CidList {
    repeated string cids = 1;
}

message Block {
    bytes rawData = 1;
    string cid    = 2;
}

message Error {
    uint32 code         = 1;
    string errorMessage = 2;
    string orderID      = 3;
}

message OrderPaymentTxn {
    string coin          = 1;
    string orderID       = 2;
    string transactionID = 3;
    bool withInput = 4;
}

src:./countrycodes.proto


syntax = "proto3";
option go_package = "pb";


enum CountryCode {
    option allow_alias = true;
    NA                             = 0;

    AFGHANISTAN                    = 1;
    ALAND_ISLANDS                  = 2;
    ALBANIA                        = 3;
    ALGERIA                        = 4;
    AMERICAN_SAMOA                 = 5;
    ANDORRA                        = 6;
    ANGOLA                         = 7;
    ANGUILLA                       = 8;
    ANTIGUA                        = 9;

    ARGENTINA                      = 10;
    ARMENIA                        = 11;
    ARUBA                          = 12;
    AUSTRALIA                      = 13;
    AUSTRIA                        = 14;
    AZERBAIJAN                     = 15;
    BAHAMAS                        = 16;
    BAHRAIN                        = 17;
    BANGLADESH                     = 18;
    BARBADOS                       = 19;

    BELARUS                        = 20;
    BELGIUM                        = 21;
    BELIZE                         = 22;
    BENIN                          = 23;
    BERMUDA                        = 24;
    BHUTAN                         = 25;
    BOLIVIA                        = 26;
    BONAIRE_SINT_EUSTATIUS_SABA    = 27;
    BOSNIA                         = 28;
    BOTSWANA                       = 29;

    BOUVET_ISLAND                  = 30;
    BRAZIL                         = 31;
    BRITISH_INDIAN_OCEAN_TERRITORY = 32;
    BRUNEI_DARUSSALAM              = 33;
    BULGARIA                       = 34;
    BURKINA_FASO                   = 35;
    BURUNDI                        = 36;
    CABO_VERDE                     = 37;
    CAMBODIA                       = 38;
    CAMEROON                       = 39;

    CANADA                         = 40;
    CAYMAN_ISLANDS                 = 41;
    CENTRAL_AFRICAN_REPUBLIC       = 42;
    CHAD                           = 43;
    CHILE                          = 44;
    CHINA                          = 45;
    CHRISTMAS_ISLAND               = 46;
    COCOS_ISLANDS                  = 47;
    COLOMBIA                       = 48;
    COMOROS                        = 49;

    CONGO_REPUBLIC                 = 50;
    CONGO                          = 51;
    COOK_ISLANDS                   = 52;
    COSTA_RICA                     = 53;
    COTE_DIVOIRE                   = 54;
    CROATIA                        = 55;
    CUBA                           = 56;
    CURACAO                        = 57;
    CYPRUS                         = 58;
    CZECH_REPUBLIC                 = 59;

    DENMARK                        = 60;
    DJIBOUTI                       = 61;
    DOMINICA                       = 62;
    DOMINICAN_REPUBLIC             = 63;
    ECUADOR                        = 64;
    EGYPT                          = 65;
    EL_SALVADOR                    = 66;
    EQUATORIAL_GUINEA              = 67;
    ERITREA                        = 68;
    ESTONIA                        = 69;

    ETHIOPIA                       = 70;
    FALKLAND_ISLANDS               = 71;
    FAROE_ISLANDS                  = 72;
    FIJI                           = 73;
    FINLAND                        = 74;
    FRANCE                         = 75;
    FRENCH_GUIANA                  = 76;
    FRENCH_POLYNESIA               = 77;
    FRENCH_SOUTHERN_TERRITORIES    = 78;
    GABON                          = 79;

    GAMBIA                         = 80;
    GEORGIA                        = 81;
    GERMANY                        = 82;
    GHANA                          = 83;
    GIBRALTAR                      = 84;
    GREECE                         = 85;
    GREENLAND                      = 86;
    GRENADA                        = 87;
    GUADELOUPE                     = 88;
    GUAM                           = 89;

    GUATEMALA                      = 90;
    GUERNSEY                       = 91;
    GUINEA                         = 92;
    GUINEA_BISSAU                  = 93;
    GUYANA                         = 94;
    HAITI                          = 95;
    HEARD_ISLAND                   = 96;
    HOLY_SEE                       = 97;
    HONDURAS                       = 98;
    HONG_KONG                      = 99;

    HUNGARY                        = 100;
    ICELAND                        = 101;
    INDIA                          = 102;
    INDONESIA                      = 103;
    IRAN                           = 104;
    IRAQ                           = 105;
    IRELAND                        = 106;
    ISLE_OF_MAN                    = 107;
    ISRAEL                         = 108;
    ITALY                          = 109;

    JAMAICA                        = 110;
    JAPAN                          = 111;
    JERSEY                         = 112;
    JORDAN                         = 113;
    KAZAKHSTAN                     = 114;
    KENYA                          = 115;
    KIRIBATI                       = 116;
    NORTH_KOREA                    = 117;
    SOUTH_KOREA                    = 118;
    KUWAIT                         = 119;

    KYRGYZSTAN                     = 120;
    LAO                            = 121;
    LATVIA                         = 122;
    LEBANON                        = 123;
    LESOTHO                        = 124;
    LIBERIA                        = 125;
    LIBYA                          = 126;
    LIECHTENSTEIN                  = 127;
    LITHUANIA                      = 128;
    LUXEMBOURG                     = 129;

    MACAO                          = 130;
    MACEDONIA                      = 131;
    MADAGASCAR                     = 132;
    MALAWI                         = 133;
    MALAYSIA                       = 134;
    MALDIVES                       = 135;
    MALI                           = 136;
    MALTA                          = 137;
    MARSHALL_ISLANDS               = 138;
    MARTINIQUE                     = 139;

    MAURITANIA                     = 140;
    MAURITIUS                      = 141;
    MAYOTTE                        = 142;
    MEXICO                         = 143;
    MICRONESIA                     = 144;
    MOLDOVA                        = 145;
    MONACO                         = 146;
    MONGOLIA                       = 147;
    MONTENEGRO                     = 148;
    MONTSERRAT                     = 149;

    MOROCCO                        = 150;
    MOZAMBIQUE                     = 151;
    MYANMAR                        = 152;
    NAMIBIA                        = 153;
    NAURU                          = 154;
    NEPAL                          = 155;
    NETHERLANDS                    = 156;
    NEW_CALEDONIA                  = 157;
    NEW_ZEALAND                    = 158;
    NICARAGUA                      = 159;

    NIGER                          = 160;
    NIGERIA                        = 161;
    NIUE                           = 162;
    NORFOLK_ISLAND                 = 163;
    NORTHERN_MARIANA_ISLANDS       = 164;
    NORWAY                         = 165;
    OMAN                           = 166;
    PAKISTAN                       = 167;
    PALAU                          = 168;
    PANAMA                         = 169;

    PAPUA_NEW_GUINEA               = 170;
    PARAGUAY                       = 171;
    PERU                           = 172;
    PHILIPPINES                    = 173;
    PITCAIRN                       = 174;
    POLAND                         = 175;
    PORTUGAL                       = 176;
    PUERTO_RICO                    = 177;
    QATAR                          = 178;
    REUNION                        = 179;

    ROMANIA                        = 180;
    RUSSIA                         = 181;
    RWANDA                         = 182;
    SAINT_BARTHELEMY               = 183;
    SAINT_HELENA                   = 184;
    SAINT_KITTS                    = 185;
    SAINT_LUCIA                    = 186;
    SAINT_MARTIN                   = 187;
    SAINT_PIERRE                   = 188;
    SAINT_VINCENT                  = 189;

    SAMOA                          = 190;
    SAN_MARINO                     = 191;
    SAO_TOME                       = 192;
    SAUDI_ARABIA                   = 193;
    SENEGAL                        = 194;
    SERBIA                         = 195;
    SEYCHELLES                     = 196;
    SIERRA_LEONE                   = 197;
    SINGAPORE                      = 198;
    SINT_MAARTEN                   = 199;

    SUCRE                          = 200;
    SLOVAKIA                       = 201;
    SLOVENIA                       = 202;
    SOLOMON_ISLANDS                = 203;
    SOMALIA                        = 204;
    SOUTH_AFRICA                   = 205;
    SOUTH_SUDAN                    = 206;
    SPAIN                          = 207;
    SRI_LANKA                      = 208;
    SUDAN                          = 209;

    SURINAME                       = 210;
    SVALBARD                       = 211;
    ESWATINI                       = 212;
    SWAZILAND                      = 212;
    SWEDEN                         = 213;
    SWITZERLAND                    = 214;
    SYRIAN_ARAB_REPUBLIC           = 215;
    TAIWAN                         = 216;
    TAJIKISTAN                     = 217;
    TANZANIA                       = 218;
    THAILAND                       = 219;

    TIMOR_LESTE                    = 220;
    TOGO                           = 221;
    TOKELAU                        = 222;
    TONGA                          = 223;
    TRINIDAD                       = 224;
    TUNISIA                        = 225;
    TURKEY                         = 226;
    TURKMENISTAN                   = 227;
    TURKS_AND_CAICOS_ISLANDS       = 228;
    TUVALU                         = 229;

    UGANDA                         = 230;
    UKRAINE                        = 231;
    UNITED_ARAB_EMIRATES           = 232;
    UNITED_KINGDOM                 = 233;
    UNITED_STATES                  = 234;
    URUGUAY                        = 235;
    UZBEKISTAN                     = 236;
    VANUATU                        = 237;
    VENEZUELA                      = 238;
    VIETNAM                        = 239;

    VIRGIN_ISLANDS_BRITISH         = 240;
    VIRGIN_ISLANDS_US              = 241;
    WALLIS_AND_FUTUNA              = 242;
    WESTERN_SAHARA                 = 243;
    YEMEN                          = 244;
    ZAMBIA                         = 245;
    ZIMBABWE                       = 246;
    UNITED_STATES_MINOR_ISLANDS    = 247;

    ALL                            = 500;
    AFRICA                         = 501;
    ASIA                           = 502;
    CENTRAL_AMERICA                = 503;
    EUROPE                         = 504;
    MIDDLE_EAST                    = 505;
    NORTH_AMERICA                  = 506;
    SOUTH_AMERICA                  = 507;
    OCEANIA                        = 508;
}

src:./profile.proto


syntax = "proto3";
option go_package = "pb";


import "google/protobuf/timestamp.proto";
import "moderator.proto";

message Profile {
    string peerID                          = 1;
    string handle                          = 2;
    string name                            = 3;
    string location                        = 4;
    string about                           = 5;
    string shortDescription                = 6;

    bool nsfw                              = 7;
    bool vendor                            = 8;
    bool moderator                         = 9;
    Moderator moderatorInfo                = 10;

    Contact contactInfo                    = 11;
    Colors colors                          = 12;

    // The following data is added to the profile
    // automatically by the server and may be omitted
    // when setting the profile via API.

    Image avatarHashes                     = 13;
    Image headerHashes                     = 14;

    Stats stats                            = 15;

    string bitcoinPubkey                   = 16;

    google.protobuf.Timestamp lastModified = 17;

    repeated string currencies             = 18;

    message Contact {
        string website                = 1;
        string email                  = 2;
        string phoneNumber            = 3;
        repeated SocialAccount social = 4;
    }

    message SocialAccount {
        string type     = 1;
        string username = 2;
        string proof    = 3;
    }

    message Image {
        string tiny     = 1;
        string small    = 2;
        string medium   = 3;
        string large    = 4;
        string original = 5;
    }

    message Colors {
        string primary       = 1;
        string secondary     = 2;
        string text          = 3;
        string highlight     = 4;
        string highlightText = 5;
    }

    message Stats {
        uint32 followerCount  = 1;
        uint32 followingCount = 2;
        uint32 listingCount   = 3;
        uint32 ratingCount    = 4;
        uint32 postCount      = 5;
        float averageRating   = 6;
    }
}

src:./moderator.proto


syntax = "proto3";
option go_package = "pb";


import "contracts.proto";

message Moderator {
    string description                 = 1;
    string termsAndConditions          = 2;
    repeated string languages          = 3;
    repeated string acceptedCurrencies = 4;
    Fee fee                            = 5;

    message Fee {
        Price fixedFee   = 1;
        float percentage = 2;
        FeeType feeType  = 3;

        enum FeeType {
            FIXED                 = 0;
            PERCENTAGE            = 1;
            FIXED_PLUS_PERCENTAGE = 2;
        }
    }

    message Price {
        string currencyCode = 1;
        uint64 amount       = 2; // Bitcoins must be in satoshi
    }
}

message DisputeUpdate {
    string orderId              = 1;
    string payoutAddress        = 2;
    repeated Outpoint outpoints = 3;
    bytes serializedContract    = 4;
}

src:./orders.proto


syntax = "proto3";
option go_package = "pb";


enum OrderState {
    // Order has been funded and sent to the vendor but vendor has not yet responded
    PENDING              = 0;

    // Waiting for the buyer to fund the payment address
    AWAITING_PAYMENT     = 1;

    // Waiting for the customer to pick up the order (customer pickup option only)
    AWAITING_PICKUP      = 2;

    // Order has been fully funded and we're waiting for the vendor to fulfill
    AWAITING_FULFILLMENT = 3;

    // Vendor has fulfilled part of the order
    PARTIALLY_FULFILLED  = 4;

    // Vendor has fulfilled the order
    FULFILLED            = 5;

    // Buyer has completed the order and left a review
    COMPLETED            = 6;

    // Buyer canceled the order (offline order only)
    CANCELED             = 7;

    // Vendor declined to confirm the order (offline order only)
    DECLINED             = 8;

    // Vendor refunded the order
    REFUNDED             = 9;

    // Contract is under active dispute
    DISPUTED             = 10;

    // The moderator has resolved the dispute and we are waiting for the winning party to
    // accept the payout.
    DECIDED              = 11;

    // The winning party has accepted the dispute and it is now complete. After the buyer
    // leaves a review the state should be set to COMPLETE.
    RESOLVED             = 12;

    // Escrow has been released after waiting the timeout period. After the buyer
    // leaves a review the state should be set to COMPLETE.
    PAYMENT_FINALIZED    = 13;

    // We screwed up and produced a order which didn't validate. This state is only used for offline orders. If a processing
    // error occurred with an open connection between buyer and vendor the vendor just rejects the order on the spot neither party
    // commits the order to the database.
    PROCESSING_ERROR     = 14;
}

src:./api.proto


syntax = "proto3";
option go_package = "pb";


import "contracts.proto";
import "orders.proto";
import "profile.proto";
import "google/protobuf/timestamp.proto";

// This schema is used for the /ob/listing api call structure
// We use protobuf for this instead of a basic struct because
// the listing object is in protobuf and we can't mix types. Also
// we want to avoid putting fields in the contract that are only
// used by the api.

message Coupon {
    string hash = 1;
    string code = 2;
}

message OrderRespApi {
    RicardianContract contract                            = 1;
    OrderState state                                      = 2;
    bool read                                             = 3;
    bool funded                                           = 4;
    uint64 unreadChatMessages                             = 5;
    repeated TransactionRecord paymentAddressTransactions = 6;
    TransactionRecord refundAddressTransaction            = 7;
}

message CaseRespApi {
    google.protobuf.Timestamp timestamp            = 1;
    RicardianContract buyerContract                = 2;
    RicardianContract vendorContract               = 3;
    repeated string buyerContractValidationErrors  = 4;
    repeated string vendorContractValidationErrors = 5;
    OrderState state                               = 6;
    bool read                                      = 7;
    bool buyerOpened                               = 8;
    string claim                                   = 9;
    uint64 unreadChatMessages                      = 10;
    DisputeResolution resolution                   = 11;
}

message TransactionRecord {
    string txid                         = 1;
    int64 value                         = 2;
    uint32 confirmations                = 3;
    uint32 height                       = 4;
    google.protobuf.Timestamp timestamp = 5;
}

message PeerAndProfile {
    string peerId   = 1;
    Profile profile = 2;
}

message PeerAndProfileWithID {
    string id       = 1;
    string peerId   = 2;
    Profile profile = 3;
}

message RatingWithID {
    string id       = 1;
    string ratingId = 2;
    Rating rating   = 3;
}