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
@@ -29,64 +29,73 @@ Before we can use the code, you'll need to create an account.
29
29
30
30
<!--TODO: explain process to create an account here.-->
31
31
32
-
## Time to write some code
32
+
## Write the script
33
33
34
-
Let's break down the implementation into smaller parts.
34
+
Instead of throwing a giant block of code at your, let's break down the implementation into smaller parts.
35
35
36
36
### Basic imports
37
37
38
-
Create a new file called `entropy-demo.mjs` and add the following lines.
38
+
1. Create a new file called `entropy-demo.mjs` and add the following lines:
39
39
40
-
```javascript
41
-
import { Keyring } from '@entropyxyz/sdk/keys';
42
-
import { wasmGlobalsReady, Entropy } from '@entropyxyz/sdk';
43
-
import { Buffer } from 'buffer';
44
-
```
40
+
```javascript
41
+
import { Keyring } from '@entropyxyz/sdk/keys';
42
+
import { wasmGlobalsReady, Entropy } from '@entropyxyz/sdk';
43
+
import { Buffer } from 'buffer';
44
+
```
45
+
46
+
2. Save the file and move onto the next section.
47
+
48
+
#### Explaining the code
45
49
46
50
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`).
47
51
48
52
### Core setup
49
53
50
-
Read through and add this block of code below the existing code in your `entropy-demo.mjs` file:
51
-
52
-
```javascript
53
-
async functionrunEntropyDemo() {
54
-
try {
55
-
// Wait for WASM to be ready.
56
-
console.log('Initializing WASM...');
57
-
await wasmGlobalsReady();
58
-
console.log('WASM initialized successfully');
59
-
60
-
// Replace this with your actual seed from the Entropy platform.
**Invalid Transaction: Inability to pay some fees**
229
+
230
+
You may encounter the following error when running the script:
231
+
232
+
```shell
233
+
2025-01-21 11:51:27 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
234
+
2025-01-21 11:51:27 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
235
+
Error in signature creation/verification: Error: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
236
+
at file:///home/johnny/Code/entropy/testing-the-sdk/node_modules/@entropyxyz/sdk/dist/index.js:59:16
237
+
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
238
+
Main execution error: Error: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low
239
+
at file:///home/johnny/Code/entropy/testing-the-sdk/node_modules/@entropyxyz/sdk/dist/index.js:59:16
240
+
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
241
+
```
242
+
243
+
The main thing to look out forhere is the line `2025-01-21 11:51:27 RPC-CORE: submitAndWatchExtrinsic(extrinsic: Extrinsic): ExtrinsicStatus:: 1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low`. This error happens because the network has determined that the seed you have used to create your accountin the script doesn't have enough funds to contrinue the registering and signing process. Take a look at the [Getting Funds]({{< relref "get-funds" >}}) guide to find out how to deal with this error.
244
+
245
+
**Undefined is not iterable at verifyAndPick**
246
+
247
+
You may encounter this error when running the script:
248
+
249
+
```shell
250
+
Creating signature...
251
+
Error in signature creation/verification: TypeError: undefined is not iterable (can
252
+
not read property Symbol(Symbol.iterator))
253
+
at #verifyAndPick (file:///home/johnny/Code/entropy/testing-the-sdk/node_modules/@entropyxyz/sdk/dist/index.js:440:26)
254
+
at SignatureRequestManager.sign (file:///home/johnny/Code/entropy/testing-the-sdk/node_modules/@entropyxyz/sdk/dist/index.js:330:48)
255
+
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
256
+
257
+
[...]
258
+
```
259
+
260
+
This is likely because the account you are using within the script has already been registered with the signing program we're using here. Try creating a new account, getting some test funds, and adding the seed of the new account into the script.
0 commit comments