Merge pull request #247 from lightninglabs/uint64-strings

refactor: use strings for GRPC uint64 fields
This commit is contained in:
Jamal James 2021-07-16 22:20:30 +00:00 committed by GitHub
commit 46f114cabe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 4019 additions and 3948 deletions

View file

@ -20,7 +20,7 @@
"@emotion/react": "11.4.0",
"@emotion/styled": "11.3.0",
"@improbable-eng/grpc-web": "0.14.0",
"big.js": "5.2.2",
"big.js": "6.1.1",
"bootstrap": "4.5.0",
"copy-to-clipboard": "3.3.1",
"d3": "6.3.1",
@ -58,7 +58,7 @@
"@testing-library/jest-dom": "5.11.5",
"@testing-library/react": "11.1.1",
"@testing-library/user-event": "12.2.0",
"@types/big.js": "4.0.5",
"@types/big.js": "6.1.1",
"@types/d3": "6.2.0",
"@types/debug": "4.1.5",
"@types/file-saver": "2.0.1",

View file

@ -36,7 +36,9 @@ const protoSources = async () => {
throw new Error(`go.mod did not match pattern ${POOL_VERSION_PATTERN}`);
}
console.log(`Found lnd version ${lndVersion[1]} and loop version ${loopVersion[1]}.`);
console.log(
`Found:\n LND ${lndVersion[1]}\n Loop ${loopVersion[1]}\n Pool ${poolVersion[1]}`,
);
return {
lnd: `lightningnetwork/lnd/${lndVersion[1]}/lnrpc/rpc.proto`,
loop: `lightninglabs/loop/${loopVersion[1]}/looprpc/client.proto`,
@ -63,7 +65,7 @@ const download = async () => {
for ([name, urlPath] of Object.entries(await protoSources())) {
const url = `https://raw.githubusercontent.com/${urlPath}`;
const filePath = join(appPath, '..', 'proto', `${name}.proto`);
mkdirSync(dirname(filePath), {recursive: true});
mkdirSync(dirname(filePath), { recursive: true });
console.log(`${url}`);
console.log(` -> ${filePath}`);
const content = await new Promise((resolve, reject) => {
@ -78,6 +80,26 @@ const download = async () => {
}
};
/**
* Adds "[jstype = JS_STRING]" to uint64 fields to indicate that they should be
* represented as strings to avoid Number overflow issues
*/
const sanitize = async () => {
const filePaths = Object.keys(filePatches).map(name =>
join(appPath, '..', 'proto', `${name}.proto`),
);
for (path of filePaths) {
let content = (await fs.readFile(path)).toString();
content = content.replace(/^\s*(repeated)? u?int64 ((?!jstype).)*$/gm, match => {
// add the jstype descriptor
return /^.*];$/.test(match)
? match.replace(/\s*];$/, `, jstype = JS_STRING];`)
: match.replace(/;$/, ` [jstype = JS_STRING];`);
});
await fs.writeFile(path, content);
}
};
/**
* Executes the `protoc` compiler to convert *.proto files into TS & JS code
*/
@ -117,11 +139,6 @@ const patch = async () => {
console.log('\nPatching generated JS files');
for (const filename of Object.keys(filePatches)) {
const patch = [
'/* eslint-disable */',
`var proto = { ${filePatches[filename]} };`,
'',
].join('\n');
const path = join(
appPath,
'src',
@ -132,7 +149,15 @@ const patch = async () => {
console.log(` - ${path}`);
let content = await fs.readFile(path);
// apply the webpack patch
const patch = [
'/* eslint-disable */',
`var proto = { ${filePatches[filename]} };`,
'',
].join('\n');
content = `${patch}\n${content}`;
await fs.writeFile(path, content);
}
};
@ -143,6 +168,7 @@ const patch = async () => {
const main = async () => {
try {
await download();
await sanitize();
await generate();
await patch();
} catch (error) {

View file

@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import { observable } from 'mobx';
import * as LOOP from 'types/generated/loop_pb';
import Big from 'big.js';
import { loopListSwaps } from 'util/tests/sampleData';
import { useStore } from 'store';
import { Swap } from 'store/models';
@ -47,7 +48,7 @@ const mockSwap = (type: number, state: number, id?: string) => {
swap.id = `${id || ''}${swap.id}`;
swap.type = type;
swap.state = state;
swap.lastUpdateTime = Date.now() * 1000 * 1000;
swap.lastUpdateTime = Big(Date.now() * 1000 * 1000);
return swap;
};
// create a list of swaps to use for stories
@ -84,7 +85,7 @@ export const LoopInProgress = () => {
await delay(2000);
swap.state = SUCCESS;
await delay(2000);
swap.initiationTime = 0;
swap.initiationTime = Big(0);
};
startTransitions();
@ -106,7 +107,7 @@ export const LoopOutProgress = () => {
await delay(2000);
swap.state = SUCCESS;
await delay(2000);
swap.initiationTime = 0;
swap.initiationTime = Big(0);
};
startTransitions();

View file

@ -3,6 +3,7 @@ import { runInAction } from 'mobx';
import { SwapStatus } from 'types/generated/loop_pb';
import { grpc } from '@improbable-eng/grpc-web';
import { fireEvent, waitFor } from '@testing-library/react';
import Big from 'big.js';
import { saveAs } from 'file-saver';
import { formatSats } from 'util/formatters';
import { renderWithProviders } from 'util/tests';
@ -70,9 +71,9 @@ describe('LoopPage component', () => {
const { findByText } = render();
// convert from numeric timestamp to string (1586390353623905000 -> '4/15/2020')
const formatDate = (s: SwapStatus.AsObject) =>
new Date(s.initiationTime / 1000 / 1000).toLocaleDateString();
new Date(+Big(s.initiationTime).div(1000).div(1000)).toLocaleDateString();
const [swap1, swap2] = loopListSwaps.swapsList.sort(
(a, b) => b.initiationTime - a.initiationTime,
(a, b) => +Big(b.initiationTime).sub(a.initiationTime),
);
expect(await findByText(formatDate(swap1))).toBeInTheDocument();

View file

@ -2,6 +2,7 @@ import React from 'react';
import { runInAction } from 'mobx';
import * as LOOP from 'types/generated/loop_pb';
import { fireEvent } from '@testing-library/react';
import Big from 'big.js';
import { renderWithProviders } from 'util/tests';
import { loopListSwaps } from 'util/tests/sampleData';
import { createStore, Store } from 'store';
@ -27,7 +28,7 @@ describe('ProcessingSwaps component', () => {
swap.id = `${id || ''}${swap.id}`;
swap.type = type;
swap.state = state;
swap.lastUpdateTime = Date.now() * 1000 * 1000;
swap.lastUpdateTime = Big(Date.now() * 1000 * 1000);
runInAction(() => {
store.swapStore.swaps.set(swap.id, swap);
});

View file

@ -117,7 +117,7 @@ describe('AccountSection', () => {
});
expect(store.accountStore.activeTraderKey).toBe(hex(poolInitAccount.traderKey));
expect(store.fundNewAccountView.amount).toBe(0);
expect(+store.fundNewAccountView.amount).toBe(0);
expect(store.fundNewAccountView.confTarget).toBe(DEFAULT_CONF_TARGET);
expect(store.fundNewAccountView.expireBlocks).toBe(DEFAULT_EXPIRE_BLOCKS);
});
@ -206,7 +206,7 @@ describe('AccountSection', () => {
expect(getByText('Account')).toBeInTheDocument();
});
expect(+store.accountStore.activeAccount.totalBalance).toBe(
expect(store.accountStore.activeAccount.totalBalance.toString()).toBe(
poolDepositAccount.account.value,
);
expect(store.fundAccountView.amount).toBe(0);
@ -322,7 +322,7 @@ describe('AccountSection', () => {
});
expect(req!.traderKey).toBe(b64(store.accountStore.activeAccount.traderKey));
expect(req!.outputWithFee?.feeRateSatPerKw).toBe(2500);
expect(req!.outputWithFee?.feeRateSatPerKw).toBe('2500');
expect(req!.outputWithFee?.address).toBe('abc123');
});
@ -375,7 +375,7 @@ describe('AccountSection', () => {
});
expect(req!.accountKey).toBe(b64(store.accountStore.activeAccount.traderKey));
expect(req!.feeRateSatPerKw).toBe(31250);
expect(req!.feeRateSatPerKw).toBe('31250');
expect(req!.relativeExpiry).toBe(2016);
});
});

View file

@ -1,6 +1,7 @@
import React from 'react';
import { runInAction } from 'mobx';
import { act, waitFor } from '@testing-library/react';
import Big from 'big.js';
import { formatSats } from 'util/formatters';
import { renderWithProviders } from 'util/tests';
import { createStore, Store } from 'store';
@ -25,7 +26,7 @@ describe('BatchStats', () => {
jest.useFakeTimers();
runInAction(() => {
const nowSecs = Math.ceil(Date.now() / 1000);
store.batchStore.nextBatchTimestamp = nowSecs + 90;
store.batchStore.nextBatchTimestamp = Big(nowSecs + 90);
});
const { getByText } = render();
expect(getByText('Next Batch')).toBeInTheDocument();

View file

@ -71,12 +71,12 @@ describe('OrderFormSection', () => {
});
fireEvent.click(getByText('Place Bid Order'));
expect(bid!.details.amt).toBe(1000000);
expect(bid!.details.amt).toBe('1000000');
expect(bid!.details.rateFixed).toBe(4960);
expect(bid!.details.minUnitsMatch).toBe(1);
expect(bid!.leaseDurationBlocks).toBe(2016);
expect(bid!.minNodeTier).toBe(1);
expect(bid!.details.maxBatchFeeRateSatPerKw).toBe(253);
expect(bid!.details.maxBatchFeeRateSatPerKw).toBe('253');
});
it('should submit an ask order', async () => {
@ -95,11 +95,11 @@ describe('OrderFormSection', () => {
});
fireEvent.click(getByText('Place Ask Order'));
expect(ask!.details.amt).toBe(1000000);
expect(ask!.details.amt).toBe('1000000');
expect(ask!.details.rateFixed).toBe(4960);
expect(ask!.details.minUnitsMatch).toBe(1);
expect(ask!.leaseDurationBlocks).toBe(2016);
expect(ask!.details.maxBatchFeeRateSatPerKw).toBe(253);
expect(ask!.details.maxBatchFeeRateSatPerKw).toBe('253');
});
it('should submit an order with a different lease duration', async () => {
@ -119,12 +119,12 @@ describe('OrderFormSection', () => {
});
fireEvent.click(getByText('Place Bid Order'));
expect(bid!.details.amt).toBe(1000000);
expect(bid!.details.amt).toBe('1000000');
expect(bid!.details.rateFixed).toBe(2480);
expect(bid!.details.minUnitsMatch).toBe(1);
expect(bid!.leaseDurationBlocks).toBe(4032);
expect(bid!.minNodeTier).toBe(1);
expect(bid!.details.maxBatchFeeRateSatPerKw).toBe(253);
expect(bid!.details.maxBatchFeeRateSatPerKw).toBe('253');
});
it('should reset the form after placing an order', async () => {

View file

@ -46,8 +46,8 @@ describe('AccountStore', () => {
});
it('should return sorted accounts', async () => {
const a = new Account(rootStore, { ...poolInitAccount, value: 300 });
const b = new Account(rootStore, { ...poolInitAccount, value: 100 });
const a = new Account(rootStore, { ...poolInitAccount, value: '300' });
const b = new Account(rootStore, { ...poolInitAccount, value: '100' });
const c = new Account(rootStore, {
...poolInitAccount,
expirationHeight: 5000,
@ -76,8 +76,8 @@ describe('AccountStore', () => {
});
it('should excluded closed accounts in sorted accounts', async () => {
const a = new Account(rootStore, { ...poolInitAccount, value: 300 });
const b = new Account(rootStore, { ...poolInitAccount, value: 100 });
const a = new Account(rootStore, { ...poolInitAccount, value: '300' });
const b = new Account(rootStore, { ...poolInitAccount, value: '100' });
const c = new Account(rootStore, {
...poolInitAccount,
expirationHeight: 5000,
@ -158,7 +158,7 @@ describe('AccountStore', () => {
it('should create a new Account', async () => {
expect(store.accounts.size).toEqual(0);
await store.createAccount(3000000, 4032);
await store.createAccount(Big(3000000), 4032);
expect(store.accounts.size).toEqual(1);
expect(store.activeAccount).toBeDefined();
});
@ -168,7 +168,7 @@ describe('AccountStore', () => {
throw new Error('test-err');
});
expect(rootStore.appView.alerts.size).toBe(0);
await store.createAccount(3000000, 4032);
await store.createAccount(Big(3000000), 4032);
await waitFor(() => {
expect(rootStore.appView.alerts.size).toBe(1);
expect(values(rootStore.appView.alerts)[0].message).toBe('test-err');
@ -216,7 +216,9 @@ describe('AccountStore', () => {
it('should deposit funds into an account', async () => {
await store.fetchAccounts();
const txid = await store.deposit(1);
expect(+store.activeAccount.totalBalance).toBe(poolDepositAccount.account?.value);
expect(store.activeAccount.totalBalance.toString()).toBe(
poolDepositAccount.account?.value,
);
expect(txid).toEqual(poolDepositAccount.depositTxid);
});
@ -236,7 +238,9 @@ describe('AccountStore', () => {
it('should withdraw funds from an account', async () => {
await store.fetchAccounts();
const txid = await store.withdraw(1);
expect(+store.activeAccount.totalBalance).toBe(poolWithdrawAccount.account?.value);
expect(store.activeAccount.totalBalance.toString()).toBe(
poolWithdrawAccount.account?.value,
);
expect(txid).toEqual(poolWithdrawAccount.withdrawTxid);
});

View file

@ -111,15 +111,15 @@ describe('BuildSwapView', () => {
});
it('should ensure amount is greater than the min terms', async () => {
store.setAmount(Big(loopInTerms.minSwapAmount - 100));
store.setAmount(Big(loopInTerms.minSwapAmount).sub(100));
await store.getTerms();
expect(+store.amountForSelected).toBe(loopInTerms.minSwapAmount);
expect(store.amountForSelected.toString()).toBe(loopInTerms.minSwapAmount);
});
it('should ensure amount is less than the max terms', async () => {
store.setAmount(Big(loopInTerms.maxSwapAmount + 100));
await store.getTerms();
expect(+store.amountForSelected).toBe(loopInTerms.maxSwapAmount);
expect(store.amountForSelected.toString()).toBe(loopInTerms.maxSwapAmount);
});
it('should validate the conf target', async () => {
@ -293,7 +293,7 @@ describe('BuildSwapView', () => {
store.setDirection(SwapDirection.OUT);
store.setAmount(Big(600));
let deadline = 0;
let deadline = '';
// mock the grpc unary function in order to capture the supplied deadline
// passed in with the API request
injectIntoGrpcUnary((desc, props) => {
@ -303,7 +303,7 @@ describe('BuildSwapView', () => {
// run a loop on mainnet and verify the deadline
rootStore.nodeStore.network = 'mainnet';
store.requestSwap();
await waitFor(() => expect(deadline).toBeGreaterThan(0));
await waitFor(() => expect(+deadline).toBeGreaterThan(0));
// inject again for the next swap
injectIntoGrpcUnary((desc, props) => {
@ -313,7 +313,7 @@ describe('BuildSwapView', () => {
// run a loop on regtest and verify the deadline
rootStore.nodeStore.network = 'regtest';
store.requestSwap();
await waitFor(() => expect(deadline).toEqual(0));
await waitFor(() => expect(+deadline).toEqual(0));
});
it('should handle errors when performing a loop', async () => {
@ -370,7 +370,12 @@ describe('BuildSwapView', () => {
describe('min/max swap limits', () => {
const addChannel = (capacity: number, localBalance: number) => {
const remoteBalance = capacity - localBalance;
const lndChan = { ...lndChannel, capacity, localBalance, remoteBalance };
const lndChan = {
...lndChannel,
capacity: `${capacity}`,
localBalance: `${localBalance}`,
remoteBalance: `${remoteBalance}`,
};
const channel = Channel.create(rootStore, lndChan);
channel.chanId = `${channel.chanId}${rootStore.channelStore.channels.size}`;
channel.remotePubkey = `${channel.remotePubkey}${rootStore.channelStore.channels.size}`;

View file

@ -134,21 +134,21 @@ describe('ChannelStore', () => {
it('should compute inbound liquidity', async () => {
await store.fetchChannels();
const inbound = lndListChannels.channelsList.reduce(
(sum, chan) => sum + chan.remoteBalance,
0,
(sum, chan) => sum.plus(chan.remoteBalance),
Big(0),
);
expect(+store.totalInbound).toBe(inbound);
expect(+store.totalInbound).toBe(+inbound);
});
it('should compute outbound liquidity', async () => {
await store.fetchChannels();
const outbound = lndListChannels.channelsList.reduce(
(sum, chan) => sum + chan.localBalance,
0,
(sum, chan) => sum.plus(chan.localBalance),
Big(0),
);
expect(+store.totalOutbound).toBe(outbound);
expect(+store.totalOutbound).toBe(+outbound);
});
it('should fetch aliases for channels', async () => {
@ -189,7 +189,9 @@ describe('ChannelStore', () => {
expect(channel.remoteFeeRate).toBe(0);
// the alias is fetched from the API and should be updated after a few ticks
await waitFor(() => {
expect(channel.remoteFeeRate).toBe(lndGetChanInfo.node1Policy.feeRateMilliMsat);
expect(channel.remoteFeeRate.toString()).toBe(
lndGetChanInfo.node1Policy.feeRateMilliMsat,
);
});
});

View file

@ -49,8 +49,8 @@ describe('NodeStore', () => {
expect(+store.wallet.channelBalance).toBe(0);
expect(+store.wallet.walletBalance).toBe(0);
await store.fetchBalances();
expect(+store.wallet.channelBalance).toEqual(lndChannelBalance.balance);
expect(+store.wallet.walletBalance).toEqual(lndWalletBalance.totalBalance);
expect(store.wallet.channelBalance.toString()).toEqual(lndChannelBalance.balance);
expect(store.wallet.walletBalance.toString()).toEqual(lndWalletBalance.totalBalance);
});
it('should handle errors fetching balances', async () => {
@ -69,14 +69,14 @@ describe('NodeStore', () => {
it('should handle a transaction event', () => {
expect(+store.wallet.walletBalance).toBe(0);
store.onTransaction(lndTransaction);
expect(+store.wallet.walletBalance).toBe(lndTransaction.amount);
expect(store.wallet.walletBalance.toString()).toBe(lndTransaction.amount);
});
it('should handle duplicate transaction events', () => {
expect(+store.wallet.walletBalance).toBe(0);
store.onTransaction(lndTransaction);
expect(+store.wallet.walletBalance).toBe(lndTransaction.amount);
expect(store.wallet.walletBalance.toString()).toBe(lndTransaction.amount);
store.onTransaction(lndTransaction);
expect(+store.wallet.walletBalance).toBe(lndTransaction.amount);
expect(store.wallet.walletBalance.toString()).toBe(lndTransaction.amount);
});
});

View file

@ -75,13 +75,27 @@ describe('OrderStore', () => {
it('should submit an ask order', async () => {
await rootStore.accountStore.fetchAccounts();
const nonce = await store.submitOrder(OrderType.Ask, 100000, 2000, 2016, 100000, 253);
const nonce = await store.submitOrder(
OrderType.Ask,
Big(100000),
2000,
2016,
100000,
253,
);
expect(nonce).toBe(hex(poolSubmitOrder.acceptedOrderNonce));
});
it('should submit a bid order', async () => {
await rootStore.accountStore.fetchAccounts();
const nonce = await store.submitOrder(OrderType.Bid, 100000, 2000, 2016, 100000, 253);
const nonce = await store.submitOrder(
OrderType.Bid,
Big(100000),
2000,
2016,
100000,
253,
);
expect(nonce).toBe(hex(poolSubmitOrder.acceptedOrderNonce));
});
@ -100,14 +114,14 @@ describe('OrderStore', () => {
}
return undefined as any;
});
await store.submitOrder(OrderType.Bid, 100000, 2000, 2016, 100000, 253);
await store.submitOrder(OrderType.Bid, Big(100000), 2000, 2016, 100000, 253);
expect(rootStore.appView.alerts.size).toBe(1);
expect(values(rootStore.appView.alerts)[0].message).toBe(poolInvalidOrder.failString);
});
it('should throw if the fixed rate rate is too low', async () => {
await rootStore.accountStore.fetchAccounts();
await store.submitOrder(OrderType.Bid, 100000, 0.9, 20000, 100000, 253);
await store.submitOrder(OrderType.Bid, Big(100000), 0.9, 20000, 100000, 253);
expect(rootStore.appView.alerts.size).toBe(1);
expect(values(rootStore.appView.alerts)[0].message).toMatch(/The rate is too low.*/);
});

View file

@ -59,7 +59,7 @@ class LoopApi extends BaseApi<LoopEvents> {
confTarget?: number,
): Promise<LOOP.InQuoteResponse.AsObject> {
const req = new LOOP.QuoteRequest();
req.setAmt(+amount);
req.setAmt(amount.toString());
if (confTarget) req.setConfTarget(confTarget);
const res = await this._grpc.request(SwapClient.GetLoopInQuote, req, this._meta);
return res.toObject();
@ -73,7 +73,7 @@ class LoopApi extends BaseApi<LoopEvents> {
confTarget?: number,
): Promise<LOOP.OutQuoteResponse.AsObject> {
const req = new LOOP.QuoteRequest();
req.setAmt(+amount);
req.setAmt(amount.toString());
if (confTarget) req.setConfTarget(confTarget);
const res = await this._grpc.request(SwapClient.LoopOutQuote, req, this._meta);
return res.toObject();
@ -89,9 +89,9 @@ class LoopApi extends BaseApi<LoopEvents> {
confTarget?: number,
): Promise<LOOP.SwapResponse.AsObject> {
const req = new LOOP.LoopInRequest();
req.setAmt(+amount);
req.setMaxSwapFee(+quote.swapFee);
req.setMaxMinerFee(+quote.minerFee);
req.setAmt(amount.toString());
req.setMaxSwapFee(quote.swapFee.toString());
req.setMaxMinerFee(quote.minerFee.toString());
req.setInitiator(LOOP_INITIATOR);
if (lastHop) req.setLastHop(b64(lastHop));
if (confTarget) req.setHtlcConfTarget(confTarget);
@ -105,20 +105,20 @@ class LoopApi extends BaseApi<LoopEvents> {
async loopOut(
amount: Big,
quote: Quote,
chanIds: number[],
chanIds: string[],
deadline: number,
confTarget?: number,
destAddress?: string,
): Promise<LOOP.SwapResponse.AsObject> {
const req = new LOOP.LoopOutRequest();
req.setAmt(+amount);
req.setMaxSwapFee(+quote.swapFee);
req.setMaxMinerFee(+quote.minerFee);
req.setMaxPrepayAmt(+quote.prepayAmount);
req.setMaxSwapRoutingFee(this._calcRoutingFee(+amount));
req.setMaxPrepayRoutingFee(this._calcRoutingFee(+quote.prepayAmount));
req.setOutgoingChanSetList(chanIds);
req.setSwapPublicationDeadline(deadline);
req.setAmt(amount.toString());
req.setMaxSwapFee(quote.swapFee.toString());
req.setMaxMinerFee(quote.minerFee.toString());
req.setMaxPrepayAmt(quote.prepayAmount.toString());
req.setMaxSwapRoutingFee(this._calcRoutingFee(amount).toString());
req.setMaxPrepayRoutingFee(this._calcRoutingFee(quote.prepayAmount).toString());
req.setOutgoingChanSetList(chanIds.map(id => id.toString()));
req.setSwapPublicationDeadline(deadline.toString());
req.setInitiator(LOOP_INITIATOR);
if (confTarget) req.setSweepConfTarget(confTarget);
if (destAddress) req.setDest(destAddress);
@ -138,15 +138,16 @@ class LoopApi extends BaseApi<LoopEvents> {
this._meta,
);
}
/**
* Calculates the max routing fee params for loop out. this mimics the loop cli
* behavior of using 2% of the amount
* @param amount the amount of the payment
*/
private _calcRoutingFee(amount: number) {
const routingFeePct = 2;
private _calcRoutingFee(amount: Big): Big {
const routingFeeFactor = 0.02;
// round up to avoid decimals
return Math.ceil(amount * (routingFeePct / 100));
return amount.mul(routingFeeFactor).round(0, Big.roundUp);
}
}

View file

@ -1,6 +1,7 @@
import * as AUCT from 'types/generated/auctioneerrpc/auctioneer_pb';
import * as POOL from 'types/generated/trader_pb';
import { Trader } from 'types/generated/trader_pb_service';
import Big from 'big.js';
import { b64 } from 'util/strings';
import { OrderType, Tier } from 'store/models/order';
import BaseApi from './base';
@ -43,11 +44,11 @@ class PoolApi extends BaseApi<PoolEvents> {
* call the pool `QuoteAccount` RPC and return the response
*/
async quoteAccount(
amount: number,
amount: Big,
confTarget: number,
): Promise<POOL.QuoteAccountResponse.AsObject> {
const req = new POOL.QuoteAccountRequest();
req.setAccountValue(amount);
req.setAccountValue(amount.toString());
req.setConfTarget(confTarget);
const res = await this._grpc.request(Trader.QuoteAccount, req, this._meta);
return res.toObject();
@ -57,12 +58,12 @@ class PoolApi extends BaseApi<PoolEvents> {
* call the pool `InitAccount` RPC and return the response
*/
async initAccount(
amount: number,
amount: Big,
expiryBlocks: number,
confTarget = 6,
): Promise<POOL.Account.AsObject> {
const req = new POOL.InitAccountRequest();
req.setAccountValue(amount);
req.setAccountValue(amount.toString());
req.setRelativeHeight(expiryBlocks);
req.setConfTarget(confTarget);
req.setInitiator(POOL_INITIATOR);
@ -76,12 +77,12 @@ class PoolApi extends BaseApi<PoolEvents> {
async renewAccount(
traderKey: string,
expiryBlocks: number,
feeRateSatPerKw: number,
feeRateSatPerKw: Big,
): Promise<POOL.RenewAccountResponse.AsObject> {
const req = new POOL.RenewAccountRequest();
req.setAccountKey(b64(traderKey));
req.setRelativeExpiry(expiryBlocks);
req.setFeeRateSatPerKw(feeRateSatPerKw);
req.setFeeRateSatPerKw(feeRateSatPerKw.toString());
const res = await this._grpc.request(Trader.RenewAccount, req, this._meta);
return res.toObject();
@ -99,7 +100,7 @@ class PoolApi extends BaseApi<PoolEvents> {
req.setTraderKey(b64(traderKey));
const output = new POOL.OutputWithFee();
output.setFeeRateSatPerKw(feeRateSatPerKw);
output.setFeeRateSatPerKw(feeRateSatPerKw.toString());
if (destinationAddr) {
output.setAddress(destinationAddr);
}
@ -123,13 +124,13 @@ class PoolApi extends BaseApi<PoolEvents> {
*/
async deposit(
traderKey: string,
amount: number,
amount: Big,
feeRateSatPerKw = 253,
): Promise<POOL.DepositAccountResponse.AsObject> {
const req = new POOL.DepositAccountRequest();
req.setTraderKey(Buffer.from(traderKey, 'hex').toString('base64'));
req.setAmountSat(amount);
req.setFeeRateSatPerKw(feeRateSatPerKw);
req.setAmountSat(amount.toString());
req.setFeeRateSatPerKw(feeRateSatPerKw.toString());
const res = await this._grpc.request(Trader.DepositAccount, req, this._meta);
return res.toObject();
}
@ -139,14 +140,14 @@ class PoolApi extends BaseApi<PoolEvents> {
*/
async withdraw(
traderKey: string,
amount: number,
amount: Big,
feeRateSatPerKw = 253,
): Promise<POOL.WithdrawAccountResponse.AsObject> {
const req = new POOL.WithdrawAccountRequest();
req.setTraderKey(Buffer.from(traderKey, 'hex').toString('base64'));
req.setFeeRateSatPerKw(feeRateSatPerKw);
req.setFeeRateSatPerKw(feeRateSatPerKw.toString());
const output = new POOL.Output();
output.setValueSat(amount);
output.setValueSat(amount.toString());
req.setOutputsList([output]);
const res = await this._grpc.request(Trader.WithdrawAccount, req, this._meta);
return res.toObject();
@ -165,18 +166,18 @@ class PoolApi extends BaseApi<PoolEvents> {
* call the pool `QuoteOrder` RPC and return the response
*/
async quoteOrder(
amount: number,
amount: Big,
rateFixed: number,
duration: number,
minUnitsMatch: number,
feeRateSatPerKw: number,
feeRateSatPerKw = 253,
): Promise<POOL.QuoteOrderResponse.AsObject> {
const req = new POOL.QuoteOrderRequest();
req.setAmt(amount);
req.setAmt(amount.toString());
req.setRateFixed(rateFixed);
req.setLeaseDurationBlocks(duration);
req.setMinUnitsMatch(minUnitsMatch);
req.setMaxBatchFeeRateSatPerKw(feeRateSatPerKw);
req.setMaxBatchFeeRateSatPerKw(feeRateSatPerKw.toString());
const res = await this._grpc.request(Trader.QuoteOrder, req, this._meta);
return res.toObject();
@ -188,11 +189,11 @@ class PoolApi extends BaseApi<PoolEvents> {
async submitOrder(
traderKey: string,
type: OrderType,
amount: number,
amount: Big,
rateFixed: number,
duration: number,
minUnitsMatch: number,
feeRateSatPerKw: number,
feeRateSatPerKw = 253,
minNodeTier?: Tier,
): Promise<POOL.SubmitOrderResponse.AsObject> {
if (rateFixed < 1) {
@ -204,10 +205,10 @@ class PoolApi extends BaseApi<PoolEvents> {
const order = new POOL.Order();
order.setTraderKey(b64(traderKey));
order.setAmt(amount);
order.setAmt(amount.toString());
order.setRateFixed(rateFixed);
order.setMinUnitsMatch(minUnitsMatch);
order.setMaxBatchFeeRateSatPerKw(feeRateSatPerKw);
order.setMaxBatchFeeRateSatPerKw(feeRateSatPerKw.toString());
switch (type) {
case OrderType.Bid:
@ -324,36 +325,37 @@ class PoolApi extends BaseApi<PoolEvents> {
* Converts from sats per kilo-weight to sats per vByte
* @param satsPerVByte the number of sats per kilo-weight
*/
satsPerKWeightToVByte(satsPerKWeight: number) {
satsPerKWeightToVByte(satsPerKWeight: Big) {
// convert to kilo-vbyte
const satsPerKVByte = satsPerKWeight * 4;
const satsPerKVByte = satsPerKWeight.mul(4);
// convert to vbyte
return satsPerKVByte / 1000;
return satsPerKVByte.div(1000);
}
/**
* Calculates the per block fixed rate given an amount and premium
* @param amount the amount of the order
* @param premium the premium being paid
* @param duration the lease duration in blocks
*/
calcFixedRate(amount: number, premium: number, duration: number) {
const ratePct = (premium * 100) / amount;
calcFixedRate(amount: Big, premium: Big, duration: number) {
const ratePct = premium.mul(100).div(amount);
// rate = % / 100
// rate = rateFixed / totalParts
// rateFixed = rate * totalParts
const interestRate = ratePct / 100;
const rateFixedFloat = interestRate * FEE_RATE_TOTAL_PARTS;
const interestRate = ratePct.div(100);
const rateFixedFloat = interestRate.mul(FEE_RATE_TOTAL_PARTS);
// We then take this rate fixed, and divide it by the number of blocks
// as the user wants this rate to be the final lump sum they pay.
return Math.floor(rateFixedFloat / duration);
return +rateFixedFloat.div(duration).round(0, Big.roundDown);
}
/**
* Calculates the percentage interest rate for a given fixed rate
* @param fixedRate the per block fixed rate
*/
calcPctRate(fixedRate: number, duration: number) {
return (fixedRate * duration) / FEE_RATE_TOTAL_PARTS;
calcPctRate(fixedRate: Big, duration: Big) {
return +fixedRate.mul(duration).div(FEE_RATE_TOTAL_PARTS);
}
}

View file

@ -2,7 +2,6 @@ import React from 'react';
import { observer } from 'mobx-react-lite';
import { LeaseDuration } from 'types/state';
import styled from '@emotion/styled';
import Big from 'big.js';
import { usePrefixedTranslation } from 'hooks';
import { Unit, Units } from 'util/constants';
import { useStore } from 'store';
@ -110,7 +109,7 @@ const OrderFormSection: React.FC = () => {
label={l(`amountLabel${orderFormView.orderType}`)}
placeholder={l('amountPlaceholder')}
extra={Units[Unit.sats].suffix}
value={orderFormView.amount}
value={orderFormView.amount.toNumber()}
onChange={orderFormView.setAmount}
/>
</FormField>
@ -121,7 +120,7 @@ const OrderFormSection: React.FC = () => {
<FormInputNumber
label={l(`premiumLabel${orderFormView.orderType}`)}
placeholder={l('premiumPlaceholder')}
value={orderFormView.premium}
value={orderFormView.premium.toNumber()}
onChange={orderFormView.setPremium}
extra={
<>
@ -194,7 +193,7 @@ const OrderFormSection: React.FC = () => {
{orderFormView.quoteLoading ? (
<LoaderLines />
) : (
<UnitCmp sats={Big(orderFormView.executionFee)} />
<UnitCmp sats={orderFormView.executionFee} />
)}
</span>
</SummaryItem>
@ -207,7 +206,7 @@ const OrderFormSection: React.FC = () => {
{orderFormView.quoteLoading ? (
<LoaderLines />
) : (
<UnitCmp sats={Big(orderFormView.worstChainFee)} />
<UnitCmp sats={orderFormView.worstChainFee} />
)}
</span>
</SummaryItem>

View file

@ -35,7 +35,7 @@ const FundNewAccountForm: React.FC = () => {
label={l(`amountLabel`)}
placeholder={l('amountPlaceholder')}
extra={Units[Unit.sats].suffix}
value={fundNewAccountView.amount}
value={fundNewAccountView.amount.toNumber()}
onChange={fundNewAccountView.setAmount}
/>
</FormField>

View file

@ -61,7 +61,7 @@ const BatchStats: React.FC = () => {
<div>
<BatchCountdown
label={l('nextBatch')}
timestamp={batchesView.nextBatchTimestamp}
timestamp={batchesView.nextBatchTimestamp.toNumber()}
tip={l('nextBatchTip')}
/>
<Stat

View file

@ -68,7 +68,7 @@ const OrderRow: React.FC<{
<TableCell right>
<Unit sats={order.amount} suffix={false} />
</TableCell>
<TableCell className="text-center">{order.duration}</TableCell>
<TableCell className="text-center">{order.duration.toNumber()}</TableCell>
<TableCell right>{order.basisPoints}</TableCell>
<TableCell>
<OrderStatus status={order.stateLabel}>{order.stateWithCount}</OrderStatus>

View file

@ -48,7 +48,7 @@ export default class Batch {
prevBatchId = '';
clearingPriceRate = 0;
batchTxId = '';
batchTxFeeRateSatPerKw = 0;
batchTxFeeRateSatPerKw = Big(0);
matchedOrders: MatchedOrder[] = [];
// the provided lease duration to filter orders by
@ -101,21 +101,21 @@ export default class Batch {
/** the total amount of sats earned in this batch */
get earnedSats() {
const pctRate = this._store.api.pool.calcPctRate(
this.clearingPriceRate,
this.leaseDuration,
Big(this.clearingPriceRate),
Big(this.leaseDuration),
);
return this.volume.mul(pctRate);
}
/** the fee in sats/vbyte rounded to the nearest whole number */
get feeLabel() {
return `${Math.round(this.feeInVBytes)}`;
return this.feeInVBytes.round().toString();
}
/** a label containing the batch fee in both sats/kw and sats/vbyte */
get feeDescription() {
// round the fee to 2 decimal places
const fee = Math.round(this.feeInVBytes * 100) / 100;
const fee = this.feeInVBytes.mul(100).round().div(100);
return `${this.batchTxFeeRateSatPerKw} sats/kw - ${fee} sats/vbyte`;
}
@ -145,8 +145,8 @@ export default class Batch {
/** the batch clearing rate expressed as basis points */
get basisPoints() {
const pct = this._store.api.pool.calcPctRate(
this.clearingPriceRate,
this.leaseDuration,
Big(this.clearingPriceRate),
Big(this.leaseDuration),
);
// convert the percentage to basis points. round up to prevent 0 bps
// which is the case for the first batch on testnet which has a
@ -173,7 +173,7 @@ export default class Batch {
this.batchId = hex(llmBatch.batchId);
this.prevBatchId = hex(llmBatch.prevBatchId);
this.batchTxId = llmBatch.batchTxId;
this.batchTxFeeRateSatPerKw = llmBatch.batchTxFeeRateSatPerKw;
this.batchTxFeeRateSatPerKw = Big(llmBatch.batchTxFeeRateSatPerKw);
// loop over all markets to limit the orders of this batch to a specific lease duration
llmBatch.matchedMarketsMap.forEach(([duration, market]) => {
// ignore markets for other lease durations

View file

@ -15,8 +15,8 @@ export default class Lease {
premiumSat = Big(0);
executionFeeSat = Big(0);
chainFeeSat = Big(0);
clearingRatePrice = 0;
orderFixedRate = 0;
clearingRatePrice = Big(0);
orderFixedRate = Big(0);
orderNonce = '';
purchased = false;
channelRemoteNodeKey = '';
@ -45,8 +45,8 @@ export default class Lease {
this.premiumSat = Big(poolLease.premiumSat);
this.executionFeeSat = Big(poolLease.executionFeeSat);
this.chainFeeSat = Big(poolLease.chainFeeSat);
this.clearingRatePrice = poolLease.clearingRatePrice;
this.orderFixedRate = poolLease.orderFixedRate;
this.clearingRatePrice = Big(poolLease.clearingRatePrice);
this.orderFixedRate = Big(poolLease.orderFixedRate);
this.orderNonce = hex(poolLease.orderNonce);
this.purchased = poolLease.purchased;
this.channelRemoteNodeKey = hex(poolLease.channelRemoteNodeKey);

View file

@ -27,17 +27,17 @@ export default class Order {
traderKey = '';
amount = Big(0);
state = 0;
rateFixed = 0;
maxBatchFeeRateSatPerKw = 0;
rateFixed = Big(0);
maxBatchFeeRateSatPerKw = Big(0);
units = 0;
unitsUnfulfilled = 0;
reserved = Big(0);
creationTimestamp = 0;
creationTimestamp = Big(0);
minNodeTier?: Tier = 0;
// custom app values
type: OrderType = OrderType.Bid;
// for bids, this is the minimum. for asks this is the maximum
duration = 0;
duration = Big(0);
constructor(store: Store) {
makeAutoObservable(this, {}, { deep: false, autoBind: true });
@ -102,7 +102,7 @@ export default class Order {
/** The date this swap was created as a JS Date object */
get createdOn() {
return new Date(this.creationTimestamp / 1000 / 1000);
return new Date(this.creationTimestamp.div(1000).div(1000).toNumber());
}
/** The date this swap was created as formatted string */
@ -124,15 +124,15 @@ export default class Order {
this.traderKey = hex(poolOrder.traderKey);
this.amount = Big(poolOrder.amt);
this.state = poolOrder.state;
this.rateFixed = poolOrder.rateFixed;
this.maxBatchFeeRateSatPerKw = poolOrder.maxBatchFeeRateSatPerKw;
this.rateFixed = Big(poolOrder.rateFixed);
this.maxBatchFeeRateSatPerKw = Big(poolOrder.maxBatchFeeRateSatPerKw);
this.units = poolOrder.units;
this.unitsUnfulfilled = poolOrder.unitsUnfulfilled;
this.reserved = Big(poolOrder.reservedValueSat);
this.creationTimestamp = poolOrder.creationTimestampNs;
this.creationTimestamp = Big(poolOrder.creationTimestampNs);
this.type = type;
this.duration = duration;
this.duration = Big(duration);
this.minNodeTier = minNodeTier;
}
@ -149,16 +149,16 @@ export default class Order {
case 'type':
return a.type.toLowerCase() > b.type.toLowerCase() ? 1 : -1;
case 'amount':
return +a.amount.sub(b.amount);
return a.amount.sub(b.amount).toNumber();
case 'rateFixed':
return a.rateFixed - b.rateFixed;
return a.rateFixed.sub(b.rateFixed).toNumber();
case 'duration':
return a.duration - b.duration;
return a.duration.sub(b.duration).toNumber();
case 'stateLabel':
return a.stateLabel.toLowerCase() > b.stateLabel.toLowerCase() ? 1 : -1;
case 'creationTimestamp':
default:
return a.creationTimestamp - b.creationTimestamp;
return a.creationTimestamp.sub(b.creationTimestamp).toNumber();
}
}
}

View file

@ -12,8 +12,8 @@ export default class Swap {
id = '';
type = 0;
amount = Big(0);
initiationTime = 0;
lastUpdateTime = 0;
initiationTime = Big(0);
lastUpdateTime = Big(0);
state = 0;
failureReason = 0;
@ -107,7 +107,7 @@ export default class Swap {
/** The date this swap was created as a JS Date object */
get createdOn() {
return new Date(this.initiationTime / 1000 / 1000);
return new Date(this.initiationTime.div(1000).div(1000).toNumber());
}
/** The date this swap was created as formatted string */
@ -117,7 +117,7 @@ export default class Swap {
/** The date this swap was last updated as a JS Date object */
get updatedOn() {
return new Date(this.lastUpdateTime / 1000 / 1000);
return new Date(this.lastUpdateTime.div(1000).div(1000).toNumber());
}
/** The date this swap was last updated as formatted string */
@ -133,8 +133,8 @@ export default class Swap {
this.id = loopSwap.id;
this.type = loopSwap.type;
this.amount = Big(loopSwap.amt);
this.initiationTime = loopSwap.initiationTime;
this.lastUpdateTime = loopSwap.lastUpdateTime;
this.initiationTime = Big(loopSwap.initiationTime);
this.lastUpdateTime = Big(loopSwap.lastUpdateTime);
this.state = loopSwap.state;
this.failureReason = loopSwap.failureReason;
}
@ -154,12 +154,12 @@ export default class Swap {
case 'typeName':
return a.typeName.toLowerCase() > b.typeName.toLowerCase() ? 1 : -1;
case 'amount':
return +a.amount.sub(b.amount);
return a.amount.sub(b.amount).toNumber();
case 'initiationTime':
return a.initiationTime - b.initiationTime;
return a.initiationTime.sub(b.initiationTime).toNumber();
case 'lastUpdateTime':
default:
return a.lastUpdateTime - b.lastUpdateTime;
return a.lastUpdateTime.sub(b.lastUpdateTime).toNumber();
}
}

View file

@ -8,6 +8,7 @@ import {
values,
} from 'mobx';
import { AccountState } from 'types/generated/trader_pb';
import Big from 'big.js';
import copyToClipboard from 'copy-to-clipboard';
import debounce from 'lodash/debounce';
import { hex } from 'util/strings';
@ -86,7 +87,7 @@ export default class AccountStore {
* @param amount the amount (sats) to fund the account with
* @param expiryBlocks the number of blocks from now to expire the account
*/
async createAccount(amount: number, expiryBlocks: number, confTarget?: number) {
async createAccount(amount: Big, expiryBlocks: number, confTarget?: number) {
this._store.log.info(`creating new account with ${amount}sats`);
try {
const acct = await this._store.api.pool.initAccount(
@ -142,7 +143,7 @@ export default class AccountStore {
const res = await this._store.api.pool.renewAccount(
acct.traderKey,
expiryBlocks,
feeRate,
Big(feeRate),
);
runInAction(() => {
// the account should always be defined but if not, fetch all accounts as a fallback
@ -214,7 +215,11 @@ export default class AccountStore {
const acct = this.activeAccount;
this._store.log.info(`depositing ${amount}sats into account ${acct.traderKey}`);
const res = await this._store.api.pool.deposit(acct.traderKey, amount, feeRate);
const res = await this._store.api.pool.deposit(
acct.traderKey,
Big(amount),
feeRate,
);
runInAction(() => {
// the account should always be defined but if not, fetch all accounts as a fallback
if (res.account) {
@ -238,7 +243,11 @@ export default class AccountStore {
const acct = this.activeAccount;
this._store.log.info(`withdrawing ${amount}sats into account ${acct.traderKey}`);
const res = await this._store.api.pool.withdraw(acct.traderKey, amount, feeRate);
const res = await this._store.api.pool.withdraw(
acct.traderKey,
Big(amount),
feeRate,
);
runInAction(() => {
if (res.account) {
acct.update(res.account);

View file

@ -9,6 +9,7 @@ import {
} from 'mobx';
import { NodeTier } from 'types/generated/auctioneerrpc/auctioneer_pb';
import { LeaseDuration } from 'types/state';
import Big from 'big.js';
import { IS_DEV, IS_TEST } from 'config';
import debounce from 'lodash/debounce';
import { hex } from 'util/strings';
@ -35,7 +36,7 @@ export default class BatchStore {
markets: ObservableMap<LeaseDuration, Market> = observable.map();
/** the timestamp of the next batch in seconds */
nextBatchTimestamp = 0;
nextBatchTimestamp = Big(0);
/** the fee rate (sats/vbyte) estimated by the auctioneer to use for the next batch */
nextFeeRate = 0;
@ -166,12 +167,12 @@ export default class BatchStore {
try {
const res = await this._store.api.pool.nextBatchInfo();
runInAction(() => {
this.setNextBatchTimestamp(res.clearTimestamp);
this.setNextBatchTimestamp(Big(res.clearTimestamp));
this._store.log.info(
'updated batchStore.nextBatchTimestamp',
this.nextBatchTimestamp,
);
this.setNextFeeRate(res.feeRateSatPerKw);
this.setNextFeeRate(Big(res.feeRateSatPerKw));
this._store.log.info('updated batchStore.nextFeeRate', this.nextFeeRate);
});
} catch (error) {
@ -254,15 +255,15 @@ export default class BatchStore {
* batched to be processed
* @param timestamp the next batch timestamp in seconds since epoch
*/
setNextBatchTimestamp(timestamp: number) {
setNextBatchTimestamp(timestamp: Big) {
// if the value is the same, then just return immediately
if (this.nextBatchTimestamp === timestamp) return;
if (this.nextBatchTimestamp.eq(timestamp)) return;
this.nextBatchTimestamp = timestamp;
if (this._nextBatchTimer) clearTimeout(this._nextBatchTimer);
// calc the number of ms between now and the next batch timestamp
let ms = timestamp * 1000 - Date.now();
let ms = timestamp.mul(1000).sub(Date.now()).toNumber();
// if the timestamp is somehow in the past, use 10 mins as a default
if (ms < 0) ms = 10 * 60 * 1000;
this._nextBatchTimer = setTimeout(this.fetchLatestBatch, ms + 3000);
@ -271,9 +272,9 @@ export default class BatchStore {
/**
* sets the nextFeeRate by converting the provided sats/kw to sats/vbyte
*/
setNextFeeRate(satsPerKWeight: number) {
setNextFeeRate(satsPerKWeight: Big) {
const satsPerVbyte = this._store.api.pool.satsPerKWeightToVByte(satsPerKWeight);
this.nextFeeRate = Math.ceil(satsPerVbyte);
this.nextFeeRate = satsPerVbyte.round(0, Big.roundUp).toNumber();
}
startPolling() {

View file

@ -240,7 +240,7 @@ export default class ChannelStore {
const localPubkey = this._store.nodeStore.pubkey;
const policy = node1Pub === localPubkey ? node2Policy : node1Policy;
if (policy) {
acc[channelId] = policy.feeRateMilliMsat;
acc[channelId] = +Big(policy.feeRateMilliMsat);
}
return acc;
}, data);

View file

@ -174,7 +174,7 @@ export default class OrderStore {
* @param maxBatchFeeRate the maximum batch fee rate to allowed as sats per vByte
*/
async quoteOrder(
amount: number,
amount: Big,
rateFixed: number,
duration: number,
minUnitsMatch: number,
@ -202,9 +202,9 @@ export default class OrderStore {
return {
ratePerBlock: rateFixed,
ratePercent: 0,
totalExecutionFeeSat: 0,
totalPremiumSat: 0,
worstCaseChainFeeSat: 0,
totalExecutionFeeSat: '0',
totalPremiumSat: '0',
worstCaseChainFeeSat: '0',
};
}
}
@ -221,7 +221,7 @@ export default class OrderStore {
*/
async submitOrder(
type: OrderType,
amount: number,
amount: Big,
rateFixed: number,
duration: number,
minUnitsMatch: number,

View file

@ -1,6 +1,7 @@
import { makeAutoObservable, observable, toJS } from 'mobx';
import { SwapState } from 'types/generated/loop_pb';
import { Alert } from 'types/state';
import Big from 'big.js';
import { AuthenticationError } from 'util/errors';
import { prefixTranslation } from 'util/translate';
import { Store } from 'store';
@ -140,7 +141,7 @@ export default class AppView {
// set the timestamp far in the future so it doesn't automatically disappear
// from the Processing Loops list after 5 mins
const tomorrow = Date.now() + 24 * 60 * 60 * 1000;
this._store.swapStore.sortedSwaps[0].lastUpdateTime = tomorrow * 1000 * 1000;
this._store.swapStore.sortedSwaps[0].lastUpdateTime = Big(tomorrow * 1000 * 1000);
} else if (step === 22 /* swap-progress */) {
// #22 is the swap-progress step
// force the swap to be 100% complete

View file

@ -489,11 +489,10 @@ class BuildSwapView {
const deadline =
this._store.nodeStore.network === 'regtest' ? 0 : Date.now() + thirtyMins;
// convert the selected channel ids to numbers
const chanIds = this.selectedChanIds.map(v => parseInt(v));
res = await this._store.api.loop.loopOut(
amount,
quote,
chanIds,
this.selectedChanIds,
deadline,
this.confTarget,
this.loopOutAddress,

View file

@ -1,4 +1,5 @@
import { makeAutoObservable } from 'mobx';
import Big from 'big.js';
import { ellipseInside } from 'util/strings';
import { Store } from 'store';

View file

@ -1,4 +1,5 @@
import { makeAutoObservable } from 'mobx';
import Big from 'big.js';
import { prefixTranslation } from 'util/translate';
import { Store } from 'store';

View file

@ -13,11 +13,11 @@ export default class FundNewAccountView {
private _store: Store;
// editable form fields
amount = 0;
amount = Big(0);
confTarget = DEFAULT_CONF_TARGET;
expireBlocks = DEFAULT_EXPIRE_BLOCKS;
// response from quote
minerFee = 0;
minerFee = Big(0);
constructor(store: Store) {
makeAutoObservable(this, {}, { deep: false, autoBind: true });
@ -49,9 +49,9 @@ export default class FundNewAccountView {
/** the error message if the amount is invalid */
get amountError() {
if (!this.amount) return '';
if (this.amount.eq(0)) return '';
const accountMinimum = 100000;
if (this.amount < accountMinimum) {
if (this.amount.lt(accountMinimum)) {
return l('amountTooLow', { accountMinimum });
}
if (this.walletBalance.lt(this.amount)) {
@ -93,7 +93,7 @@ export default class FundNewAccountView {
//
setAmount(amount: number) {
this.amount = amount;
this.amount = Big(amount);
}
setConfTarget(confTarget: number) {
@ -110,7 +110,7 @@ export default class FundNewAccountView {
/** shows the summary view */
cancel() {
this.amount = 0;
this.amount = Big(0);
this.confTarget = DEFAULT_CONF_TARGET;
this.expireBlocks = DEFAULT_EXPIRE_BLOCKS;
this._store.accountSectionView.showSummary();
@ -126,7 +126,7 @@ export default class FundNewAccountView {
);
runInAction(() => {
this.minerFee = minerFeeTotal;
this.minerFee = Big(minerFeeTotal);
});
this._store.accountSectionView.showFundNewConfirm();

View file

@ -1,5 +1,6 @@
import { makeAutoObservable } from 'mobx';
import { SortParams } from 'types/state';
import Big from 'big.js';
import { annualPercentRate, toPercent } from 'util/bigmath';
import { BLOCKS_PER_DAY } from 'util/constants';
import { formatSats } from 'util/formatters';
@ -40,7 +41,7 @@ export default class LeaseView {
get apr() {
const { channelAmtSat, premiumSat, channelDurationBlocks } = this.lease;
const termInDays = channelDurationBlocks / BLOCKS_PER_DAY;
return annualPercentRate(+channelAmtSat, +premiumSat, termInDays);
return annualPercentRate(channelAmtSat, premiumSat, termInDays);
}
/** the annual percentage rate of this lease as a percentage */

View file

@ -4,6 +4,7 @@ import {
NodeTier,
} from 'types/generated/auctioneerrpc/auctioneer_pb';
import { LeaseDuration } from 'types/state';
import Big from 'big.js';
import debounce from 'lodash/debounce';
import { annualPercentRate, toBasisPoints, toPercent } from 'util/bigmath';
import { BLOCKS_PER_DAY } from 'util/constants';
@ -22,8 +23,8 @@ export default class OrderFormView {
/** the currently selected type of the order */
orderType: OrderType = OrderType.Bid;
amount = 0;
premium = 0;
amount = Big(0);
premium = Big(0);
duration = 0;
minChanSize = DEFAULT_MIN_CHAN_SIZE;
maxBatchFeeRate = DEFAULT_MAX_BATCH_FEE;
@ -33,8 +34,8 @@ export default class OrderFormView {
addlOptionsVisible = false;
/** quoted fees */
executionFee = 0;
worstChainFee = 0;
executionFee = Big(0);
worstChainFee = Big(0);
quoteLoading = false;
constructor(store: Store) {
@ -52,8 +53,8 @@ export default class OrderFormView {
/** the error message if the amount is invalid */
get amountError() {
if (!this.amount) return '';
if (this.amount % ONE_UNIT !== 0) {
if (this.amount.eq(0)) return '';
if (!this.amount.mod(ONE_UNIT).eq(0)) {
return l('errorMultiple');
}
return '';
@ -61,7 +62,7 @@ export default class OrderFormView {
/** the error message if the premium is invalid */
get premiumError() {
if (!this.premium || !this.amount) return '';
if (this.premium.eq(0) || this.amount.eq(0)) return '';
if (this.perBlockFixedRate < 1) {
return l('premiumLowError');
}
@ -74,7 +75,7 @@ export default class OrderFormView {
if (this.minChanSize % ONE_UNIT !== 0) {
return l('errorMultiple');
}
if (this.amount && this.minChanSize > this.amount) {
if (!this.amount.eq(0) && this.amount.lt(this.minChanSize)) {
return l('errorLiquidity');
}
return '';
@ -145,7 +146,7 @@ export default class OrderFormView {
/** the per block fixed rate */
get perBlockFixedRate() {
if ([this.amount, this.premium].includes(0)) return 0;
if (this.amount.eq(0) || this.premium.eq(0)) return 0;
return this._store.api.pool.calcFixedRate(
this.amount,
@ -156,13 +157,13 @@ export default class OrderFormView {
/** the premium interest of the amount in basis points */
get interestBps() {
if ([this.amount, this.premium].includes(0)) return 0;
return toBasisPoints(this.premium / this.amount);
if (this.amount.eq(0) || this.premium.eq(0)) return 0;
return toBasisPoints(this.premium.div(this.amount).toNumber());
}
/** the APR given the amount and premium */
get apr() {
if ([this.amount, this.premium].includes(0)) return 0;
if (this.amount.eq(0) || this.premium.eq(0)) return 0;
const termInDays = this.derivedDuration / BLOCKS_PER_DAY;
const apr = annualPercentRate(this.amount, this.premium, termInDays);
return toPercent(apr);
@ -177,7 +178,9 @@ export default class OrderFormView {
/** determines if the current values are all valid */
get isValid() {
return (
![this.amount, this.premium, this.minChanSize, this.maxBatchFeeRate].includes(0) &&
!this.amount.eq(0) &&
!this.premium.eq(0) &&
![this.minChanSize, this.maxBatchFeeRate].includes(0) &&
!this.amountError &&
!this.minChanSizeError &&
!this.feeRateError
@ -189,12 +192,12 @@ export default class OrderFormView {
}
setAmount(amount: number) {
this.amount = amount;
this.amount = Big(amount);
this.fetchQuote();
}
setPremium(premium: number) {
this.premium = premium;
this.premium = Big(premium);
this.fetchQuote();
}
@ -219,18 +222,18 @@ export default class OrderFormView {
setSuggestedPremium() {
try {
if (!this.amount) throw new Error('Must specify amount first');
if (this.amount.eq(0)) throw new Error('Must specify amount first');
const prevBatch = this._store.batchStore.sortedBatches[0];
if (!prevBatch) throw new Error('Previous batch not found');
const prevFixedRate = prevBatch.clearingPriceRate;
// get the percentage rate of the previous batch and apply to the current amount
const prevPctRate = this._store.api.pool.calcPctRate(
prevFixedRate,
this.derivedDuration,
Big(prevFixedRate),
Big(this.derivedDuration),
);
const suggested = this.amount * prevPctRate;
const suggested = this.amount.mul(prevPctRate);
// round to the nearest 10 to offset lose of precision in calculating percentages
this.premium = Math.round(suggested / 10) * 10;
this.premium = suggested.div(10).round().mul(10);
this.fetchQuote();
} catch (error) {
this._store.appView.handleError(error, 'Unable to suggest premium');
@ -243,7 +246,7 @@ export default class OrderFormView {
/** requests a quote for an order to obtain accurate fees */
async quoteOrder() {
const minUnitsMatch = Math.floor(this.minChanSize / ONE_UNIT);
const minUnitsMatch = +Big(this.minChanSize).div(ONE_UNIT).round(0, Big.roundDown);
const satsPerKWeight = this._store.api.pool.satsPerVByteToKWeight(
this.maxBatchFeeRate,
);
@ -260,8 +263,8 @@ export default class OrderFormView {
);
runInAction(() => {
this.executionFee = totalExecutionFeeSat;
this.worstChainFee = worstCaseChainFeeSat;
this.executionFee = Big(totalExecutionFeeSat);
this.worstChainFee = Big(worstCaseChainFeeSat);
this.quoteLoading = false;
});
}
@ -276,8 +279,8 @@ export default class OrderFormView {
fetchQuote() {
if (!this.isValid) {
runInAction(() => {
this.executionFee = 0;
this.worstChainFee = 0;
this.executionFee = Big(0);
this.worstChainFee = Big(0);
this.quoteLoading = false;
});
return;
@ -303,11 +306,11 @@ export default class OrderFormView {
);
runInAction(() => {
if (nonce) {
this.amount = 0;
this.premium = 0;
this.amount = Big(0);
this.premium = Big(0);
this.duration = 0;
this.executionFee = 0;
this.worstChainFee = 0;
this.executionFee = Big(0);
this.worstChainFee = Big(0);
// persist the additional options so they can be used for future orders
this._store.settingsStore.setOrderSettings(
this.minChanSize,

View file

@ -1,4 +1,5 @@
import { makeAutoObservable } from 'mobx';
import Big from 'big.js';
import { Store } from 'store';
// default expiration to ~90 days

View file

@ -4,8 +4,8 @@
import * as jspb from "google-protobuf";
export class ReserveAccountRequest extends jspb.Message {
getAccountValue(): number;
setAccountValue(value: number): void;
getAccountValue(): string;
setAccountValue(value: string): void;
getAccountExpiry(): number;
setAccountExpiry(value: number): void;
@ -27,7 +27,7 @@ export class ReserveAccountRequest extends jspb.Message {
export namespace ReserveAccountRequest {
export type AsObject = {
accountValue: number,
accountValue: string,
accountExpiry: number,
traderKey: Uint8Array | string,
}
@ -72,8 +72,8 @@ export class ServerInitAccountRequest extends jspb.Message {
getAccountScript_asB64(): string;
setAccountScript(value: Uint8Array | string): void;
getAccountValue(): number;
setAccountValue(value: number): void;
getAccountValue(): string;
setAccountValue(value: string): void;
getAccountExpiry(): number;
setAccountExpiry(value: number): void;
@ -100,7 +100,7 @@ export namespace ServerInitAccountRequest {
export type AsObject = {
accountPoint?: OutPoint.AsObject,
accountScript: Uint8Array | string,
accountValue: number,
accountValue: string,
accountExpiry: number,
traderKey: Uint8Array | string,
userAgent: string,
@ -711,11 +711,11 @@ export class OrderMatchPrepare extends jspb.Message {
getBatchTransaction_asB64(): string;
setBatchTransaction(value: Uint8Array | string): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
getFeeRebateSat(): number;
setFeeRebateSat(value: number): void;
getFeeRebateSat(): string;
setFeeRebateSat(value: string): void;
getBatchId(): Uint8Array | string;
getBatchId_asU8(): Uint8Array;
@ -744,8 +744,8 @@ export namespace OrderMatchPrepare {
chargedAccountsList: Array<AccountDiff.AsObject>,
executionFee?: ExecutionFee.AsObject,
batchTransaction: Uint8Array | string,
feeRateSatPerKw: number,
feeRebateSat: number,
feeRateSatPerKw: string,
feeRebateSat: string,
batchId: Uint8Array | string,
batchVersion: number,
matchedMarketsMap: Array<[number, MatchedMarket.AsObject]>,
@ -852,8 +852,8 @@ export namespace SubscribeError {
}
export class AuctionAccount extends jspb.Message {
getValue(): number;
setValue(value: number): void;
getValue(): string;
setValue(value: string): void;
getExpiry(): number;
setExpiry(value: number): void;
@ -901,7 +901,7 @@ export class AuctionAccount extends jspb.Message {
export namespace AuctionAccount {
export type AsObject = {
value: number,
value: string,
expiry: number,
traderKey: Uint8Array | string,
auctioneerKey: Uint8Array | string,
@ -994,8 +994,8 @@ export namespace MatchedBid {
}
export class AccountDiff extends jspb.Message {
getEndingBalance(): number;
setEndingBalance(value: number): void;
getEndingBalance(): string;
setEndingBalance(value: string): void;
getEndingState(): AccountDiff.AccountStateMap[keyof AccountDiff.AccountStateMap];
setEndingState(value: AccountDiff.AccountStateMap[keyof AccountDiff.AccountStateMap]): void;
@ -1020,7 +1020,7 @@ export class AccountDiff extends jspb.Message {
export namespace AccountDiff {
export type AsObject = {
endingBalance: number,
endingBalance: string,
endingState: AccountDiff.AccountStateMap[keyof AccountDiff.AccountStateMap],
outpointIndex: number,
traderKey: Uint8Array | string,
@ -1045,11 +1045,11 @@ export class ServerOrder extends jspb.Message {
getRateFixed(): number;
setRateFixed(value: number): void;
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getMinChanAmt(): number;
setMinChanAmt(value: number): void;
getMinChanAmt(): string;
setMinChanAmt(value: string): void;
getOrderNonce(): Uint8Array | string;
getOrderNonce_asU8(): Uint8Array;
@ -1079,8 +1079,8 @@ export class ServerOrder extends jspb.Message {
getChanType(): number;
setChanType(value: number): void;
getMaxBatchFeeRateSatPerKw(): number;
setMaxBatchFeeRateSatPerKw(value: number): void;
getMaxBatchFeeRateSatPerKw(): string;
setMaxBatchFeeRateSatPerKw(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ServerOrder.AsObject;
@ -1096,15 +1096,15 @@ export namespace ServerOrder {
export type AsObject = {
traderKey: Uint8Array | string,
rateFixed: number,
amt: number,
minChanAmt: number,
amt: string,
minChanAmt: string,
orderNonce: Uint8Array | string,
orderSig: Uint8Array | string,
multiSigKey: Uint8Array | string,
nodePub: Uint8Array | string,
nodeAddrList: Array<NodeAddress.AsObject>,
chanType: number,
maxBatchFeeRateSatPerKw: number,
maxBatchFeeRateSatPerKw: string,
}
}
@ -1123,8 +1123,8 @@ export class ServerBid extends jspb.Message {
getMinNodeTier(): NodeTierMap[keyof NodeTierMap];
setMinNodeTier(value: NodeTierMap[keyof NodeTierMap]): void;
getSelfChanBalance(): number;
setSelfChanBalance(value: number): void;
getSelfChanBalance(): string;
setSelfChanBalance(value: string): void;
getIsSidecarChannel(): boolean;
setIsSidecarChannel(value: boolean): void;
@ -1145,7 +1145,7 @@ export namespace ServerBid {
leaseDurationBlocks: number,
version: number,
minNodeTier: NodeTierMap[keyof NodeTierMap],
selfChanBalance: number,
selfChanBalance: string,
isSidecarChannel: boolean,
}
}
@ -1267,8 +1267,8 @@ export namespace ServerInput {
}
export class ServerOutput extends jspb.Message {
getValue(): number;
setValue(value: number): void;
getValue(): string;
setValue(value: string): void;
getScript(): Uint8Array | string;
getScript_asU8(): Uint8Array;
@ -1287,7 +1287,7 @@ export class ServerOutput extends jspb.Message {
export namespace ServerOutput {
export type AsObject = {
value: number,
value: string,
script: Uint8Array | string,
}
}
@ -1332,8 +1332,8 @@ export namespace ServerModifyAccountRequest {
}
export class NewAccountParameters extends jspb.Message {
getValue(): number;
setValue(value: number): void;
getValue(): string;
setValue(value: string): void;
getExpiry(): number;
setExpiry(value: number): void;
@ -1350,7 +1350,7 @@ export namespace ServerModifyAccountRequest {
export namespace NewAccountParameters {
export type AsObject = {
value: number,
value: string,
expiry: number,
}
}
@ -1441,8 +1441,8 @@ export namespace TermsRequest {
}
export class TermsResponse extends jspb.Message {
getMaxAccountValue(): number;
setMaxAccountValue(value: number): void;
getMaxAccountValue(): string;
setMaxAccountValue(value: string): void;
getMaxOrderDurationBlocks(): number;
setMaxOrderDurationBlocks(value: number): void;
@ -1457,11 +1457,11 @@ export class TermsResponse extends jspb.Message {
getNextBatchConfTarget(): number;
setNextBatchConfTarget(value: number): void;
getNextBatchFeeRateSatPerKw(): number;
setNextBatchFeeRateSatPerKw(value: number): void;
getNextBatchFeeRateSatPerKw(): string;
setNextBatchFeeRateSatPerKw(value: string): void;
getNextBatchClearTimestamp(): number;
setNextBatchClearTimestamp(value: number): void;
getNextBatchClearTimestamp(): string;
setNextBatchClearTimestamp(value: string): void;
getLeaseDurationBucketsMap(): jspb.Map<number, DurationBucketStateMap[keyof DurationBucketStateMap]>;
clearLeaseDurationBucketsMap(): void;
@ -1477,13 +1477,13 @@ export class TermsResponse extends jspb.Message {
export namespace TermsResponse {
export type AsObject = {
maxAccountValue: number,
maxAccountValue: string,
maxOrderDurationBlocks: number,
executionFee?: ExecutionFee.AsObject,
leaseDurationsMap: Array<[number, boolean]>,
nextBatchConfTarget: number,
nextBatchFeeRateSatPerKw: number,
nextBatchClearTimestamp: number,
nextBatchFeeRateSatPerKw: string,
nextBatchClearTimestamp: string,
leaseDurationBucketsMap: Array<[number, DurationBucketStateMap[keyof DurationBucketStateMap]]>,
}
}
@ -1547,11 +1547,11 @@ export class RelevantBatch extends jspb.Message {
getTransaction_asB64(): string;
setTransaction(value: Uint8Array | string): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
getCreationTimestampNs(): number;
setCreationTimestampNs(value: number): void;
getCreationTimestampNs(): string;
setCreationTimestampNs(value: string): void;
getMatchedMarketsMap(): jspb.Map<number, MatchedMarket>;
clearMatchedMarketsMap(): void;
@ -1574,18 +1574,18 @@ export namespace RelevantBatch {
clearingPriceRate: number,
executionFee?: ExecutionFee.AsObject,
transaction: Uint8Array | string,
feeRateSatPerKw: number,
creationTimestampNs: number,
feeRateSatPerKw: string,
creationTimestampNs: string,
matchedMarketsMap: Array<[number, MatchedMarket.AsObject]>,
}
}
export class ExecutionFee extends jspb.Message {
getBaseFee(): number;
setBaseFee(value: number): void;
getBaseFee(): string;
setBaseFee(value: string): void;
getFeeRate(): number;
setFeeRate(value: number): void;
getFeeRate(): string;
setFeeRate(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ExecutionFee.AsObject;
@ -1599,8 +1599,8 @@ export class ExecutionFee extends jspb.Message {
export namespace ExecutionFee {
export type AsObject = {
baseFee: number,
feeRate: number,
baseFee: string,
feeRate: string,
}
}
@ -1732,8 +1732,8 @@ export class MatchedOrderSnapshot extends jspb.Message {
getMatchingRate(): number;
setMatchingRate(value: number): void;
getTotalSatsCleared(): number;
setTotalSatsCleared(value: number): void;
getTotalSatsCleared(): string;
setTotalSatsCleared(value: string): void;
getUnitsMatched(): number;
setUnitsMatched(value: number): void;
@ -1753,7 +1753,7 @@ export namespace MatchedOrderSnapshot {
ask?: AskSnapshot.AsObject,
bid?: BidSnapshot.AsObject,
matchingRate: number,
totalSatsCleared: number,
totalSatsCleared: string,
unitsMatched: number,
}
}
@ -1836,11 +1836,11 @@ export class BatchSnapshotResponse extends jspb.Message {
getBatchTx_asB64(): string;
setBatchTx(value: Uint8Array | string): void;
getBatchTxFeeRateSatPerKw(): number;
setBatchTxFeeRateSatPerKw(value: number): void;
getBatchTxFeeRateSatPerKw(): string;
setBatchTxFeeRateSatPerKw(value: string): void;
getCreationTimestampNs(): number;
setCreationTimestampNs(value: number): void;
getCreationTimestampNs(): string;
setCreationTimestampNs(value: string): void;
getMatchedMarketsMap(): jspb.Map<number, MatchedMarketSnapshot>;
clearMatchedMarketsMap(): void;
@ -1863,8 +1863,8 @@ export namespace BatchSnapshotResponse {
matchedOrdersList: Array<MatchedOrderSnapshot.AsObject>,
batchTxId: string,
batchTx: Uint8Array | string,
batchTxFeeRateSatPerKw: number,
creationTimestampNs: number,
batchTxFeeRateSatPerKw: string,
creationTimestampNs: string,
matchedMarketsMap: Array<[number, MatchedMarketSnapshot.AsObject]>,
}
}

View file

@ -135,7 +135,7 @@ proto.poolrpc.ReserveAccountRequest.prototype.toObject = function(opt_includeIns
*/
proto.poolrpc.ReserveAccountRequest.toObject = function(includeInstance, msg) {
var f, obj = {
accountValue: jspb.Message.getFieldWithDefault(msg, 1, 0),
accountValue: jspb.Message.getFieldWithDefault(msg, 1, "0"),
accountExpiry: jspb.Message.getFieldWithDefault(msg, 2, 0),
traderKey: msg.getTraderKey_asB64()
};
@ -175,7 +175,7 @@ proto.poolrpc.ReserveAccountRequest.deserializeBinaryFromReader = function(msg,
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setAccountValue(value);
break;
case 2:
@ -216,8 +216,8 @@ proto.poolrpc.ReserveAccountRequest.prototype.serializeBinary = function() {
proto.poolrpc.ReserveAccountRequest.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getAccountValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -241,16 +241,16 @@ proto.poolrpc.ReserveAccountRequest.serializeBinaryToWriter = function(message,
/**
* optional uint64 account_value = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.ReserveAccountRequest.prototype.getAccountValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ReserveAccountRequest.prototype.setAccountValue = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -574,7 +574,7 @@ proto.poolrpc.ServerInitAccountRequest.toObject = function(includeInstance, msg)
var f, obj = {
accountPoint: (f = msg.getAccountPoint()) && proto.poolrpc.OutPoint.toObject(includeInstance, f),
accountScript: msg.getAccountScript_asB64(),
accountValue: jspb.Message.getFieldWithDefault(msg, 3, 0),
accountValue: jspb.Message.getFieldWithDefault(msg, 3, "0"),
accountExpiry: jspb.Message.getFieldWithDefault(msg, 4, 0),
traderKey: msg.getTraderKey_asB64(),
userAgent: jspb.Message.getFieldWithDefault(msg, 6, "")
@ -624,7 +624,7 @@ proto.poolrpc.ServerInitAccountRequest.deserializeBinaryFromReader = function(ms
msg.setAccountScript(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setAccountValue(value);
break;
case 4:
@ -684,8 +684,8 @@ proto.poolrpc.ServerInitAccountRequest.serializeBinaryToWriter = function(messag
);
}
f = message.getAccountValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
3,
f
);
@ -785,16 +785,16 @@ proto.poolrpc.ServerInitAccountRequest.prototype.setAccountScript = function(val
/**
* optional uint64 account_value = 3;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerInitAccountRequest.prototype.getAccountValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerInitAccountRequest.prototype.setAccountValue = function(value) {
jspb.Message.setProto3IntField(this, 3, value);
jspb.Message.setProto3StringIntField(this, 3, value);
};
@ -5025,8 +5025,8 @@ proto.poolrpc.OrderMatchPrepare.toObject = function(includeInstance, msg) {
proto.poolrpc.AccountDiff.toObject, includeInstance),
executionFee: (f = msg.getExecutionFee()) && proto.poolrpc.ExecutionFee.toObject(includeInstance, f),
batchTransaction: msg.getBatchTransaction_asB64(),
feeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 6, 0),
feeRebateSat: jspb.Message.getFieldWithDefault(msg, 7, 0),
feeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 6, "0"),
feeRebateSat: jspb.Message.getFieldWithDefault(msg, 7, "0"),
batchId: msg.getBatchId_asB64(),
batchVersion: jspb.Message.getFieldWithDefault(msg, 9, 0),
matchedMarketsMap: (f = msg.getMatchedMarketsMap()) ? f.toObject(includeInstance, proto.poolrpc.MatchedMarket.toObject) : []
@ -5091,11 +5091,11 @@ proto.poolrpc.OrderMatchPrepare.deserializeBinaryFromReader = function(msg, read
msg.setBatchTransaction(value);
break;
case 6:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setFeeRateSatPerKw(value);
break;
case 7:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setFeeRebateSat(value);
break;
case 8:
@ -5176,15 +5176,15 @@ proto.poolrpc.OrderMatchPrepare.serializeBinaryToWriter = function(message, writ
);
}
f = message.getFeeRateSatPerKw();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
6,
f
);
}
f = message.getFeeRebateSat();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
7,
f
);
@ -5345,31 +5345,31 @@ proto.poolrpc.OrderMatchPrepare.prototype.setBatchTransaction = function(value)
/**
* optional uint64 fee_rate_sat_per_kw = 6;
* @return {number}
* @return {string}
*/
proto.poolrpc.OrderMatchPrepare.prototype.getFeeRateSatPerKw = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.OrderMatchPrepare.prototype.setFeeRateSatPerKw = function(value) {
jspb.Message.setProto3IntField(this, 6, value);
jspb.Message.setProto3StringIntField(this, 6, value);
};
/**
* optional uint64 fee_rebate_sat = 7;
* @return {number}
* @return {string}
*/
proto.poolrpc.OrderMatchPrepare.prototype.getFeeRebateSat = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.OrderMatchPrepare.prototype.setFeeRebateSat = function(value) {
jspb.Message.setProto3IntField(this, 7, value);
jspb.Message.setProto3StringIntField(this, 7, value);
};
@ -6176,7 +6176,7 @@ proto.poolrpc.AuctionAccount.prototype.toObject = function(opt_includeInstance)
*/
proto.poolrpc.AuctionAccount.toObject = function(includeInstance, msg) {
var f, obj = {
value: jspb.Message.getFieldWithDefault(msg, 1, 0),
value: jspb.Message.getFieldWithDefault(msg, 1, "0"),
expiry: jspb.Message.getFieldWithDefault(msg, 2, 0),
traderKey: msg.getTraderKey_asB64(),
auctioneerKey: msg.getAuctioneerKey_asB64(),
@ -6222,7 +6222,7 @@ proto.poolrpc.AuctionAccount.deserializeBinaryFromReader = function(msg, reader)
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setValue(value);
break;
case 2:
@ -6288,8 +6288,8 @@ proto.poolrpc.AuctionAccount.prototype.serializeBinary = function() {
proto.poolrpc.AuctionAccount.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -6356,16 +6356,16 @@ proto.poolrpc.AuctionAccount.serializeBinaryToWriter = function(message, writer)
/**
* optional uint64 value = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.AuctionAccount.prototype.getValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.AuctionAccount.prototype.setValue = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -7233,7 +7233,7 @@ proto.poolrpc.AccountDiff.prototype.toObject = function(opt_includeInstance) {
*/
proto.poolrpc.AccountDiff.toObject = function(includeInstance, msg) {
var f, obj = {
endingBalance: jspb.Message.getFieldWithDefault(msg, 1, 0),
endingBalance: jspb.Message.getFieldWithDefault(msg, 1, "0"),
endingState: jspb.Message.getFieldWithDefault(msg, 2, 0),
outpointIndex: jspb.Message.getFieldWithDefault(msg, 3, 0),
traderKey: msg.getTraderKey_asB64()
@ -7274,7 +7274,7 @@ proto.poolrpc.AccountDiff.deserializeBinaryFromReader = function(msg, reader) {
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setEndingBalance(value);
break;
case 2:
@ -7319,8 +7319,8 @@ proto.poolrpc.AccountDiff.prototype.serializeBinary = function() {
proto.poolrpc.AccountDiff.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEndingBalance();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -7361,16 +7361,16 @@ proto.poolrpc.AccountDiff.AccountState = {
/**
* optional uint64 ending_balance = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.AccountDiff.prototype.getEndingBalance = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.AccountDiff.prototype.setEndingBalance = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -7499,8 +7499,8 @@ proto.poolrpc.ServerOrder.toObject = function(includeInstance, msg) {
var f, obj = {
traderKey: msg.getTraderKey_asB64(),
rateFixed: jspb.Message.getFieldWithDefault(msg, 2, 0),
amt: jspb.Message.getFieldWithDefault(msg, 3, 0),
minChanAmt: jspb.Message.getFieldWithDefault(msg, 4, 0),
amt: jspb.Message.getFieldWithDefault(msg, 3, "0"),
minChanAmt: jspb.Message.getFieldWithDefault(msg, 4, "0"),
orderNonce: msg.getOrderNonce_asB64(),
orderSig: msg.getOrderSig_asB64(),
multiSigKey: msg.getMultiSigKey_asB64(),
@ -7508,7 +7508,7 @@ proto.poolrpc.ServerOrder.toObject = function(includeInstance, msg) {
nodeAddrList: jspb.Message.toObjectList(msg.getNodeAddrList(),
proto.poolrpc.NodeAddress.toObject, includeInstance),
chanType: jspb.Message.getFieldWithDefault(msg, 12, 0),
maxBatchFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 13, 0)
maxBatchFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 13, "0")
};
if (includeInstance) {
@ -7554,11 +7554,11 @@ proto.poolrpc.ServerOrder.deserializeBinaryFromReader = function(msg, reader) {
msg.setRateFixed(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setAmt(value);
break;
case 4:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setMinChanAmt(value);
break;
case 6:
@ -7587,7 +7587,7 @@ proto.poolrpc.ServerOrder.deserializeBinaryFromReader = function(msg, reader) {
msg.setChanType(value);
break;
case 13:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setMaxBatchFeeRateSatPerKw(value);
break;
default:
@ -7634,15 +7634,15 @@ proto.poolrpc.ServerOrder.serializeBinaryToWriter = function(message, writer) {
);
}
f = message.getAmt();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
3,
f
);
}
f = message.getMinChanAmt();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
4,
f
);
@ -7691,8 +7691,8 @@ proto.poolrpc.ServerOrder.serializeBinaryToWriter = function(message, writer) {
);
}
f = message.getMaxBatchFeeRateSatPerKw();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
13,
f
);
@ -7756,31 +7756,31 @@ proto.poolrpc.ServerOrder.prototype.setRateFixed = function(value) {
/**
* optional uint64 amt = 3;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerOrder.prototype.getAmt = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerOrder.prototype.setAmt = function(value) {
jspb.Message.setProto3IntField(this, 3, value);
jspb.Message.setProto3StringIntField(this, 3, value);
};
/**
* optional uint64 min_chan_amt = 4;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerOrder.prototype.getMinChanAmt = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerOrder.prototype.setMinChanAmt = function(value) {
jspb.Message.setProto3IntField(this, 4, value);
jspb.Message.setProto3StringIntField(this, 4, value);
};
@ -7988,16 +7988,16 @@ proto.poolrpc.ServerOrder.prototype.setChanType = function(value) {
/**
* optional uint64 max_batch_fee_rate_sat_per_kw = 13;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerOrder.prototype.getMaxBatchFeeRateSatPerKw = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerOrder.prototype.setMaxBatchFeeRateSatPerKw = function(value) {
jspb.Message.setProto3IntField(this, 13, value);
jspb.Message.setProto3StringIntField(this, 13, value);
};
@ -8052,7 +8052,7 @@ proto.poolrpc.ServerBid.toObject = function(includeInstance, msg) {
leaseDurationBlocks: jspb.Message.getFieldWithDefault(msg, 2, 0),
version: jspb.Message.getFieldWithDefault(msg, 4, 0),
minNodeTier: jspb.Message.getFieldWithDefault(msg, 5, 0),
selfChanBalance: jspb.Message.getFieldWithDefault(msg, 6, 0),
selfChanBalance: jspb.Message.getFieldWithDefault(msg, 6, "0"),
isSidecarChannel: jspb.Message.getFieldWithDefault(msg, 7, false)
};
@ -8108,7 +8108,7 @@ proto.poolrpc.ServerBid.deserializeBinaryFromReader = function(msg, reader) {
msg.setMinNodeTier(value);
break;
case 6:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setSelfChanBalance(value);
break;
case 7:
@ -8174,8 +8174,8 @@ proto.poolrpc.ServerBid.serializeBinaryToWriter = function(message, writer) {
);
}
f = message.getSelfChanBalance();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
6,
f
);
@ -8267,16 +8267,16 @@ proto.poolrpc.ServerBid.prototype.setMinNodeTier = function(value) {
/**
* optional uint64 self_chan_balance = 6;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerBid.prototype.getSelfChanBalance = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerBid.prototype.setSelfChanBalance = function(value) {
jspb.Message.setProto3IntField(this, 6, value);
jspb.Message.setProto3StringIntField(this, 6, value);
};
@ -9160,7 +9160,7 @@ proto.poolrpc.ServerOutput.prototype.toObject = function(opt_includeInstance) {
*/
proto.poolrpc.ServerOutput.toObject = function(includeInstance, msg) {
var f, obj = {
value: jspb.Message.getFieldWithDefault(msg, 1, 0),
value: jspb.Message.getFieldWithDefault(msg, 1, "0"),
script: msg.getScript_asB64()
};
@ -9199,7 +9199,7 @@ proto.poolrpc.ServerOutput.deserializeBinaryFromReader = function(msg, reader) {
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setValue(value);
break;
case 2:
@ -9236,8 +9236,8 @@ proto.poolrpc.ServerOutput.prototype.serializeBinary = function() {
proto.poolrpc.ServerOutput.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -9254,16 +9254,16 @@ proto.poolrpc.ServerOutput.serializeBinaryToWriter = function(message, writer) {
/**
* optional uint64 value = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerOutput.prototype.getValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerOutput.prototype.setValue = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -9531,7 +9531,7 @@ proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.prototype.toObject
*/
proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.toObject = function(includeInstance, msg) {
var f, obj = {
value: jspb.Message.getFieldWithDefault(msg, 1, 0),
value: jspb.Message.getFieldWithDefault(msg, 1, "0"),
expiry: jspb.Message.getFieldWithDefault(msg, 2, 0)
};
@ -9570,7 +9570,7 @@ proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.deserializeBinaryF
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setValue(value);
break;
case 2:
@ -9607,8 +9607,8 @@ proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.prototype.serializ
proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -9625,16 +9625,16 @@ proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.serializeBinaryToW
/**
* optional uint64 value = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.prototype.getValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ServerModifyAccountRequest.NewAccountParameters.prototype.setValue = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -10448,13 +10448,13 @@ proto.poolrpc.TermsResponse.prototype.toObject = function(opt_includeInstance) {
*/
proto.poolrpc.TermsResponse.toObject = function(includeInstance, msg) {
var f, obj = {
maxAccountValue: jspb.Message.getFieldWithDefault(msg, 1, 0),
maxAccountValue: jspb.Message.getFieldWithDefault(msg, 1, "0"),
maxOrderDurationBlocks: jspb.Message.getFieldWithDefault(msg, 2, 0),
executionFee: (f = msg.getExecutionFee()) && proto.poolrpc.ExecutionFee.toObject(includeInstance, f),
leaseDurationsMap: (f = msg.getLeaseDurationsMap()) ? f.toObject(includeInstance, undefined) : [],
nextBatchConfTarget: jspb.Message.getFieldWithDefault(msg, 5, 0),
nextBatchFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 6, 0),
nextBatchClearTimestamp: jspb.Message.getFieldWithDefault(msg, 7, 0),
nextBatchFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 6, "0"),
nextBatchClearTimestamp: jspb.Message.getFieldWithDefault(msg, 7, "0"),
leaseDurationBucketsMap: (f = msg.getLeaseDurationBucketsMap()) ? f.toObject(includeInstance, undefined) : []
};
@ -10493,7 +10493,7 @@ proto.poolrpc.TermsResponse.deserializeBinaryFromReader = function(msg, reader)
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setMaxAccountValue(value);
break;
case 2:
@ -10516,11 +10516,11 @@ proto.poolrpc.TermsResponse.deserializeBinaryFromReader = function(msg, reader)
msg.setNextBatchConfTarget(value);
break;
case 6:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setNextBatchFeeRateSatPerKw(value);
break;
case 7:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setNextBatchClearTimestamp(value);
break;
case 8:
@ -10559,8 +10559,8 @@ proto.poolrpc.TermsResponse.prototype.serializeBinary = function() {
proto.poolrpc.TermsResponse.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getMaxAccountValue();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
@ -10592,15 +10592,15 @@ proto.poolrpc.TermsResponse.serializeBinaryToWriter = function(message, writer)
);
}
f = message.getNextBatchFeeRateSatPerKw();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
6,
f
);
}
f = message.getNextBatchClearTimestamp();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
7,
f
);
@ -10614,16 +10614,16 @@ proto.poolrpc.TermsResponse.serializeBinaryToWriter = function(message, writer)
/**
* optional uint64 max_account_value = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.TermsResponse.prototype.getMaxAccountValue = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.TermsResponse.prototype.setMaxAccountValue = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
@ -10707,31 +10707,31 @@ proto.poolrpc.TermsResponse.prototype.setNextBatchConfTarget = function(value) {
/**
* optional uint64 next_batch_fee_rate_sat_per_kw = 6;
* @return {number}
* @return {string}
*/
proto.poolrpc.TermsResponse.prototype.getNextBatchFeeRateSatPerKw = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.TermsResponse.prototype.setNextBatchFeeRateSatPerKw = function(value) {
jspb.Message.setProto3IntField(this, 6, value);
jspb.Message.setProto3StringIntField(this, 6, value);
};
/**
* optional uint64 next_batch_clear_timestamp = 7;
* @return {number}
* @return {string}
*/
proto.poolrpc.TermsResponse.prototype.getNextBatchClearTimestamp = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.TermsResponse.prototype.setNextBatchClearTimestamp = function(value) {
jspb.Message.setProto3IntField(this, 7, value);
jspb.Message.setProto3StringIntField(this, 7, value);
};
@ -11053,8 +11053,8 @@ proto.poolrpc.RelevantBatch.toObject = function(includeInstance, msg) {
clearingPriceRate: jspb.Message.getFieldWithDefault(msg, 5, 0),
executionFee: (f = msg.getExecutionFee()) && proto.poolrpc.ExecutionFee.toObject(includeInstance, f),
transaction: msg.getTransaction_asB64(),
feeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 8, 0),
creationTimestampNs: jspb.Message.getFieldWithDefault(msg, 9, 0),
feeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 8, "0"),
creationTimestampNs: jspb.Message.getFieldWithDefault(msg, 9, "0"),
matchedMarketsMap: (f = msg.getMatchedMarketsMap()) ? f.toObject(includeInstance, proto.poolrpc.MatchedMarket.toObject) : []
};
@ -11125,11 +11125,11 @@ proto.poolrpc.RelevantBatch.deserializeBinaryFromReader = function(msg, reader)
msg.setTransaction(value);
break;
case 8:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setFeeRateSatPerKw(value);
break;
case 9:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setCreationTimestampNs(value);
break;
case 10:
@ -11216,15 +11216,15 @@ proto.poolrpc.RelevantBatch.serializeBinaryToWriter = function(message, writer)
);
}
f = message.getFeeRateSatPerKw();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
8,
f
);
}
f = message.getCreationTimestampNs();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
9,
f
);
@ -11425,31 +11425,31 @@ proto.poolrpc.RelevantBatch.prototype.setTransaction = function(value) {
/**
* optional uint64 fee_rate_sat_per_kw = 8;
* @return {number}
* @return {string}
*/
proto.poolrpc.RelevantBatch.prototype.getFeeRateSatPerKw = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.RelevantBatch.prototype.setFeeRateSatPerKw = function(value) {
jspb.Message.setProto3IntField(this, 8, value);
jspb.Message.setProto3StringIntField(this, 8, value);
};
/**
* optional uint64 creation_timestamp_ns = 9;
* @return {number}
* @return {string}
*/
proto.poolrpc.RelevantBatch.prototype.getCreationTimestampNs = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.RelevantBatch.prototype.setCreationTimestampNs = function(value) {
jspb.Message.setProto3IntField(this, 9, value);
jspb.Message.setProto3StringIntField(this, 9, value);
};
@ -11518,8 +11518,8 @@ proto.poolrpc.ExecutionFee.prototype.toObject = function(opt_includeInstance) {
*/
proto.poolrpc.ExecutionFee.toObject = function(includeInstance, msg) {
var f, obj = {
baseFee: jspb.Message.getFieldWithDefault(msg, 1, 0),
feeRate: jspb.Message.getFieldWithDefault(msg, 2, 0)
baseFee: jspb.Message.getFieldWithDefault(msg, 1, "0"),
feeRate: jspb.Message.getFieldWithDefault(msg, 2, "0")
};
if (includeInstance) {
@ -11557,11 +11557,11 @@ proto.poolrpc.ExecutionFee.deserializeBinaryFromReader = function(msg, reader) {
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setBaseFee(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setFeeRate(value);
break;
default:
@ -11594,15 +11594,15 @@ proto.poolrpc.ExecutionFee.prototype.serializeBinary = function() {
proto.poolrpc.ExecutionFee.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getBaseFee();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
1,
f
);
}
f = message.getFeeRate();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
2,
f
);
@ -11612,31 +11612,31 @@ proto.poolrpc.ExecutionFee.serializeBinaryToWriter = function(message, writer) {
/**
* optional uint64 base_fee = 1;
* @return {number}
* @return {string}
*/
proto.poolrpc.ExecutionFee.prototype.getBaseFee = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ExecutionFee.prototype.setBaseFee = function(value) {
jspb.Message.setProto3IntField(this, 1, value);
jspb.Message.setProto3StringIntField(this, 1, value);
};
/**
* optional uint64 fee_rate = 2;
* @return {number}
* @return {string}
*/
proto.poolrpc.ExecutionFee.prototype.getFeeRate = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.ExecutionFee.prototype.setFeeRate = function(value) {
jspb.Message.setProto3IntField(this, 2, value);
jspb.Message.setProto3StringIntField(this, 2, value);
};
@ -12498,7 +12498,7 @@ proto.poolrpc.MatchedOrderSnapshot.toObject = function(includeInstance, msg) {
ask: (f = msg.getAsk()) && proto.poolrpc.AskSnapshot.toObject(includeInstance, f),
bid: (f = msg.getBid()) && proto.poolrpc.BidSnapshot.toObject(includeInstance, f),
matchingRate: jspb.Message.getFieldWithDefault(msg, 3, 0),
totalSatsCleared: jspb.Message.getFieldWithDefault(msg, 4, 0),
totalSatsCleared: jspb.Message.getFieldWithDefault(msg, 4, "0"),
unitsMatched: jspb.Message.getFieldWithDefault(msg, 5, 0)
};
@ -12551,7 +12551,7 @@ proto.poolrpc.MatchedOrderSnapshot.deserializeBinaryFromReader = function(msg, r
msg.setMatchingRate(value);
break;
case 4:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setTotalSatsCleared(value);
break;
case 5:
@ -12611,8 +12611,8 @@ proto.poolrpc.MatchedOrderSnapshot.serializeBinaryToWriter = function(message, w
);
}
f = message.getTotalSatsCleared();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
4,
f
);
@ -12704,16 +12704,16 @@ proto.poolrpc.MatchedOrderSnapshot.prototype.setMatchingRate = function(value) {
/**
* optional uint64 total_sats_cleared = 4;
* @return {number}
* @return {string}
*/
proto.poolrpc.MatchedOrderSnapshot.prototype.getTotalSatsCleared = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.MatchedOrderSnapshot.prototype.setTotalSatsCleared = function(value) {
jspb.Message.setProto3IntField(this, 4, value);
jspb.Message.setProto3StringIntField(this, 4, value);
};
@ -13155,8 +13155,8 @@ proto.poolrpc.BatchSnapshotResponse.toObject = function(includeInstance, msg) {
proto.poolrpc.MatchedOrderSnapshot.toObject, includeInstance),
batchTxId: jspb.Message.getFieldWithDefault(msg, 7, ""),
batchTx: msg.getBatchTx_asB64(),
batchTxFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 8, 0),
creationTimestampNs: jspb.Message.getFieldWithDefault(msg, 9, 0),
batchTxFeeRateSatPerKw: jspb.Message.getFieldWithDefault(msg, 8, "0"),
creationTimestampNs: jspb.Message.getFieldWithDefault(msg, 9, "0"),
matchedMarketsMap: (f = msg.getMatchedMarketsMap()) ? f.toObject(includeInstance, proto.poolrpc.MatchedMarketSnapshot.toObject) : []
};
@ -13224,11 +13224,11 @@ proto.poolrpc.BatchSnapshotResponse.deserializeBinaryFromReader = function(msg,
msg.setBatchTx(value);
break;
case 8:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setBatchTxFeeRateSatPerKw(value);
break;
case 9:
var value = /** @type {number} */ (reader.readUint64());
var value = /** @type {string} */ (reader.readUint64String());
msg.setCreationTimestampNs(value);
break;
case 10:
@ -13317,15 +13317,15 @@ proto.poolrpc.BatchSnapshotResponse.serializeBinaryToWriter = function(message,
);
}
f = message.getBatchTxFeeRateSatPerKw();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
8,
f
);
}
f = message.getCreationTimestampNs();
if (f !== 0) {
writer.writeUint64(
if (parseInt(f, 10) !== 0) {
writer.writeUint64String(
9,
f
);
@ -13532,31 +13532,31 @@ proto.poolrpc.BatchSnapshotResponse.prototype.setBatchTx = function(value) {
/**
* optional uint64 batch_tx_fee_rate_sat_per_kw = 8;
* @return {number}
* @return {string}
*/
proto.poolrpc.BatchSnapshotResponse.prototype.getBatchTxFeeRateSatPerKw = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 8, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.BatchSnapshotResponse.prototype.setBatchTxFeeRateSatPerKw = function(value) {
jspb.Message.setProto3IntField(this, 8, value);
jspb.Message.setProto3StringIntField(this, 8, value);
};
/**
* optional uint64 creation_timestamp_ns = 9;
* @return {number}
* @return {string}
*/
proto.poolrpc.BatchSnapshotResponse.prototype.getCreationTimestampNs = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0"));
};
/** @param {number} value */
/** @param {string} value */
proto.poolrpc.BatchSnapshotResponse.prototype.setCreationTimestampNs = function(value) {
jspb.Message.setProto3IntField(this, 9, value);
jspb.Message.setProto3StringIntField(this, 9, value);
};

1154
app/src/types/generated/lnd_pb.d.ts generated vendored

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

278
app/src/types/generated/loop_pb.d.ts generated vendored
View file

@ -5,34 +5,34 @@ import * as jspb from "google-protobuf";
import * as google_api_annotations_pb from "./google/api/annotations_pb";
export class LoopOutRequest extends jspb.Message {
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getDest(): string;
setDest(value: string): void;
getMaxSwapRoutingFee(): number;
setMaxSwapRoutingFee(value: number): void;
getMaxSwapRoutingFee(): string;
setMaxSwapRoutingFee(value: string): void;
getMaxPrepayRoutingFee(): number;
setMaxPrepayRoutingFee(value: number): void;
getMaxPrepayRoutingFee(): string;
setMaxPrepayRoutingFee(value: string): void;
getMaxSwapFee(): number;
setMaxSwapFee(value: number): void;
getMaxSwapFee(): string;
setMaxSwapFee(value: string): void;
getMaxPrepayAmt(): number;
setMaxPrepayAmt(value: number): void;
getMaxPrepayAmt(): string;
setMaxPrepayAmt(value: string): void;
getMaxMinerFee(): number;
setMaxMinerFee(value: number): void;
getMaxMinerFee(): string;
setMaxMinerFee(value: string): void;
getLoopOutChannel(): number;
setLoopOutChannel(value: number): void;
getLoopOutChannel(): string;
setLoopOutChannel(value: string): void;
clearOutgoingChanSetList(): void;
getOutgoingChanSetList(): Array<number>;
setOutgoingChanSetList(value: Array<number>): void;
addOutgoingChanSet(value: number, index?: number): number;
getOutgoingChanSetList(): Array<string>;
setOutgoingChanSetList(value: Array<string>): void;
addOutgoingChanSet(value: string, index?: number): string;
getSweepConfTarget(): number;
setSweepConfTarget(value: number): void;
@ -40,8 +40,8 @@ export class LoopOutRequest extends jspb.Message {
getHtlcConfirmations(): number;
setHtlcConfirmations(value: number): void;
getSwapPublicationDeadline(): number;
setSwapPublicationDeadline(value: number): void;
getSwapPublicationDeadline(): string;
setSwapPublicationDeadline(value: string): void;
getLabel(): string;
setLabel(value: string): void;
@ -61,32 +61,32 @@ export class LoopOutRequest extends jspb.Message {
export namespace LoopOutRequest {
export type AsObject = {
amt: number,
amt: string,
dest: string,
maxSwapRoutingFee: number,
maxPrepayRoutingFee: number,
maxSwapFee: number,
maxPrepayAmt: number,
maxMinerFee: number,
loopOutChannel: number,
outgoingChanSetList: Array<number>,
maxSwapRoutingFee: string,
maxPrepayRoutingFee: string,
maxSwapFee: string,
maxPrepayAmt: string,
maxMinerFee: string,
loopOutChannel: string,
outgoingChanSetList: Array<string>,
sweepConfTarget: number,
htlcConfirmations: number,
swapPublicationDeadline: number,
swapPublicationDeadline: string,
label: string,
initiator: string,
}
}
export class LoopInRequest extends jspb.Message {
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getMaxSwapFee(): number;
setMaxSwapFee(value: number): void;
getMaxSwapFee(): string;
setMaxSwapFee(value: string): void;
getMaxMinerFee(): number;
setMaxMinerFee(value: number): void;
getMaxMinerFee(): string;
setMaxMinerFee(value: string): void;
getLastHop(): Uint8Array | string;
getLastHop_asU8(): Uint8Array;
@ -117,9 +117,9 @@ export class LoopInRequest extends jspb.Message {
export namespace LoopInRequest {
export type AsObject = {
amt: number,
maxSwapFee: number,
maxMinerFee: number,
amt: string,
maxSwapFee: string,
maxMinerFee: string,
lastHop: Uint8Array | string,
externalHtlc: boolean,
htlcConfTarget: number,
@ -187,8 +187,8 @@ export namespace MonitorRequest {
}
export class SwapStatus extends jspb.Message {
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getId(): string;
setId(value: string): void;
@ -207,11 +207,11 @@ export class SwapStatus extends jspb.Message {
getFailureReason(): FailureReasonMap[keyof FailureReasonMap];
setFailureReason(value: FailureReasonMap[keyof FailureReasonMap]): void;
getInitiationTime(): number;
setInitiationTime(value: number): void;
getInitiationTime(): string;
setInitiationTime(value: string): void;
getLastUpdateTime(): number;
setLastUpdateTime(value: number): void;
getLastUpdateTime(): string;
setLastUpdateTime(value: string): void;
getHtlcAddress(): string;
setHtlcAddress(value: string): void;
@ -222,14 +222,14 @@ export class SwapStatus extends jspb.Message {
getHtlcAddressNp2wsh(): string;
setHtlcAddressNp2wsh(value: string): void;
getCostServer(): number;
setCostServer(value: number): void;
getCostServer(): string;
setCostServer(value: string): void;
getCostOnchain(): number;
setCostOnchain(value: number): void;
getCostOnchain(): string;
setCostOnchain(value: string): void;
getCostOffchain(): number;
setCostOffchain(value: number): void;
getCostOffchain(): string;
setCostOffchain(value: string): void;
getLabel(): string;
setLabel(value: string): void;
@ -246,20 +246,20 @@ export class SwapStatus extends jspb.Message {
export namespace SwapStatus {
export type AsObject = {
amt: number,
amt: string,
id: string,
idBytes: Uint8Array | string,
type: SwapTypeMap[keyof SwapTypeMap],
state: SwapStateMap[keyof SwapStateMap],
failureReason: FailureReasonMap[keyof FailureReasonMap],
initiationTime: number,
lastUpdateTime: number,
initiationTime: string,
lastUpdateTime: string,
htlcAddress: string,
htlcAddressP2wsh: string,
htlcAddressNp2wsh: string,
costServer: number,
costOnchain: number,
costOffchain: number,
costServer: string,
costOnchain: string,
costOffchain: string,
label: string,
}
}
@ -341,11 +341,11 @@ export namespace TermsRequest {
}
export class InTermsResponse extends jspb.Message {
getMinSwapAmount(): number;
setMinSwapAmount(value: number): void;
getMinSwapAmount(): string;
setMinSwapAmount(value: string): void;
getMaxSwapAmount(): number;
setMaxSwapAmount(value: number): void;
getMaxSwapAmount(): string;
setMaxSwapAmount(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): InTermsResponse.AsObject;
@ -359,17 +359,17 @@ export class InTermsResponse extends jspb.Message {
export namespace InTermsResponse {
export type AsObject = {
minSwapAmount: number,
maxSwapAmount: number,
minSwapAmount: string,
maxSwapAmount: string,
}
}
export class OutTermsResponse extends jspb.Message {
getMinSwapAmount(): number;
setMinSwapAmount(value: number): void;
getMinSwapAmount(): string;
setMinSwapAmount(value: string): void;
getMaxSwapAmount(): number;
setMaxSwapAmount(value: number): void;
getMaxSwapAmount(): string;
setMaxSwapAmount(value: string): void;
getMinCltvDelta(): number;
setMinCltvDelta(value: number): void;
@ -389,16 +389,16 @@ export class OutTermsResponse extends jspb.Message {
export namespace OutTermsResponse {
export type AsObject = {
minSwapAmount: number,
maxSwapAmount: number,
minSwapAmount: string,
maxSwapAmount: string,
minCltvDelta: number,
maxCltvDelta: number,
}
}
export class QuoteRequest extends jspb.Message {
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getConfTarget(): number;
setConfTarget(value: number): void;
@ -406,8 +406,8 @@ export class QuoteRequest extends jspb.Message {
getExternalHtlc(): boolean;
setExternalHtlc(value: boolean): void;
getSwapPublicationDeadline(): number;
setSwapPublicationDeadline(value: number): void;
getSwapPublicationDeadline(): string;
setSwapPublicationDeadline(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuoteRequest.AsObject;
@ -421,19 +421,19 @@ export class QuoteRequest extends jspb.Message {
export namespace QuoteRequest {
export type AsObject = {
amt: number,
amt: string,
confTarget: number,
externalHtlc: boolean,
swapPublicationDeadline: number,
swapPublicationDeadline: string,
}
}
export class InQuoteResponse extends jspb.Message {
getSwapFeeSat(): number;
setSwapFeeSat(value: number): void;
getSwapFeeSat(): string;
setSwapFeeSat(value: string): void;
getHtlcPublishFeeSat(): number;
setHtlcPublishFeeSat(value: number): void;
getHtlcPublishFeeSat(): string;
setHtlcPublishFeeSat(value: string): void;
getCltvDelta(): number;
setCltvDelta(value: number): void;
@ -453,22 +453,22 @@ export class InQuoteResponse extends jspb.Message {
export namespace InQuoteResponse {
export type AsObject = {
swapFeeSat: number,
htlcPublishFeeSat: number,
swapFeeSat: string,
htlcPublishFeeSat: string,
cltvDelta: number,
confTarget: number,
}
}
export class OutQuoteResponse extends jspb.Message {
getSwapFeeSat(): number;
setSwapFeeSat(value: number): void;
getSwapFeeSat(): string;
setSwapFeeSat(value: string): void;
getPrepayAmtSat(): number;
setPrepayAmtSat(value: number): void;
getPrepayAmtSat(): string;
setPrepayAmtSat(value: string): void;
getHtlcSweepFeeSat(): number;
setHtlcSweepFeeSat(value: number): void;
getHtlcSweepFeeSat(): string;
setHtlcSweepFeeSat(value: string): void;
getSwapPaymentDest(): Uint8Array | string;
getSwapPaymentDest_asU8(): Uint8Array;
@ -493,9 +493,9 @@ export class OutQuoteResponse extends jspb.Message {
export namespace OutQuoteResponse {
export type AsObject = {
swapFeeSat: number,
prepayAmtSat: number,
htlcSweepFeeSat: number,
swapFeeSat: string,
prepayAmtSat: string,
htlcSweepFeeSat: string,
swapPaymentDest: Uint8Array | string,
cltvDelta: number,
confTarget: number,
@ -556,14 +556,14 @@ export class LsatToken extends jspb.Message {
getPaymentPreimage_asB64(): string;
setPaymentPreimage(value: Uint8Array | string): void;
getAmountPaidMsat(): number;
setAmountPaidMsat(value: number): void;
getAmountPaidMsat(): string;
setAmountPaidMsat(value: string): void;
getRoutingFeePaidMsat(): number;
setRoutingFeePaidMsat(value: number): void;
getRoutingFeePaidMsat(): string;
setRoutingFeePaidMsat(value: string): void;
getTimeCreated(): number;
setTimeCreated(value: number): void;
getTimeCreated(): string;
setTimeCreated(value: string): void;
getExpired(): boolean;
setExpired(value: boolean): void;
@ -586,9 +586,9 @@ export namespace LsatToken {
baseMacaroon: Uint8Array | string,
paymentHash: Uint8Array | string,
paymentPreimage: Uint8Array | string,
amountPaidMsat: number,
routingFeePaidMsat: number,
timeCreated: number,
amountPaidMsat: string,
routingFeePaidMsat: string,
timeCreated: string,
expired: boolean,
storageName: string,
}
@ -616,50 +616,50 @@ export class LiquidityParameters extends jspb.Message {
setRulesList(value: Array<LiquidityRule>): void;
addRules(value?: LiquidityRule, index?: number): LiquidityRule;
getFeePpm(): number;
setFeePpm(value: number): void;
getFeePpm(): string;
setFeePpm(value: string): void;
getSweepFeeRateSatPerVbyte(): number;
setSweepFeeRateSatPerVbyte(value: number): void;
getSweepFeeRateSatPerVbyte(): string;
setSweepFeeRateSatPerVbyte(value: string): void;
getMaxSwapFeePpm(): number;
setMaxSwapFeePpm(value: number): void;
getMaxSwapFeePpm(): string;
setMaxSwapFeePpm(value: string): void;
getMaxRoutingFeePpm(): number;
setMaxRoutingFeePpm(value: number): void;
getMaxRoutingFeePpm(): string;
setMaxRoutingFeePpm(value: string): void;
getMaxPrepayRoutingFeePpm(): number;
setMaxPrepayRoutingFeePpm(value: number): void;
getMaxPrepayRoutingFeePpm(): string;
setMaxPrepayRoutingFeePpm(value: string): void;
getMaxPrepaySat(): number;
setMaxPrepaySat(value: number): void;
getMaxPrepaySat(): string;
setMaxPrepaySat(value: string): void;
getMaxMinerFeeSat(): number;
setMaxMinerFeeSat(value: number): void;
getMaxMinerFeeSat(): string;
setMaxMinerFeeSat(value: string): void;
getSweepConfTarget(): number;
setSweepConfTarget(value: number): void;
getFailureBackoffSec(): number;
setFailureBackoffSec(value: number): void;
getFailureBackoffSec(): string;
setFailureBackoffSec(value: string): void;
getAutoloop(): boolean;
setAutoloop(value: boolean): void;
getAutoloopBudgetSat(): number;
setAutoloopBudgetSat(value: number): void;
getAutoloopBudgetSat(): string;
setAutoloopBudgetSat(value: string): void;
getAutoloopBudgetStartSec(): number;
setAutoloopBudgetStartSec(value: number): void;
getAutoloopBudgetStartSec(): string;
setAutoloopBudgetStartSec(value: string): void;
getAutoMaxInFlight(): number;
setAutoMaxInFlight(value: number): void;
getAutoMaxInFlight(): string;
setAutoMaxInFlight(value: string): void;
getMinSwapAmount(): number;
setMinSwapAmount(value: number): void;
getMinSwapAmount(): string;
setMinSwapAmount(value: string): void;
getMaxSwapAmount(): number;
setMaxSwapAmount(value: number): void;
getMaxSwapAmount(): string;
setMaxSwapAmount(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LiquidityParameters.AsObject;
@ -674,27 +674,27 @@ export class LiquidityParameters extends jspb.Message {
export namespace LiquidityParameters {
export type AsObject = {
rulesList: Array<LiquidityRule.AsObject>,
feePpm: number,
sweepFeeRateSatPerVbyte: number,
maxSwapFeePpm: number,
maxRoutingFeePpm: number,
maxPrepayRoutingFeePpm: number,
maxPrepaySat: number,
maxMinerFeeSat: number,
feePpm: string,
sweepFeeRateSatPerVbyte: string,
maxSwapFeePpm: string,
maxRoutingFeePpm: string,
maxPrepayRoutingFeePpm: string,
maxPrepaySat: string,
maxMinerFeeSat: string,
sweepConfTarget: number,
failureBackoffSec: number,
failureBackoffSec: string,
autoloop: boolean,
autoloopBudgetSat: number,
autoloopBudgetStartSec: number,
autoMaxInFlight: number,
minSwapAmount: number,
maxSwapAmount: number,
autoloopBudgetSat: string,
autoloopBudgetStartSec: string,
autoMaxInFlight: string,
minSwapAmount: string,
maxSwapAmount: string,
}
}
export class LiquidityRule extends jspb.Message {
getChannelId(): number;
setChannelId(value: number): void;
getChannelId(): string;
setChannelId(value: string): void;
getPubkey(): Uint8Array | string;
getPubkey_asU8(): Uint8Array;
@ -722,7 +722,7 @@ export class LiquidityRule extends jspb.Message {
export namespace LiquidityRule {
export type AsObject = {
channelId: number,
channelId: string,
pubkey: Uint8Array | string,
type: LiquidityRuleTypeMap[keyof LiquidityRuleTypeMap],
incomingThreshold: number,

File diff suppressed because it is too large Load diff

View file

@ -5,8 +5,8 @@ import * as jspb from "google-protobuf";
import * as auctioneerrpc_auctioneer_pb from "./auctioneerrpc/auctioneer_pb";
export class InitAccountRequest extends jspb.Message {
getAccountValue(): number;
setAccountValue(value: number): void;
getAccountValue(): string;
setAccountValue(value: string): void;
hasAbsoluteHeight(): boolean;
clearAbsoluteHeight(): void;
@ -40,7 +40,7 @@ export class InitAccountRequest extends jspb.Message {
export namespace InitAccountRequest {
export type AsObject = {
accountValue: number,
accountValue: string,
absoluteHeight: number,
relativeHeight: number,
confTarget: number,
@ -60,8 +60,8 @@ export namespace InitAccountRequest {
}
export class QuoteAccountRequest extends jspb.Message {
getAccountValue(): number;
setAccountValue(value: number): void;
getAccountValue(): string;
setAccountValue(value: string): void;
hasConfTarget(): boolean;
clearConfTarget(): void;
@ -81,7 +81,7 @@ export class QuoteAccountRequest extends jspb.Message {
export namespace QuoteAccountRequest {
export type AsObject = {
accountValue: number,
accountValue: string,
confTarget: number,
}
@ -92,11 +92,11 @@ export namespace QuoteAccountRequest {
}
export class QuoteAccountResponse extends jspb.Message {
getMinerFeeRateSatPerKw(): number;
setMinerFeeRateSatPerKw(value: number): void;
getMinerFeeRateSatPerKw(): string;
setMinerFeeRateSatPerKw(value: string): void;
getMinerFeeTotal(): number;
setMinerFeeTotal(value: number): void;
getMinerFeeTotal(): string;
setMinerFeeTotal(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuoteAccountResponse.AsObject;
@ -110,8 +110,8 @@ export class QuoteAccountResponse extends jspb.Message {
export namespace QuoteAccountResponse {
export type AsObject = {
minerFeeRateSatPerKw: number,
minerFeeTotal: number,
minerFeeRateSatPerKw: string,
minerFeeTotal: string,
}
}
@ -158,8 +158,8 @@ export namespace ListAccountsResponse {
}
export class Output extends jspb.Message {
getValueSat(): number;
setValueSat(value: number): void;
getValueSat(): string;
setValueSat(value: string): void;
getAddress(): string;
setAddress(value: string): void;
@ -176,7 +176,7 @@ export class Output extends jspb.Message {
export namespace Output {
export type AsObject = {
valueSat: number,
valueSat: string,
address: string,
}
}
@ -192,8 +192,8 @@ export class OutputWithFee extends jspb.Message {
hasFeeRateSatPerKw(): boolean;
clearFeeRateSatPerKw(): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
getFeesCase(): OutputWithFee.FeesCase;
serializeBinary(): Uint8Array;
@ -210,7 +210,7 @@ export namespace OutputWithFee {
export type AsObject = {
address: string,
confTarget: number,
feeRateSatPerKw: number,
feeRateSatPerKw: string,
}
export enum FeesCase {
@ -316,8 +316,8 @@ export class WithdrawAccountRequest extends jspb.Message {
setOutputsList(value: Array<Output>): void;
addOutputs(value?: Output, index?: number): Output;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): WithdrawAccountRequest.AsObject;
@ -333,7 +333,7 @@ export namespace WithdrawAccountRequest {
export type AsObject = {
traderKey: Uint8Array | string,
outputsList: Array<Output.AsObject>,
feeRateSatPerKw: number,
feeRateSatPerKw: string,
}
}
@ -371,11 +371,11 @@ export class DepositAccountRequest extends jspb.Message {
getTraderKey_asB64(): string;
setTraderKey(value: Uint8Array | string): void;
getAmountSat(): number;
setAmountSat(value: number): void;
getAmountSat(): string;
setAmountSat(value: string): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DepositAccountRequest.AsObject;
@ -390,8 +390,8 @@ export class DepositAccountRequest extends jspb.Message {
export namespace DepositAccountRequest {
export type AsObject = {
traderKey: Uint8Array | string,
amountSat: number,
feeRateSatPerKw: number,
amountSat: string,
feeRateSatPerKw: string,
}
}
@ -439,8 +439,8 @@ export class RenewAccountRequest extends jspb.Message {
getRelativeExpiry(): number;
setRelativeExpiry(value: number): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
getAccountExpiryCase(): RenewAccountRequest.AccountExpiryCase;
serializeBinary(): Uint8Array;
@ -458,7 +458,7 @@ export namespace RenewAccountRequest {
accountKey: Uint8Array | string,
absoluteExpiry: number,
relativeExpiry: number,
feeRateSatPerKw: number,
feeRateSatPerKw: string,
}
export enum AccountExpiryCase {
@ -502,8 +502,8 @@ export class BumpAccountFeeRequest extends jspb.Message {
getTraderKey_asB64(): string;
setTraderKey(value: Uint8Array | string): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BumpAccountFeeRequest.AsObject;
@ -518,7 +518,7 @@ export class BumpAccountFeeRequest extends jspb.Message {
export namespace BumpAccountFeeRequest {
export type AsObject = {
traderKey: Uint8Array | string,
feeRateSatPerKw: number,
feeRateSatPerKw: string,
}
}
@ -549,11 +549,11 @@ export class Account extends jspb.Message {
getOutpoint(): auctioneerrpc_auctioneer_pb.OutPoint | undefined;
setOutpoint(value?: auctioneerrpc_auctioneer_pb.OutPoint): void;
getValue(): number;
setValue(value: number): void;
getValue(): string;
setValue(value: string): void;
getAvailableBalance(): number;
setAvailableBalance(value: number): void;
getAvailableBalance(): string;
setAvailableBalance(value: string): void;
getExpirationHeight(): number;
setExpirationHeight(value: number): void;
@ -580,8 +580,8 @@ export namespace Account {
export type AsObject = {
traderKey: Uint8Array | string,
outpoint?: auctioneerrpc_auctioneer_pb.OutPoint.AsObject,
value: number,
availableBalance: number,
value: string,
availableBalance: string,
expirationHeight: number,
state: AccountStateMap[keyof AccountStateMap],
latestTxid: Uint8Array | string,
@ -763,11 +763,11 @@ export class Order extends jspb.Message {
getRateFixed(): number;
setRateFixed(value: number): void;
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getMaxBatchFeeRateSatPerKw(): number;
setMaxBatchFeeRateSatPerKw(value: number): void;
getMaxBatchFeeRateSatPerKw(): string;
setMaxBatchFeeRateSatPerKw(value: string): void;
getOrderNonce(): Uint8Array | string;
getOrderNonce_asU8(): Uint8Array;
@ -783,11 +783,11 @@ export class Order extends jspb.Message {
getUnitsUnfulfilled(): number;
setUnitsUnfulfilled(value: number): void;
getReservedValueSat(): number;
setReservedValueSat(value: number): void;
getReservedValueSat(): string;
setReservedValueSat(value: string): void;
getCreationTimestampNs(): number;
setCreationTimestampNs(value: number): void;
getCreationTimestampNs(): string;
setCreationTimestampNs(value: string): void;
clearEventsList(): void;
getEventsList(): Array<OrderEvent>;
@ -811,14 +811,14 @@ export namespace Order {
export type AsObject = {
traderKey: Uint8Array | string,
rateFixed: number,
amt: number,
maxBatchFeeRateSatPerKw: number,
amt: string,
maxBatchFeeRateSatPerKw: string,
orderNonce: Uint8Array | string,
state: auctioneerrpc_auctioneer_pb.OrderStateMap[keyof auctioneerrpc_auctioneer_pb.OrderStateMap],
units: number,
unitsUnfulfilled: number,
reservedValueSat: number,
creationTimestampNs: number,
reservedValueSat: string,
creationTimestampNs: string,
eventsList: Array<OrderEvent.AsObject>,
minUnitsMatch: number,
}
@ -839,8 +839,8 @@ export class Bid extends jspb.Message {
getMinNodeTier(): auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap];
setMinNodeTier(value: auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap]): void;
getSelfChanBalance(): number;
setSelfChanBalance(value: number): void;
getSelfChanBalance(): string;
setSelfChanBalance(value: string): void;
getSidecarTicket(): string;
setSidecarTicket(value: string): void;
@ -861,7 +861,7 @@ export namespace Bid {
leaseDurationBlocks: number,
version: number,
minNodeTier: auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap],
selfChanBalance: number,
selfChanBalance: string,
sidecarTicket: string,
}
}
@ -897,8 +897,8 @@ export namespace Ask {
}
export class QuoteOrderRequest extends jspb.Message {
getAmt(): number;
setAmt(value: number): void;
getAmt(): string;
setAmt(value: string): void;
getRateFixed(): number;
setRateFixed(value: number): void;
@ -906,8 +906,8 @@ export class QuoteOrderRequest extends jspb.Message {
getLeaseDurationBlocks(): number;
setLeaseDurationBlocks(value: number): void;
getMaxBatchFeeRateSatPerKw(): number;
setMaxBatchFeeRateSatPerKw(value: number): void;
getMaxBatchFeeRateSatPerKw(): string;
setMaxBatchFeeRateSatPerKw(value: string): void;
getMinUnitsMatch(): number;
setMinUnitsMatch(value: number): void;
@ -924,17 +924,17 @@ export class QuoteOrderRequest extends jspb.Message {
export namespace QuoteOrderRequest {
export type AsObject = {
amt: number,
amt: string,
rateFixed: number,
leaseDurationBlocks: number,
maxBatchFeeRateSatPerKw: number,
maxBatchFeeRateSatPerKw: string,
minUnitsMatch: number,
}
}
export class QuoteOrderResponse extends jspb.Message {
getTotalPremiumSat(): number;
setTotalPremiumSat(value: number): void;
getTotalPremiumSat(): string;
setTotalPremiumSat(value: string): void;
getRatePerBlock(): number;
setRatePerBlock(value: number): void;
@ -942,11 +942,11 @@ export class QuoteOrderResponse extends jspb.Message {
getRatePercent(): number;
setRatePercent(value: number): void;
getTotalExecutionFeeSat(): number;
setTotalExecutionFeeSat(value: number): void;
getTotalExecutionFeeSat(): string;
setTotalExecutionFeeSat(value: string): void;
getWorstCaseChainFeeSat(): number;
setWorstCaseChainFeeSat(value: number): void;
getWorstCaseChainFeeSat(): string;
setWorstCaseChainFeeSat(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): QuoteOrderResponse.AsObject;
@ -960,17 +960,17 @@ export class QuoteOrderResponse extends jspb.Message {
export namespace QuoteOrderResponse {
export type AsObject = {
totalPremiumSat: number,
totalPremiumSat: string,
ratePerBlock: number,
ratePercent: number,
totalExecutionFeeSat: number,
worstCaseChainFeeSat: number,
totalExecutionFeeSat: string,
worstCaseChainFeeSat: string,
}
}
export class OrderEvent extends jspb.Message {
getTimestampNs(): number;
setTimestampNs(value: number): void;
getTimestampNs(): string;
setTimestampNs(value: string): void;
getEventStr(): string;
setEventStr(value: string): void;
@ -998,7 +998,7 @@ export class OrderEvent extends jspb.Message {
export namespace OrderEvent {
export type AsObject = {
timestampNs: number,
timestampNs: string,
eventStr: string,
stateChange?: UpdatedEvent.AsObject,
matched?: MatchEvent.AsObject,
@ -1153,8 +1153,8 @@ export class Lease extends jspb.Message {
getChannelPoint(): auctioneerrpc_auctioneer_pb.OutPoint | undefined;
setChannelPoint(value?: auctioneerrpc_auctioneer_pb.OutPoint): void;
getChannelAmtSat(): number;
setChannelAmtSat(value: number): void;
getChannelAmtSat(): string;
setChannelAmtSat(value: string): void;
getChannelDurationBlocks(): number;
setChannelDurationBlocks(value: number): void;
@ -1162,20 +1162,20 @@ export class Lease extends jspb.Message {
getChannelLeaseExpiry(): number;
setChannelLeaseExpiry(value: number): void;
getPremiumSat(): number;
setPremiumSat(value: number): void;
getPremiumSat(): string;
setPremiumSat(value: string): void;
getExecutionFeeSat(): number;
setExecutionFeeSat(value: number): void;
getExecutionFeeSat(): string;
setExecutionFeeSat(value: string): void;
getChainFeeSat(): number;
setChainFeeSat(value: number): void;
getChainFeeSat(): string;
setChainFeeSat(value: string): void;
getClearingRatePrice(): number;
setClearingRatePrice(value: number): void;
getClearingRatePrice(): string;
setClearingRatePrice(value: string): void;
getOrderFixedRate(): number;
setOrderFixedRate(value: number): void;
getOrderFixedRate(): string;
setOrderFixedRate(value: string): void;
getOrderNonce(): Uint8Array | string;
getOrderNonce_asU8(): Uint8Array;
@ -1193,8 +1193,8 @@ export class Lease extends jspb.Message {
getChannelNodeTier(): auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap];
setChannelNodeTier(value: auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap]): void;
getSelfChanBalance(): number;
setSelfChanBalance(value: number): void;
getSelfChanBalance(): string;
setSelfChanBalance(value: string): void;
getSidecarChannel(): boolean;
setSidecarChannel(value: boolean): void;
@ -1212,19 +1212,19 @@ export class Lease extends jspb.Message {
export namespace Lease {
export type AsObject = {
channelPoint?: auctioneerrpc_auctioneer_pb.OutPoint.AsObject,
channelAmtSat: number,
channelAmtSat: string,
channelDurationBlocks: number,
channelLeaseExpiry: number,
premiumSat: number,
executionFeeSat: number,
chainFeeSat: number,
clearingRatePrice: number,
orderFixedRate: number,
premiumSat: string,
executionFeeSat: string,
chainFeeSat: string,
clearingRatePrice: string,
orderFixedRate: string,
orderNonce: Uint8Array | string,
purchased: boolean,
channelRemoteNodeKey: Uint8Array | string,
channelNodeTier: auctioneerrpc_auctioneer_pb.NodeTierMap[keyof auctioneerrpc_auctioneer_pb.NodeTierMap],
selfChanBalance: number,
selfChanBalance: string,
sidecarChannel: boolean,
}
}
@ -1267,11 +1267,11 @@ export class LeasesResponse extends jspb.Message {
setLeasesList(value: Array<Lease>): void;
addLeases(value?: Lease, index?: number): Lease;
getTotalAmtEarnedSat(): number;
setTotalAmtEarnedSat(value: number): void;
getTotalAmtEarnedSat(): string;
setTotalAmtEarnedSat(value: string): void;
getTotalAmtPaidSat(): number;
setTotalAmtPaidSat(value: number): void;
getTotalAmtPaidSat(): string;
setTotalAmtPaidSat(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LeasesResponse.AsObject;
@ -1286,8 +1286,8 @@ export class LeasesResponse extends jspb.Message {
export namespace LeasesResponse {
export type AsObject = {
leasesList: Array<Lease.AsObject>,
totalAmtEarnedSat: number,
totalAmtPaidSat: number,
totalAmtEarnedSat: string,
totalAmtPaidSat: string,
}
}
@ -1345,14 +1345,14 @@ export class LsatToken extends jspb.Message {
getPaymentPreimage_asB64(): string;
setPaymentPreimage(value: Uint8Array | string): void;
getAmountPaidMsat(): number;
setAmountPaidMsat(value: number): void;
getAmountPaidMsat(): string;
setAmountPaidMsat(value: string): void;
getRoutingFeePaidMsat(): number;
setRoutingFeePaidMsat(value: number): void;
getRoutingFeePaidMsat(): string;
setRoutingFeePaidMsat(value: string): void;
getTimeCreated(): number;
setTimeCreated(value: number): void;
getTimeCreated(): string;
setTimeCreated(value: string): void;
getExpired(): boolean;
setExpired(value: boolean): void;
@ -1375,9 +1375,9 @@ export namespace LsatToken {
baseMacaroon: Uint8Array | string,
paymentHash: Uint8Array | string,
paymentPreimage: Uint8Array | string,
amountPaidMsat: number,
routingFeePaidMsat: number,
timeCreated: number,
amountPaidMsat: string,
routingFeePaidMsat: string,
timeCreated: string,
expired: boolean,
storageName: string,
}
@ -1441,11 +1441,11 @@ export class NextBatchInfoResponse extends jspb.Message {
getConfTarget(): number;
setConfTarget(value: number): void;
getFeeRateSatPerKw(): number;
setFeeRateSatPerKw(value: number): void;
getFeeRateSatPerKw(): string;
setFeeRateSatPerKw(value: string): void;
getClearTimestamp(): number;
setClearTimestamp(value: number): void;
getClearTimestamp(): string;
setClearTimestamp(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): NextBatchInfoResponse.AsObject;
@ -1460,8 +1460,8 @@ export class NextBatchInfoResponse extends jspb.Message {
export namespace NextBatchInfoResponse {
export type AsObject = {
confTarget: number,
feeRateSatPerKw: number,
clearTimestamp: number,
feeRateSatPerKw: string,
clearTimestamp: string,
}
}

File diff suppressed because it is too large Load diff

View file

@ -11,10 +11,7 @@ import Big from 'big.js';
export const percentage = (portion: Big, whole: Big, decimals = 0): number => {
if (whole.eq(0)) return 0;
// needed because RoundingMode.RoundDown is a `const enum` which we cannot use
// with '--isolatedModules'
const roundDown = 0;
return +portion.mul(100).div(whole).round(decimals, roundDown);
return +portion.mul(100).div(whole).round(decimals, Big.roundDown);
};
/**
@ -35,11 +32,6 @@ export const toBasisPoints = (value: number) => Math.round(toPercent(value) * 10
* @param premium the premium being paid for the loan
* @param termInDays the term of the loan in days
*/
export const annualPercentRate = (
principal: number,
premium: number,
termInDays: number,
) => {
const apr = (premium / principal / termInDays) * 365;
return apr;
export const annualPercentRate = (principal: Big, premium: Big, termInDays: number) => {
return +premium.div(principal).div(termInDays).mul(365);
};

View file

@ -20,7 +20,7 @@ export const lndGetInfo: LND.GetInfoResponse.AsObject = {
numPeers: 1,
blockHeight: 185,
blockHash: '547d3dcfb7d56532bed2efdeea0d400f11167b34d493bcd45fedb21f2ef7ed43',
bestHeaderTimestamp: 1586548672,
bestHeaderTimestamp: '1586548672',
syncedToChain: false,
syncedToGraph: true,
testnet: false,
@ -63,18 +63,18 @@ export const lndGetNodeInfo: Required<LND.NodeInfo.AsObject> = {
pubKey: '037136742c67e24681f36542f7c8916aa6f6fdf665c1dca2a107425503cff94501',
},
numChannels: 3,
totalCapacity: 47000000,
totalCapacity: '47000000',
};
export const lndChannelBalance: LND.ChannelBalanceResponse.AsObject = {
balance: 9990950,
pendingOpenBalance: 0,
balance: '9990950',
pendingOpenBalance: '0',
};
export const lndWalletBalance: LND.WalletBalanceResponse.AsObject = {
totalBalance: 84992363,
confirmedBalance: 84992363,
unconfirmedBalance: 0,
totalBalance: '84992363',
confirmedBalance: '84992363',
unconfirmedBalance: '0',
accountBalanceMap: [],
};
@ -85,39 +85,39 @@ export const lndChannel: LND.Channel.AsObject = {
remotePubkey: '037136742c67e24681f36542f7c8916aa6f6fdf665c1dca2a107425503cff94501',
channelPoint: `${txId}:${outIndex}`,
chanId: '124244814004224',
capacity: 15000000,
localBalance: 9988660,
remoteBalance: 4501409,
commitFee: 11201,
commitWeight: 896,
feePerKw: 12500,
unsettledBalance: 498730,
totalSatoshisSent: 1338,
totalSatoshisReceived: 499929,
numUpdates: 6,
capacity: '15000000',
localBalance: '9988660',
remoteBalance: '4501409',
commitFee: '11201',
commitWeight: '896',
feePerKw: '12500',
unsettledBalance: '498730',
totalSatoshisSent: '1338',
totalSatoshisReceived: '499929',
numUpdates: '6',
pendingHtlcsList: [
{
incoming: false,
amount: 498730,
amount: '498730',
hashLock: 'pl8fmsyoSqEQFQCw6Zu9e1aIlFnMz5H+hW2mmh3kRlI=',
expirationHeight: 285,
htlcIndex: 0,
forwardingChannel: 124244814004224,
forwardingHtlcIndex: 0,
htlcIndex: '0',
forwardingChannel: '124244814004224',
forwardingHtlcIndex: '0',
},
],
csvDelay: 1802,
pb_private: false,
initiator: true,
chanStatusFlags: 'ChanStatusDefault',
localChanReserveSat: 150000,
remoteChanReserveSat: 150000,
localChanReserveSat: '150000',
remoteChanReserveSat: '150000',
staticRemoteKey: true,
commitmentType: LND.CommitmentType.STATIC_REMOTE_KEY,
lifetime: 21802,
uptime: 21802,
lifetime: '21802',
uptime: '21802',
closeAddress: '',
pushAmountSat: 5000000,
pushAmountSat: '5000000',
thawHeight: 0,
};
@ -133,10 +133,10 @@ export const lndListChannelsMany: LND.ListChannelsResponse.AsObject = {
chanId: `${i || ''}${c.chanId}`,
channelPoint: `${c.channelPoint.substring(0, c.channelPoint.length - 2)}:${i}`,
remotePubkey: `${i || ''}${c.remotePubkey}`,
localBalance: local,
remoteBalance: cap - local,
capacity: cap,
uptime: Math.floor(Math.random() * (c.lifetime / 2)) + c.lifetime / 2,
localBalance: `${local}`,
remoteBalance: `${cap - local}`,
capacity: `${cap}`,
uptime: `${Math.floor(Math.random() * (+c.lifetime / 2)) + +c.lifetime / 2}`,
};
}),
};
@ -146,29 +146,29 @@ export const lndListChannels: LND.ListChannelsResponse.AsObject = {
};
export const lndPendingChannel: LND.PendingChannelsResponse.PendingChannel.AsObject = {
capacity: 500000,
capacity: '500000',
channelPoint: '987da7ae4e56a30ee841edc5a4ccf61112e98bce7d4acfdf8e71a670296d16a7:0',
commitmentType: 1,
initiator: 2,
localBalance: 0,
localChanReserveSat: 5000,
remoteBalance: 490950,
remoteChanReserveSat: 5000,
localBalance: '0',
localChanReserveSat: '5000',
remoteBalance: '490950',
remoteChanReserveSat: '5000',
remoteNodePub: '03bb934930cdcd25576aa61d08cc95214e0036f1219c435c06976e561558703290',
};
export const lndPendingChannels: LND.PendingChannelsResponse.AsObject = {
totalLimboBalance: 0,
totalLimboBalance: '0',
pendingOpenChannelsList: [
{
channel: {
...lndPendingChannel,
channelPoint: lndListChannels.channelsList[0].channelPoint,
},
commitFee: 9050,
commitWeight: 552,
commitFee: '9050',
commitWeight: '552',
confirmationHeight: 0,
feePerKw: 12500,
feePerKw: '12500',
},
],
pendingClosingChannelsList: [
@ -187,14 +187,14 @@ export const lndPendingChannels: LND.PendingChannelsResponse.AsObject = {
channelPoint: lndListChannels.channelsList[2].channelPoint,
},
commitments: {
localCommitFeeSat: 9050,
localCommitFeeSat: '9050',
localTxid: 'fe65f668a1efe1c088b0e7d44abb707cb0171ebbbe43e8f6bb985a98643f1672',
remoteCommitFeeSat: 9050,
remotePendingCommitFeeSat: 0,
remoteCommitFeeSat: '9050',
remotePendingCommitFeeSat: '0',
remotePendingTxid: '',
remoteTxid: '9850a4b1cfcfbf972f8541b26b8061ed3091ee8cbed5875167080be4be9524e7',
},
limboBalance: 0,
limboBalance: '0',
},
],
pendingForceClosingChannelsList: [
@ -206,10 +206,10 @@ export const lndPendingChannels: LND.PendingChannelsResponse.AsObject = {
anchor: 0,
blocksTilMaturity: 142,
closingTxid: '6c151252215b73547a5415051c82dd25c725c4309b93fed4f38c4c5b610c3fb0',
limboBalance: 990950,
limboBalance: '990950',
maturityHeight: 440,
pendingHtlcsList: [],
recoveredBalance: 0,
recoveredBalance: '0',
},
],
};
@ -219,7 +219,7 @@ export const lndChannelEvent: Required<LND.ChannelEventUpdate.AsObject> = {
type: LND.ChannelEventUpdate.UpdateType.OPEN_CHANNEL,
openChannel: lndChannel,
closedChannel: {
capacity: 15000000,
capacity: '15000000',
chainHash: '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206',
chanId: lndChannel.chanId,
channelPoint: lndChannel.channelPoint,
@ -227,8 +227,8 @@ export const lndChannelEvent: Required<LND.ChannelEventUpdate.AsObject> = {
closeType: 0,
closingTxHash: '1f765f45f2a6d33837a203e3fc911915c891e9b86f9c9d91a1931b92efdedf5b',
remotePubkey: '030e98fdacf2464bdfb027b866a018d6cdc5108514208988873abea7eff59afd91',
settledBalance: 12990950,
timeLockedBalance: 0,
settledBalance: '12990950',
timeLockedBalance: '0',
openInitiator: 1,
closeInitiator: 1,
resolutionsList: [],
@ -250,7 +250,7 @@ export const lndChannelEvent: Required<LND.ChannelEventUpdate.AsObject> = {
};
export const lndTransaction: LND.Transaction.AsObject = {
amount: 12990950,
amount: '12990950',
blockHash: '',
blockHeight: 0,
destAddressesList: [
@ -260,8 +260,8 @@ export const lndTransaction: LND.Transaction.AsObject = {
numConfirmations: 0,
rawTxHex:
'02000000000101a8e7e18989480f10638b5ff610cf4b9f1e850498f27351e29161ac7058e4e46e0000000000ffffffff0280841e000000000016001440d80dab5140fb45bd58632c6d84b453c76ece6fe639c60000000000160014b2106d044df68f79e830c517b7718cae1531302d040047304402207e17f9938f04a2379300a5c0f37305c902855fa000726bb7f0ad78d084acfcee02206d3da5edd73624d6ecfa27ae61e994e75bd0ad8cca6c9b7dda087bcf34b2bbbc0148304502210086d0b7e77b1d81f210d55bc13f9eef975774ac1509a22ff649bd2baac85b3fd702203bb272d6372450159b89ca41d97efbf6bdac076bc271696a1bd556efc31b5cda01475221028d084ada5554c83421bfac35bc78332f3c1f6ae980dea1e0eb3220411b7b83972103c60b39c8558f280fe2f0dfa7cb6a04f016470c4670e631458b400774a667610052ae00000000',
timeStamp: 1591226124,
totalFees: 0,
timeStamp: '1591226124',
totalFees: '0',
txHash: '1f765f45f2a6d33837a203e3fc911915c891e9b86f9c9d91a1931b92efdedf5b',
label: '',
};
@ -272,23 +272,23 @@ export const lndGetChanInfo: Required<LND.ChannelEdge.AsObject> = {
lastUpdate: 1591622793,
node1Pub: lndGetInfo.identityPubkey,
node2Pub: '021626ad63f6876f2baa6000739312690b027ec289b9d1bf9184f3194e8c923dad',
capacity: 1800000,
capacity: '1800000',
node1Policy: {
timeLockDelta: 3000,
minHtlc: 1000,
feeBaseMsat: 3000,
feeRateMilliMsat: 300,
minHtlc: '1000',
feeBaseMsat: '3000',
feeRateMilliMsat: '300',
disabled: false,
maxHtlcMsat: 1782000000,
maxHtlcMsat: '1782000000',
lastUpdate: 1591622793,
},
node2Policy: {
timeLockDelta: 40,
minHtlc: 1000,
feeBaseMsat: 1000,
feeRateMilliMsat: 1,
minHtlc: '1000',
feeBaseMsat: '1000',
feeRateMilliMsat: '1',
disabled: false,
maxHtlcMsat: 1782000000,
maxHtlcMsat: '1782000000',
lastUpdate: 1591622772,
},
};
@ -299,49 +299,49 @@ export const lndGetChanInfo: Required<LND.ChannelEdge.AsObject> = {
export const loopListSwaps: LOOP.ListSwapsResponse.AsObject = {
swapsList: [...Array(7)].map((x, i) => ({
amt: 500000 + i * 5000,
amt: `${500000 + i * 5000}`,
id: `f4eb118383c2b09d8c7289ce21c25900cfb4545d46c47ed23a31ad2aa57ce83${i}`,
idBytes: '9OsRg4PCsJ2MconOIcJZAM+0VF1GxH7SOjGtKqV86DU=',
type: (i % 3) as LOOP.SwapStatus.AsObject['type'],
state: i % 2 ? LOOP.SwapState.SUCCESS : LOOP.SwapState.FAILED,
failureReason: (i % 2 === 0 ? 0 : i % 7) as LOOP.SwapStatus.AsObject['failureReason'],
initiationTime: 1586390353623905000 + i * 100000000000000,
lastUpdateTime: 1586398369729857000 + i * 200000000000000,
initiationTime: `${1586390353623905000 + i * 100000000000000}`,
lastUpdateTime: `${1586398369729857000 + i * 200000000000000}`,
htlcAddress: 'bcrt1qzu4077erkr78k52yuf2rwkk6ayr6m3wtazdfz2qqmd7taa5vvy9s5d75gd',
htlcAddressP2wsh: 'bcrt1qzu4077erkr78k52yuf2rwkk6ayr6m3wtazdfz2qqmd7taa5vvy9s5d75gd',
htlcAddressNp2wsh: '',
costServer: 66,
costOnchain: 6812,
costOffchain: 2,
costServer: '66',
costOnchain: '6812',
costOffchain: '2',
label: `Sample Swap #${i + 1}`,
})),
};
export const loopOutTerms: LOOP.OutTermsResponse.AsObject = {
minSwapAmount: 250000,
maxSwapAmount: 1000000,
minSwapAmount: '250000',
maxSwapAmount: '1000000',
minCltvDelta: 20,
maxCltvDelta: 60,
};
export const loopInTerms: LOOP.InTermsResponse.AsObject = {
minSwapAmount: 250000,
maxSwapAmount: 1000000,
minSwapAmount: '250000',
maxSwapAmount: '1000000',
};
export const loopOutQuote: LOOP.OutQuoteResponse.AsObject = {
cltvDelta: 50,
htlcSweepFeeSat: 7387,
prepayAmtSat: 1337,
swapFeeSat: 83,
htlcSweepFeeSat: '7387',
prepayAmtSat: '1337',
swapFeeSat: '83',
swapPaymentDest: 'Au1a9/hEsbxHUOwFC1QwxZq6EnnKYtpAdc74OZK8/syU',
confTarget: 6,
};
export const loopInQuote: LOOP.InQuoteResponse.AsObject = {
cltvDelta: 50,
htlcPublishFeeSat: 7387,
swapFeeSat: 83,
htlcPublishFeeSat: '7387',
swapFeeSat: '83',
confTarget: 6,
};
@ -359,7 +359,7 @@ export const loopSwapResponse: LOOP.SwapResponse.AsObject = {
//
export const poolInitAccount: POOL.Account.AsObject = {
availableBalance: 10000000,
availableBalance: '10000000',
latestTxid: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
expirationHeight: 4334,
outpoint: {
@ -368,12 +368,12 @@ export const poolInitAccount: POOL.Account.AsObject = {
},
state: POOL.AccountState.OPEN,
traderKey: 'Ap+9XjK2X8EOrmAJvcvWS1B9jt3xLYka0S7aMru0Bude',
value: 30000000,
value: '30000000',
};
export const poolQuoteAccount: POOL.QuoteAccountResponse.AsObject = {
minerFeeRateSatPerKw: 12500,
minerFeeTotal: 7650,
minerFeeRateSatPerKw: '12500',
minerFeeTotal: '7650',
};
export const poolCloseAccount: POOL.CloseAccountResponse.AsObject = {
@ -389,7 +389,7 @@ export const poolListAccounts: POOL.ListAccountsResponse.AsObject = {
accountsList: [
poolInitAccount,
{
availableBalance: 15000000,
availableBalance: '15000000',
latestTxid: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
expirationHeight: 4331,
outpoint: {
@ -398,10 +398,10 @@ export const poolListAccounts: POOL.ListAccountsResponse.AsObject = {
},
state: POOL.AccountState.OPEN,
traderKey: 'A1XCKczWrUUjZg4rmtYoQnji2mGEyLxM8FvIPZ9ZnRCk',
value: 15000000,
value: '15000000',
},
{
availableBalance: 7773185,
availableBalance: '7773185',
latestTxid: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=',
expirationHeight: 4328,
outpoint: {
@ -410,7 +410,7 @@ export const poolListAccounts: POOL.ListAccountsResponse.AsObject = {
},
state: POOL.AccountState.OPEN,
traderKey: 'A9Mua6d2a+1NZZ8knxJ/XtE3VENxQO4erD9Y3igCmH9q',
value: 10000000,
value: '10000000',
},
],
};
@ -429,7 +429,7 @@ export const poolWithdrawAccount: Required<POOL.WithdrawAccountResponse.AsObject
account: {
...poolInitAccount,
state: POOL.AccountState.PENDING_UPDATE,
value: poolInitAccount.value - 1,
value: `${+poolInitAccount.value - 1}`,
},
};
@ -439,14 +439,14 @@ export const poolListOrders: POOL.ListOrdersResponse.AsObject = {
details: {
traderKey: poolInitAccount.traderKey,
rateFixed: 4960,
amt: 3000000,
maxBatchFeeRateSatPerKw: 25000,
amt: '3000000',
maxBatchFeeRateSatPerKw: '25000',
orderNonce: 'Iw842N6B77EGuZCy5oiBDRAvJrQoIrlsjPosuKevT9g=',
state: AUCT.OrderState.ORDER_EXECUTED,
units: 30,
unitsUnfulfilled: 0,
reservedValueSat: 0,
creationTimestampNs: 1605370663652010000,
reservedValueSat: '0',
creationTimestampNs: '1605370663652010000',
eventsList: [],
minUnitsMatch: 1,
},
@ -459,84 +459,84 @@ export const poolListOrders: POOL.ListOrdersResponse.AsObject = {
details: {
traderKey: poolInitAccount.traderKey,
rateFixed: 4960,
amt: 2000000,
maxBatchFeeRateSatPerKw: 25000,
amt: '2000000',
maxBatchFeeRateSatPerKw: '25000',
orderNonce: 'NWKpd8HC5zIWr4f2CRbLEVv+g9s5LeArnK9xREAZ2mY=',
state: AUCT.OrderState.ORDER_EXECUTED,
units: 20,
unitsUnfulfilled: 0,
reservedValueSat: 0,
creationTimestampNs: 1605371586127059200,
reservedValueSat: '0',
creationTimestampNs: '1605371586127059200',
eventsList: [],
minUnitsMatch: 1,
},
leaseDurationBlocks: 2016,
version: 1,
minNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarTicket: '',
},
{
details: {
traderKey: poolInitAccount.traderKey,
rateFixed: 2480,
amt: 2000000,
maxBatchFeeRateSatPerKw: 25000,
amt: '2000000',
maxBatchFeeRateSatPerKw: '25000',
orderNonce: 'nRXHe7gMTmox7AXMW6yVYg9Lp4ZMNps6KRGQXH4PXu8=',
state: AUCT.OrderState.ORDER_PARTIALLY_FILLED,
units: 20,
unitsUnfulfilled: 10,
reservedValueSat: 169250,
creationTimestampNs: 1605372478047663000,
reservedValueSat: '169250',
creationTimestampNs: '1605372478047663000',
eventsList: [],
minUnitsMatch: 1,
},
leaseDurationBlocks: 2016,
version: 1,
minNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarTicket: '',
},
{
details: {
traderKey: poolInitAccount.traderKey,
rateFixed: 826,
amt: 3000000,
maxBatchFeeRateSatPerKw: 25000,
amt: '3000000',
maxBatchFeeRateSatPerKw: '25000',
orderNonce: 'ZVQRWJ8pTkV5ln/ekUlFICajxLH4M7/B1rdCR8z+eqw=',
state: AUCT.OrderState.ORDER_CANCELED,
units: 30,
unitsUnfulfilled: 30,
reservedValueSat: 0,
creationTimestampNs: 1605372382040897300,
reservedValueSat: '0',
creationTimestampNs: '1605372382040897300',
eventsList: [],
minUnitsMatch: 1,
},
leaseDurationBlocks: 2016,
version: 1,
minNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarTicket: '',
},
{
details: {
traderKey: poolInitAccount.traderKey,
rateFixed: 1240,
amt: 2000000,
maxBatchFeeRateSatPerKw: 25000,
amt: '2000000',
maxBatchFeeRateSatPerKw: '25000',
orderNonce: 'BAgKGEv94LUG6lizcf0LxT3CJiqMTpvq27XRqr/IG00=',
state: AUCT.OrderState.ORDER_SUBMITTED,
units: 20,
unitsUnfulfilled: 20,
reservedValueSat: 333500,
creationTimestampNs: 1605372096883950800,
reservedValueSat: '333500',
creationTimestampNs: '1605372096883950800',
eventsList: [],
minUnitsMatch: 1,
},
leaseDurationBlocks: 2016,
version: 1,
minNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarTicket: '',
},
],
@ -545,9 +545,9 @@ export const poolListOrders: POOL.ListOrdersResponse.AsObject = {
export const poolQuoteOrder: POOL.QuoteOrderResponse.AsObject = {
ratePerBlock: 0.00000248,
ratePercent: 0.000248,
totalExecutionFeeSat: 5001,
totalPremiumSat: 24998,
worstCaseChainFeeSat: 40810,
totalExecutionFeeSat: '5001',
totalPremiumSat: '24998',
worstCaseChainFeeSat: '40810',
};
export const poolSubmitOrder: POOL.SubmitOrderResponse.AsObject = {
@ -567,7 +567,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
batchId: 'A64GSAcrLtlDCUmKXLAv2bxngryfrSxrK9W8s+cl7Vb4',
prevBatchId: 'Ag/jvmtyBec1qrOj1FuswaZozPADVTguxmLjCa+E4wYS',
clearingPriceRate: 19841,
creationTimestampNs: 1610763907325185500,
creationTimestampNs: '1610763907325185500',
matchedOrdersList: [],
matchedMarketsMap: [
[
@ -589,7 +589,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
chanType: 0,
},
matchingRate: 19841,
totalSatsCleared: 7700000,
totalSatsCleared: '7700000',
unitsMatched: 77,
},
{
@ -606,7 +606,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
chanType: 0,
},
matchingRate: 19841,
totalSatsCleared: 30000000,
totalSatsCleared: '30000000',
unitsMatched: 300,
},
],
@ -631,7 +631,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
chanType: 0,
},
matchingRate: 19841,
totalSatsCleared: 7700000,
totalSatsCleared: '7700000',
unitsMatched: 77,
},
{
@ -648,7 +648,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
chanType: 0,
},
matchingRate: 19841,
totalSatsCleared: 20000000,
totalSatsCleared: '20000000',
unitsMatched: 300,
},
],
@ -658,7 +658,7 @@ export const poolBatchSnapshot: AUCT.BatchSnapshotResponse.AsObject = {
batchTxId: '6f29af3cb54480fec52d3a48ba94a5327aa31ed2c3b85ee8f0fd0da2f5ea8620',
batchTx:
'02000000000103f1a75ac5d0fdd52393410f71ead0bd9ab8d0af3974d47e86dde91c76cab46bb9010000000000000000f1a75ac5d0fdd52393410f71ead0bd9ab8d0af3974d47e86dde91c76cab46bb90300000000000000004324d5c4a412675ee5262aaa5afcca95ecdeb94764145823b93a41c53a7d07ef0600000000000000000523751100000000002200200dd535051271e7718bedb65e6861b31815a644b91d3a5107a74fa8ee16c823ed207e750000000000220020a70ab73d7d1c2efaeb280e26b98df9761d8e37cb3160cafc29381e8086254f7180c3c9010000000022002050dba23ca20d53adf5f94695040839c0be1ef609b70e19713c1d88d7d0db04f5c008fe0200000000220020bb8bc3b7c011060ff4002ab1c995a4eddcd1b4ef41aee5dca690a2903ede53ea24819e0300000000220020a3e3dfb76e7a4e72634bb5ee3006491fffbaecafe8882554d9a6b434f0b841aa02473044022066fe9cc1b0ecc84367839cdbaad606888260e6349d6c21f22186660f78dbe38202206fa0066fd0a4385348c615777b3e751db5f5d8306771522445a873dc7bed56a101232103d7c453a1aefcbbc6043372036db9d76816f830865392f97a262c447b59eb332eac03483045022100db6895c68e4cbd5fb83af7c37164dbf3da0c1222fb55177c4c367f05e9bed55902206b4775bb1c978380f95a9c444f392a53803b8b6d5508d41d0982a540d0c9062601483045022100ecc4ccaf440eae13e2afb8461f1c28d66af87f7e5d880732ae2fe72f85d5572302204656d5dbc963166c7bd92a93631fe49e20e4b1121914ca76e7cb87c3d983ee5a014e2103c736dec8b8f45cecd32fcedfcb8c0be92a2a3b40bffa8b1ce64640972a19fc49ad2102c642aaf70c56aa156db9546fc6e76c484b6a091b645fb848fd51916bd1e931caac736403cc531cb16803483045022100ed30c4f090dbe19d4f1dcb28f2701cf8a0bbf671a360d217384332248502de6c022025dac44cd380eda709bda3cbe6dbbe7a916549994bd72e48470a322a89fbbfba01473044022070c7e4909786fe5d482f35e1301d5cd2b5932c91b23d16bf699fe6bf455165220220015a3241a84620a27c110f307906f7047262947694c29b4752891d8b00153054014e2103305a3323068e66461ac3b247a2bfdc339959c3975da0ac4677e4d027462aaa14ad2102e2ec3f93e098e073490ad19fda9c11a92e2ed02ed3eecc5527972dba99b6d4e1ac736403a4f51bb16800000000',
batchTxFeeRateSatPerKw: 12574,
batchTxFeeRateSatPerKw: '12574',
};
export const poolBatchSnapshots: AUCT.BatchSnapshotsResponse.AsObject = {
@ -680,9 +680,9 @@ export const poolLeaseDurations: POOL.LeaseDurationResponse.AsObject = {
};
export const poolNextBatchInfo: POOL.NextBatchInfoResponse.AsObject = {
clearTimestamp: 1605936138,
clearTimestamp: '1605936138',
confTarget: 6,
feeRateSatPerKw: 12500,
feeRateSatPerKw: '12500',
};
export const poolNodeRatings: POOL.NodeRatingResponse.AsObject = {
@ -702,92 +702,92 @@ export const poolLeases: POOL.LeasesResponse.AsObject = {
leasesList: [
{
channelPoint: stringToChannelPoint(lndListChannels.channelsList[5].channelPoint),
channelAmtSat: 1000000,
channelAmtSat: '1000000',
channelDurationBlocks: 2016,
channelLeaseExpiry: 2304,
premiumSat: 9999,
executionFeeSat: 1001,
chainFeeSat: 4606,
clearingRatePrice: 4960,
orderFixedRate: 4960,
premiumSat: '9999',
executionFeeSat: '1001',
chainFeeSat: '4606',
clearingRatePrice: '4960',
orderFixedRate: '4960',
orderNonce: 'Iw842N6B77EGuZCy5oiBDRAvJrQoIrlsjPosuKevT9g=',
purchased: false,
channelRemoteNodeKey: 'ArW+q/+aS+teUy/E6TgVgVZ2sQ9wX/YJBbwH6if4SuLA',
channelNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarChannel: false,
},
{
channelPoint: stringToChannelPoint(lndListChannels.channelsList[6].channelPoint),
channelAmtSat: 2000000,
channelAmtSat: '2000000',
channelDurationBlocks: 2016,
channelLeaseExpiry: 2304,
premiumSat: 19998,
executionFeeSat: 2001,
chainFeeSat: 4606,
clearingRatePrice: 4960,
orderFixedRate: 4960,
premiumSat: '19998',
executionFeeSat: '2001',
chainFeeSat: '4606',
clearingRatePrice: '4960',
orderFixedRate: '4960',
orderNonce: 'Iw842N6B77EGuZCy5oiBDRAvJrQoIrlsjPosuKevT9g=',
purchased: false,
channelRemoteNodeKey: 'A9L6+xEwFa2vULND3YYfdoCQwHqlzE5UyLvvQ+gfapg+',
channelNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarChannel: false,
},
{
channelPoint: stringToChannelPoint(lndListChannels.channelsList[7].channelPoint),
channelAmtSat: 1000000,
channelAmtSat: '1000000',
channelDurationBlocks: 2016,
channelLeaseExpiry: 2317,
premiumSat: 9999,
executionFeeSat: 1001,
chainFeeSat: 4606,
clearingRatePrice: 4960,
orderFixedRate: 4960,
premiumSat: '9999',
executionFeeSat: '1001',
chainFeeSat: '4606',
clearingRatePrice: '4960',
orderFixedRate: '4960',
orderNonce: 'NWKpd8HC5zIWr4f2CRbLEVv+g9s5LeArnK9xREAZ2mY=',
purchased: true,
channelRemoteNodeKey: 'A9L6+xEwFa2vULND3YYfdoCQwHqlzE5UyLvvQ+gfapg+',
channelNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarChannel: false,
},
{
channelPoint: stringToChannelPoint(lndListChannels.channelsList[8].channelPoint),
channelAmtSat: 1000000,
channelAmtSat: '1000000',
channelDurationBlocks: 2016,
channelLeaseExpiry: 2317,
premiumSat: 9999,
executionFeeSat: 1001,
chainFeeSat: 4606,
clearingRatePrice: 4960,
orderFixedRate: 4960,
premiumSat: '9999',
executionFeeSat: '1001',
chainFeeSat: '4606',
clearingRatePrice: '4960',
orderFixedRate: '4960',
orderNonce: 'NWKpd8HC5zIWr4f2CRbLEVv+g9s5LeArnK9xREAZ2mY=',
purchased: true,
channelRemoteNodeKey: 'ArW+q/+aS+teUy/E6TgVgVZ2sQ9wX/YJBbwH6if4SuLA',
channelNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarChannel: false,
},
{
channelPoint: stringToChannelPoint(lndListChannels.channelsList[9].channelPoint),
channelAmtSat: 1000000,
channelAmtSat: '1000000',
channelDurationBlocks: 2016,
channelLeaseExpiry: 2320,
premiumSat: 4999,
executionFeeSat: 1001,
chainFeeSat: 8162,
clearingRatePrice: 2480,
orderFixedRate: 2480,
premiumSat: '4999',
executionFeeSat: '1001',
chainFeeSat: '8162',
clearingRatePrice: '2480',
orderFixedRate: '2480',
orderNonce: 'nRXHe7gMTmox7AXMW6yVYg9Lp4ZMNps6KRGQXH4PXu8=',
purchased: true,
channelRemoteNodeKey: 'A9L6+xEwFa2vULND3YYfdoCQwHqlzE5UyLvvQ+gfapg+',
channelNodeTier: 1,
selfChanBalance: 0,
selfChanBalance: '0',
sidecarChannel: false,
},
],
totalAmtEarnedSat: 29997,
totalAmtPaidSat: 57588,
totalAmtEarnedSat: '29997',
totalAmtPaidSat: '57588',
};
export const poolRegisterSidecar: POOL.SidecarTicket.AsObject = {

View file

@ -2738,10 +2738,10 @@
dependencies:
"@babel/types" "^7.3.0"
"@types/big.js@4.0.5":
version "4.0.5"
resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-4.0.5.tgz#62c61697646269e39191f24e55e8272f05f21fc0"
integrity sha512-D9KFrAt05FDSqLo7PU9TDHfDgkarlwdkuwFsg7Zm4xl62tTNaz+zN+Tkcdx2wGLBbSMf8BnoMhOVeUGUaJfLKg==
"@types/big.js@6.1.1":
version "6.1.1"
resolved "https://registry.yarnpkg.com/@types/big.js/-/big.js-6.1.1.tgz#c2be5e81e0cf0c1c31704e3b12f750712f647414"
integrity sha512-Zns+nT0hj96ie+GDbL5NeHxhL4wNz8QMxCHqBvxgc4x0hhgQ/o92rPwqxvPBhY3ZYnH8TJGw/8oCkjhOy2Rfzw==
"@types/d3-array@*":
version "3.0.1"
@ -4763,7 +4763,12 @@ bfj@^7.0.2:
hoopy "^0.1.4"
tryer "^1.0.1"
big.js@5.2.2, big.js@^5.2.2:
big.js@6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-6.1.1.tgz#63b35b19dc9775c94991ee5db7694880655d5537"
integrity sha512-1vObw81a8ylZO5ePrtMay0n018TcftpTA5HFKDaSuiUDBo8biRBtjIobw60OpwuvrGk+FsxKamqN4cnmj/eXdg==
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==

View file

@ -48,7 +48,7 @@ message ReserveAccountRequest {
/*
The desired value of the account in satoshis.
*/
uint64 account_value = 1;
uint64 account_value = 1 [jstype = JS_STRING];
/*
The block height at which the account should expire.
@ -94,7 +94,7 @@ message ServerInitAccountRequest {
The value of the account in satoshis. Must match the amount of the
account_point output.
*/
uint64 account_value = 3;
uint64 account_value = 3 [jstype = JS_STRING];
/*
The block height at which the account should expire.
@ -519,13 +519,13 @@ message OrderMatchPrepare {
Fee rate of the batch transaction, expressed in satoshis per 1000 weight
units (sat/kW).
*/
uint64 fee_rate_sat_per_kw = 6;
uint64 fee_rate_sat_per_kw = 6 [jstype = JS_STRING];
/*
Fee rebate in satoshis, offered if another batch participant wants to pay
more fees for a faster confirmation.
*/
uint64 fee_rebate_sat = 7;
uint64 fee_rebate_sat = 7 [jstype = JS_STRING];
/*
The 32 byte unique identifier of this batch.
@ -666,7 +666,7 @@ message AuctionAccount {
The value of the account in satoshis. Must match the amount of the
account_point output.
*/
uint64 value = 1;
uint64 value = 1 [jstype = JS_STRING];
/*
The block height at which the account should expire.
@ -760,7 +760,7 @@ message AccountDiff {
/*
The final balance of the account after the executed batch.
*/
uint64 ending_balance = 1;
uint64 ending_balance = 1 [jstype = JS_STRING];
/*
Depending on the amount of the final balance of the account, the remainder
@ -797,9 +797,9 @@ message ServerOrder {
/*
Order amount in satoshis.
*/
uint64 amt = 3;
uint64 amt = 3 [jstype = JS_STRING];
uint64 min_chan_amt = 4;
uint64 min_chan_amt = 4 [jstype = JS_STRING];
// TODO(guggero): implement
// repeated bytes must_fill_pub = 5;
@ -836,7 +836,7 @@ message ServerOrder {
/*
// TODO(guggero): implement
int64 min_node_score = 11;
int64 min_node_score = 11 [jstype = JS_STRING];
*/
reserved 11;
@ -849,7 +849,7 @@ message ServerOrder {
Maximum fee rate the trader is willing to pay for the batch transaction,
expressed in satoshis per 1000 weight units (sat/kW).
*/
uint64 max_batch_fee_rate_sat_per_kw = 13;
uint64 max_batch_fee_rate_sat_per_kw = 13 [jstype = JS_STRING];
}
enum NodeTier {
@ -905,7 +905,7 @@ message ServerBid {
as the order amount and the min_chan_amt must be set to the full order
amount.
*/
uint64 self_chan_balance = 6;
uint64 self_chan_balance = 6 [jstype = JS_STRING];
/*
If this bid order is meant to lease a channel for another node (which is
@ -960,7 +960,7 @@ message ServerInput {
message ServerOutput {
// The value, in satoshis, of the output.
uint64 value = 1;
uint64 value = 1 [jstype = JS_STRING];
// The script of the output to send the value to.
bytes script = 2;
@ -988,7 +988,7 @@ message ServerModifyAccountRequest {
message NewAccountParameters {
// The new value of the account.
uint64 value = 1;
uint64 value = 1 [jstype = JS_STRING];
// The new expiry of the account as an absolute height.
uint32 expiry = 2;
@ -1067,7 +1067,7 @@ message TermsResponse {
/*
The maximum account size in satoshis currently allowed by the auctioneer.
*/
uint64 max_account_value = 1;
uint64 max_account_value = 1 [jstype = JS_STRING];
/*
Deprecated, use explicit order duration from lease_duration_buckets.
@ -1091,13 +1091,13 @@ message TermsResponse {
The fee rate, in satoshis per kiloweight, estimated to use for the next
batch.
*/
uint64 next_batch_fee_rate_sat_per_kw = 6;
uint64 next_batch_fee_rate_sat_per_kw = 6 [jstype = JS_STRING];
/*
The absolute unix timestamp at which the auctioneer will attempt to clear
the next batch.
*/
uint64 next_batch_clear_timestamp = 7;
uint64 next_batch_clear_timestamp = 7 [jstype = JS_STRING];
/*
The set of lease durations the market is currently accepting and the state
@ -1150,10 +1150,10 @@ message RelevantBatch {
Fee rate of the batch transaction, expressed in satoshis per 1000 weight
units (sat/kW).
*/
uint64 fee_rate_sat_per_kw = 8;
uint64 fee_rate_sat_per_kw = 8 [jstype = JS_STRING];
// The unix timestamp in nanoseconds the batch was made.
uint64 creation_timestamp_ns = 9;
uint64 creation_timestamp_ns = 9 [jstype = JS_STRING];
/*
Maps the distinct lease duration markets to the orders that were matched
@ -1166,12 +1166,12 @@ message ExecutionFee {
/*
The base fee in satoshis charged per order, regardless of the matched size.
*/
uint64 base_fee = 1;
uint64 base_fee = 1 [jstype = JS_STRING];
/*
The fee rate in parts per million.
*/
uint64 fee_rate = 2;
uint64 fee_rate = 2 [jstype = JS_STRING];
}
message NodeAddress {
@ -1228,7 +1228,7 @@ message MatchedOrderSnapshot {
uint32 matching_rate = 3;
// The total number of satoshis that were bought.
uint64 total_sats_cleared = 4;
uint64 total_sats_cleared = 4 [jstype = JS_STRING];
// The total number of units that were matched.
uint32 units_matched = 5;
@ -1279,10 +1279,10 @@ message BatchSnapshotResponse {
bytes batch_tx = 6;
// The fee rate, in satoshis per kiloweight, of the batch transaction.
uint64 batch_tx_fee_rate_sat_per_kw = 8;
uint64 batch_tx_fee_rate_sat_per_kw = 8 [jstype = JS_STRING];
// The unix timestamp in nanoseconds the batch was made.
uint64 creation_timestamp_ns = 9;
uint64 creation_timestamp_ns = 9 [jstype = JS_STRING];
/*
Maps the distinct lease duration markets to the orders that were matched

File diff suppressed because it is too large Load diff

View file

@ -146,7 +146,7 @@ message LoopOutRequest {
/*
Requested swap amount in sat. This does not include the swap and miner fee.
*/
int64 amt = 1;
int64 amt = 1 [jstype = JS_STRING];
/*
Base58 encoded destination address for the swap.
@ -158,14 +158,14 @@ message LoopOutRequest {
This limit is applied during path finding. Typically this value is taken
from the response of the GetQuote call.
*/
int64 max_swap_routing_fee = 3;
int64 max_swap_routing_fee = 3 [jstype = JS_STRING];
/*
Maximum off-chain fee in sat that may be paid for the prepay to the server.
This limit is applied during path finding. Typically this value is taken
from the response of the GetQuote call.
*/
int64 max_prepay_routing_fee = 4;
int64 max_prepay_routing_fee = 4 [jstype = JS_STRING];
/*
Maximum we are willing to pay the server for the swap. This value is not
@ -173,12 +173,12 @@ message LoopOutRequest {
higher fee, we abort the swap. Typically this value is taken from the
response of the GetQuote call. It includes the prepay amount.
*/
int64 max_swap_fee = 5;
int64 max_swap_fee = 5 [jstype = JS_STRING];
/*
Maximum amount of the swap fee that may be charged as a prepayment.
*/
int64 max_prepay_amt = 6;
int64 max_prepay_amt = 6 [jstype = JS_STRING];
/*
Maximum in on-chain fees that we are willing to spend. If we want to
@ -196,21 +196,21 @@ message LoopOutRequest {
max_miner_fee is typically taken from the response of the GetQuote call.
*/
int64 max_miner_fee = 7;
int64 max_miner_fee = 7 [jstype = JS_STRING];
/*
Deprecated, use outgoing_chan_set. The channel to loop out, the channel
to loop out is selected based on the lowest routing fee for the swap
payment to the server.
*/
uint64 loop_out_channel = 8 [deprecated = true];
uint64 loop_out_channel = 8 [deprecated = true, jstype = JS_STRING];
/*
A restriction on the channel set that may be used to loop out. The actual
channel(s) that will be used are selected based on the lowest routing fee
for the swap payment to the server.
*/
repeated uint64 outgoing_chan_set = 11;
repeated uint64 outgoing_chan_set = 11 [jstype = JS_STRING];
/*
The number of blocks from the on-chain HTLC's confirmation height that it
@ -231,7 +231,7 @@ message LoopOutRequest {
low-fee periods before publishing the HTLC, potentially resulting in a
lower total swap fee.
*/
uint64 swap_publication_deadline = 10;
uint64 swap_publication_deadline = 10 [jstype = JS_STRING];
/*
An optional label for this swap. This field is limited to 500 characters
@ -255,7 +255,7 @@ message LoopInRequest {
Requested swap amount in sat. This does not include the swap and miner
fee.
*/
int64 amt = 1;
int64 amt = 1 [jstype = JS_STRING];
/*
Maximum we are willing to pay the server for the swap. This value is not
@ -263,7 +263,7 @@ message LoopInRequest {
higher fee, we abort the swap. Typically this value is taken from the
response of the GetQuote call.
*/
int64 max_swap_fee = 2;
int64 max_swap_fee = 2 [jstype = JS_STRING];
/*
Maximum in on-chain fees that we are willing to spend. If we want to
@ -272,7 +272,7 @@ message LoopInRequest {
max_miner_fee is typically taken from the response of the GetQuote call.
*/
int64 max_miner_fee = 3;
int64 max_miner_fee = 3 [jstype = JS_STRING];
/*
The last hop to use for the loop in swap. If empty, the last hop is selected
@ -358,7 +358,7 @@ message SwapStatus {
Requested swap amount in sat. This does not include the swap and miner
fee.
*/
int64 amt = 1;
int64 amt = 1 [jstype = JS_STRING];
/*
Swap identifier to track status in the update stream that is returned from
@ -392,12 +392,12 @@ message SwapStatus {
/*
Initiation time of the swap.
*/
int64 initiation_time = 5;
int64 initiation_time = 5 [jstype = JS_STRING];
/*
Initiation time of the swap.
*/
int64 last_update_time = 6;
int64 last_update_time = 6 [jstype = JS_STRING];
/*
DEPRECATED: This field stores the address of the onchain htlc.
@ -417,13 +417,13 @@ message SwapStatus {
string htlc_address_np2wsh = 13;
// Swap server cost
int64 cost_server = 8;
int64 cost_server = 8 [jstype = JS_STRING];
// On-chain transaction cost
int64 cost_onchain = 9;
int64 cost_onchain = 9 [jstype = JS_STRING];
// Off-chain routing fees
int64 cost_offchain = 10;
int64 cost_offchain = 10 [jstype = JS_STRING];
// An optional label given to the swap on creation.
string label = 15;
@ -554,12 +554,12 @@ message InTermsResponse {
/*
Minimum swap amount (sat)
*/
int64 min_swap_amount = 5;
int64 min_swap_amount = 5 [jstype = JS_STRING];
/*
Maximum swap amount (sat)
*/
int64 max_swap_amount = 6;
int64 max_swap_amount = 6 [jstype = JS_STRING];
}
message OutTermsResponse {
@ -569,12 +569,12 @@ message OutTermsResponse {
/*
Minimum swap amount (sat)
*/
int64 min_swap_amount = 5;
int64 min_swap_amount = 5 [jstype = JS_STRING];
/*
Maximum swap amount (sat)
*/
int64 max_swap_amount = 6;
int64 max_swap_amount = 6 [jstype = JS_STRING];
// The minimally accepted cltv delta of the on-chain htlc.
int32 min_cltv_delta = 8;
@ -587,7 +587,7 @@ message QuoteRequest {
/*
The amount to swap in satoshis.
*/
int64 amt = 1;
int64 amt = 1 [jstype = JS_STRING];
/*
The confirmation target that should be used either for the sweep of the
@ -610,7 +610,7 @@ message QuoteRequest {
low-fee periods before publishing the HTLC, potentially resulting in a
lower total swap fee. This only has an effect on loop out quotes.
*/
uint64 swap_publication_deadline = 4;
uint64 swap_publication_deadline = 4 [jstype = JS_STRING];
}
message InQuoteResponse {
@ -619,7 +619,7 @@ message InQuoteResponse {
/*
The fee that the swap server is charging for the swap.
*/
int64 swap_fee_sat = 1;
int64 swap_fee_sat = 1 [jstype = JS_STRING];
/*
An estimate of the on-chain fee that needs to be paid to publish the HTLC
@ -629,7 +629,7 @@ message InQuoteResponse {
create a sample estimation transaction because not enough funds are
available. An information message should be shown to the user in this case.
*/
int64 htlc_publish_fee_sat = 3;
int64 htlc_publish_fee_sat = 3 [jstype = JS_STRING];
/*
On-chain cltv expiry delta
@ -646,18 +646,18 @@ message OutQuoteResponse {
/*
The fee that the swap server is charging for the swap.
*/
int64 swap_fee_sat = 1;
int64 swap_fee_sat = 1 [jstype = JS_STRING];
/*
The part of the swap fee that is requested as a prepayment.
*/
int64 prepay_amt_sat = 2;
int64 prepay_amt_sat = 2 [jstype = JS_STRING];
/*
An estimate of the on-chain fee that needs to be paid to sweep the HTLC for
a loop out.
*/
int64 htlc_sweep_fee_sat = 3;
int64 htlc_sweep_fee_sat = 3 [jstype = JS_STRING];
/*
The node pubkey where the swap payment needs to be paid
@ -707,17 +707,17 @@ message LsatToken {
/*
The amount of millisatoshis that was paid to get the token.
*/
int64 amount_paid_msat = 4;
int64 amount_paid_msat = 4 [jstype = JS_STRING];
/*
The amount of millisatoshis paid in routing fee to pay for the token.
*/
int64 routing_fee_paid_msat = 5;
int64 routing_fee_paid_msat = 5 [jstype = JS_STRING];
/*
The creation time of the token as UNIX timestamp in seconds.
*/
int64 time_created = 6;
int64 time_created = 6 [jstype = JS_STRING];
/*
Indicates whether the token is expired or still valid.
@ -746,37 +746,37 @@ message LiquidityParameters {
conjunction with sweep fee rate, swap fee ppm, routing fee ppm, prepay
routing, max prepay and max miner fee.
*/
uint64 fee_ppm = 16;
uint64 fee_ppm = 16 [jstype = JS_STRING];
/*
The limit we place on our estimated sweep cost for a swap in sat/vByte. If
the estimated fee for our sweep transaction within the specified
confirmation target is above this value, we will not suggest any swaps.
*/
uint64 sweep_fee_rate_sat_per_vbyte = 2;
uint64 sweep_fee_rate_sat_per_vbyte = 2 [jstype = JS_STRING];
/*
The maximum fee paid to the server for facilitating the swap, expressed
as parts per million of the swap volume.
*/
uint64 max_swap_fee_ppm = 3;
uint64 max_swap_fee_ppm = 3 [jstype = JS_STRING];
/*
The maximum fee paid to route the swap invoice off chain, expressed as
parts per million of the volume being routed.
*/
uint64 max_routing_fee_ppm = 4;
uint64 max_routing_fee_ppm = 4 [jstype = JS_STRING];
/*
The maximum fee paid to route the prepay invoice off chain, expressed as
parts per million of the volume being routed.
*/
uint64 max_prepay_routing_fee_ppm = 5;
uint64 max_prepay_routing_fee_ppm = 5 [jstype = JS_STRING];
/*
The maximum no-show penalty in satoshis paid for a swap.
*/
uint64 max_prepay_sat = 6;
uint64 max_prepay_sat = 6 [jstype = JS_STRING];
/*
The maximum miner fee we will pay to sweep the swap on chain. Note that we
@ -785,7 +785,7 @@ message LiquidityParameters {
this value is only a cap placed on the amount we spend on fees in the case
where the swap needs to be claimed on chain, but fees have suddenly spiked.
*/
uint64 max_miner_fee_sat = 7;
uint64 max_miner_fee_sat = 7 [jstype = JS_STRING];
/*
The number of blocks from the on-chain HTLC's confirmation height that it
@ -798,7 +798,7 @@ message LiquidityParameters {
swap due to off chain payment failure until it will be considered for swap
suggestions again, expressed in seconds.
*/
uint64 failure_backoff_sec = 9;
uint64 failure_backoff_sec = 9 [jstype = JS_STRING];
/*
Set to true to enable automatic dispatch of swaps. All swaps will be limited
@ -811,7 +811,7 @@ message LiquidityParameters {
The total budget for automatically dispatched swaps since the budget start
time, expressed in satoshis.
*/
uint64 autoloop_budget_sat = 11;
uint64 autoloop_budget_sat = 11 [jstype = JS_STRING];
/*
The start time for autoloop budget, expressed as a unix timestamp in
@ -819,27 +819,27 @@ message LiquidityParameters {
automatically dispatched swaps. Swaps that were completed before this date
will not be included in budget calculations.
*/
uint64 autoloop_budget_start_sec = 12;
uint64 autoloop_budget_start_sec = 12 [jstype = JS_STRING];
/*
The maximum number of automatically dispatched swaps that we allow to be in
flight at any point in time.
*/
uint64 auto_max_in_flight = 13;
uint64 auto_max_in_flight = 13 [jstype = JS_STRING];
/*
The minimum amount, expressed in satoshis, that the autoloop client will
dispatch a swap for. This value is subject to the server-side limits
specified by the LoopOutTerms endpoint.
*/
uint64 min_swap_amount = 14;
uint64 min_swap_amount = 14 [jstype = JS_STRING];
/*
The maximum amount, expressed in satoshis, that the autoloop client will
dispatch a swap for. This value is subject to the server-side limits
specified by the LoopOutTerms endpoint.
*/
uint64 max_swap_amount = 15;
uint64 max_swap_amount = 15 [jstype = JS_STRING];
}
enum LiquidityRuleType {
@ -852,7 +852,7 @@ message LiquidityRule {
The short channel ID of the channel that this rule should be applied to.
This field may not be set when the pubkey field is set.
*/
uint64 channel_id = 1;
uint64 channel_id = 1 [jstype = JS_STRING];
/*
The public key of the peer that this rule should be applied to. This field

View file

@ -188,7 +188,7 @@ service Trader {
}
message InitAccountRequest {
uint64 account_value = 1;
uint64 account_value = 1 [jstype = JS_STRING];
oneof account_expiry {
uint32 absolute_height = 2;
@ -216,7 +216,7 @@ message InitAccountRequest {
}
message QuoteAccountRequest {
uint64 account_value = 1;
uint64 account_value = 1 [jstype = JS_STRING];
oneof fees {
/*
@ -230,9 +230,9 @@ message QuoteAccountRequest {
}
message QuoteAccountResponse {
uint64 miner_fee_rate_sat_per_kw = 1;
uint64 miner_fee_rate_sat_per_kw = 1 [jstype = JS_STRING];
uint64 miner_fee_total = 2;
uint64 miner_fee_total = 2 [jstype = JS_STRING];
}
message ListAccountsRequest {
@ -247,7 +247,7 @@ message ListAccountsResponse {
message Output {
// The value, in satoshis, of the output.
uint64 value_sat = 1;
uint64 value_sat = 1 [jstype = JS_STRING];
// The address corresponding to the output.
string address = 2;
@ -266,7 +266,7 @@ message OutputWithFee {
/*
The fee rate, in satoshis per kw, to use for the withdrawal transaction.
*/
uint64 fee_rate_sat_per_kw = 3;
uint64 fee_rate_sat_per_kw = 3 [jstype = JS_STRING];
}
}
@ -314,7 +314,7 @@ message WithdrawAccountRequest {
/*
The fee rate, in satoshis per kw, to use for the withdrawal transaction.
*/
uint64 fee_rate_sat_per_kw = 3;
uint64 fee_rate_sat_per_kw = 3 [jstype = JS_STRING];
}
message WithdrawAccountResponse {
// The state of the account after processing the withdrawal.
@ -332,12 +332,12 @@ message DepositAccountRequest {
bytes trader_key = 1;
// The amount in satoshis to deposit into the account.
uint64 amount_sat = 2;
uint64 amount_sat = 2 [jstype = JS_STRING];
/*
The fee rate, in satoshis per kw, to use for the deposit transaction.
*/
uint64 fee_rate_sat_per_kw = 3;
uint64 fee_rate_sat_per_kw = 3 [jstype = JS_STRING];
}
message DepositAccountResponse {
// The state of the account after processing the deposit.
@ -360,7 +360,7 @@ message RenewAccountRequest {
}
// The fee rate, in satoshis per kw, to use for the renewal transaction.
uint64 fee_rate_sat_per_kw = 4;
uint64 fee_rate_sat_per_kw = 4 [jstype = JS_STRING];
}
message RenewAccountResponse {
// The state of the account after processing the renewal.
@ -380,7 +380,7 @@ message BumpAccountFeeRequest {
The new fee rate, in satoshis per kw, to use for the child of the account
transaction.
*/
uint64 fee_rate_sat_per_kw = 2;
uint64 fee_rate_sat_per_kw = 2 [jstype = JS_STRING];
}
message BumpAccountFeeResponse {
}
@ -443,13 +443,13 @@ message Account {
OutPoint outpoint = 2;
// The current total amount of satoshis in the account.
uint64 value = 3;
uint64 value = 3 [jstype = JS_STRING];
/*
The amount of satoshis in the account that is available, meaning not
allocated to any oustanding orders.
*/
uint64 available_balance = 4;
uint64 available_balance = 4 [jstype = JS_STRING];
// The height at which the account will expire.
uint32 expiration_height = 5;
@ -527,13 +527,13 @@ message Order {
/*
Order amount in satoshis.
*/
uint64 amt = 3;
uint64 amt = 3 [jstype = JS_STRING];
/*
Maximum fee rate the trader is willing to pay for the batch transaction,
expressed in satoshis per 1000 weight units (sat/KW).
*/
uint64 max_batch_fee_rate_sat_per_kw = 4;
uint64 max_batch_fee_rate_sat_per_kw = 4 [jstype = JS_STRING];
/*
Order nonce, acts as unique order identifier.
@ -559,10 +559,10 @@ message Order {
// The value reserved from the account by this order to ensure the account
// can pay execution and chain fees in case it gets matched.
uint64 reserved_value_sat = 9;
uint64 reserved_value_sat = 9 [jstype = JS_STRING];
// The unix timestamp in nanoseconds the order was first created/submitted.
uint64 creation_timestamp_ns = 10;
uint64 creation_timestamp_ns = 10 [jstype = JS_STRING];
/*
A list of events that were emitted for this order. This field is only set
@ -606,7 +606,7 @@ message Bid {
as the order amount and the min_chan_amt must be set to the full order
amount.
*/
uint64 self_chan_balance = 5;
uint64 self_chan_balance = 5 [jstype = JS_STRING];
/*
If this bid order is meant to lease a channel for another node (which is
@ -640,7 +640,7 @@ message QuoteOrderRequest {
/*
Order amount in satoshis.
*/
uint64 amt = 1;
uint64 amt = 1 [jstype = JS_STRING];
/*
Fixed order rate in parts per billion.
@ -657,7 +657,7 @@ message QuoteOrderRequest {
Maximum fee rate the trader is willing to pay for the batch transaction,
expressed in satoshis per 1000 weight units (sat/KW).
*/
uint64 max_batch_fee_rate_sat_per_kw = 4;
uint64 max_batch_fee_rate_sat_per_kw = 4 [jstype = JS_STRING];
// The minimum number of order units that must be matched per order pair.
uint32 min_units_match = 5;
@ -668,7 +668,7 @@ message QuoteOrderResponse {
represents the interest amount paid to the maker by the taker excluding any
execution or chain fees.
*/
uint64 total_premium_sat = 1;
uint64 total_premium_sat = 1 [jstype = JS_STRING];
/*
The fixed order rate expressed as a fraction instead of parts per billion.
@ -684,7 +684,7 @@ message QuoteOrderResponse {
The total execution fee in satoshis that needs to be paid to the auctioneer
for executing the entire order.
*/
uint64 total_execution_fee_sat = 4;
uint64 total_execution_fee_sat = 4 [jstype = JS_STRING];
/*
The worst case chain fees that need to be paid if fee rates spike up to the
@ -693,7 +693,7 @@ message QuoteOrderResponse {
calculation assumes chain fees for the chain footprint of opening
amt/min_units_match channels (hence worst case calculation).
*/
uint64 worst_case_chain_fee_sat = 5;
uint64 worst_case_chain_fee_sat = 5 [jstype = JS_STRING];
}
message OrderEvent {
@ -701,7 +701,7 @@ message OrderEvent {
The unix timestamp in nanoseconds the event was emitted at. This is the
primary key of the event and is unique across the database.
*/
int64 timestamp_ns = 1;
int64 timestamp_ns = 1 [jstype = JS_STRING];
// The human readable representation of the event.
string event_str = 2;
@ -844,7 +844,7 @@ message Lease {
OutPoint channel_point = 1;
// The amount, in satoshis, of the channel created.
uint64 channel_amt_sat = 2;
uint64 channel_amt_sat = 2 [jstype = JS_STRING];
// The intended duration, in blocks, of the channel created.
uint32 channel_duration_blocks = 3;
@ -855,31 +855,31 @@ message Lease {
/*
The premium, in satoshis, either paid or received for the offered liquidity.
*/
uint64 premium_sat = 5;
uint64 premium_sat = 5 [jstype = JS_STRING];
/*
The execution fee, in satoshis, charged by the auctioneer for the channel
created.
*/
uint64 execution_fee_sat = 6;
uint64 execution_fee_sat = 6 [jstype = JS_STRING];
/*
The fee, in satoshis, charged by the auctioneer for the batch execution
transaction that created this lease.
*/
uint64 chain_fee_sat = 7;
uint64 chain_fee_sat = 7 [jstype = JS_STRING];
/*
The actual fixed rate expressed in parts per billionth this lease was
bought/sold at.
*/
uint64 clearing_rate_price = 8;
uint64 clearing_rate_price = 8 [jstype = JS_STRING];
/*
The actual fixed rate of the bid/ask, this should always be 'better' than
the clearing_rate_price.
*/
uint64 order_fixed_rate = 9;
uint64 order_fixed_rate = 9 [jstype = JS_STRING];
// The order executed that resulted in the channel created.
bytes order_nonce = 10;
@ -894,7 +894,7 @@ message Lease {
NodeTier channel_node_tier = 13;
// The self channel balance that was pushed to the recipient.
uint64 self_chan_balance = 14;
uint64 self_chan_balance = 14 [jstype = JS_STRING];
// Whether the channel was leased as a sidecar channel (bid orders only).
bool sidecar_channel = 15;
@ -919,10 +919,10 @@ message LeasesResponse {
repeated Lease leases = 1;
// The total amount of satoshis earned from the leases returned.
uint64 total_amt_earned_sat = 2;
uint64 total_amt_earned_sat = 2 [jstype = JS_STRING];
// The total amount of satoshis paid for the leases returned.
uint64 total_amt_paid_sat = 3;
uint64 total_amt_paid_sat = 3 [jstype = JS_STRING];
}
message TokensRequest {
@ -956,17 +956,17 @@ message LsatToken {
/**
The amount of millisatoshis that was paid to get the token.
*/
int64 amount_paid_msat = 4;
int64 amount_paid_msat = 4 [jstype = JS_STRING];
/**
The amount of millisatoshis paid in routing fee to pay for the token.
*/
int64 routing_fee_paid_msat = 5;
int64 routing_fee_paid_msat = 5 [jstype = JS_STRING];
/**
The creation time of the token as UNIX timestamp in seconds.
*/
int64 time_created = 6;
int64 time_created = 6 [jstype = JS_STRING];
/**
Indicates whether the token is expired or still valid.
@ -1010,13 +1010,13 @@ message NextBatchInfoResponse {
The fee rate, in satoshis per kiloweight, estimated by the auctioneer to use
for the next batch.
*/
uint64 fee_rate_sat_per_kw = 6;
uint64 fee_rate_sat_per_kw = 6 [jstype = JS_STRING];
/*
The absolute unix timestamp in seconds at which the auctioneer will attempt
to clear the next batch.
*/
uint64 clear_timestamp = 7;
uint64 clear_timestamp = 7 [jstype = JS_STRING];
}
message NodeRatingRequest {