GithubHelp home page GithubHelp logo

0xweb-org / 0xweb Goto Github PK

View Code? Open in Web Editor NEW
111.0 3.0 1.0 4.8 MB

Contract Package Manager with built in cli wallet

Home Page: https://0xweb.org

JavaScript 94.06% TypeScript 5.94%
blockhain dapps solidity-contracts

0xweb's Introduction

0xWeb - Contract package manager and CLI Web3 Toolkit


Website Link Documentation Link NPM version CircleCI

Contract Package Manager

Generate TypeScript classes for contracts fetched from Etherscan and Co.

We use ๐Ÿ“ฆ dequanto library for the wrapped classes

Here the example of generated classes: 0xweb-org/0xweb-sample ๐Ÿ”—

Install

$ npm i 0xweb -g

# Boostrap dequanto library in cwd
$ 0xweb init

# Download sources/ABI and generate TS classes
$ 0xweb install 0x5f4ec3df9cbd43714fe2740f5e3616155c5b8419 --name chainlink/oracle-eth

API Usage

Use autogenerated TypeScript classes for much safer and faster backend implementation

import { ChainlinkOracleEth } from './0xweb/eth/chainlink/oracle-eth/oracle-eth';
import { Config } from '@dequanto/Config';
import { $bigint } from '@dequanto/utils/$bigint';

await Config.fetch();

let oracle = new ChainlinkOracleEth();
let decimals = await oracle.decimals();
let price = await oracle.latestAnswer();

console.log(`ETH Price`, $bigint.toEther(price, decimals));

CLI Usage

READ and WRITE to installed contracts directly from the command line

$ 0xweb contract chainlink/oracle-eth latestAnswer

Config

โ—โฃ๏ธโ— We include our default KEYs for etherscan/co and infura. They are rate-limited. Please, create and insert your keys. Thank you!

$ 0xweb config --edit

## optionally, you can provide the Nodes Endpoint with `--endpoint` flag
$ 0xweb COMMAND --endpoint https://my-node-url-here

Various Blockchain tools

Get the commands overview

$ 0xweb --help
$ 0xweb install --help

block

  1. Get current block info
$ web3 block get latest

token

  1. Get Token Price
$ 0xweb token price WETH

accounts

๐Ÿ” Wallet feature allows to store accounts in encrypted local storage. We use local machine KEY and provided PIN in arguments to create cryptographically strong secrets ๐Ÿ”‘ for encryption.

When calling contracts WRITE methods, you should first add an account to the wallet, and then use PIN to unlock the storage

$ 0xweb account add --name foo --key the_private_key --pin foobar
$ 0xweb token transfer USDC --from foo --to 0x123456 --amount 20 --pin foobar

๐Ÿ


ยฉ๏ธ MIT License.

0xweb's People

Contributors

tenbits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

papiguy

0xweb's Issues

Fresh install doesn't work

I wanted to play with the CLI tool and fresh install on a fresh ubuntu machine doesn't work out.

$ npm i 0xweb -g
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@noble/[email protected]',
npm WARN EBADENGINE   required: { node: '>= 16' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

added 97 packages, and audited 98 packages in 10s

7 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (4 moderate, 2 high, 3 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

$ 0xweb
/usr/local/lib/node_modules/0xweb/lib/cli.js:5
    if (typeof module !== 'undefined' && Array.isArray(module?.paths)) {
                                                              ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/0xweb/index.js:3:11)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

$ 0xweb init
/usr/local/lib/node_modules/0xweb/lib/cli.js:5
    if (typeof module !== 'undefined' && Array.isArray(module?.paths)) {
                                                              ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/0xweb/index.js:3:11)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)

What should I do ?

When the contract isn't verified I get an error

05:20:00 ABI is not resolved from ....9f6aE4670183662F96ecd97E: Contract source code not verified. Extract from bytecode...
(node:6360) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
Provided address undefined is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.

--endpoint option not taken into account for dump

$ 0xweb c dump PudgyPenguins --output dumps/pudgy
...
20:29:08 Range worker request: 12876178-18978939. block range is too wide https://eth.public-rpc.com ...

or

$ 0xweb c dump PudgyPenguins --output dumps/pudgy --endpoints https://invalid-url-that-doesnt-exist.com
...
20:29:08 Range worker request: 12876178-18978939. block range is too wide https://eth.public-rpc.com ...

I haven't tried with other methods.

Invalid suggestion / command

I "installed" a contract

0xweb i 0xBd3531dA5CF5857e7CfAA92426877b022e612cf8 --name PudgyPenguins --chain eth

Then wanted to dump its storage

$ 0xweb c dump PudgePenguins --output dumps/pudgy
14:45:37 Package PudgePenguins not found. 0xweb c list to view all installed contracts

You can see I miswrote the package name. I then tried to run the list command but it does not exist.

$ 0xweb c list
14:45:44 Subcommand 'list' of 'c' not found

Can't load CLI

After installing the package through npm and trying to run it the following error shows up:

Unknown command: /opt/homebrew/Cellar/node/19.2.0/bin/node at CommandsHandler.findCommand (/opt/homebrew/lib/node_modules/0xweb/lib/cli.js:3234:19) at App.execute (/opt/homebrew/lib/node_modules/0xweb/lib/cli.js:24305:79) at async App.runFromCli (/opt/homebrew/lib/node_modules/0xweb/lib/cli.js:24326:13)

Tested on Ubuntu, MacOS and Windows

config --edit doesn't work

Basically just simply do nothing

$ 0xweb config -e
20:24:39 Open file:///home/ubuntu/.dequanto/config.yml

on a vanilla ubuntu - installed lynx, or links, or links2, doesn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.