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

Separate functions that are not related to the issuer #664

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

YoshihitoAso
Copy link
Member

@YoshihitoAso YoshihitoAso commented Jul 24, 2024

1. Change to store issuer-related and unrelated APIs in separate directories

app > routers > issuer | misc

2. Add environment variables

  • FREEZE_LOG_FEATURE_ENABLED: Set if you want to use FRREZE-LOG features.
  • DVP_AGENT_FEATURE_ENABLED: Set if you want to use DVP Paying Agent features.

3. Change to DVP-related APIs

  1. The API used by the paying agent was extracted and redefined.
    • For issuer: app.routers.issuer.settlement_issuer.py
    • For paying agent: app.routers.misc.settlement_agent.py
  2. Change the specifications for issuer-related APIs to force the issuer address to be set in the header. Data between issuers is now safely separated.
    • GET: /settlement/dvp/{exchange_address}/deliveries
    • GET: /settlement/dvp/{exchange_address}/delivery/{delivery_id}

@YoshihitoAso YoshihitoAso marked this pull request as ready for review July 24, 2024 14:31
Comment on lines +121 to +128
if DVP_AGENT_FEATURE_ENABLED:
app.include_router(settlement_agent.router)

if BC_EXPLORER_ENABLED:
app.include_router(bc_explorer.router)

if FREEZE_LOG_FEATURE_ENABLED:
app.include_router(freeze_log.router)
Copy link
Member Author

Choose a reason for hiding this comment

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

APIs are loaded according to the environment variable settings.

Comment on lines 70 to 81
issuer_address: str = Header(...),
):
"""List of DVP delivery"""
stmt = select(IDXDelivery).where(
IDXDelivery.exchange_address == exchange_address,
stmt = (
select(IDXDelivery)
.join(Token, Token.token_address == IDXDelivery.token_address)
.where(
and_(
IDXDelivery.exchange_address == exchange_address,
Token.issuer_address == issuer_address,
)
)
Copy link
Member Author

@YoshihitoAso YoshihitoAso Jul 24, 2024

Choose a reason for hiding this comment

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

Filter only data related to tokens issued by the issuer set in the header.

@YoshihitoAso
Copy link
Member Author

From the Agent's perspective, there was a problem with referencing the delivery list, so a new API was added.
17a38ff

Copy link
Member

@purplesmoke05 purplesmoke05 left a comment

Choose a reason for hiding this comment

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

LGTM

@YoshihitoAso YoshihitoAso merged commit 52c5164 into dev-24.9 Jul 25, 2024
6 checks passed
@YoshihitoAso YoshihitoAso deleted the separate-dvp-agent branch July 25, 2024 03:43
@YoshihitoAso YoshihitoAso added the enhancement New feature or request label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants