mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Add maker_hash_id to book response
This commit is contained in:
parent
b62ace481d
commit
92b041cb31
@ -476,6 +476,7 @@ class OrderDetailSerializer(serializers.ModelSerializer):
|
||||
|
||||
class OrderPublicSerializer(serializers.ModelSerializer):
|
||||
maker_nick = serializers.CharField(required=False)
|
||||
maker_hash_id = serializers.CharField(required=False)
|
||||
maker_status = serializers.CharField(
|
||||
help_text='Status of the nick - "Active" or "Inactive"', required=False
|
||||
)
|
||||
@ -505,6 +506,7 @@ class OrderPublicSerializer(serializers.ModelSerializer):
|
||||
"satoshis",
|
||||
"maker",
|
||||
"maker_nick",
|
||||
"maker_hash_id",
|
||||
"maker_status",
|
||||
"price",
|
||||
"escrow_duration",
|
||||
|
@ -708,6 +708,7 @@ class BookView(ListAPIView):
|
||||
for order in queryset:
|
||||
data = ListOrderSerializer(order).data
|
||||
data["maker_nick"] = str(order.maker)
|
||||
data["maker_hash_id"] = str(order.maker.robot.hash_id)
|
||||
|
||||
data["satoshis_now"] = Logics.satoshis_now(order)
|
||||
# Compute current premium for those orders that are explicitly priced.
|
||||
|
@ -1554,6 +1554,8 @@ components:
|
||||
nullable: true
|
||||
maker_nick:
|
||||
type: string
|
||||
maker_hash_id:
|
||||
type: string
|
||||
maker_status:
|
||||
type: string
|
||||
description: Status of the nick - "Active" or "Inactive"
|
||||
|
@ -137,6 +137,9 @@ class RobotTokenSHA256AuthenticationMiddleWare:
|
||||
|
||||
user = User.objects.create_user(username=nickname, password=None)
|
||||
|
||||
# Store hash_id
|
||||
user.robot.hash_id = hash
|
||||
|
||||
# Django rest_framework authtokens are limited to 40 characters.
|
||||
# We use base91 so we can store the full entropy in the field.
|
||||
Token.objects.create(key=token_sha256_b91, user=user)
|
||||
|
@ -831,6 +831,7 @@ class TradeTest(BaseAPITestCase):
|
||||
|
||||
self.assertIsInstance(datetime.fromisoformat(data[0]["created_at"]), datetime)
|
||||
self.assertIsInstance(datetime.fromisoformat(data[0]["expires_at"]), datetime)
|
||||
self.assertIsHash(data[0]["maker_hash_id"])
|
||||
self.assertIsNone(data[0]["amount"])
|
||||
self.assertAlmostEqual(
|
||||
float(data[0]["min_amount"]), trade.maker_form["min_amount"]
|
||||
|
Loading…
Reference in New Issue
Block a user