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

Add trusted field to token serialiser #1790

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions safe_transaction_service/history/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def test_all_transactions_view(self):
"symbol": token.symbol,
"decimals": token.decimals,
"logo_uri": token.get_full_logo_uri(),
"trusted": token.trusted,
},
)
transfers_not_empty = [
Expand Down Expand Up @@ -2325,6 +2326,7 @@ def test_incoming_transfers_view(self):
"symbol": token.symbol,
"decimals": token.decimals,
"logoUri": token.get_full_logo_uri(),
"trusted": token.trusted,
},
},
{
Expand Down Expand Up @@ -2400,6 +2402,7 @@ def test_incoming_transfers_view(self):
"symbol": token.symbol,
"decimals": token.decimals,
"logoUri": token.get_full_logo_uri(),
"trusted": token.trusted,
},
},
{
Expand Down Expand Up @@ -2569,6 +2572,7 @@ def test_transfers_view(self):
"symbol": token.symbol,
"decimals": token.decimals,
"logoUri": token.get_full_logo_uri(),
"trusted": token.trusted,
},
},
{
Expand Down Expand Up @@ -2856,6 +2860,7 @@ def test_get_transfer_view(self):
"symbol": token.symbol,
"decimals": token.decimals,
"logoUri": token.get_full_logo_uri(),
"trusted": token.trusted,
},
}
self.assertEqual(response.json(), expected_result)
Expand Down
1 change: 1 addition & 0 deletions safe_transaction_service/tokens/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TokenInfoResponseSerializer(serializers.Serializer):
symbol = serializers.CharField()
decimals = serializers.IntegerField()
logo_uri = serializers.SerializerMethodField()
trusted = serializers.BooleanField()

def get_type(self, obj: Token) -> str:
if obj.is_erc20():
Expand Down
3 changes: 3 additions & 0 deletions safe_transaction_service/tokens/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_token_view(self):
"name": token.name,
"symbol": token.symbol,
"decimals": token.decimals,
"trusted": token.trusted,
},
)

Expand All @@ -59,6 +60,7 @@ def test_token_view(self):
"name": token.name,
"symbol": token.symbol,
"decimals": token.decimals,
"trusted": token.trusted,
},
)

Expand Down Expand Up @@ -95,6 +97,7 @@ def test_tokens_view(self):
"name": token.name,
"symbol": token.symbol,
"decimals": token.decimals,
"trusted": token.trusted,
}
],
)