@@ -19,7 +19,7 @@ import {
1919import i18n from 'utils/i18n'
2020import AddressService from 'services/addresses'
2121import WalletCreatedSubject from 'models/subjects/wallet-created-subject'
22- import { TransactionWithoutHash } from 'types/cell-types'
22+ import { TransactionWithoutHash , OutPoint } from 'types/cell-types'
2323
2424export default class WalletsController {
2525 public static async getAll ( ) : Promise < Controller . Response < Pick < Wallet , 'id' | 'name' > [ ] > > {
@@ -400,6 +400,74 @@ export default class WalletsController {
400400 }
401401 }
402402
403+ public static async generateDepositTx ( params : {
404+ walletID : string ,
405+ capacity : string ,
406+ fee : string ,
407+ feeRate : string ,
408+ } ) {
409+ if ( ! params ) {
410+ throw new IsRequired ( 'Parameters' )
411+ }
412+ const walletsService = WalletsService . getInstance ( )
413+ const tx = await walletsService . generateDepositTx (
414+ params . walletID ,
415+ params . capacity ,
416+ params . fee ,
417+ params . feeRate ,
418+ )
419+ return {
420+ status : ResponseCode . Success ,
421+ result : tx ,
422+ }
423+ }
424+
425+ public static async startWithdrawFromDao ( params : {
426+ walletID : string ,
427+ outPoint : OutPoint ,
428+ fee : string ,
429+ feeRate : string ,
430+ } ) {
431+ if ( ! params ) {
432+ throw new IsRequired ( 'Parameters' )
433+ }
434+ const walletsService = WalletsService . getInstance ( )
435+ const tx = await walletsService . startWithdrawFromDao (
436+ params . walletID ,
437+ params . outPoint ,
438+ params . fee ,
439+ params . feeRate ,
440+ )
441+ return {
442+ status : ResponseCode . Success ,
443+ result : tx ,
444+ }
445+ }
446+
447+ public static async withdrawFormDao ( params : {
448+ walletID : string ,
449+ depositOutPoint : OutPoint ,
450+ withdrawingOutPoint : OutPoint ,
451+ fee : string ,
452+ feeRate : string ,
453+ } ) {
454+ if ( ! params ) {
455+ throw new IsRequired ( 'Parameters' )
456+ }
457+ const walletsService = WalletsService . getInstance ( )
458+ const tx = await walletsService . withdrawFormDao (
459+ params . walletID ,
460+ params . depositOutPoint ,
461+ params . withdrawingOutPoint ,
462+ params . fee ,
463+ params . feeRate ,
464+ )
465+ return {
466+ status : ResponseCode . Success ,
467+ result : tx ,
468+ }
469+ }
470+
403471 public static async computeCycles ( params : { walletID : string ; capacities : string } ) {
404472 if ( ! params ) {
405473 throw new IsRequired ( 'Parameters' )
0 commit comments