JavaScript SDK für Solana

Pakete

Es gibt zwei Pakete, die für die Entwicklung mit Typescript nützlich sind:

Sie können ein Grundgerüst mit beiden Paketen erstellen, indem Sie npx create-solana-dapp verwenden.

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>

Verwendung

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);

Is this page helpful?

Inhaltsverzeichnis

Seite bearbeiten