thor-builtin 1.1.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.vscode/launch.json +37 -0
- package/dist/wallet.d.ts +1 -0
- package/dist/wallet.js +7 -3
- package/package.json +3 -2
- package/src/wallet.ts +8 -4
@@ -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/dist/wallet.d.ts
CHANGED
package/dist/wallet.js
CHANGED
@@ -4,14 +4,18 @@ exports.HDWalletDerivationPath = exports.SoloDefault = void 0;
|
|
4
4
|
const thor_devkit_1 = require("thor-devkit");
|
5
5
|
const word = 'denial kitchen pet squirrel other broom bar gas better priority spoil cross';
|
6
6
|
const hdNode = thor_devkit_1.HDNode.fromMnemonic(word.split(' '));
|
7
|
-
let
|
7
|
+
let privKeys = [];
|
8
|
+
let accounts = [];
|
8
9
|
for (let i = 0; i < 10; i++) {
|
9
10
|
const priv = hdNode.derive(i).privateKey;
|
10
|
-
|
11
|
+
const pub = thor_devkit_1.secp256k1.derivePublicKey(priv);
|
12
|
+
privKeys.push('0x' + (priv === null || priv === void 0 ? void 0 : priv.toString('hex')));
|
13
|
+
accounts.push(thor_devkit_1.address.fromPublicKey(pub));
|
11
14
|
}
|
12
15
|
const SoloDefault = {
|
13
16
|
mnemonic: word,
|
14
|
-
|
17
|
+
privKeys: privKeys,
|
18
|
+
accounts: accounts
|
15
19
|
};
|
16
20
|
exports.SoloDefault = SoloDefault;
|
17
21
|
const HDWalletDerivationPath = `m/44'/818'/0'/0`;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thor-builtin",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.2",
|
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,17 +1,21 @@
|
|
1
|
-
import { HDNode } 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(' '))
|
5
5
|
|
6
|
-
let
|
6
|
+
let privKeys: string[] = []
|
7
|
+
let accounts: string[] = []
|
7
8
|
for (let i = 0; i < 10; i++) {
|
8
9
|
const priv = hdNode.derive(i).privateKey
|
9
|
-
|
10
|
+
const pub = secp256k1.derivePublicKey(<Buffer>priv)
|
11
|
+
privKeys.push('0x' + priv?.toString('hex'))
|
12
|
+
accounts.push(address.fromPublicKey(pub))
|
10
13
|
}
|
11
14
|
|
12
15
|
const SoloDefault = {
|
13
16
|
mnemonic: word,
|
14
|
-
|
17
|
+
privKeys: privKeys,
|
18
|
+
accounts: accounts
|
15
19
|
}
|
16
20
|
|
17
21
|
const HDWalletDerivationPath = `m/44'/818'/0'/0`
|