Skip to content

Commit

Permalink
chore: update inbound fee types
Browse files Browse the repository at this point in the history
  • Loading branch information
bufo24 committed May 30, 2024
1 parent d5802ee commit 01fce0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
8 changes: 4 additions & 4 deletions lnd_methods/info/subscribe_to_graph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export type SubscribeToGraphChannelUpdatedEvent = {
min_htlc_mtokens: string;
/** Announcing Public Key, Target Public Key */
public_keys: [string, string];
/** Channel Source Discount Base Fee Millitokens */
source_discount_base_mtokens: string;
/** Channel Source Discount Fee Rate In Millitokens Per Million */
source_discount_fee_rate: number;
/** Source Base Fee Reduction String */
inbound_base_discount_mtokens: string;
/** Source Per Million Rate Reduction Number */
inbound_rate_discount: number;
/** Channel Transaction Id */
transaction_id: string;
/** Channel Transaction Output Index */
Expand Down
4 changes: 2 additions & 2 deletions lnd_methods/info/subscribe_to_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const type = 'default';
[max_htlc_mtokens]: <Channel Maximum HTLC Millitokens String>
min_htlc_mtokens: <Channel Minimum HTLC Millitokens String>
public_keys: [<Announcing Public Key>, <Target Public Key String>]
source_discount_base_mtokens: <Channel Base Fee Millitokens Number>
source_discount_fee_rate: <Channel Source Discount Fee Rate In PPM Number>
inbound_base_discount_mtokens: <Source Specific Base Fee Reduction String>
inbound_rate_discount: <Source Specific Per Million Rate Reduction Number>
[transaction_id]: <Channel Transaction Id String>
[transaction_vout]: <Channel Transaction Output Index Number>
updated_at: <Update Received At ISO 8601 Date String>
Expand Down
28 changes: 9 additions & 19 deletions lnd_responses/rpc_channel_update_as_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const now = () => new Date().toISOString();
disabled: <Forwarding is Disabled Bool>
fee_base_msat: <Forwarding Base Fee Millitokens String>
fee_rate_milli_msat: <Forwarding Fee Rate Per Million String>
inbound_fee_base_msat: <Inbound Forwarding Base Fee Millitokens Number>
inbound_fee_rate_milli_msat: <Inbound Forwarding Fee Rate Per Million Number>
inbound_fee_base_msat: <Inbound Fee Base Number>
inbound_fee_rate_milli_msat: <Inbound Fee Base Number>
max_htlc_msat: <Maximum HTLC Size Millitokens String>
min_htlc: <Minimum HTLC Size Millitokens String>
time_lock_delta: <Forwarding CLTV Delta Number>
Expand Down Expand Up @@ -119,28 +119,18 @@ module.exports = update => {

const txId = !!transactionId.equals(emptyTxId) ? null : transactionId;

const {
disabled,
fee_base_msat,
fee_rate_milli_msat,
min_htlc,
inbound_fee_base_msat,
inbound_fee_rate_milli_msat,
time_lock_delta,
} = update.routing_policy;

return {
base_fee_mtokens: fee_base_msat,
base_fee_mtokens: update.routing_policy.fee_base_msat,
capacity: Number(update.capacity) || undefined,
cltv_delta: time_lock_delta,
fee_rate: Number(fee_rate_milli_msat),
id: chanFormat({ number: update.chan_id }).channel,
is_disabled: disabled,
cltv_delta: update.routing_policy.time_lock_delta,
fee_rate: Number(update.routing_policy.fee_rate_milli_msat),
id: chanFormat({number: update.chan_id}).channel,
is_disabled: update.routing_policy.disabled,
max_htlc_mtokens: maxHtlc !== Number().toString() ? maxHtlc : undefined,
min_htlc_mtokens: min_htlc,
min_htlc_mtokens: update.routing_policy.min_htlc,
public_keys: [update.advertising_node, update.connecting_node],
inbound_base_discount_mtokens: inbound_fee_base_msat.toString(),
inbound_rate_discount: inbound_fee_rate_milli_msat.toString(),
inbound_rate_discount: inbound_fee_rate_milli_msat,
transaction_id: !!txId ? bufferAsHex(txId) : undefined,
transaction_vout: !!txId ? update.chan_point.output_index : undefined,
updated_at: now(),
Expand Down

0 comments on commit 01fce0f

Please sign in to comment.