@@ -161,61 +161,6 @@ func (k Keeper) NewWithdrawRequest(ctx sdk.Context, sender string, amount string
161161 Sequence : k .IncreaseWithdrawRequestSequence (ctx ),
162162 }
163163}
164-
165- // NewSigningRequest creates a new withdrawal request
166- func (k Keeper ) NewSigningRequest (ctx sdk.Context , sender string , amount sdk.Coin , feeRate int64 ) (* types.SigningRequest , error ) {
167- p := k .GetParams (ctx )
168- btcVault := types .SelectVaultByAssetType (p .Vaults , types .AssetType_ASSET_TYPE_BTC )
169-
170- switch types .AssetTypeFromDenom (amount .Denom , p ) {
171- case types .AssetType_ASSET_TYPE_BTC :
172- return k .NewBtcSigningRequest (ctx , sender , amount , feeRate , btcVault .Address )
173-
174- case types .AssetType_ASSET_TYPE_RUNES :
175- runesVault := types .SelectVaultByAssetType (p .Vaults , types .AssetType_ASSET_TYPE_RUNES )
176- return k .NewRunesSigningRequest (ctx , sender , amount , feeRate , runesVault .Address , btcVault .Address )
177-
178- default :
179- return nil , types .ErrAssetNotSupported
180- }
181- }
182-
183- // NewBtcSigningRequest creates the signing request for btc withdrawal
184- func (k Keeper ) NewBtcSigningRequest (ctx sdk.Context , sender string , amount sdk.Coin , feeRate int64 , vault string ) (* types.SigningRequest , error ) {
185- utxoIterator := k .GetUTXOIteratorByAddr (ctx , vault )
186-
187- psbt , selectedUTXOs , changeUTXO , err := types .BuildPsbt (utxoIterator , sender , amount .Amount .Int64 (), feeRate , vault , k .GetMaxUtxoNum (ctx ))
188- if err != nil {
189- return nil , err
190- }
191-
192- psbtB64 , err := psbt .B64Encode ()
193- if err != nil {
194- return nil , types .ErrFailToSerializePsbt
195- }
196-
197- txHash := psbt .UnsignedTx .TxHash ().String ()
198-
199- // spend the selected utxos
200- _ = k .SpendUTXOs (ctx , selectedUTXOs )
201-
202- // lock the change utxo
203- k .lockChangeUTXOs (ctx , txHash , changeUTXO )
204-
205- signingRequest := & types.SigningRequest {
206- Address : sender ,
207- Sequence : k .IncrementSigningRequestSequence (ctx ),
208- Txid : txHash ,
209- Psbt : psbtB64 ,
210- CreationTime : ctx .BlockTime (),
211- Status : types .SigningStatus_SIGNING_STATUS_PENDING ,
212- }
213-
214- k .SetSigningRequest (ctx , signingRequest )
215-
216- return signingRequest , nil
217- }
218-
219164// NewRunesSigningRequest creates the signing request for runes withdrawal
220165func (k Keeper ) NewRunesSigningRequest (ctx sdk.Context , sender string , amount sdk.Coin , feeRate int64 , vault string , btcVault string ) (* types.SigningRequest , error ) {
221166 var runeId types.RuneId
0 commit comments