thor-builtin 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +37 -0
- package/package.json +3 -2
- package/src/wallet.ts +3 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"name": "Current TS File",
|
9
|
+
"type": "node",
|
10
|
+
"request": "launch",
|
11
|
+
"cwd": "${workspaceRoot}",
|
12
|
+
"args": [
|
13
|
+
"${relativeFile}"
|
14
|
+
],
|
15
|
+
"runtimeArgs": [
|
16
|
+
"-r",
|
17
|
+
"ts-node/register"
|
18
|
+
],
|
19
|
+
"internalConsoleOptions": "openOnSessionStart",
|
20
|
+
"console": "integratedTerminal",
|
21
|
+
"sourceMaps": true
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"name": "Mocha Current File",
|
25
|
+
"type": "node",
|
26
|
+
"request": "launch",
|
27
|
+
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
28
|
+
"args": [
|
29
|
+
"--no-timeouts",
|
30
|
+
"${file}"
|
31
|
+
],
|
32
|
+
"internalConsoleOptions": "openOnSessionStart",
|
33
|
+
"console": "integratedTerminal",
|
34
|
+
"sourceMaps": true
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thor-builtin",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"description": "Addresses and ABIs of the built-in contracts deployed on the VeChain Thor blockchain.",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"scripts": {
|
@@ -19,7 +19,8 @@
|
|
19
19
|
"homepage": "https://github.com/zzGHzz/thor-builtin#readme",
|
20
20
|
"devDependencies": {
|
21
21
|
"@types/node": "^17.0.23",
|
22
|
-
"
|
22
|
+
"ts-node": "^10.7.0",
|
23
|
+
"typescript": "^4.6.4"
|
23
24
|
},
|
24
25
|
"peerDependencies": {
|
25
26
|
"thor-devkit": "^2.0.5"
|
package/src/wallet.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { HDNode, address } from 'thor-devkit'
|
1
|
+
import { HDNode, address, secp256k1 } from 'thor-devkit'
|
2
2
|
|
3
3
|
const word = 'denial kitchen pet squirrel other broom bar gas better priority spoil cross'
|
4
4
|
const hdNode = HDNode.fromMnemonic(word.split(' '))
|
@@ -7,8 +7,9 @@ let privKeys: string[] = []
|
|
7
7
|
let accounts: string[] = []
|
8
8
|
for (let i = 0; i < 10; i++) {
|
9
9
|
const priv = hdNode.derive(i).privateKey
|
10
|
+
const pub = secp256k1.derivePublicKey(<Buffer>priv)
|
10
11
|
privKeys.push('0x' + priv?.toString('hex'))
|
11
|
-
accounts.push(address.fromPublicKey(
|
12
|
+
accounts.push(address.fromPublicKey(pub))
|
12
13
|
}
|
13
14
|
|
14
15
|
const SoloDefault = {
|