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

Export functions for creating Timepoint/Duration #1201

Merged
merged 5 commits into from
Jan 17, 2024
Merged

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Jan 8, 2024

What

Export functions for creating and accessing Timepoint and Duration.

Why

The types are not creatable inside a contract, and outside a contract in tests are only creatable using the XDR ScVal type. If developers are to use the Timepoint and Duration types, they need to be able to construct the types from primitive values.

The Timepoint from_unix and to_unix functions were added using the unix terminologgy because that's the type of time values the Stellar network uses.

The Duration from_seconds and to_seconds functions were added using the seconds terminology because it seemed like the most direct way to communicate intent. I originally intended to use secs which I think would also be reasonable and feedback on the issue suggested seconds which also seems reasonable to me.

While for both types functions were repurposed/removed, those functions were private only and should have no impact on compatibility.

Close #1197

@leighmcculloch leighmcculloch marked this pull request as ready for review January 8, 2024 02:24
soroban-sdk/src/env.rs Outdated Show resolved Hide resolved
@leighmcculloch
Copy link
Member Author

Holding until this other issue is closed:

@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 16, 2024
@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 17, 2024
@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 17, 2024
@leighmcculloch leighmcculloch removed this pull request from the merge queue due to a manual request Jan 17, 2024
@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 17, 2024
@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 17, 2024
Merged via the queue into main with commit eb9f7e2 Jan 17, 2024
21 checks passed
@leighmcculloch leighmcculloch deleted the i1197forreal branch January 17, 2024 21:14
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.

Timepoint and Duration types are difficult to construct in tests
2 participants