diff --git a/internal/transform/schema.go b/internal/transform/schema.go index 0f255a2b..466fab22 100644 --- a/internal/transform/schema.go +++ b/internal/transform/schema.go @@ -230,7 +230,7 @@ type TrustlineOutput struct { AccountID string `json:"account_id"` AssetCode string `json:"asset_code"` AssetIssuer string `json:"asset_issuer"` - AssetType int32 `json:"asset_type"` + AssetType string `json:"asset_type"` AssetID int64 `json:"asset_id"` Balance float64 `json:"balance"` TrustlineLimit int64 `json:"trust_line_limit"` diff --git a/internal/transform/trustline.go b/internal/transform/trustline.go index dd0f3c26..40f06e6d 100644 --- a/internal/transform/trustline.go +++ b/internal/transform/trustline.go @@ -41,6 +41,7 @@ func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHisto if asset.Type == xdr.AssetTypeAssetTypePoolShare { poolID = PoolIDToString(trustEntry.Asset.MustLiquidityPoolId()) + assetType = "pool_share" } else { if err = asset.Extract(&assetType, &outputAssetCode, &outputAssetIssuer); err != nil { return TrustlineOutput{}, errors.Wrap(err, fmt.Sprintf("could not parse asset for trustline with account %s", outputAccountID)) @@ -61,7 +62,7 @@ func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHisto transformedTrustline := TrustlineOutput{ LedgerKey: outputLedgerKey, AccountID: outputAccountID, - AssetType: int32(asset.Type), + AssetType: assetType, AssetCode: outputAssetCode, AssetIssuer: outputAssetIssuer, AssetID: outputAssetID, diff --git a/internal/transform/trustline_test.go b/internal/transform/trustline_test.go index 437fd7dc..7bbef506 100644 --- a/internal/transform/trustline_test.go +++ b/internal/transform/trustline_test.go @@ -128,7 +128,7 @@ func makeTrustlineTestOutput() []TrustlineOutput { { LedgerKey: "AAAAAQAAAACI4aa0pXFSj6qfJuIObLw/5zyugLRGYwxb7wFSr3B9eAAAAAFFVEgAAAAAAGfMAIZMO4kWjGqv4Lw0cJ7QIcUFcuL5iGE0IggsIily", AccountID: testAccount1Address, - AssetType: 1, + AssetType: "credit_alphanum4", AssetIssuer: testAccount3Address, AssetCode: "ETH", AssetID: -2311386320395871674, @@ -146,7 +146,7 @@ func makeTrustlineTestOutput() []TrustlineOutput { { LedgerKey: "AAAAAQAAAAAcR0GXGO76pFs4y38vJVAanjnLg4emNun7zAx0pHcDGAAAAAMBAwQFBwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", AccountID: testAccount2Address, - AssetType: 3, + AssetType: "pool_share", AssetID: -1967220342708457407, Balance: 0.5, TrustlineLimit: 1111111111111111111,