diff --git a/internal/input/assets.go b/internal/input/assets.go index 6e29e816..00e83984 100644 --- a/internal/input/assets.go +++ b/internal/input/assets.go @@ -37,7 +37,7 @@ func GetPaymentOperations(start, end uint32, limit int64, isTest bool, isFuture for txIndex, transaction := range transactionSet { for opIndex, op := range transaction.Operations() { - if op.Body.Type == xdr.OperationTypePayment { + if op.Body.Type == xdr.OperationTypePayment || op.Body.Type == xdr.OperationTypeManageSellOffer { assetSlice = append(assetSlice, AssetTransformInput{ Operation: op, OperationIndex: int32(opIndex), diff --git a/internal/transform/asset.go b/internal/transform/asset.go index cbe60395..beec2540 100644 --- a/internal/transform/asset.go +++ b/internal/transform/asset.go @@ -15,16 +15,29 @@ func TransformAsset(operation xdr.Operation, operationIndex int32, transactionIn operationID := toid.New(ledgerSeq, int32(transactionIndex), operationIndex).ToInt64() opType := operation.Body.Type - if opType != xdr.OperationTypePayment { + if opType != xdr.OperationTypePayment && opType != xdr.OperationTypeManageSellOffer { return AssetOutput{}, fmt.Errorf("operation of type %d cannot issue an asset (id %d)", opType, operationID) } - op, ok := operation.Body.GetPaymentOp() - if !ok { - return AssetOutput{}, fmt.Errorf("could not access Payment info for this operation (id %d)", operationID) + asset := xdr.Asset{} + switch opType { + case xdr.OperationTypeManageSellOffer: + opSellOf, ok := operation.Body.GetManageSellOfferOp() + if ok { + return AssetOutput{}, fmt.Errorf("operation of type ManageSellOfferOp cannot issue an asset (id %d)", operationID) + } + asset = opSellOf.Selling + + case xdr.OperationTypePayment: + opPayment, ok := operation.Body.GetPaymentOp() + if !ok { + return AssetOutput{}, fmt.Errorf("could not access Payment info for this operation (id %d)", operationID) + } + asset = opPayment.Asset + } - outputAsset, err := transformSingleAsset(op.Asset) + outputAsset, err := transformSingleAsset(asset) if err != nil { return AssetOutput{}, fmt.Errorf("%s (id %d)", err.Error(), operationID) }