Skip to content

Commit

Permalink
release v1.0.25-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
22388o committed Aug 15, 2024
1 parent a5f6450 commit a22f273
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 52 deletions.
6 changes: 6 additions & 0 deletions CHAGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

See last releases and versions

## V1.0.25 - Beta

- Fixed imports for LDK
- Removed BDK to Bitcoinjs-lib


## V1.0.24 - Beta

- Upgrade dependencies (Curve Elliptic)
Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ currently being supported with security updates.
| v1.0.22-beta | :white_check_mark: |
| v1.0.23-beta | :white_check_mark: |
| v1.0.24-beta | :white_check_mark: |
| v1.0.25-beta | :white_check_mark: |

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "javascript-dlc",
"version": "1.0.24-beta",
"version": "1.0.25-beta",
"description": "Javascript DLC library",
"main": "index.js",
"scripts": {
Expand Down
108 changes: 57 additions & 51 deletions src/lightning/ldk_ts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { LDK } from 'ldk';
import { Secp256k1, Network, OutPoint, Txid, Script } from 'ldk';

async function LDK () {
async function LDK() {
// Initialize LDK
const ldk = LDK.create(Network.Testnet);

Expand All @@ -18,70 +18,76 @@ async function LDK () {
sats: Number,
pair: String,
peers: String,

};

const contractDescriptor = {

async function DLC() {

// Create and sign DLC transaction
const contractTxId = Txid.fromHex('previous_transaction_id');
const fundingTxOutpoint = new OutPoint(contractTxId, 0);
const fundAmount = 10000000; // Amount in satoshis

const oracleSigs = {
// Add contract descriptor properties here
};

const partyASigs = {
};
async function DLC() {
// Create and sign DLC transaction
const contractTxId = Txid.fromHex('previous_transaction_id');
const fundingTxOutpoint = new OutPoint(contractTxId, 0);
const fundAmount = 10000000; // Amount in satoshis

const oracleSigs = {
// Add oracle signatures here
};

const partyASigs = {
// Add party A signatures here
};

const partyBSigs = {
// Add party B signatures here
};

const contractTx = await ldk.createDlcTransactions({
contractDescriptor,
oracleInfo,
fundingTxOutpoint,
fundAmount,
oracleSigs,
partyASigs,
partyBSigs,
});

// Interact with the DLC contract
const dlcContract = ldk.loadDlcContract(contractDescriptor);

const partyBSigs = {
};
const oracleSignature = {
// ... oracle signature ...
};

const contractTx = await ldk.createDlcTransactions({
contractDescriptor,
oracleInfo,
fundingTxOutpoint,
fundAmount,
oracleSigs,
partyASigs,
partyBSigs,
});

// Interact with the DLC contract
const dlcContract = ldk.loadDlcContract(contractDescriptor);

const oracleSignature = {
// ... oracle signature ...
};
const oracleEvent = {
// ... oracle event ...
};

const oracleEvent = {
// ... oracle event ...
};
const partyASignedOutcome = {
// ... party A signed outcome ...
};

const partyASignedOutcome = {
// ... party A signed outcome ...
};
const partyBDispute = {
// ... party B dispute ...
};

const partyBDispute = {
// ... party B dispute ...
};
// Update the contract state based on different events
dlcContract.updateContractFromOracleSignature(oracleSignature, oracleEvent);
dlcContract.updateContractFromPartyASignedOutcome(partyASignedOutcome);
dlcContract.updateContractFromPartyBDispute(partyBDispute);

// Update the contract state based on different events
dlcContract.updateContractFromOracleSignature(oracleSignature, oracleEvent);
dlcContract.updateContractFromPartyASignedOutcome(partyASignedOutcome);
dlcContract.updateContractFromPartyBDispute(partyBDispute);
// ... Other interactions and contract state updates ...

// ... Other interactions and contract state updates ...
// Closing the contract and settling
const closingTx = await dlcContract.close();
// Broadcast the closing transaction
// ...

// Closing the contract and settling
const closingTx = await dlcContract.close();
// Broadcast the closing transaction
// ...
// Cleanup resources
ldk.destroy();
}

// Cleanup resources
ldk.destroy();
await DLC();
}

main().catch(console.error);

0 comments on commit a22f273

Please sign in to comment.