@lightsparkdev/lightspark-sdk 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/{chunk-J7GJGYME.js → chunk-4KFNQOMH.js} +84 -39
- package/dist/index.cjs +142 -91
- package/dist/index.js +3 -3
- package/dist/objects/index.cjs +97 -52
- package/dist/objects/index.js +1 -1
- package/package.json +2 -2
- package/src/objects/Account.ts +4 -2
- package/src/objects/ApiToken.ts +2 -2
- package/src/objects/AuditLogActor.ts +2 -2
- package/src/objects/Channel.ts +2 -2
- package/src/objects/ChannelClosingTransaction.ts +2 -2
- package/src/objects/ChannelOpeningTransaction.ts +2 -2
- package/src/objects/ChannelSnapshot.ts +2 -2
- package/src/objects/Deposit.ts +2 -2
- package/src/objects/GraphNode.ts +2 -2
- package/src/objects/Hop.ts +2 -2
- package/src/objects/IncomingPayment.ts +2 -2
- package/src/objects/IncomingPaymentAttempt.ts +2 -2
- package/src/objects/Invoice.ts +2 -2
- package/src/objects/LightningTransaction.ts +2 -2
- package/src/objects/LightsparkNode.ts +2 -2
- package/src/objects/LightsparkNodeOwner.ts +2 -2
- package/src/objects/LightsparkNodeWithOSK.ts +2 -2
- package/src/objects/LightsparkNodeWithRemoteSigning.ts +2 -2
- package/src/objects/Node.ts +2 -2
- package/src/objects/OnChainTransaction.ts +2 -2
- package/src/objects/OutgoingPayment.ts +2 -2
- package/src/objects/OutgoingPaymentAttempt.ts +2 -2
- package/src/objects/PaymentRequest.ts +2 -2
- package/src/objects/RoutingTransaction.ts +2 -2
- package/src/objects/Signable.ts +2 -2
- package/src/objects/SignablePayload.ts +2 -2
- package/src/objects/Transaction.ts +2 -2
- package/src/objects/UmaInvitation.ts +2 -2
- package/src/objects/Wallet.ts +2 -2
- package/src/objects/Withdrawal.ts +2 -2
- package/src/objects/WithdrawalRequest.ts +2 -2
- package/src/tests/generated-objects.test.ts +93 -0
- package/src/tests/serialization.test.ts +0 -21
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InvoiceDataFromJson,
|
|
3
|
-
InvoiceDataToJson,
|
|
4
|
-
} from "../objects/InvoiceData.js";
|
|
5
|
-
|
|
6
|
-
describe("Serialization", () => {
|
|
7
|
-
test("should serialize and deserialize InvoiceData to the same object", () => {
|
|
8
|
-
const serialized = `{"__typename": "InvoiceData", "invoice_data_encoded_payment_request":"lnbcrt34170n1pj5vdn4pp56jhw0672v566u4rvl333v8hwwuvavvu9gx4a2mqag4pkrvm0hwkqhp5xaz278y6cejcvpqnndl4wfq3slgthjduwlfksg778aevn23v2pdscqzpgxqyz5vqsp5ee5jezfvjqvvz7hfwta3ekk8hs6dq36szkgp40qh7twa8upquxlq9qyyssqjg2slc95falxf2t67y0wu2w43qwfcvfflwl8tn4ppqw9tumwqxk36qkfct9p2w8c3yy2ld7c6nacy4ssv2gl6qyqfpmhl4jmarnjf8cpvjlxek","invoice_data_bitcoin_network":"REGTEST","invoice_data_payment_hash":"d4aee7ebca6535ae546cfc63161eee7719d6338541abd56c1d454361b36fbbac","invoice_data_amount":{"currency_amount_original_value":3417,"currency_amount_original_unit":"SATOSHI","currency_amount_preferred_currency_unit":"USD","currency_amount_preferred_currency_value_rounded":118,"currency_amount_preferred_currency_value_approx":118.89352818371607},"invoice_data_created_at":"2023-11-04T12:17:57Z","invoice_data_expires_at":"2023-11-05T12:17:57Z","invoice_data_memo":null,"invoice_data_destination":{"graph_node_id":"GraphNode:0189a572-6dba-cf00-0000-ac0908d34ea6","graph_node_created_at":"2023-07-30T06:18:07.162759Z","graph_node_updated_at":"2023-11-04T12:01:04.015414Z","graph_node_alias":"ls_test_vSViIQitob_SE","graph_node_bitcoin_network":"REGTEST","graph_node_color":"#3399ff","graph_node_conductivity":null,"graph_node_display_name":"ls_test_vSViIQitob_SE","graph_node_public_key":"02253935a5703a6f0429081e08d2defce0faa15f4d75305302284751d53a4e0608", "__typename":"GraphNode"}}`;
|
|
9
|
-
const deserialized = InvoiceDataFromJson(JSON.parse(serialized));
|
|
10
|
-
const reserialized = InvoiceDataToJson(deserialized) as Record<
|
|
11
|
-
string,
|
|
12
|
-
unknown
|
|
13
|
-
>;
|
|
14
|
-
expect(reserialized).toEqual(JSON.parse(serialized));
|
|
15
|
-
|
|
16
|
-
const deserializedAgain = InvoiceDataFromJson(reserialized);
|
|
17
|
-
expect(JSON.stringify(deserializedAgain)).toEqual(
|
|
18
|
-
JSON.stringify(deserialized),
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
});
|