0xWeb
  • 0xWeb
  • πŸ’»Installation
  • πŸ—ƒοΈBlockchains
  • πŸ“¦Package Manager
    • πŸ“‚Folder structure
    • πŸš€Dequanto dependency
    • πŸŽ†Installing contracts
    • πŸ”’Versioning
  • πŸ”Wallet
    • πŸ”‘Keys notice
    • πŸ™‚Accounts
  • πŸ’»CLI
    • Commands Overview
  • πŸ—„οΈGnosis Safe
    • πŸ™†β€β™‚οΈZero Trust Wallet
  • πŸš€Dequanto
    • ℹ️Info
    • πŸ•ΈοΈRPC Client Pool
    • πŸ—οΈTx Builder
    • πŸ“€Tx Writer
    • ⛓️Blockchain Explorers
    • πŸͺ™Token Services
    • πŸ—ƒοΈIndexer
    • ✨Utilities
  • ⛑️Hardhat
    • ℹ️Info
    • ⬇️Installation
    • 🧩Compile
    • πŸ’«Deploy
  • 0️Openzeppelin
    • Openzeppelin contracts
Powered by GitBook
On this page
  • Manage accounts via CLI
  • Use the account in CLI
  • Use the account in code
  1. Wallet

Accounts

PreviousKeys noticeNextCommands Overview

Last updated 3 years ago

You can add or create an account with the assigned name to it, and save the account to local ecrypted storage. This will make it easier and safer to list and access the keys.

WRITE methods of a contract, do not depened on accounts storage, you can also load and provide account data (the key) on your own.

Manage accounts via CLI

See the help for accounts command to get full and up-to-date information

0xweb accounts --help
  • add β€” adds an account

0xweb accounts add --key PRIVATE_KEY --name FOOBAR --pin YOUR_PASSWORD
  • remove β€” removed the account

0xweb accounts remove --name FOOBAR --pin YOUR_PASSWORD
  • list β€” show account names saved in storage

0xweb accounts list --pin YOUR_PASSWORD
  • new β€” generates a new account. Remember to back-up the KEY

0xweb accounts new --name FOOBAR --pin YOUR_PASSWORD

Use the account in CLI

Provide the name and pin to retrieve the account from storage. For example, if you want to transfer a token:

0xweb token transfer USDC --from FOOBAR --to 0x.... --amount 10 --pin YOUR_PASSWORD

Use the account in code

import { USDC } from '@0xweb/eth/USDC/USDC'

async function example () {
    // read the configuration, safe to call multiple times, but can be called once at application start
    await Config.fetch();
    
    let usdcContract = new USDC();
    let decimals = await usdcContract.decimals();
    // 10$ to wei
    let wei = 10n * 10n**BigInt(decimals);
    let tx = await usdcContract.transfer('FOOBAR', '0x....', wei);
    let receipt = await tx.wait();
}
example();
πŸ”
πŸ™‚
❗