Skip to content

Commit

Permalink
Merge pull request #176 from multiversx/add-ledger-account-in-cookbook
Browse files Browse the repository at this point in the history
Added Ledger account in cookbook
  • Loading branch information
popenta authored Jan 14, 2025
2 parents 4e478a5 + 6cfc69a commit e7d63d6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions examples/v1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,45 @@
"account.save_to_keystore(path=Path(\"keystoreWallet.json\"), password=\"password\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Ledger Account\n",
"\n",
"It is possible to use a Ledger Device to manage your account. The Ledger account allows you to sign both transactions and messages, but it can also store the nonce of the account.\n",
"\n",
"By default, the package does not include all the dependencies required to communicate with a Ledger device. To enable Ledger support, install the package with the following command:\n",
"\n",
"```sh\n",
"pip install multiversx-sdk[ledger]\n",
"```\n",
"\n",
"This will install the necessary dependencies for interacting with a Ledger device.\n",
"\n",
"When instantiating a `LedgerAccount`, the index of the address that will be used should be provided. By default, the index `0` is used."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from multiversx_sdk import LedgerAccount\n",
"\n",
"account = LedgerAccount()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When signing transactions with a Ledger device, the transaction details will appear on the device, awaiting your confirmation. The same process applies when signing messages.\n",
"\n",
"Both **Account** and **LedgerAccount** are compatible with the **IAccount** interface and can be used wherever the interface is expected (e.g. in transaction controllers)."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -4537,6 +4576,12 @@
"pip install multiversx-sdk\n",
"```\n",
"\n",
"If you wish to interact with Ledger devices through the sdk, install the sdk as follows:\n",
"\n",
"```sh\n",
"pip install multiversx-sdk[ledger]\n",
"```\n",
"\n",
"If your project has multiple dependencies, we recommend using a `requirements.txt` file for having all dependencies in one place. Inside the file we are going to place each dependency on a new line:\n",
"\n",
"```sh\n",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
]

[project.optional-dependencies]
optional = ["ledgercomm[hid]"]
ledger = ["ledgercomm[hid]"]

[project.urls]
"Homepage" = "https://github.com/multiversx/mx-sdk-py"
Expand Down

0 comments on commit e7d63d6

Please sign in to comment.