⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
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
21 changes: 9 additions & 12 deletions modules/abstract-lightning/src/codecs/api/invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@ export const InvoiceStatus = t.union(
);
export type InvoiceStatus = t.TypeOf<typeof InvoiceStatus>;

export const CreateInvoiceBody = t.intersection(
[
t.type({
valueMsat: BigIntFromString,
}),
t.partial({
memo: t.string,
expiry: t.number,
}),
],
'CreateInvoiceBody'
);
export const CreateInvoiceBody = t.partial({
valueMsat: BigIntFromString,
valueSat: t.number,
memo: t.string,
expiry: t.number,
});
export type CreateInvoiceBody = t.TypeOf<typeof CreateInvoiceBody>;

/**
Expand All @@ -52,6 +46,9 @@ export const Invoice = t.intersection(
updatedAt: DateFromISOString,
}),
t.partial({
// Keep valueSat for backward compatibility with older versions of the API
// Will be moved up to required fields in the future
valueSat: t.number,
memo: t.string,
amtPaidMsat: BigIntFromString,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ describe('Lightning Invoice Routes', () => {
});
req.bitgo = bitgo;

await should(handleCreateLightningInvoice(req)).be.rejectedWith(
/^Invalid request body to create lightning invoice/
);
await should(handleCreateLightningInvoice(req)).be.rejected();
});
});

Expand Down
Loading