Solana DocumentationReferencesSolana SDKs

JavaScript SDK for Solana

Packages

There are two packages that are useful for developing with Typescript:

You'll be able to create a scaffold using both of these using npx create-solana-dapp.

Installation

yarn

Terminal
yarn add @solana/web3.js@1

npm

Terminal
npm install --save @solana/web3.js@1

Bundle

index.html
<!-- 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>

Usage

Javascript

const solanaWeb3 = require("@solana/web3.js");
console.log(solanaWeb3);

ES6

import * as solanaWeb3 from "@solana/web3.js";
console.log(solanaWeb3);

Browser Bundle

// solanaWeb3 is provided in the global namespace by the bundle script
console.log(solanaWeb3);

Inhaltsverzeichnis

Seite bearbeiten