Skip to main content

StaticAddressLoopIn

loop:static StaticAddressLoopIn initiates a static address loop-in swap.

Source: looprpc/client.proto

gRPC

rpc StaticAddressLoopIn (StaticAddressLoopInRequest) returns (StaticAddressLoopInResponse);

Code Samples

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

const GRPC_HOST = 'localhost:11010'
const MACAROON_PATH = 'LOOP_DIR/regtest/loop.macaroon'
const TLS_PATH = 'LOOP_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('looprpc/client.proto', loaderOptions);
const looprpc = grpc.loadPackageDefinition(packageDefinition).looprpc;
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 looprpc.SwapClient(GRPC_HOST, creds);
let request = {
outpoints: <string>,
max_swap_fee_satoshis: <int64>,
last_hop: <bytes>,
label: <string>,
initiator: <string>,
route_hints: <RouteHint>,
private: <bool>,
payment_timeout_seconds: <uint32>,
};
client.staticAddressLoopIn(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "swap_hash": <bytes>,
// "state": <string>,
// "amount": <uint64>,
// "htlc_cltv": <int32>,
// "quoted_swap_fee_satoshis": <int64>,
// "max_swap_fee_satoshis": <int64>,
// "initiation_height": <uint32>,
// "protocol_version": <string>,
// "label": <string>,
// "initiator": <string>,
// "payment_timeout_seconds": <uint32>,
// }

Messages

looprpc.StaticAddressLoopInRequest

Source: looprpc/client.proto

FieldgRPC TypeREST TypeREST Placement
outpoints
string[]unknownunknown
max_swap_fee_satoshis
int64unknownunknown
last_hop
bytesunknownunknown
label
stringunknownunknown
initiator
stringunknownunknown
route_hints
RouteHint[]unknownunknown
private
boolunknownunknown
payment_timeout_seconds
uint32unknownunknown

looprpc.StaticAddressLoopInResponse

Source: looprpc/client.proto

FieldgRPC TypeREST Type
swap_hash
bytesstring
state
stringstring
amount
uint64string
htlc_cltv
int32integer
quoted_swap_fee_satoshis
int64string
max_swap_fee_satoshis
int64string
initiation_height
uint32integer
protocol_version
stringstring
label
stringstring
initiator
stringstring
payment_timeout_seconds
uint32integer