@@ -3,7 +3,11 @@ import { LightningOnchainRecipient } from '@bitgo/public-types';
33import { PendingApprovalData , TxRequestState } from '@bitgo/sdk-core' ;
44import { BigIntFromString } from 'io-ts-types' ;
55
6- // todo:(current) which to keep here which to take to common types
6+ export const WithdrawStatusDelivered = 'delivered' ;
7+ export const WithdrawStatusFailed = 'failed' ;
8+
9+ export const WithdrawStatus = t . union ( [ t . literal ( WithdrawStatusDelivered ) , t . literal ( WithdrawStatusFailed ) ] ) ;
10+
711export const LightningOnchainWithdrawParams = t . type ( {
812 recipients : t . array ( LightningOnchainRecipient ) ,
913 satsPerVbyte : BigIntFromString ,
@@ -13,6 +17,20 @@ export const LightningOnchainWithdrawParams = t.type({
1317
1418export type LightningOnchainWithdrawParams = t . TypeOf < typeof LightningOnchainWithdrawParams > ;
1519
20+ export const LndCreateWithdrawResponse = t . intersection (
21+ [
22+ t . type ( {
23+ status : WithdrawStatus ,
24+ } ) ,
25+ t . partial ( {
26+ txid : t . string ,
27+ failureReason : t . string ,
28+ } ) ,
29+ ] ,
30+ 'LndCreateWithdrawResponse'
31+ ) ;
32+ export type LndCreateWithdrawResponse = t . TypeOf < typeof LndCreateWithdrawResponse > ;
33+
1634export type LightningOnchainWithdrawResponse = {
1735 /**
1836 * Unique identifier for withdraw request submitted to BitGo.
@@ -32,6 +50,14 @@ export type LightningOnchainWithdrawResponse = {
3250 */
3351 pendingApproval ?: PendingApprovalData ;
3452
53+ /**
54+ * Current snapshot of withdraw status (if available).
55+ * - **`'delivered'`**: Withdraw request is delivered to the blockchain.
56+ * - **`'failed'`**: Withdraw failed.
57+ * This field is absent if approval is required before processing.
58+ */
59+ withdrawStatus ?: LndCreateWithdrawResponse ;
60+
3561 /**
3662 * Latest transfer details for this withdraw request (if available).
3763 * - Provides the current state of the transfer.
@@ -77,10 +103,16 @@ export const SendPsbtRequest = t.type(
77103) ;
78104export type SendPsbtRequest = t . TypeOf < typeof SendPsbtRequest > ;
79105
80- export const SendPsbtResponse = t . type (
81- {
82- label : t . string ,
83- } ,
106+ export const SendPsbtResponse = t . intersection (
107+ [
108+ t . type ( {
109+ label : t . string ,
110+ } ) ,
111+ t . partial ( {
112+ status : WithdrawStatus ,
113+ failureReason : t . string ,
114+ } ) ,
115+ ] ,
84116 'SendPsbtResponse'
85117) ;
86118export type SendPsbtResponse = t . TypeOf < typeof SendPsbtResponse > ;
0 commit comments