Skip to content

Commit

Permalink
feat: settleHtlc now accepts an object for tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Jun 5, 2024
1 parent 53cf727 commit a8b3bde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/FiatAssetAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ export class FiatAssetAdapter implements AssetAdapter<FiatSwapAsset> {
settlementJWS: string,
secret: string,
hash: string,
authorizationToken?: string,
tokens?: {
authorization: string,
smsApi: string
}
): Promise<HtlcDetails> {
if (this.stopped) throw new Error('FiatAssetAdapter called while stopped');

Expand All @@ -112,7 +115,7 @@ export class FiatAssetAdapter implements AssetAdapter<FiatSwapAsset> {

let htlc: HtlcDetails;
try {
htlc = await this.client.settleHtlc(payload.contractId, secret, settlementJWS, { authorization: authorizationToken });
htlc = await this.client.settleHtlc(payload.contractId, secret, settlementJWS, tokens);
} catch (error) {
console.error(error); // eslint-disable-line no-console
htlc = await this.client.getHtlc(payload.contractId);
Expand Down
5 changes: 4 additions & 1 deletion src/IAssetAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export interface AssetAdapter<TAsset extends SwapAsset> {
serializedTx: string,
secret: string,
hash: string,
authorizationToken?: string,
tokens?: {
authorization: string,
smsApi: string
}
): Promise<Transaction<TAsset>>;

awaitSettlementConfirmation(
Expand Down

0 comments on commit a8b3bde

Please sign in to comment.