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

[construction] Support public_keys in /construction/metadata options #61

Merged
merged 1 commit into from
Aug 10, 2023
Merged

[construction] Support public_keys in /construction/metadata options #61

merged 1 commit into from
Aug 10, 2023

Conversation

stefanmendoza
Copy link
Collaborator

@stefanmendoza stefanmendoza commented Aug 10, 2023

Summary

Adding support for pulling the public_keys from the options in /construction/metadata.

Example

With public_keys provided

POST http://localhost:8080/construction/metadata

Request:

{
    "network_identifier": {
        "blockchain": "vara",
        "network": "testnet"
    },
    "public_keys": [
        {
            "hex_bytes": "6b476b66796d46714234614256756e5843573639457a515244746b5a6b5551423434474234584a6e774e77716d5779524e",
            "curve_type": "edwards25519"
        }
    ]
}

Response:

{
    "metadata": {
        "nonce": 0,
        "blockHash": "0x2ce823ec9e56c3885c2eae5b3ef0de53b9a858cd919aa03e58d8b348249d9ff8",
        "blockNumber": 2806228,
        "eraPeriod": 105
    }
}

With public_keys in options

POST http://localhost:8080/construction/metadata

Request:

{
    "network_identifier": {
        "blockchain": "vara",
        "network": "testnet"
    },
    "options": {
        "public_keys": [
            "6b476b66796d46714234614256756e5843573639457a515244746b5a6b5551423434474234584a6e774e77716d5779524e"
        ]
    }
}

Response:

{
    "metadata": {
        "nonce": 0,
        "blockHash": "0xf8e13dda214658a1c54f866a473bd9952238011aeb61601d141a48d7c6024507",
        "blockNumber": 2806243,
        "eraPeriod": 105
    }
}

Error Handling

POST http://localhost:8080/construction/metadata

Request:

{
    "network_identifier": {
        "blockchain": "vara",
        "network": "testnet"
    }
}

Response:

{
    "code": 612,
    "message": "No public key was provided",
    "retriable": false
}

@stefanmendoza stefanmendoza merged commit b5d73b4 into gear-foundation:master Aug 10, 2023
1 check passed
@stefanmendoza stefanmendoza deleted the stefanmendoza/support-publicKeys-in-metadata-options branch August 10, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants