Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add TypeScript to getting started page #379

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ If you install it on the backend side, you may need to also install [`isomorphic
## Instantiation

```js
import { ERC725 } from '@erc725/erc725.js';

// Part of LSP3-UniversalProfile Schema
// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md
const schemas = [
Expand Down Expand Up @@ -62,6 +60,22 @@ const config = {
ipfsGateway: 'https://YOUR-IPFS-GATEWAY/ipfs/',
gas: 20_000_000, // optional, default is 1_000_000
};
```

### TypeScript

> If you are using ES6 `import` statements in Node.js, make sure your file has a `.mjs` extension, or that your project is set up to support ES6 modules.

```ts
import { ERC725 } from '@erc725/erc725.js';

const erc725 = new ERC725(schemas as ERC725JSONSchema[], address, RPC_URL, config);
fhildeb marked this conversation as resolved.
Show resolved Hide resolved
```

### JavaScript

```js
import { ERC725 } require('@erc725/erc725.js');

const erc725 = new ERC725(schemas, address, RPC_URL, config);
```
Expand Down
Loading