Move pricing and payments into bitswap protobuf message
Only a single message type is forwarded to the rpc handler, so we add pricing and payment info to that message type.
This commit is contained in:
parent
9635f26b90
commit
02ef50ab46
|
@ -17,6 +17,7 @@ import_proto3 "message.proto"
|
||||||
export Message
|
export Message
|
||||||
export Wantlist, WantType, Entry
|
export Wantlist, WantType, Entry
|
||||||
export Block, BlockPresenceType, BlockPresence
|
export Block, BlockPresenceType, BlockPresence
|
||||||
|
export PricingMessage, StateChannelUpdate
|
||||||
|
|
||||||
proc hash*(e: Entry): Hash =
|
proc hash*(e: Entry): Hash =
|
||||||
hash(e.`block`)
|
hash(e.`block`)
|
||||||
|
|
|
@ -37,9 +37,21 @@ message Message {
|
||||||
BlockPresenceType type = 2;
|
BlockPresenceType type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message PricingMessage {
|
||||||
|
bytes address = 1; // Ethereum address to which payments should be made
|
||||||
|
bytes asset = 2; // Asset (coin) with which to pay
|
||||||
|
bytes price = 3; // Amount of assets to pay per byte (UInt256)
|
||||||
|
}
|
||||||
|
|
||||||
|
message StateChannelUpdate {
|
||||||
|
bytes update = 1; // Signed Nitro state, serialized as JSON
|
||||||
|
}
|
||||||
|
|
||||||
Wantlist wantlist = 1;
|
Wantlist wantlist = 1;
|
||||||
repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0
|
repeated bytes blocks = 2; // used to send Blocks in bitswap 1.0.0
|
||||||
repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0
|
repeated Block payload = 3; // used to send Blocks in bitswap 1.1.0
|
||||||
repeated BlockPresence blockPresences = 4;
|
repeated BlockPresence blockPresences = 4;
|
||||||
int32 pendingBytes = 5;
|
int32 pendingBytes = 5;
|
||||||
|
PricingMessage pricing = 6;
|
||||||
|
StateChannelUpdate payment = 7;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,7 @@ import pkg/protobuf_serialization
|
||||||
import pkg/nitro
|
import pkg/nitro
|
||||||
import pkg/questionable
|
import pkg/questionable
|
||||||
import pkg/upraises
|
import pkg/upraises
|
||||||
|
import ./bitswap
|
||||||
import_proto3 "payments.proto"
|
|
||||||
|
|
||||||
export PricingMessage
|
export PricingMessage
|
||||||
export StateChannelUpdate
|
export StateChannelUpdate
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package bitswap.payments.pb;
|
|
||||||
|
|
||||||
message PricingMessage {
|
|
||||||
bytes address = 1; // Ethereum address to which payments should be made
|
|
||||||
bytes asset = 2; // Asset (coin) with which to pay
|
|
||||||
bytes price = 3; // Amount of assets to pay per byte (UInt256)
|
|
||||||
}
|
|
||||||
|
|
||||||
message StateChannelUpdate {
|
|
||||||
bytes update = 1; // Signed Nitro state, serialized as JSON
|
|
||||||
}
|
|
Loading…
Reference in New Issue