Skip to content

Name-registry: Refactor get_timestamp_and_call to get the timestamp from a transaction #684

Open
@K1-R1

Description

@K1-R1

Once fuels-rs 0.42.0 is available, the test utility function get_timestamp_and_call can be refactored in order to get the timestamp from a transaction, as opposed to a hard-coded value. An example of how the refactor might look:

pub(crate) async fn get_timestamp_and_call<T, D>(
    handler: ContractCallHandler<T, D>,
) -> (FuelCallResponse<D>, u64)
where
    T: FuelAccount,
    D: Tokenizable + Debug,
{
    let call_response = handler.call().await.unwrap();
    let tx_id = call_response.tx_id;

    let provider = handler.account.try_provider().unwrap();
    let tx_response = provider
        .get_transaction_by_id(&tx_id)
        .await
        .unwrap()
        .unwrap();

    let time = tx_response.time.unwrap().timestamp().try_into().unwrap();

    (call_response, time)
}

This requires the release of fuels-rs 0.42.0 in order to access the tx_id from a FuelCallResponse, made available by:
FuelLabs/fuels-rs#734

This should also allow for testing on currently ignored tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    App: Name RegistryLabel used to filter for the app issueAwaiting SDK feature(s)SDK does not support desired functionality, yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions