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);

REST

HTTP MethodPath
POST /v1/staticaddr/loopin

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>,
amount: <int64>,
fast: <bool>,
};
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>,
// "used_deposits": <Deposit>,
// "swap_amount": <uint64>,
// "change": <int64>,
// "fast": <bool>,
// }

Messages

looprpc.StaticAddressLoopInRequest

Source: looprpc/client.proto

FieldgRPC TypeREST TypeREST Placement
outpoints
string[]arraybody
max_swap_fee_satoshis
int64stringbody
last_hop
bytesstringbody
label
stringstringbody
initiator
stringstringbody
route_hints
RouteHint[]arraybody
private
boolbooleanbody
payment_timeout_seconds
uint32integerbody
amount
int64stringbody
fast
boolbooleanbody

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
used_deposits
Deposit[]array
swap_amount
uint64string
change
int64string
fast
boolboolean

Nested Messages

looprpc.Deposit

FieldgRPC TypeREST Type
id
bytesstring
state
DepositStatestring
outpoint
stringstring
value
int64string
confirmation_height
int64string
blocks_until_expiry
int64string
swap_hash
bytesstring

Enums

looprpc.DepositState

NameNumber
UNKNOWN_STATE
0
DEPOSITED
1
WITHDRAWING
2
WITHDRAWN
3
LOOPING_IN
4
LOOPED_IN
5
SWEEP_HTLC_TIMEOUT
6
HTLC_TIMEOUT_SWEPT
7
PUBLISH_EXPIRED
8
WAIT_FOR_EXPIRY_SWEEP
9
EXPIRED
10