Repository navigation
Expand file tree
/
Copy pathoperation_trace_result.go
More file actions
71 lines (68 loc) · 3.41 KB
/
Copy pathoperation_trace_result.go
File metadata and controls
71 lines (68 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package xdr
import "fmt"
// MapOperationResultTr returns a string representation of the result code for the operation.
// Each operation type corresponds to a specific result struct (e.g., CreateAccountResult, PaymentResult, ...)
// This function extracts and returns the result code's string value.
func (o OperationResultTr) MapOperationResultTr() (string, error) {
var operationTraceDescription string
operationType := o.Type
switch operationType {
case OperationTypeCreateAccount:
operationTraceDescription = o.CreateAccountResult.Code.String()
case OperationTypePayment:
operationTraceDescription = o.PaymentResult.Code.String()
case OperationTypePathPaymentStrictReceive:
operationTraceDescription = o.PathPaymentStrictReceiveResult.Code.String()
case OperationTypePathPaymentStrictSend:
operationTraceDescription = o.PathPaymentStrictSendResult.Code.String()
case OperationTypeManageBuyOffer:
operationTraceDescription = o.ManageBuyOfferResult.Code.String()
case OperationTypeManageSellOffer:
operationTraceDescription = o.ManageSellOfferResult.Code.String()
case OperationTypeCreatePassiveSellOffer:
operationTraceDescription = o.CreatePassiveSellOfferResult.Code.String()
case OperationTypeSetOptions:
operationTraceDescription = o.SetOptionsResult.Code.String()
case OperationTypeChangeTrust:
operationTraceDescription = o.ChangeTrustResult.Code.String()
case OperationTypeAllowTrust:
operationTraceDescription = o.AllowTrustResult.Code.String()
case OperationTypeAccountMerge:
operationTraceDescription = o.AccountMergeResult.Code.String()
case OperationTypeInflation:
operationTraceDescription = o.InflationResult.Code.String()
case OperationTypeManageData:
operationTraceDescription = o.ManageDataResult.Code.String()
case OperationTypeBumpSequence:
operationTraceDescription = o.BumpSeqResult.Code.String()
case OperationTypeCreateClaimableBalance:
operationTraceDescription = o.CreateClaimableBalanceResult.Code.String()
case OperationTypeClaimClaimableBalance:
operationTraceDescription = o.ClaimClaimableBalanceResult.Code.String()
case OperationTypeBeginSponsoringFutureReserves:
operationTraceDescription = o.BeginSponsoringFutureReservesResult.Code.String()
case OperationTypeEndSponsoringFutureReserves:
operationTraceDescription = o.EndSponsoringFutureReservesResult.Code.String()
case OperationTypeRevokeSponsorship:
operationTraceDescription = o.RevokeSponsorshipResult.Code.String()
case OperationTypeClawback:
operationTraceDescription = o.ClawbackResult.Code.String()
case OperationTypeClawbackClaimableBalance:
operationTraceDescription = o.ClawbackClaimableBalanceResult.Code.String()
case OperationTypeSetTrustLineFlags:
operationTraceDescription = o.SetTrustLineFlagsResult.Code.String()
case OperationTypeLiquidityPoolDeposit:
operationTraceDescription = o.LiquidityPoolDepositResult.Code.String()
case OperationTypeLiquidityPoolWithdraw:
operationTraceDescription = o.LiquidityPoolWithdrawResult.Code.String()
case OperationTypeInvokeHostFunction:
operationTraceDescription = o.InvokeHostFunctionResult.Code.String()
case OperationTypeExtendFootprintTtl:
operationTraceDescription = o.ExtendFootprintTtlResult.Code.String()
case OperationTypeRestoreFootprint:
operationTraceDescription = o.RestoreFootprintResult.Code.String()
default:
return operationTraceDescription, fmt.Errorf("unknown operation type: %s", o.Type.String())
}
return operationTraceDescription, nil
}