-
Notifications
You must be signed in to change notification settings - Fork 252
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: refactor ext API and add new NEP264 functionality #742
Merged
Merged
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d2c3a5a
Add new host function to sys and env
austinabell dda9d97
Add new ext codegen macros
austinabell 12c4a96
update examples to new auto-gen API
austinabell 5715b08
update serializer input to take references
austinabell 43f325c
fmt and clippy
austinabell 166ff7c
update ext struct to be must_use
austinabell f8bde2c
update ext_contract API
austinabell a88e9b0
cleanup and remove duplication
austinabell 5cbf844
addr comments
austinabell cc1983d
rebuild
austinabell 5610500
Merge branch 'master' of github.com:near/near-sdk-rs into austin/func…
austinabell 94cd0d3
fix weight
austinabell 06e3fed
Merge branch 'master' of github.com:near/near-sdk-rs into austin/func…
austinabell 93850fd
Merge branch 'master' of github.com:near/near-sdk-rs into austin/func…
austinabell e68b7f3
update with_attached_deposit name
austinabell e5a6e1f
Merge branch 'master' into austin/func_call_weight
austinabell 896c2cb
fmt
austinabell 4204e22
ignore broken sim tests and update doc test
austinabell ad75973
link unused host function for testing temporarily
austinabell 522301d
Merge branch 'master' of github.com:near/near-sdk-rs into austin/func…
austinabell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+209 Bytes
(100%)
examples/cross-contract-high-level/res/cross_contract_high_level.wasm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+12 Bytes
(100%)
examples/cross-contract-low-level/res/cross_contract_low_level.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
examples/lockable-fungible-token/res/lockable_fungible_token.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
examples/status-message-collections/res/status_message_collections.wasm
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't
account_id
always beenv::current_account_id()
here since we are calling the current contract?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it is. This is just cloning that every time to avoid using the host function three times (unnecessary gas usage)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then perhaps the
Self
could handle this making the API a little more ergonomic and preventing users from calling another contract.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But they can call the self API to another contract. I thought you meant only in this case. The account_id can absolutely be different than the current.
I don't think it's worth adding another method for calling it on self, because cases like this you might want to avoid calling the host function more than once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another contract might have the same interface as the current contract, but I would personally propose
Self
always be calling the current contract. It would make reading over the contract easier:And my point with
Self
handling theaccount_id
is that it could lazily load and cache it.Also You could still have
Self::ext
if you need the functionality, but for most uses ofSelf
this would be a better DevX.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work. These methods already exist. Feel free to create a commit/diff if you have an idea for this working, and I'll happily consider it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah silly me forgot it's the same
Self
, thought it was generated. You would need to generate another modulecurrent_contract
, which is a bit longer thanSelf
. I'll think about it more because this is a pain point.