NEWTON

NEWTON


Popular tags

    How do I get started with starknetjs?

    Asked

    23 days ago

    16

    views


    0

    How do I get started with starknetjs?

      starknetjscairostarknet

    Newton

    asked

    23 days ago


    1 answers

    0

    Accepted answer

    Getting Started

    Installation

    # use the main branch npm install starknet # to use latest features (merges in develop branch) npm install starknet@next

    Running test locally

    With Devnet

    Example devnet version is 0.7.1.

    Get devnet with docker:

    docker pull shardlabs/starknet-devnet:0.7.1 docker run -p 5050:5050 shardlabs/starknet-devnet:0.7.1 --seed 0

    Open new console tab, go to your starknet.js directory and run:

    npm run test # all tests npm run test ./__tests__/contract.test.ts # just one test suite

    By default defaultProvider tests will be ran through the Sequencer.

    If you want to run defaultProvider through the RPC run:

    export TEST_RPC_URL = "http://127.0.0.1:5050/rpc"# only RPC related tests: npm run test ./__tests__/rpcProvider.test.ts

    Compiling StarkNet Contracts

    Please check the StarkNet documentation here to compile starknet contracts.

    Additional helpful resources can also be found at OpenZeppelin documentation site.

    Get the class hash of a contract: starkli.

    Full example with account & erc20 deployments

    Please take a look at our workshop using OpenZeppelin contracts here.

    Example with Argent contract here.

    Newton

    answered

    23 days ago

    Your answer

    NEWTON

    NEWTON