Solana JavaScript SDK

repository·maintenance/v1.x·Indexed 25 days ago

https://github.com/solana-foundation/solana-web3.js

The Solana JavaScript SDK (v1.x) allows developers to interact with accounts and programs on the Solana network using the Solana JSON RPC API. It is a core library for building Solana-based applications in Node.js and browser environments, providing tools for managing connections, fetching account information, simulating transactions, and handling token data.

Tokens
12.8K
Snippets
20
Records
136
Agent score
75%

What's inside @solana/web3.js

  1. Run unit and integration tests

    maintenance/v1.x

    Unit tests

    To run the full suite of unit tests, execute the following in the root directory:

    $ npm test

    Integration tests

    Integration tests require a validator client running on your machine.

    1. Install a test validator:
    $ npm run test:live-with-test-validator:setup
    1. Start the validator and run integration tests:
    $ cd packages/library-legacy
    $ npm run test:live-with-test-validator
    $ npm test
    
    $ npm run test:live-with-test-validator:setup
    
    $ cd packages/library-legacy
    $ npm run test:live-with-test-validator
  2. Install @solana/web3.js in a browser without a build system

    maintenance/v1.x

    If you are not using a build system and want to include the SDK directly in an HTML file via a <script> tag, use the unpkg CDN. Use the .min.js version for production environments.

    <!-- Development (un-minified) -->
    <script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js"></script>
    
    <!-- Production (minified) -->
    <script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.min.js"></script>
  3. Check compatibility requirements for @solana/web3.js

    maintenance/v1.x

    The library requires a JavaScript runtime that supports BigInt and the exponentiation operator (**).

    Supported Runtimes:

    • Browsers: Chrome (May 2018+), Firefox (July 2019+), Safari/Mobile Safari (Sept 2020+), Edge (Jan 2020+), Opera (June 2018+), Samsung Internet (April 2019+).
    • Deno: >=1.0
    • Node.js: >=10.4.0
    • React Native: >=0.7.0 using the Hermes engine.