Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bolt12 Human Readable Offers #1989

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import ProductDetails from './views/POS/ProductDetails';
import PaymentsSettings from './views/Settings/PaymentsSettings';
import InvoicesSettings from './views/Settings/InvoicesSettings';
import LSP from './views/Settings/LSP';
import Bolt12Address from './views/Settings/Bolt12Address';

// Lightning address
import LightningAddress from './views/Settings/LightningAddress';
Expand Down Expand Up @@ -404,6 +405,9 @@ const AppScenes = {
ContactDetails: {
screen: ContactDetails
},
Bolt12Address: {
screen: Bolt12Address
},
NostrKeys: {
screen: NostrKeys
},
Expand Down
3 changes: 3 additions & 0 deletions assets/images/SVG/AtSign.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion backends/CLightningREST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,18 @@ export default class CLightningREST extends LND {
payments: data.pays
}));
getNewAddress = () => this.getRequest('/v1/newaddr?addrType=bech32');
getNewOffer = () =>
this.postRequest('/v1/offers/offer', {
amount: 'any',
description: 'Bolt12 Payment Address'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we perhaps want to add the ability to generate Bolt12 offers manually on the receive page too?

});
fetchInvoiceFromOffer = async (bolt12: string, amountSatoshis: string) => {
return await this.postRequest('/v1/offers/fetchInvoice', {
offer: bolt12,
msatoshi: Number(amountSatoshis) * 1000,
timeout: 60
});
};
openChannel = (data: OpenChannelRequest) => {
let request: any;
if (data.utxos && data.utxos.length > 0) {
Expand Down Expand Up @@ -195,7 +207,7 @@ export default class CLightningREST extends LND {
id: `${data.addr.pubkey}@${data.addr.host}`
});
decodePaymentRequest = (urlParams?: Array<string>) =>
this.getRequest(`/v1/pay/decodePay/${urlParams && urlParams[0]}`);
this.getRequest(`/v1/utility/decode/${urlParams && urlParams[0]}`);
payLightningInvoice = (data: any) =>
this.postRequest('/v1/pay', {
invoice: data.payment_request,
Expand Down Expand Up @@ -268,4 +280,9 @@ export default class CLightningREST extends LND {
supportsCustomPreimages = () => false;
supportsSweep = () => true;
isLNDBased = () => false;
supportsOffers = async () => {
const res = await this.getRequest('/v1/utility/listConfigs');
const supportsOffers: boolean = res['experimental-offers'] || false;
return supportsOffers;
};
}
1 change: 1 addition & 0 deletions backends/Eclair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export default class Eclair {
supportsCustomPreimages = () => false;
supportsSweep = () => false;
isLNDBased = () => false;
supportsOffers = () => false;
}

const mapInvoice =
Expand Down
1 change: 1 addition & 0 deletions backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,5 @@ export default class EmbeddedLND extends LND {
supportsCustomPreimages = () => true;
supportsSweep = () => true;
isLNDBased = () => true;
supportsOffers = () => false;
}
1 change: 1 addition & 0 deletions backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,5 @@ export default class LND {
supportsCustomPreimages = () => true;
supportsSweep = () => true;
isLNDBased = () => true;
supportsOffers = async () => false;
}
1 change: 1 addition & 0 deletions backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,5 @@ export default class LightningNodeConnect {
supportsCustomPreimages = () => true;
supportsSweep = () => true;
isLNDBased = () => true;
supportsOffers = () => false;
}
1 change: 1 addition & 0 deletions backends/LndHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,5 @@ export default class LndHub extends LND {
supportsCustomPreimages = () => false;
supportsSweep = () => false;
isLNDBased = () => false;
supportsOffers = () => false;
}
1 change: 1 addition & 0 deletions backends/Spark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,5 @@ export default class Spark {
supportsCustomPreimages = () => false;
supportsSweep = () => false;
isLNDBased = () => false;
supportsOffers = () => false;
}
2 changes: 1 addition & 1 deletion ios/.xcode.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
. "$(brew --prefix nvm)/nvm.sh" --no-use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this change required for your env? would rather it be unchanged

export NODE_BINARY=$(command -v node)
14 changes: 7 additions & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ PODS:
- React-Core
- react-native-notifications (5.1.0):
- React-Core
- react-native-qrcode-local-image (1.0.4):
- React
- react-native-randombytes (3.5.3):
- React
- react-native-restart (0.0.27):
Expand Down Expand Up @@ -465,8 +467,6 @@ PODS:
- React-perflogger (= 0.72.5)
- ReactNativeCameraKit (13.0.0):
- React-Core
- RemobileReactNativeQrcodeLocalImage (1.0.4):
- React
- RNCAsyncStorage (1.19.3):
- React-Core
- RNCClipboard (1.13.2):
Expand Down Expand Up @@ -563,6 +563,7 @@ DEPENDENCIES:
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-nfc-manager (from `../node_modules/react-native-nfc-manager`)
- react-native-notifications (from `../node_modules/react-native-notifications`)
- "react-native-qrcode-local-image (from `../node_modules/@remobile/react-native-qrcode-local-image`)"
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-restart (from `../node_modules/react-native-restart`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
Expand All @@ -586,7 +587,6 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeCameraKit (from `../node_modules/react-native-camera-kit`)
- "RemobileReactNativeQrcodeLocalImage (from `../node_modules/@remobile/react-native-qrcode-local-image`)"
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
Expand Down Expand Up @@ -681,6 +681,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-nfc-manager"
react-native-notifications:
:path: "../node_modules/react-native-notifications"
react-native-qrcode-local-image:
:path: "../node_modules/@remobile/react-native-qrcode-local-image"
react-native-randombytes:
:path: "../node_modules/react-native-randombytes"
react-native-restart:
Expand Down Expand Up @@ -727,8 +729,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeCameraKit:
:path: "../node_modules/react-native-camera-kit"
RemobileReactNativeQrcodeLocalImage:
:path: "../node_modules/@remobile/react-native-qrcode-local-image"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCClipboard:
Expand Down Expand Up @@ -798,6 +798,7 @@ SPEC CHECKSUMS:
react-native-netinfo: fefd4e98d75cbdd6e85fc530f7111a8afdf2b0c5
react-native-nfc-manager: 250424ac5f6b2827f98bec7a1ed7f27615852ed4
react-native-notifications: 4601a5a8db4ced6ae7cfc43b44d35fe437ac50c4
react-native-qrcode-local-image: 35ccb306e4265bc5545f813e54cc830b5d75bcfc
react-native-randombytes: 3638d24759d67c68f6ccba60c52a7a8a8faa6a23
react-native-restart: 7595693413fe3ca15893702f2c8306c62a708162
react-native-safe-area-context: 52342d2d80ea8faadd0ffa76d83b6051f20c5329
Expand All @@ -821,7 +822,6 @@ SPEC CHECKSUMS:
React-utils: 7a9918a1ffdd39aba67835d42386f592ea3f8e76
ReactCommon: 91ece8350ebb3dd2be9cef662abd78b6948233c0
ReactNativeCameraKit: 9d46a5d7dd544ca64aa9c03c150d2348faf437eb
RemobileReactNativeQrcodeLocalImage: 57aadc12896b148fb5e04bc7c6805f3565f5c3fa
RNCAsyncStorage: c913ede1fa163a71cea118ed4670bbaaa4b511bb
RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
Expand All @@ -842,4 +842,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 643f83a7955aa123651bac4a54204e22598914df

COCOAPODS: 1.12.1
COCOAPODS: 1.14.3
65 changes: 5 additions & 60 deletions ios/zeus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -1060,7 +1060,6 @@
};
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1210;
ProvisioningStyle = Automatic;
};
2D02E47A1E0B4A5D006451C7 = {
CreatedOnToolsVersion = 8.2.1;
Expand Down Expand Up @@ -1772,7 +1771,6 @@
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"-ld_classic",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1804,7 +1802,6 @@
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"-ld_classic",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1824,7 +1821,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9TU7M3555F;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
EXCLUDED_ARCHS = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand Down Expand Up @@ -1873,7 +1870,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9TU7M3555F;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GCC_NO_COMMON_BLOCKS = NO;
Expand Down Expand Up @@ -2114,33 +2111,7 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl -ld_classic ",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -2198,33 +2169,7 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl",
"-ld_classic",
"-Wl -ld_classic ",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down
10 changes: 1 addition & 9 deletions ios/zeus/zeus.entitlements
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
<string>TAG</string>
</array>
</dict>
<dict/>
</plist>
10 changes: 1 addition & 9 deletions ios/zeus/zeusRelease.entitlements
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
<string>TAG</string>
</array>
</dict>
<dict/>
</plist>
5 changes: 5 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@
"views.Receive.createLightningAddress": "Create lightning address",
"views.Send.title": "Send",
"views.Send.lnPayment": "Lightning payment request",
"views.Send.bolt12Address": "Bolt 12 address",
"views.Send.btcAddress": "Bitcoin address",
"views.Send.keysendAddress": "keysend address (if enabled)",
"views.Send.mustBeValid": "Must be a valid",
Expand Down Expand Up @@ -839,6 +840,10 @@
"views.Settings.Contacts.noAddress": "No Address",
"views.Settings.Contacts.to": "To",
"views.Settings.Contacts.deleteAllContacts": "Delete all contacts",
"views.Settings.Bolt12Address.bolt12Address": "Bolt12 Address",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we change between styling it as Bolt 12 and Bolt12. We should be consistent

"views.Settings.Bolt12Address.requestButton": "Request Paycode",
"views.Settings.Bolt12Address.changeButton": "Change Paycode",
"views.Settings.Bolt12Address.handle": "Your handle",
"views.Transaction.title": "Transaction",
"views.Transaction.totalFees": "Total Fees",
"views.Transaction.transactionHash": "Transaction Hash",
Expand Down
Loading