You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before starting this tutorial, make sure you have:
9
-
10
-
1. Node.js
11
-
1. An Entropy account (we'll cover how to create one).
8
+
Before starting this tutorial, make sure you have Node v20.0.0 or above installed
12
9
13
10
## Setting up your project
14
11
15
-
1. First, create a new directory and initialize a Node.js project:
12
+
1. First, create a new directory and initialize a Node project:
16
13
17
14
```shell
18
15
mkdir entropy-sdk-demo
19
16
cd entropy-sdk-demo
20
17
npm init -y
21
-
cd entropy-sdk-demo
22
18
```
23
19
24
20
1. Install the required dependencies:
@@ -29,7 +25,7 @@ Before starting this tutorial, make sure you have:
29
25
30
26
## Creating your Entropy account
31
27
32
-
Before we can use the code, you'll need to:
28
+
Before we can use the code, you'll need to create an account.
33
29
34
30
<!--TODO: explain process to create an account here.-->
35
31
@@ -39,48 +35,46 @@ Let's break down the implementation into smaller parts.
39
35
40
36
### Basic imports
41
37
42
-
Create a new file called `entropy-demo.js` and add the following lines.
38
+
Create a new file called `entropy-demo.mjs` and add the following lines.
43
39
44
40
```javascript
45
41
import { Keyring } from '@entropyxyz/sdk/keys';
46
42
import { wasmGlobalsReady, Entropy } from '@entropyxyz/sdk';
47
-
48
-
// Add this at the top of your file to handle ES modules
49
43
import { Buffer } from 'buffer';
50
44
```
51
45
52
46
These imports set up the fundamental building blocks needed to manage your cryptographic keys (`Keyring`), connect to and interact with the Entropy network (`Entropy`), ensure the cryptographic operations are ready (`wasmGlobalsReady`), and handle the necessary data conversions (`Buffer`).
53
47
54
48
### Core setup
55
49
56
-
Read through and add this block of code:
50
+
Read through and add this block of code below the existing code in your `entropy-demo.mjs` file:
57
51
58
52
```javascript
59
53
async functionrunEntropyDemo() {
60
54
try {
61
-
// Wait for WASM to be ready
55
+
// Wait for WASM to be ready.
62
56
console.log('Initializing WASM...');
63
57
await wasmGlobalsReady();
64
58
console.log('WASM initialized successfully');
65
59
66
-
// Replace this with your actual seed from the Entropy platform
60
+
// Replace this with your actual seed from the Entropy platform.
0 commit comments