-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Add batch redeem/issue token API and Notification for batch redeem/issue #374
feat: Add batch redeem/issue token API and Notification for batch redeem/issue #374
Conversation
class IssueErrorMetainfo(BaseModel): | ||
token_address: str | ||
token_type: TokenType | ||
arguments: dict | ||
|
||
|
||
############################ | ||
# RESPONSE | ||
############################ | ||
class BulkTransferErrorMetainfo(BaseModel): | ||
upload_id: str | ||
token_type: TokenType | ||
error_transfer_id: list[int] | ||
|
||
class NotificationsListResponse(BaseModel): | ||
"""Notifications List schema (Response)""" | ||
|
||
class ScheduleEventErrorMetainfo(BaseModel): | ||
scheduled_event_id: int | ||
token_type: TokenType | ||
|
||
|
||
class TransferApprovalInfoMetaInfo(BaseModel): | ||
id: int | ||
token_address: str | ||
|
||
|
||
class CreateLedgerInfoMetaInfo(BaseModel): | ||
token_address: str | ||
token_type: TokenType | ||
ledger_id: int | ||
|
||
|
||
class BatchRegisterPersonalInfoErrorMetainfo(BaseModel): | ||
upload_id: str | ||
error_registration_id: list[int] | ||
|
||
|
||
class BatchIssueRedeemProcessedMetainfo(BaseModel): | ||
category: BatchIssueRedeemProcessingCategory | ||
upload_id: str | ||
error_data_id: list[int] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add notification types so as to make clear what will be set to metainfo.
|
||
class BulkTransferErrorNotification(Notification): | ||
notice_type: str = NotificationType.BULK_TRANSFER_ERROR | ||
notice_code: conint(ge=0, le=2) | ||
metainfo: BulkTransferErrorMetainfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = " - 0: Issuer does not exist\n" \ | ||
" - 1: Could not get the private key of the issuer\n" \ | ||
" - 2: Failed to send transaction\n" \ | ||
"\n" \ | ||
"notice_type: BatchRegisterPersonalInfoError\n" \ | ||
" - 0: Issuer does not exist\n" \ | ||
" - 1: Failed to send transaction\n" \ | ||
"\n" \ | ||
"notice_type: ScheduleEventError\n" \ | ||
" - 0: Issuer does not exist\n" \ | ||
|
||
|
||
|
||
class ScheduleEventErrorNotification(Notification): | ||
notice_type: str = NotificationType.SCHEDULE_EVENT_ERROR | ||
notice_code: conint(ge=0, le=2) | ||
metainfo: ScheduleEventErrorMetainfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = " - 0: Issuer does not exist\n" \ | ||
" - 1: Could not get the private key of the issuer\n" \ | ||
" - 2: Failed to send transaction\n" \ | ||
"\n" \ | ||
"notice_type: TransferApprovalInfo\n" \ | ||
" - 0: Apply for transfer\n" \ | ||
|
||
|
||
|
||
class TransferApprovalInfoNotification(Notification): | ||
notice_type: str = NotificationType.TRANSFER_APPROVAL_INFO | ||
notice_code: conint(ge=0, le=3) | ||
metainfo: TransferApprovalInfoMetaInfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = " - 0: Apply for transfer\n" \ | ||
" - 1: Cancel transfer\n" \ | ||
" - 2: Approve transfer\n" \ | ||
" - 3: Escrow finished (Only occurs in security token escrow)\n" \ | ||
"\n" \ | ||
"notice_type: CreateLedgerInfo\n" \ | ||
" - 0: Created ledger info successfully\n" \ | ||
" - 3: Escrow finished (Only occurs in security token escrow)\n" | ||
|
||
|
||
class CreateLedgerInfoNotification(Notification): | ||
notice_type: str = NotificationType.CREATE_LEDGER_INFO | ||
notice_code: conint(ge=0, le=0) | ||
metainfo: CreateLedgerInfoMetaInfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = " - 0: Created ledger info successfully\n" | ||
|
||
|
||
class BatchRegisterPersonalInfoErrorNotification(Notification): | ||
notice_type: str = NotificationType.BATCH_REGISTER_PERSONAL_INFO_ERROR | ||
notice_code: conint(ge=0, le=1) | ||
metainfo: BatchRegisterPersonalInfoErrorMetainfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = "notice_type: BatchRegisterPersonalInfoError\n" \ | ||
" - 0: Issuer does not exist\n" \ | ||
" - 1: Failed to send transaction\n" | ||
|
||
|
||
class BatchIssueRedeemProcessedNotification(Notification): | ||
notice_type: str = NotificationType.BATCH_ISSUE_REDEEM_PROCESSED | ||
notice_code: conint(ge=0, le=3) | ||
metainfo: BatchIssueRedeemProcessedMetainfo | ||
|
||
class Config: | ||
@staticmethod | ||
def schema_extra(schema: Dict[str, Any], _) -> None: | ||
notice_code_schema = schema["properties"]["notice_code"] | ||
notice_code_schema["description"] = "notice_type: BatchIssueRedeemProcessed\n" \ | ||
" - 0: All records successfully processed\n" \ | ||
" - 1: Issuer does not exist\n" \ | ||
" - 2: Failed to decode keyfile\n" \ | ||
" - 3: Some records are failed to send transaction" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently notice code schema description is too long because it's described in Notification model.
So I split notification into each type.
API doc view example is shown in PR top.
sort_order: int = Query(1, ge=0, le=1, description="0:asc, 1:desc (created)"), | ||
offset: Optional[int] = Query(None), | ||
limit: Optional[int] = Query(None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort_order
/offset
/limit
are added.- applied "created" field to sort item
- default
sort_order
is desc.
- default
notice_type: BatchIssueRedeemProcessed | ||
- 0: All records successfully processed | ||
- 1: Issuer does not exist | ||
- 2: Failed to decode keyfile | ||
- 3: Some records are failed to send transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added BatchIssueRedeemProcessed
.
Additional implementation for #331.
(Previous PR are #351 and #372)
Changes
Add API for referencing issue/redeem batch uploads list.
/bond/tokens/{token_address}/additional_issue/batch
/bond/tokens/{token_address}/redeem/batch
/share/tokens/{token_address}/additional_issue/batch
/share/tokens/{token_address}/redeem/batch
Add Notification Type for issue/redeem batch process.
BatchIssueProcessed
Refactoring of API Notification to define metainfo schema.(I/F not changed)
Refactoring of API to reference processing status of personal_info batch.(“created” field added)
/bond/tokens/{token_address}/personal_info/batch
/share/tokens/{token_address}/personal_info/batch