Skip to content

Commit 11a986e

Browse files
authored
Merge pull request #7075 from BitGo/BTC-2520-remove-transfer-data
fix: removed transfer data from payment withdraw
2 parents 1350108 + 53dcd91 commit 11a986e

File tree

3 files changed

+2
-75
lines changed

3 files changed

+2
-75
lines changed

modules/abstract-lightning/src/codecs/api/withdraw.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ export type LightningOnchainWithdrawResponse = {
6060
* This field is absent if approval is required before processing.
6161
*/
6262
withdrawStatus?: LndCreateWithdrawResponse;
63-
64-
/**
65-
* Latest transfer details for this withdraw request (if available).
66-
* - Provides the current state of the transfer.
67-
* - To track the latest withdraw status, monitor `transfer` asynchronously.
68-
* This field is absent if approval is required before processing.
69-
*/
70-
transfer?: any;
7163
};
7264

7365
export const FundPsbtResponse = t.type(

modules/abstract-lightning/src/wallet/lightning.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,6 @@ export type PayInvoiceResponse = {
6464
* This field is absent if approval is required before processing.
6565
*/
6666
paymentStatus?: LndCreatePaymentResponse;
67-
68-
/**
69-
* Latest transfer details for this payment request (if available).
70-
* - Provides the current state of the transfer.
71-
* - To track the final payment status, monitor `transfer` asynchronously.
72-
* This field is absent if approval is required before processing.
73-
*/
74-
transfer?: any;
7567
};
7668

7769
/**
@@ -303,7 +295,7 @@ export class LightningWallet implements ILightningWallet {
303295
};
304296
}
305297

306-
const transfer: { id: string } = await this.wallet.bitgo
298+
await this.wallet.bitgo
307299
.post(
308300
this.wallet.bitgo.url(
309301
'/wallet/' + this.wallet.id() + '/txrequests/' + transactionRequestCreate.txRequestId + '/transfers',
@@ -322,22 +314,13 @@ export class LightningWallet implements ILightningWallet {
322314
);
323315

324316
const coinSpecific = transactionRequestSend.transactions?.[0]?.unsignedTx?.coinSpecific;
325-
let updatedTransfer: any = undefined;
326-
try {
327-
updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
328-
} catch (e) {
329-
// If transfer is not found which is possible in cases where the payment has definitely failed
330-
// Or even if some unknown error occurs, we will not throw an error here
331-
// We still want to return the txRequestId, txRequestState and paymentStatus.
332-
}
333317

334318
return {
335319
txRequestId: transactionRequestCreate.txRequestId,
336320
txRequestState: transactionRequestSend.state,
337321
paymentStatus: coinSpecific
338322
? t.exact(LndCreatePaymentResponse).encode(coinSpecific as LndCreatePaymentResponse)
339323
: undefined,
340-
transfer: updatedTransfer,
341324
};
342325
}
343326

@@ -431,7 +414,7 @@ export class LightningWallet implements ILightningWallet {
431414
};
432415
}
433416

434-
const transfer: { id: string } = await this.wallet.bitgo
417+
await this.wallet.bitgo
435418
.post(
436419
this.wallet.bitgo.url(
437420
'/wallet/' + this.wallet.id() + '/txrequests/' + transactionRequestWithSignature.txRequestId + '/transfers',
@@ -450,19 +433,10 @@ export class LightningWallet implements ILightningWallet {
450433
);
451434

452435
const coinSpecific = transactionRequestSend.transactions?.[0]?.unsignedTx?.coinSpecific;
453-
let updatedTransfer: any = undefined;
454-
try {
455-
updatedTransfer = await this.wallet.getTransfer({ id: transfer.id });
456-
} catch (e) {
457-
// If transfer is not found which is possible in cases where the withdraw has definitely failed
458-
// Or even if some unknown error occurs, we will not throw an error here
459-
// We still want to return the txRequestId and txRequestState.
460-
}
461436

462437
return {
463438
txRequestId: transactionRequestWithSignature.txRequestId,
464439
txRequestState: transactionRequestSend.state,
465-
transfer: updatedTransfer,
466440
withdrawStatus:
467441
coinSpecific && 'status' in coinSpecific
468442
? t.exact(LndCreateWithdrawResponse).encode(coinSpecific as LndCreateWithdrawResponse)

modules/bitgo/test/v2/unit/lightning/lightningWallets.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -401,17 +401,6 @@ describe('Lightning wallets', function () {
401401
state: 'initialized',
402402
};
403403

404-
const transferData = {
405-
id: 'fake_id',
406-
coin: 'tlnbtc',
407-
state: 'confirmed',
408-
txid: lndResponse.paymentHash,
409-
};
410-
411-
const getTransferNock = nock(bgUrl)
412-
.get(`/api/v2/${coinName}/wallet/${wallet.wallet.id()}/transfer/fake_id`)
413-
.reply(200, transferData);
414-
415404
const createTxRequestNock = nock(bgUrl)
416405
.post(`/api/v2/wallet/${wallet.wallet.id()}/txrequests`)
417406
.reply(200, txRequestResponse);
@@ -434,7 +423,6 @@ describe('Lightning wallets', function () {
434423
const response = await wallet.payInvoice(params);
435424
assert.strictEqual(response.txRequestId, 'txReq123');
436425
assert.strictEqual(response.txRequestState, 'delivered');
437-
assert.strictEqual(response.transfer.id, transferData.id);
438426
assert.ok(response.paymentStatus);
439427
assert.strictEqual(
440428
response.paymentStatus.status,
@@ -457,7 +445,6 @@ describe('Lightning wallets', function () {
457445
finalPaymentResponse.transactions[0].unsignedTx.coinSpecific.paymentPreimage
458446
);
459447

460-
getTransferNock.done();
461448
createTxRequestNock.done();
462449
sendTxRequestNock.done();
463450
createTransferNock.done();
@@ -960,26 +947,6 @@ describe('Lightning wallets', function () {
960947
createdTime: '2025-06-09T07:47:16.102Z',
961948
};
962949

963-
const updatedTransferResponse = {
964-
...transferResponse,
965-
txid: '211b8fb30990632751a83d1dc4f0323ff7d2fd3cad88084de13c9be2ae1c6426',
966-
date: '2025-06-09T08:50:55.063Z',
967-
state: 'signed',
968-
history: [
969-
{
970-
date: '2025-06-09T07:50:55.063Z',
971-
user: '6846918281f118cc42c33352779df88f',
972-
action: 'signed',
973-
},
974-
{
975-
date: '2025-06-09T07:47:16.102Z',
976-
user: '6846918281f118cc42c33352779df88f',
977-
action: 'created',
978-
},
979-
],
980-
signedTime: '2025-06-09T08:50:55.063Z',
981-
};
982-
983950
const createTxRequestNock = nock(bgUrl)
984951
.post(`/api/v2/wallet/${wallet.wallet.id()}/txrequests`)
985952
.reply(200, txRequestResponse);
@@ -996,10 +963,6 @@ describe('Lightning wallets', function () {
996963
.post(`/api/v2/wallet/${wallet.wallet.id()}/txrequests/${txRequestResponse.txRequestId}/transactions/0/send`)
997964
.reply(200, finalWithdrawResponse);
998965

999-
const getTransferNock = nock(bgUrl)
1000-
.get(`/api/v2/${coinName}/wallet/${wallet.wallet.id()}/transfer/${transferResponse.id}`)
1001-
.reply(200, updatedTransferResponse);
1002-
1003966
const userAuthKeyNock = nock(bgUrl)
1004967
.get('/api/v2/' + coinName + '/key/def')
1005968
.reply(200, userAuthKey);
@@ -1013,15 +976,13 @@ describe('Lightning wallets', function () {
1013976
assert.strictEqual(response.withdrawStatus?.status, 'delivered');
1014977
assert.strictEqual(response.withdrawStatus?.txid, 'tx123');
1015978
assert.strictEqual((response.withdrawStatus as any).signature, undefined);
1016-
assert.deepStrictEqual(response.transfer, updatedTransferResponse);
1017979

1018980
userAuthKeyNock.done();
1019981
nodeAuthKeyNock.done();
1020982
createTxRequestNock.done();
1021983
storeSignatureNock.done();
1022984
createTransferNock.done();
1023985
sendTxRequestNock.done();
1024-
getTransferNock.done();
1025986
});
1026987

1027988
it('should handle pending approval when withdrawing onchain', async function () {

0 commit comments

Comments
 (0)