Skip to content
Closed
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
3 changes: 3 additions & 0 deletions packages/bitcoin-ddk-provider/lib/BitcoinDdkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@
public async createDlcTxs(
dlcOffer: DlcOffer,
dlcAccept: DlcAccept,
options?: { offerRefundPayout?: bigint; acceptRefundPayout?: bigint },
): Promise<CreateDlcTxsResponse> {
const localFundPubkey = dlcOffer.fundingPubkey.toString('hex');
const remoteFundPubkey = dlcAccept.fundingPubkey.toString('hex');
Expand Down Expand Up @@ -810,6 +811,7 @@
inputAmount: BigInt(localInputAmount),
collateral: BigInt(dlcOffer.offerCollateral),
dlcInputs: localDlcInputs,
refundPayout: options?.offerRefundPayout,
};

const remoteParams: PartyParams = {
Expand All @@ -822,6 +824,7 @@
inputAmount: BigInt(remoteInputAmount),
collateral: BigInt(dlcAccept.acceptCollateral),
dlcInputs: [],
refundPayout: options?.acceptRefundPayout,
};

// Determine whether to use regular or spliced DLC transactions
Expand Down Expand Up @@ -950,7 +953,7 @@
return messagesList;
}

private convertToJsonSerializable(obj: any): any {

Check warning on line 956 in packages/bitcoin-ddk-provider/lib/BitcoinDdkProvider.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type

Check warning on line 956 in packages/bitcoin-ddk-provider/lib/BitcoinDdkProvider.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (obj === null || obj === undefined) {
return obj;
}
Expand All @@ -968,7 +971,7 @@
}

if (typeof obj === 'object') {
const result: any = {};

Check warning on line 974 in packages/bitcoin-ddk-provider/lib/BitcoinDdkProvider.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
for (const [key, value] of Object.entries(obj)) {
result[key] = this.convertToJsonSerializable(value);
}
Expand Down Expand Up @@ -4434,7 +4437,7 @@
/**
* Convert BitcoinNetwork to bitcoinjs-lib network format
*/
private getBitcoinJsNetwork(): any {

Check warning on line 4440 in packages/bitcoin-ddk-provider/lib/BitcoinDdkProvider.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const network = this._network;
if (network.name === 'bitcoin') {
return networks.bitcoin;
Expand Down
1 change: 1 addition & 0 deletions packages/bitcoin-dlc-provider/lib/BitcoinDlcProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@
public async createDlcTxs(
dlcOffer: DlcOffer,
dlcAccept: DlcAccept,
_options?: { offerRefundPayout?: bigint; acceptRefundPayout?: bigint },

Check failure on line 698 in packages/bitcoin-dlc-provider/lib/BitcoinDlcProvider.ts

View workflow job for this annotation

GitHub Actions / test

'_options' is defined but never used
): Promise<CreateDlcTxsResponse> {
const localFundPubkey = dlcOffer.fundingPubkey.toString('hex');
const remoteFundPubkey = dlcAccept.fundingPubkey.toString('hex');
Expand Down
3 changes: 2 additions & 1 deletion packages/client/lib/Dlc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ export default class Dlc implements DlcProvider {
async createDlcTxs(
dlcOffer: DlcOffer,
dlcAccept: DlcAccept,
options?: { offerRefundPayout?: bigint; acceptRefundPayout?: bigint },
): Promise<CreateDlcTxsResponse> {
return this.client.getMethod('createDlcTxs')(dlcOffer, dlcAccept);
return this.client.getMethod('createDlcTxs')(dlcOffer, dlcAccept, options);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/types/lib/ddk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface PartyParams {
inputAmount: bigint;
collateral: bigint;
dlcInputs: Array<DdkDlcInputInfo>;
refundPayout?: bigint;
}

export interface Payout {
Expand Down
1 change: 1 addition & 0 deletions packages/types/lib/dlc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface DlcProvider {
createDlcTxs(
_dlcOffer: DlcOffer,
_dlcAccept: DlcAccept,
_options?: { offerRefundPayout?: bigint; acceptRefundPayout?: bigint },
): Promise<CreateDlcTxsResponse>;

/**
Expand Down
Loading