Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
gouthamp-stellar committed Nov 27, 2024
1 parent 0c94a3f commit c26052a
Showing 1 changed file with 0 additions and 96 deletions.
96 changes: 0 additions & 96 deletions internal/tss/services/transaction_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,6 @@ func (t *transactionService) NetworkPassphrase() string {
return t.DistributionAccountSignatureClient.NetworkPassphrase()
}

/*
func buildPayments(srcAccount string, operations []txnbuild.Operation) ([]txnbuild.Operation, error) {
var payments []txnbuild.Operation
for _, op := range operations {
origPayment, ok := op.(*txnbuild.Payment)
if !ok {
return nil, fmt.Errorf("unable to convert operation to payment op")
}
payment := &txnbuild.Payment{
SourceAccount: srcAccount,
Amount: origPayment.Amount,
Destination: origPayment.Destination,
Asset: origPayment.Asset,
}
payments = append(payments, payment)
}
return payments, nil
}
*/

func (t *transactionService) BuildAndSignTransactionWithChannelAccount(ctx context.Context, operations []txnbuild.Operation, timeoutInSecs int64) (*txnbuild.Transaction, error) {
channelAccountPublicKey, err := t.ChannelAccountSignatureClient.GetAccountPublicKey(ctx)
if err != nil {
Expand Down Expand Up @@ -140,78 +119,3 @@ func (t *transactionService) BuildFeeBumpTransaction(ctx context.Context, tx *tx
}
return feeBumpTx, nil
}

// on the BuildTransactions API endpoint, call this method, but pass in the list of operations instead of origTxXdr
// everything else remains the same.
/*
func (t *transactionService) SignAndBuildNewFeeBumpTransaction(ctx context.Context, origTxXdr string) (*txnbuild.FeeBumpTransaction, error) {
genericTx, err := txnbuild.TransactionFromXDR(origTxXdr)
if err != nil {
return nil, tsserror.OriginalXDRMalformed
}
originalTx, txEmpty := genericTx.Transaction()
if !txEmpty {
return nil, tsserror.OriginalXDRMalformed
}
channelAccountPublicKey, err := t.ChannelAccountSignatureClient.GetAccountPublicKey(ctx)
if err != nil {
return nil, fmt.Errorf("getting channel account public key: %w", err)
}
channelAccount, err := t.HorizonClient.AccountDetail(horizonclient.AccountRequest{AccountID: channelAccountPublicKey})
if err != nil {
return nil, fmt.Errorf("getting channel account details from horizon: %w", err)
}
distributionAccountPublicKey, err := t.DistributionAccountSignatureClient.GetAccountPublicKey(ctx)
if err != nil {
return nil, fmt.Errorf("getting distribution account public key: %w", err)
}
operations, err := buildPayments(distributionAccountPublicKey, originalTx.Operations())
if err != nil {
return nil, fmt.Errorf("building payment operations: %w", err)
}
log.Info(operations)
tx, err := txnbuild.NewTransaction(
txnbuild.TransactionParams{
SourceAccount: &channelAccount,
Operations: operations,
BaseFee: int64(t.BaseFee),
Preconditions: txnbuild.Preconditions{
TimeBounds: txnbuild.NewTimeout(120),
},
IncrementSequenceNum: true,
},
)
if err != nil {
return nil, fmt.Errorf("building transaction: %w", err)
}
tx, err = t.ChannelAccountSignatureClient.SignStellarTransaction(ctx, tx, channelAccountPublicKey)
if err != nil {
return nil, fmt.Errorf("signing transaction with channel account: %w", err)
}
tx, err = t.DistributionAccountSignatureClient.SignStellarTransaction(ctx, tx, distributionAccountPublicKey)
if err != nil {
return nil, fmt.Errorf("signing transaction with distribution account: %w", err)
}
feeBumpTx, err := txnbuild.NewFeeBumpTransaction(
txnbuild.FeeBumpTransactionParams{
Inner: tx,
FeeAccount: distributionAccountPublicKey,
BaseFee: int64(t.BaseFee),
},
)
if err != nil {
return nil, fmt.Errorf("building fee-bump transaction %w", err)
}
feeBumpTx, err = t.DistributionAccountSignatureClient.SignStellarFeeBumpTransaction(ctx, feeBumpTx)
if err != nil {
return nil, fmt.Errorf("signing the fee bump transaction with distribution account: %w", err)
}
return feeBumpTx, nil
}
*/

0 comments on commit c26052a

Please sign in to comment.