Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the data type of AssetType in trustline tables #268

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/transform/schema.go
Original file line number Diff line number Diff line change
@@ -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"`
2 changes: 1 addition & 1 deletion internal/transform/trustline.go
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHisto
transformedTrustline := TrustlineOutput{
LedgerKey: outputLedgerKey,
AccountID: outputAccountID,
AssetType: int32(asset.Type),
AssetType: asset.Type.String(),
amishas157 marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chowbao I am seeing values like AssetTypeAssetTypePoolShare in the tables
Screenshot 2024-07-19 at 10 26 15 AM

Should it rather be AssetTypePoolShare ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should match how history_assets does it which I think removes AssetTypeAssetType.

You might need to define a new function to make the change or look for an existing if one exists

AssetCode: outputAssetCode,
AssetIssuer: outputAssetIssuer,
AssetID: outputAssetID,
4 changes: 2 additions & 2 deletions internal/transform/trustline_test.go
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ func makeTrustlineTestOutput() []TrustlineOutput {
{
LedgerKey: "AAAAAQAAAACI4aa0pXFSj6qfJuIObLw/5zyugLRGYwxb7wFSr3B9eAAAAAFFVEgAAAAAAGfMAIZMO4kWjGqv4Lw0cJ7QIcUFcuL5iGE0IggsIily",
AccountID: testAccount1Address,
AssetType: 1,
AssetType: "AssetTypeAssetTypeCreditAlphanum4",
AssetIssuer: testAccount3Address,
AssetCode: "ETH",
AssetID: -2311386320395871674,
@@ -146,7 +146,7 @@ func makeTrustlineTestOutput() []TrustlineOutput {
{
LedgerKey: "AAAAAQAAAAAcR0GXGO76pFs4y38vJVAanjnLg4emNun7zAx0pHcDGAAAAAMBAwQFBwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
AccountID: testAccount2Address,
AssetType: 3,
AssetType: "AssetTypeAssetTypePoolShare",
AssetID: -1967220342708457407,
Balance: 0.5,
TrustlineLimit: 1111111111111111111,
Loading