Concordium / concordium-scan

CCDScan
Apache License 2.0
3 stars 14 forks source link

`input_parameter` display of `init_transactions` #303

Open DOBEN opened 5 days ago

DOBEN commented 5 days ago

Task description The current CCDScan (as well as other tooling https://github.com/Concordium/concordium-client/issues/291) doesn't display the input_parameter/message for init_transactions. The reason is that the ContractInitializedEvent from the node doesn't expose the value so this edge case was not handled previously. https://developer.concordium.software/concordium-grpc-api/#concordium.v2.ContractInitializedEvent

In contrast, contract_update_transactions have the input_parameter available in the event. https://developer.concordium.software/concordium-grpc-api/#concordium.v2.InstanceUpdatedEvent

Tasks:

Expand the CCDScan backend logic to extract the input_parameter/message e.g. via the SDK (not from the event) for init_transactions. Expand the frontend to display the input_parameter/message for init_transactions as well:

Back-end functions:

#[ComplexObject]
impl ContractInitialized {
    // TODO: the send message/input parameter is missing and not exposed by the event of the node currently.
    async fn message(&self) -> ApiResult<String> {

        // TODO: decode `self.input_parameter` with the schema.

        Ok(input_parameter_decoded)
    }

    // TODO: the send message/input parameter is missing and not exposed by the event of the node currently.
    async fn message_as_hex(&self) -> ApiResult<String> {
        Ok(hex::encode(self.input_parameter))
    }
    ...
}
DOBEN commented 1 day ago

Related PRs that expose the parameter in the ContractInitializedEvent: https://github.com/Concordium/concordium-base/pull/577 https://github.com/Concordium/concordium-node/pull/1261