Coder Social home page Coder Social logo

fuellabs / fuels-ts Goto Github PK

View Code? Open in Web Editor NEW
44.7K 118.0 1.3K 20.75 MB

Fuel Network Typescript SDK

Home Page: https://docs.fuel.network/docs/fuels-ts/

License: Apache License 2.0

TypeScript 97.78% Shell 0.20% JavaScript 0.92% Handlebars 0.39% Sway 0.10% Vue 0.04% CSS 0.49% HTML 0.10%
fuel typescript

fuels-ts's Introduction

Fuels-ts SDK logo

fuels-ts is a library for interacting with Fuel v2.

test npm docs discord

Resources

The documentation site is your main stop for resources.

Install

npm install fuels --save

If you are a Windows user, you will need to be running Windows Subsystem for Linux (WSL) to install and use the Fuel toolchain, including the TypeScript SDK. We don't support Windows natively at this time.

Import

Simple example usages.

import { Wallet } from "fuels";

// Random Wallet
console.log(Wallet.generate());

// Using privateKey Wallet
console.log(new Wallet("0x0000...0000"));

CLI

Fuels include some utility commands via built-in CLI tool.

Check the docs for more info.

$ npm add fuels
$ npx fuels --help
Usage: fuels [options] [command]

Options:
  -D, --debug        Enables verbose logging (default: false)
  -S, --silent       Omit output messages (default: false)
  -v, --version      Output the version number
  -h, --help         Display help

Commands:
  init [options]     Create a sample `fuel.config.ts` file
  dev [options]      Start a Fuel node and run build + deploy on every file change
  build [options]    Build Sway programs and generate Typescript for them
  deploy [options]   Deploy contracts to the Fuel network
  typegen [options]  Generate Typescript from Sway ABI JSON files
  versions           Check for version incompatibilities
  core               Wrapper around Fuel Core binary
  forc               Wrapper around Forc binary
  help [command]     Display help for command

The Fuel Ecosystem

Learn more about the Fuel Ecosystem.

License

The primary license for this repo is Apache 2.0, see LICENSE.

fuels-ts's People

Contributors

adlerjohn avatar alicanc avatar alphak3y avatar arboleya avatar camiinthisthang avatar cold-briu avatar dabit3 avatar danielbate avatar dhaiwat10 avatar fuel-service-user avatar github-actions[bot] avatar luizasfight avatar luizstacio avatar maschad avatar mohammadfawaz avatar nedsalk avatar pedronauck avatar petertonysmith94 avatar pixelcircuits avatar protocolwhisper avatar quinnlee avatar red-haze-dev avatar richardgreg avatar sarahschwartz avatar sdankel avatar shuoer86 avatar tibi77 avatar torres-ssf avatar vuittont60 avatar yirenlu92 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  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

fuels-ts's Issues

Setup Versioned Releases

We have addressed the issue of publishing packages to NPM on #38, but that doesn't include proper versioning.

We should make proper releases that:

Suggest rename to fuel-ts

I think this repository / module should be renamed fuel-ts. Is there any reason why we went with "fuels-ts"?

Update `contact-v2` dependency to use NPM instead of github

The merkle tree code uses contracts from contract-v2. The repo is private and uses git to pull the dependency. This forces us to set an access token for CI. Once contract-v2 is accessible via NPM, CI and package.json should be updated.

Add `signTransaction`

Currently it is hard to test/dev against a provider/contract. We should mock it out

Encrypt/Decrypt wallet

  • Encrypt wallet data using password wallet.lock(password: string) -> Wallet({ locked: true })
  • Decrypt wallet data using password wallet.unlock(password: string) -> Wallet({ locked: false })

Refactor `Tuple` and `Array` Coders

These coders are called recursively and have input/output types of any. We should refactor this so the types are explicit on these coders.

Update to latest Forc and fuel-core

We don't actually depend on Forc, but we have files generated by Forc. We should update Forc on our locals and regenerate these files to make sure we are compatible with their latest version.

Changes similar to FuelLabs/fuels-rs#19 will be required.

Bikeshed Display Name

Just like ethers.js/Ethers and sway/Sway, fuels-ts and fuels-rs should also have capitalized display names.

Fix `byte[]` Coding

WitnessCoder and anything else that uses byte[] should be checked if they properly pad to 8 bytes when encoding and also consume that padding during decoding.

Metamask intergration

Integrate with metamask

https://docs.metamask.io/guide/rpc-api.html#wallet-addethereumchain

To intergrate we need the following:

interface AddEthereumChainParameter {
  chainId: string; // A 0x-prefixed hexadecimal string
  chainName: string;
  nativeCurrency: {
    name: string;
    symbol: string; // 2-6 characters long
    decimals: 18;
  };
  rpcUrls: string[];
  blockExplorerUrls?: string[];
  iconUrls?: string[]; // Currently ignored.
}

Currently don't have an ethereum json-rpc facade

`Utilites.signMessage` it's not working like `wallet.<signMessage|signTransaction>`

It looks like we have a divergency when finding the public key from a signed message;

Given private key in this case:
0xae78c8b502571dba876742437f8bc78b689cf8518356c0921393d89caaf284ce

We have;

  1. When we sign a transaction/message with wallet.<signMessage|signTransaction> and retrieve the public key with utilities.<verifyMessage|verifyTransaction> or just check the wallet.publickKey it has a value
    0xa1ad658fd9b046cb8bc37cba09e1330c859467b235a5c76659000c4577f526c7. Link
  2. If we use utilities.signMessage and try to check the publicKey using utilities.verifyMessage it returns the publicKey 0xbafe4b5d65c9efd34390402ca185d4a58a9e5b1d89c5bc52d90d382059296508. Link

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.