Skip to content

Commit

Permalink
Fix the name of unlock data schema
Browse files Browse the repository at this point in the history
  • Loading branch information
purplesmoke05 committed Oct 31, 2024
1 parent c6d0255 commit d5509f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/model/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
IDXPositionShareBlockNumber,
)
from .idx_transfer import (
DataMessage,
IDXTransfer,
IDXTransferBlockNumber,
IDXTransferSourceEventType,
UnlockData,
)
from .idx_transfer_approval import (
IDXTransferApproval,
Expand Down
4 changes: 2 additions & 2 deletions app/model/db/idx_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IDXTransferSourceEventType(StrEnum):
UNLOCK = "Unlock"


class UnlockData(BaseModel):
class DataMessage(BaseModel):
message: Literal[
"garnishment",
"inheritance",
Expand Down Expand Up @@ -65,7 +65,7 @@ class IDXTransfer(Base):
# source_event = "Transfer"
# => None
# source_event = "Unlock"
# => UnlockData
# => DataMessage
data: Mapped[dict | None] = mapped_column(JSON)
# Message
# source_event = "Transfer"
Expand Down
4 changes: 2 additions & 2 deletions app/model/schema/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Transfer(TransferBase):
data: None = Field(description="Event data")


class UnlockData(BaseModel):
class DataMessage(BaseModel):
message: Literal[
"garnishment",
"inheritance",
Expand All @@ -81,7 +81,7 @@ class UnlockTransfer(TransferBase):
source_event: Literal[TransferSourceEventType.Unlock] = Field(
description="Source Event"
)
data: UnlockData | dict = Field(description="Event data")
data: DataMessage | dict = Field(description="Event data")


############################
Expand Down
4 changes: 2 additions & 2 deletions batch/indexer_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
from app.exceptions import ServiceUnavailableError
from app.model.db import (
Account,
DataMessage,
IDXTransfer,
IDXTransferBlockNumber,
IDXTransferSourceEventType,
Token,
UnlockData,
)
from app.utils.contract_utils import AsyncContractUtils
from app.utils.web3_utils import AsyncWeb3Wrapper
Expand Down Expand Up @@ -286,7 +286,7 @@ async def __sink_on_transfer(
if data_str is not None:
try:
data = json.loads(data_str)
validated_data = UnlockData(**data)
validated_data = DataMessage(**data)
message = validated_data.message
except ValidationError:
data = {}
Expand Down
28 changes: 14 additions & 14 deletions docs/ibet_prime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11153,6 +11153,19 @@ components:
- notice_type
- metainfo
title: DVPDeliveryInfoNotification
DataMessage:
properties:
message:
type: string
enum:
- garnishment
- inheritance
- force_unlock
title: Message
type: object
required:
- message
title: DataMessage
DeliveryStatus:
type: integer
enum:
Expand Down Expand Up @@ -15422,19 +15435,6 @@ components:
allOf:
- $ref: '#/components/schemas/TxDataDetail'
title: TxDataResponse
UnlockData:
properties:
message:
type: string
enum:
- garnishment
- inheritance
- force_unlock
title: Message
type: object
required:
- message
title: UnlockData
UnlockInfoMetaInfo:
properties:
token_address:
Expand Down Expand Up @@ -15542,7 +15542,7 @@ components:
description: Source Event
data:
anyOf:
- $ref: '#/components/schemas/UnlockData'
- $ref: '#/components/schemas/DataMessage'
- type: object
title: Data
description: Event data
Expand Down

0 comments on commit d5509f1

Please sign in to comment.