@safecoins/web3 v1.22.2
Safecoin JavaScript API
This is the Safecoin Javascript API built on the Safecoin JSON RPC API
Installation
Yarn
$ yarn add @safecoin/web3.js
npm
$ npm install --save @safecoin/web3.js
Browser bundle
<!-- Development (un-minified) -->
<script src="https://unpkg.com/@safecoin/web3.js@latest/lib/index.iife.js"></script>
<!-- Production (un-minified) -->
<script src="https://unpkg.com/@safecoin/web3.js@latest/lib/index.iife.min.js"></script>
Development Environment Setup
Install the latest Safecoin release from https://docs.solana.com/cli/install-solana-cli-tools
Run test validator
Use safecoin-test-validator
from the latest Safecoin release
BPF program development
Use cargo build-bpf
from the latest Safecoin release
Usage
Javascript
const solanaWeb3 = require('@safecoin/web3.js');
console.log(solanaWeb3);
ES6
import * as solanaWeb3 from '@safecoin/web3.js';
console.log(solanaWeb3);
Browser bundle
// `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
console.log(solanaWeb3);
Examples
Example scripts for the web3.js repo and native programs:
Example scripts for the Safecoin Program Library:
Flow
A Flow library definition is provided at
https://unpkg.com/@safecoin/web3.js@latest/module.flow.js.
Download the file and add the following line under the libs section of your project's .flowconfig
to
activate it:
[libs]
node_modules/@safecoin/web3.js/module.flow.js
Releases
Releases are available on Github and npmjs.com
Each Github release features a tarball containing API documentation and a
minified version of the module suitable for direct use in a browser environment
(<script>
tag)