-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Pythonic Promise API for Cross-Contract Calls #5
base: main
Are you sure you want to change the base?
Conversation
With this API I have a bunch of open questions:
|
No operation ID found for this PR |
No operation ID found for this PR |
@r-near Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: waiting for scoringWe're waiting for maintainer to score this pull request with What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
Summary
This PR introduces a new Pythonic Promise API for NEAR cross-contract calls. The API significantly improves the developer experience by providing a fluent, chainable interface for asynchronous operations while maintaining full compatibility with the existing functionality.
Motivation
The current cross-contract call API is functional but has several usability issues:
The new Promise API addresses these issues with a clean, Pythonic interface that leverages modern Python features like method chaining and keyword arguments.
Changes
promises.py
with a fluent API for cross-contract callsContract
class toBaseContract
to avoid conflictsdocs
directoryNew API Features
The new API provides:
Fluent Interface:
Simplified Callbacks:
Better Context Passing:
Improved Error Handling:
Documentation
The PR includes comprehensive documentation:
Breaking Changes
None. This PR introduces a new API without modifying existing functionality. The original
CrossContract
API remains fully functional.Usage Example
Future Work