-
Notifications
You must be signed in to change notification settings - Fork 98
feat: add --no-wallet flag and --wallet option to allow Users to bypass Wallet or specify a Wallet to use for calls #1476
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5c2bee1
feat: call as user to bypass wallet
d8fe587
Merge branch 'master' of github.com:dfinity/sdk into pshahi/call-as-user
4342a3c
add call_as_user
9c9d911
add e2e tests
db94409
update changelog and help string
84406d0
Merge branch 'master' of github.com:dfinity/sdk into pshahi/call-as-user
75090bb
change to --no-wallet and --wallet
5b24749
feat: add --no-wallet and --wallet for dfx canister call (#1485)
p-shahi 6b10b62
refactor
2884bc3
forgot to include identity_utils
c86ddad
remove where
32cd0c5
add Enzo's initializer test
5871f8c
newline
7e4c8b3
just default to create wallet for users on any command, its simpler t…
9681192
update tests now that each command will create wallets if it can
6484ddf
Merge branch 'master' into pshahi/call-as-user
p-shahi 557aef9
update changelog
eb04dc8
Merge branch 'master' into pshahi/call-as-user
p-shahi 5a71af4
remove unneeded method
a11772d
Merge branch 'pshahi/call-as-user' of github.com:dfinity/sdk into psh…
e1a1419
Merge branch 'master' of github.com:dfinity/sdk into pshahi/call-as-user
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
This file contains hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import Error "mo:base/Error"; | ||
|
|
||
| shared ({caller = initializer}) actor class() { | ||
| public shared (message) func test(): async Bool { | ||
| message.caller == initializer | ||
| } | ||
| } |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dfx config canisters/e2e_project/main initializer.mo |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bats | ||
|
|
||
| load ../utils/_ | ||
|
|
||
| setup() { | ||
| # We want to work from a temporary directory, different for every test. | ||
| cd "$(mktemp -d -t dfx-e2e-XXXXXXXX)" || exit | ||
|
|
||
| # Each test gets its own home directory in order to have its own identities. | ||
| x=$(pwd)/home-for-test | ||
| mkdir "$x" | ||
| export HOME="$x" | ||
|
|
||
| dfx_new | ||
| } | ||
|
|
||
| teardown() { | ||
| dfx_stop | ||
| x=$(pwd)/home-for-test | ||
| rm -rf "$x" | ||
| } | ||
|
|
||
| @test "test access control flow via dfx call" { | ||
| install_asset initializer | ||
| dfx_start | ||
| assert_command dfx identity new alice | ||
| assert_command dfx identity use alice | ||
|
|
||
| dfx canister create --all | ||
| assert_command dfx build | ||
| assert_command dfx canister install --all | ||
|
|
||
| # The wallet is the initializer | ||
| assert_command dfx canister call e2e_project test | ||
| assert_eq '(true)' | ||
|
|
||
| # The user Identity's principal is not the initializer | ||
| assert_command dfx canister --no-wallet call e2e_project test | ||
| assert_eq '(false)' | ||
| } |
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.