Skip to content

Commit 1ee5899

Browse files
github-actions[bot]matthappenspengyinglightspark-ci-js-sdk[bot]Lightspark Eng
authored
Adding idempotency to payInvoice method and a hint to birthday input (#479)
* striga design review feedback (#20071) ## Reason Design review feedback from Pat GitOrigin-RevId: 612af3dbfbaf3dacae1c526b5073e1c48bcfa952 * feat: adding idempotency to typescript client payInvoice (#20102) ## Reason Added support for idempotency keys in the `payInvoice` method. This was already available via the API but not exposed in the client lib. ## Overview This change adds an optional `idempotencyKey` parameter to the `payInvoice` method in the Lightspark SDK. When provided, this key is passed to the GraphQL API, allowing the server to identify and prevent duplicate payment attempts. GitOrigin-RevId: 78045ab188bddb612c6b19431419ac35f133c660 * Update from public js-sdk main branch (#20094) Update public `js` sources with the latest code from the [public repository](https://github.com/lightsparkdev/js-sdk) main branch. This typically happens when new versions of the SDK are released and version updates need to be synced. The PR should be merged as soon as possible to avoid updates to webdev overwriting the changes in the js-sdk develop branch. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lightspark Eng <engineering@lightspark.com> Co-authored-by: Corey Martin <coreyn.martin@gmail.com> GitOrigin-RevId: de0143b6431a7a7232e6c88135f5f3a2398b8b89 * chore: adding changesets --------- Co-authored-by: Matt Davis <matthappens@gmail.com> Co-authored-by: Peng Ying <peng@lightspark.com> Co-authored-by: lightspark-ci-js-sdk[bot] <134011073+lightspark-ci-js-sdk[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lightspark Eng <engineering@lightspark.com> Co-authored-by: Corey Martin <coreyn.martin@gmail.com>
1 parent 015368a commit 1ee5899

6 files changed

Lines changed: 25 additions & 1 deletion

File tree

.changeset/legal-hoops-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@lightsparkdev/ui": patch
3+
---
4+
5+
feat: adding hint for birthday input

.changeset/tame-towns-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@lightsparkdev/lightspark-sdk": patch
3+
---
4+
5+
feat: exposing idempotency field on payInvoice method

packages/lightspark-sdk/src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ class LightsparkClient {
866866
maximumFeesMsats: number,
867867
timeoutSecs: number = 60,
868868
amountMsats: number | undefined = undefined,
869+
idempotencyKey: string | undefined = undefined,
869870
): Promise<OutgoingPayment | undefined> {
870871
if (!this.nodeKeyCache.hasKey(payerNodeId)) {
871872
throw new LightsparkSigningException("Paying node is not unlocked");
@@ -879,6 +880,9 @@ class LightsparkClient {
879880
if (amountMsats !== undefined) {
880881
variables.amount_msats = amountMsats;
881882
}
883+
if (idempotencyKey !== undefined) {
884+
variables.idempotency_key = idempotencyKey;
885+
}
882886
const response = await this.requester.makeRawRequest(
883887
PayInvoice,
884888
variables,

packages/lightspark-sdk/src/graphql/PayInvoice.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const PayInvoice = `
99
$timeout_secs: Int!
1010
$maximum_fees_msats: Long!
1111
$amount_msats: Long
12+
$idempotency_key: String
1213
) {
1314
pay_invoice(
1415
input: {
@@ -17,6 +18,7 @@ export const PayInvoice = `
1718
timeout_secs: $timeout_secs
1819
maximum_fees_msats: $maximum_fees_msats
1920
amount_msats: $amount_msats
21+
idempotency_key: $idempotency_key
2022
}
2123
) {
2224
payment {

packages/ui/src/components/BirthdayInput.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@ export function BirthdayInput({
145145
typography={{
146146
size: "Large",
147147
}}
148-
hint={formatDateToText(date)}
148+
hint={{
149+
text: formatDateToText(date),
150+
typography: {
151+
type: "Label",
152+
size: "Medium",
153+
color: "secondary",
154+
},
155+
}}
149156
error={
150157
birthdayFieldBlurred && isInvalid ? invalidBirthdayError : undefined
151158
}

packages/ui/src/components/TextInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export type TextInputProps = {
7979
side?: IconSide | undefined;
8080
offset?: IconOffset | undefined;
8181
strokeWidth?: IconStrokeWidth | undefined;
82+
color?: ThemeOrColorKey | undefined;
8283
}
8384
| undefined;
8485
maxLength?: number;

0 commit comments

Comments
 (0)