diff --git a/internal/tss/services/transaction_service.go b/internal/tss/services/transaction_service.go index 5724b57..d998627 100644 --- a/internal/tss/services/transaction_service.go +++ b/internal/tss/services/transaction_service.go @@ -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 { @@ -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 -} -*/