fuellabs / fuels-ts Goto Github PK
View Code? Open in Web Editor NEWFuel Network Typescript SDK
Home Page: https://docs.fuel.network/docs/fuels-ts/
License: Apache License 2.0
Fuel Network Typescript SDK
Home Page: https://docs.fuel.network/docs/fuels-ts/
License: Apache License 2.0
Add signMessage
following;
wallet.lock(password: string) -> Wallet({ locked: true })
wallet.unlock(password: string) -> Wallet({ locked: false })
Use husky
and run linting and tests
add the license and magic
Add feature to send signed transactions. Related to #39
Our MT code should be available as an independent package that isn't Fuel specific so it can be used on other projects.
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;
wallet.<signMessage|signTransaction>
and retrieve the public key with utilities.<verifyMessage|verifyTransaction>
or just check the wallet.publickKey
it has a value0xa1ad658fd9b046cb8bc37cba09e1330c859467b235a5c76659000c4577f526c7
. Linkutilities.signMessage
and try to check the publicKey using utilities.verifyMessage
it returns the publicKey 0xbafe4b5d65c9efd34390402ca185d4a58a9e5b1d89c5bc52d90d382059296508
. LinkWitnessCoder 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.
Add an example Node.js app that uses fuels-ts.
Just like ethers.js
/Ethers
and sway
/Sway
, fuels-ts
and fuels-rs
should also have capitalized display names.
First pass is to create encode
and decode
functions to match argument encoding specs.
Use https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/abi-coder.ts as a reference
A Provider should be implemented to communicate with Fuel nodes.
As discussed in FuelLabs/fuels-rs#11 (comment), once the Sway compiler removes the need to have gas, color, and coin amount as mandatory arguments to every ABI method, we should go back to this place in the fuels-ts code and remove the workaround.
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.
Users should be able to specify default values for contract storage when deploying them.
Blockers:
Follow https://docs.ethers.io/v5/api/signer/ and implement it
Run test, linting, etc
Currently, function
is only one supported.
With more custom data types, abi of type contract
with struct definitions will be added. https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#json-abi-format
Implement contract
type
Match specs to take in https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/abi.md#json-abi-format and encode and decode function and arguments.
Follow patterns from https://github.com/ethers-io/ethers.js/blob/master/packages/abi/src.ts/interface.ts
https://docs.ethers.io/v5/api/utils/abi/interface/
Create a target using this structure and create *.d.ts
files and factories for development
Notes:
Current supported type:
These coders are called recursively and have input/output types of any
. We should refactor this so the types are explicit on these coders.
Having an ABI format that is human-readable may provide a better experience.
https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917
Currently it is hard to test/dev against a provider/contract. We should mock it out
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.
Currently function
is supported.
What are the other types we should spec out?
ATM Provider tests are being skipped. We should enable them.
Blockers:
ABI should be able to encode and decode function results on the interface
Update provider tests
Main one is the getCoinsByOwner
-> coins
update.
ProgramState
coin id update
etc
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:
latest
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
Interface and Contract should have support for accessing storage slots.
Blockers
Set up the project structure, add linting, and TS
Transaction encoding should be implemented according to spec: https://github.com/FuelLabs/fuel-specs/blob/master/specs/protocol/tx_format.md
I think this repository / module should be renamed fuel-ts. Is there any reason why we went with "fuels-ts"?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.