ethers.js/docs.wrm/getting-started.wrm
2020-05-08 03:24:40 -04:00

49 lines
1.1 KiB
Plaintext

_section: Getting Started
_subsection: Installing
The various Classes and Functions are available to be imported
manually from sub-packages under the [@ethersproject](link-ethers-npm)
but for most projects, the umbrella package is the easiest way to
get started.
_code: @lang<shell>
/home/ricmoo> npm install --save ethers@next
_subsection: Importing
_heading: Node.js
_code: node.js require @lang<script>
const { ethers } = require("ethers");
_code: ES6 or TypeScript @lang<script>
import { ethers } from "ethers";
_heading: Web Browser
It is generally better practice (for security reasons) to copy the
[ethers library](link-ethers-js) to your own webserver and serve it
yourself.
For quick demos or prototyping though, it can be loaded in your
Web Applications from our CDN.
_code: ES6 in the Browser @lang<html>
<script src="https://cdn.ethers.io/lib/ethers-5.0.esm.min.js"
type="application/javascipt"></script>
_code: ES3 (UMD) in the Browser @lang<html>
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"
type="application/javascipt"></script>