[go: nahoru, domu]

Skip to content

Commit

Permalink
Lg/dfx wallet cmds (dfinity#330)
Browse files Browse the repository at this point in the history
* get-wallet, set-wallet CLI WIP

* Draft get and set wallet info
  • Loading branch information
lsgunnlsgunn committed Feb 17, 2021
1 parent 7e0654d commit 346c715
Showing 1 changed file with 83 additions and 2 deletions.
85 changes: 83 additions & 2 deletions modules/developers-guide/pages/cli-reference/dfx-identity.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ For reference information and examples that illustrate using `+dfx identity+` co
|===
|Command |Description

|<<dfx identity get-principal,`+get-principal+`>> | Shows the textual representation of the Principal associated with the current identity.
|<<dfx identity get-principal,`+get-principal+`>> | Shows the textual representation of the principal associated with the current identity.

|<<dfx identity get-wallet,`+get-wallet+`>> | Shows the canister identifier for the wallet associated with your current identity principal on a network.

|`+help+` |Displays this usage message or the help of the given subcommand(s).

Expand All @@ -38,6 +40,8 @@ For reference information and examples that illustrate using `+dfx identity+` co

|<<dfx identity rename,`+rename+`>> |Renames an existing identity.

|<<dfx identity set-wallet,`+set-wallet+`>> | Sets the wallet canister identifier to use for your current identity principal on a network.

|<<dfx identity use,`+use+`>> |Specifies the identity to use.

|<<dfx identity whoami,`+whoami+`>> |Displays the name of the current identity user context.
Expand Down Expand Up @@ -94,6 +98,48 @@ dfx identity get-principal

In this example, the first command sets the user context to use the `+ic_admin+` identity. The second command then returns the principal associated with the `+ic_admin+` identity.

== dfx identity get-wallet

Use the `+dfx identity get-wallet+` command to display the canister identifier for the wallet associated with your current identity principal on a network.

Note that you must be connected to the {IC} network or running the network locally to run this command.
In addition, you must be in a project directory to run the command.
For example, if your project name is `+hello_world+`, your current working directory must be the `+hello_world+` top-level project directory or one of its subdirectories to run the `+dfx identity get-wallet+` command.

=== Basic usage

[source,bash]
----
dfx identity get-wallet [flag]
----

=== Flags

You can use the following optional flags with the `+dfx identity get-wallet+` command.

[width="100%",cols="<32%,<68%",options="header"]
|===
|Flag |Description
|`+-h+`, `+--help+` |Displays usage information.
|`+-V+`, `+--version+` |Displays version information.
|===

=== Example

If you want to display the canister identifier for the wallet canister associated with your identity, you can run the following command:

[source,bash]
----
dfx identity get-wallet
----

To display the canister identifier for the wallet canister associated with your identity on a specific network, you might run a command similar to the following:

[source,bash]
----
dfx identity --network=https://192.168.74.4 get-wallet
----

== dfx identity list

Use the `+dfx identity list+` command to display the list of user identities available.
Expand Down Expand Up @@ -307,6 +353,42 @@ For example, if you want to rename a `+test_admin+` identity that you previously
dfx identity rename test_admin devops
....

== dfx identity set-wallet

Use the `+dfx identity set-wallet+` command to specify the wallet canister identifier to use for your identity on a network.

=== Basic usage

[source,bash]
----
dfx identity set-wallet [flag] [--canister-name canister-name]
----

=== Flags

You can use the following optional flags with the `+dfx identity set-wallet+` command.

[width="100%",cols="<32%,<68%",options="header"]
|===
|Flag |Description
|`+force+` |Skips verification that the canister you specify is a valid wallet canister.
This option is only useful if you are connecting to the {IC} running locally.
|`+-h+`, `+--help+` |Displays usage information.
|`+-V+`, `+--version+` |Displays version information.
|===

=== Example

If you have access to more than one {IC} network or use more than one principal for your identity, you might have access to more than one wallet canister identifier.
You can use the `+dfx identity set-wallet+` command to specify the wallet canister identifier to use for a given identity on a given network.

For example, you might store the wallet canister identifier in an environment variable, then invoke the `+dfx identity set-wallet+` command to use that wallet canister for additional operations by running the following:

....
export WALLET_CANISTER_ID=$(dfx identity get-wallet)
dfx identity --network=https://192.168.74.4 set-wallet --canister-name ${WALLET_CANISTER_ID}
....

== dfx identity use

Use the `+dfx identity use+` command to specify the user identity you want to active.
Expand Down Expand Up @@ -344,7 +426,6 @@ This argument is required.

|===


=== Examples

If you want to run multiple commands with the same user identity context, you can run a command similar to the following:
Expand Down

0 comments on commit 346c715

Please sign in to comment.