Skip to content

Commit a22f273

Browse files
author
223880
committed
release v1.0.25-beta
1 parent a5f6450 commit a22f273

File tree

4 files changed

+65
-52
lines changed

4 files changed

+65
-52
lines changed

CHAGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
See last releases and versions
44

5+
## V1.0.25 - Beta
6+
7+
- Fixed imports for LDK
8+
- Removed BDK to Bitcoinjs-lib
9+
10+
511
## V1.0.24 - Beta
612

713
- Upgrade dependencies (Curve Elliptic)

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ currently being supported with security updates.
2525
| v1.0.22-beta | :white_check_mark: |
2626
| v1.0.23-beta | :white_check_mark: |
2727
| v1.0.24-beta | :white_check_mark: |
28+
| v1.0.25-beta | :white_check_mark: |
2829

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-dlc",
3-
"version": "1.0.24-beta",
3+
"version": "1.0.25-beta",
44
"description": "Javascript DLC library",
55
"main": "index.js",
66
"scripts": {

src/lightning/ldk_ts.jsx

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { LDK } from 'ldk';
33
import { Secp256k1, Network, OutPoint, Txid, Script } from 'ldk';
44

5-
async function LDK () {
5+
async function LDK() {
66
// Initialize LDK
77
const ldk = LDK.create(Network.Testnet);
88

@@ -18,70 +18,76 @@ async function LDK () {
1818
sats: Number,
1919
pair: String,
2020
peers: String,
21-
2221
};
2322

2423
const contractDescriptor = {
25-
26-
async function DLC() {
27-
28-
// Create and sign DLC transaction
29-
const contractTxId = Txid.fromHex('previous_transaction_id');
30-
const fundingTxOutpoint = new OutPoint(contractTxId, 0);
31-
const fundAmount = 10000000; // Amount in satoshis
32-
33-
const oracleSigs = {
24+
// Add contract descriptor properties here
3425
};
3526

36-
const partyASigs = {
37-
};
27+
async function DLC() {
28+
// Create and sign DLC transaction
29+
const contractTxId = Txid.fromHex('previous_transaction_id');
30+
const fundingTxOutpoint = new OutPoint(contractTxId, 0);
31+
const fundAmount = 10000000; // Amount in satoshis
32+
33+
const oracleSigs = {
34+
// Add oracle signatures here
35+
};
36+
37+
const partyASigs = {
38+
// Add party A signatures here
39+
};
40+
41+
const partyBSigs = {
42+
// Add party B signatures here
43+
};
44+
45+
const contractTx = await ldk.createDlcTransactions({
46+
contractDescriptor,
47+
oracleInfo,
48+
fundingTxOutpoint,
49+
fundAmount,
50+
oracleSigs,
51+
partyASigs,
52+
partyBSigs,
53+
});
54+
55+
// Interact with the DLC contract
56+
const dlcContract = ldk.loadDlcContract(contractDescriptor);
3857

39-
const partyBSigs = {
40-
};
58+
const oracleSignature = {
59+
// ... oracle signature ...
60+
};
4161

42-
const contractTx = await ldk.createDlcTransactions({
43-
contractDescriptor,
44-
oracleInfo,
45-
fundingTxOutpoint,
46-
fundAmount,
47-
oracleSigs,
48-
partyASigs,
49-
partyBSigs,
50-
});
51-
52-
// Interact with the DLC contract
53-
const dlcContract = ldk.loadDlcContract(contractDescriptor);
54-
55-
const oracleSignature = {
56-
// ... oracle signature ...
57-
};
62+
const oracleEvent = {
63+
// ... oracle event ...
64+
};
5865

59-
const oracleEvent = {
60-
// ... oracle event ...
61-
};
66+
const partyASignedOutcome = {
67+
// ... party A signed outcome ...
68+
};
6269

63-
const partyASignedOutcome = {
64-
// ... party A signed outcome ...
65-
};
70+
const partyBDispute = {
71+
// ... party B dispute ...
72+
};
6673

67-
const partyBDispute = {
68-
// ... party B dispute ...
69-
};
74+
// Update the contract state based on different events
75+
dlcContract.updateContractFromOracleSignature(oracleSignature, oracleEvent);
76+
dlcContract.updateContractFromPartyASignedOutcome(partyASignedOutcome);
77+
dlcContract.updateContractFromPartyBDispute(partyBDispute);
7078

71-
// Update the contract state based on different events
72-
dlcContract.updateContractFromOracleSignature(oracleSignature, oracleEvent);
73-
dlcContract.updateContractFromPartyASignedOutcome(partyASignedOutcome);
74-
dlcContract.updateContractFromPartyBDispute(partyBDispute);
79+
// ... Other interactions and contract state updates ...
7580

76-
// ... Other interactions and contract state updates ...
81+
// Closing the contract and settling
82+
const closingTx = await dlcContract.close();
83+
// Broadcast the closing transaction
84+
// ...
7785

78-
// Closing the contract and settling
79-
const closingTx = await dlcContract.close();
80-
// Broadcast the closing transaction
81-
// ...
86+
// Cleanup resources
87+
ldk.destroy();
88+
}
8289

83-
// Cleanup resources
84-
ldk.destroy();
90+
await DLC();
8591
}
8692

8793
main().catch(console.error);

0 commit comments

Comments
 (0)