Skip to content

Commit 4f729b4

Browse files
dangerossdanielgranhao
authored andcommitted
React Native support for custom u128 type
1 parent 112dfbc commit 4f729b4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

crates/breez-sdk/core/uniffi.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ from_custom = "{}.description"
2929
type_name = "int"
3030
into_custom = "int({})"
3131
from_custom = "str({})"
32+
33+
[bindings.typescript.customTypes.u128]
34+
typeName = "bigint"
35+
intoCustom = "BigInt({})"
36+
fromCustom = "{}.toString()"

docs/breez-sdk/snippets/react-native/send_payment.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const examplePrepareSendPaymentLightningBolt11 = async (sdk: BreezSdk) => {
1414

1515
const prepareResponse = await sdk.prepareSendPayment({
1616
paymentRequest,
17-
amountSats: optionalAmountSats
17+
amount: optionalAmountSats,
18+
tokenIdentifier: undefined
1819
})
1920

2021
// If the fees are acceptable, continue to create the Send Payment
@@ -37,7 +38,8 @@ const examplePrepareSendPaymentOnchain = async (sdk: BreezSdk) => {
3738

3839
const prepareResponse = await sdk.prepareSendPayment({
3940
paymentRequest,
40-
amountSats
41+
amount: amountSats,
42+
tokenIdentifier: undefined
4143
})
4244

4345
// If the fees are acceptable, continue to create the Send Payment
@@ -61,12 +63,13 @@ const examplePrepareSendPaymentSpark = async (sdk: BreezSdk) => {
6163

6264
const prepareResponse = await sdk.prepareSendPayment({
6365
paymentRequest,
64-
amountSats
66+
amount: amountSats,
67+
tokenIdentifier: undefined
6568
})
6669

6770
// If the fees are acceptable, continue to create the Send Payment
6871
if (prepareResponse.paymentMethod instanceof SendPaymentMethod.SparkAddress) {
69-
const feeSats = prepareResponse.paymentMethod.inner.feeSats
72+
const feeSats = prepareResponse.paymentMethod.inner.fee
7073
console.debug(`Fees: ${feeSats} sats`)
7174
}
7275
// ANCHOR_END: prepare-send-payment-spark

0 commit comments

Comments
 (0)