Skip to main content

OfferSidecar

OfferSidecar is step 1/4 of the sidecar negotiation between the provider (the trader submitting the bid order) and the recipient (the trader receiving the sidecar channel). This step must be run by the provider. The result is a sidecar ticket with an offer to lease a sidecar channel for the recipient. The offer will be signed with the provider's lnd node public key. The ticket returned by this call will have the state "offered".

Source: poolrpc/trader.proto

gRPC

rpc OfferSidecar (OfferSidecarRequest) returns (SidecarTicket);

REST

HTTP MethodPath
POST /v1/pool/sidecar/offer

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:12010'
const MACAROON_PATH = 'POOL_DIR/regtest/pool.macaroon'
const TLS_PATH = 'POOL_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('poolrpc/trader.proto', loaderOptions);
const poolrpc = grpc.loadPackageDefinition(packageDefinition).poolrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new poolrpc.Trader(GRPC_HOST, creds);
let request = {
auto_negotiate: <bool>,
bid: <Bid>,
};
client.offerSidecar(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "ticket": <string>,
// }

Messages

poolrpc.OfferSidecarRequest

Source: poolrpc/trader.proto

FieldgRPC TypeREST TypeREST Placement
auto_negotiate
boolbooleanbody
bid
Bidobjectbody

poolrpc.SidecarTicket

Source: poolrpc/trader.proto

FieldgRPC TypeREST Type
ticket
stringstring

Nested Messages

poolrpc.Bid

FieldgRPC TypeREST Type
details
Orderobject
lease_duration_blocks
uint32integer
version
uint32integer
min_node_tier
NodeTierstring
self_chan_balance
uint64string
sidecar_ticket
stringstring
unannounced_channel
boolboolean
zero_conf_channel
boolboolean

poolrpc.MatchEvent

FieldgRPC TypeREST Type
match_state
MatchStatestring
units_filled
uint32integer
matched_order
bytesstring
reject_reason
MatchRejectReasonstring

poolrpc.Order

FieldgRPC TypeREST Type
trader_key
bytesstring
rate_fixed
uint32integer
amt
uint64string
max_batch_fee_rate_sat_per_kw
uint64string
order_nonce
bytesstring
state
OrderStatestring
units
uint32integer
units_unfulfilled
uint32integer
reserved_value_sat
uint64string
creation_timestamp_ns
uint64string
events
OrderEvent[]array
min_units_match
uint32integer
channel_type
OrderChannelTypestring
allowed_node_ids
bytes[]array
not_allowed_node_ids
bytes[]array
auction_type
AuctionTypestring
is_public
boolboolean

poolrpc.OrderEvent

FieldgRPC TypeREST Type
timestamp_ns
int64string
event_str
stringstring
state_change
UpdatedEventobject
matched
MatchEventobject

poolrpc.UpdatedEvent

FieldgRPC TypeREST Type
previous_state
OrderStatestring
new_state
OrderStatestring
units_filled
uint32integer

Enums

poolrpc.AuctionType

NameNumber
AUCTION_TYPE_BTC_INBOUND_LIQUIDITY
0
AUCTION_TYPE_BTC_OUTBOUND_LIQUIDITY
1

poolrpc.MatchRejectReason

NameNumber
NONE
0
SERVER_MISBEHAVIOR
1
BATCH_VERSION_MISMATCH
2
PARTIAL_REJECT_COLLATERAL
3
PARTIAL_REJECT_DUPLICATE_PEER
4
PARTIAL_REJECT_CHANNEL_FUNDING_FAILED
5

poolrpc.MatchState

NameNumber
PREPARE
0
ACCEPTED
1
REJECTED
2
SIGNED
3
FINALIZED
4

poolrpc.NodeTier

NameNumber
TIER_DEFAULT
0
TIER_0
1
TIER_1
2

poolrpc.OrderChannelType

NameNumber
ORDER_CHANNEL_TYPE_UNKNOWN
0
ORDER_CHANNEL_TYPE_PEER_DEPENDENT
1
ORDER_CHANNEL_TYPE_SCRIPT_ENFORCED
2
ORDER_CHANNEL_TYPE_SIMPLE_TAPROOT
3

poolrpc.OrderState

NameNumber
ORDER_SUBMITTED
0
ORDER_CLEARED
1
ORDER_PARTIALLY_FILLED
2
ORDER_EXECUTED
3
ORDER_CANCELED
4
ORDER_EXPIRED
5
ORDER_FAILED
6