From 4560d5c68b1a96b7c212766bbe08cb6dd61761c5 Mon Sep 17 00:00:00 2001 From: Mothana Date: Tue, 17 Sep 2024 19:39:55 +0400 Subject: [PATCH] getuserinfo returns bridgeUrl from env --- env.example | 3 +++ proto/autogenerated/client.md | 1 + proto/autogenerated/ts/types.ts | 5 +++++ proto/service/structs.proto | 1 + src/services/main/appUserManager.ts | 3 ++- src/services/main/settings.ts | 6 ++++-- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/env.example b/env.example index f4383e14..b238ad6d 100644 --- a/env.example +++ b/env.example @@ -25,6 +25,9 @@ #PORT=1776 #JWT_SECRET= +#Lightning Address Bridge +#BRIDGE_URL=https://shockwallet.app + #LIGHTNING # Maximum amount in network fees passed to LND when it pays an external invoice # BPS are basis points, 100 BPS = 1% diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index 6884a4cb..8cf79f20 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -962,6 +962,7 @@ The nostr server will send back a message response, and inside the body there wi ### UserInfo - __balance__: _number_ + - __bridge_url__: _string_ - __max_withdrawable__: _number_ - __network_max_fee_bps__: _number_ - __network_max_fee_fixed__: _number_ diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index d3c2c131..44149aea 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -2353,6 +2353,7 @@ export const UseInviteLinkRequestValidate = (o?: UseInviteLinkRequest, opts: Use export type UserInfo = { balance: number + bridge_url: string max_withdrawable: number network_max_fee_bps: number network_max_fee_fixed: number @@ -2365,6 +2366,7 @@ export const UserInfoOptionalFields: [] = [] export type UserInfoOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] balance_CustomCheck?: (v: number) => boolean + bridge_url_CustomCheck?: (v: string) => boolean max_withdrawable_CustomCheck?: (v: number) => boolean network_max_fee_bps_CustomCheck?: (v: number) => boolean network_max_fee_fixed_CustomCheck?: (v: number) => boolean @@ -2380,6 +2382,9 @@ export const UserInfoValidate = (o?: UserInfo, opts: UserInfoOptions = {}, path: if (typeof o.balance !== 'number') return new Error(`${path}.balance: is not a number`) if (opts.balance_CustomCheck && !opts.balance_CustomCheck(o.balance)) return new Error(`${path}.balance: custom check failed`) + if (typeof o.bridge_url !== 'string') return new Error(`${path}.bridge_url: is not a string`) + if (opts.bridge_url_CustomCheck && !opts.bridge_url_CustomCheck(o.bridge_url)) return new Error(`${path}.bridge_url: custom check failed`) + if (typeof o.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`) if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: custom check failed`) diff --git a/proto/service/structs.proto b/proto/service/structs.proto index bedb45bf..2af29129 100644 --- a/proto/service/structs.proto +++ b/proto/service/structs.proto @@ -354,6 +354,7 @@ message UserInfo{ int64 network_max_fee_bps = 6; int64 network_max_fee_fixed = 7; string noffer = 8; + string bridge_url = 9; } message GetUserOperationsRequest{ diff --git a/src/services/main/appUserManager.ts b/src/services/main/appUserManager.ts index 1909be9d..9ef7b730 100644 --- a/src/services/main/appUserManager.ts +++ b/src/services/main/appUserManager.ts @@ -61,7 +61,8 @@ export default class { network_max_fee_bps: this.settings.lndSettings.feeRateBps, network_max_fee_fixed: this.settings.lndSettings.feeFixedLimit, service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps, - noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: appUser.identifier, priceType: PriceType.spontaneous, relay: "" }) + noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: appUser.identifier, priceType: PriceType.spontaneous, relay: "" }), + bridge_url: this.settings.bridgeUrl } } diff --git a/src/services/main/settings.ts b/src/services/main/settings.ts index 89aeb512..e9d7ef7d 100644 --- a/src/services/main/settings.ts +++ b/src/services/main/settings.ts @@ -33,7 +33,8 @@ export type MainSettings = { wizard: boolean defaultAppName: string pushBackupsToNostr: boolean - lnurlMetaText: string + lnurlMetaText: string, + bridgeUrl: string } export type BitcoinCoreSettings = { @@ -72,7 +73,8 @@ export const LoadMainSettingsFromEnv = (): MainSettings => { wizard: process.env.WIZARD === 'true' || false, defaultAppName: process.env.DEFAULT_APP_NAME || "wallet", pushBackupsToNostr: process.env.PUSH_BACKUPS_TO_NOSTR === 'true' || false, - lnurlMetaText: process.env.LNURL_META_TEXT || "LNURL via Lightning.pub" + lnurlMetaText: process.env.LNURL_META_TEXT || "LNURL via Lightning.pub", + bridgeUrl: process.env.BRIDGE_URL || "https://shockwallet.app" } }