lunesjs 1.5.9 → 1.5.12
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/client/transactions/BaseTransaction.d.ts +6 -0
- package/lib/client/transactions/BaseTransaction.js +2 -0
- package/{dist → lib}/client/transactions/transactions.types.d.ts +0 -0
- package/lib/client/transactions/transactions.types.js +27 -0
- package/lib/client/transactions/transfer/service.transfer.d.ts +21 -0
- package/lib/client/transactions/transfer/service.transfer.js +153 -0
- package/lib/client/transactions/transfer/transfer.types.d.ts +12 -0
- package/lib/client/transactions/transfer/transfer.types.js +2 -0
- package/lib/client/transactions/transfer/validator.d.ts +22 -0
- package/lib/client/transactions/transfer/validator.js +176 -0
- package/lib/client/wallet/constants.d.ts +8 -0
- package/{dist → lib}/client/wallet/constants.js +9 -9
- package/lib/client/wallet/service.account.d.ts +28 -0
- package/lib/client/wallet/service.account.js +83 -0
- package/lib/client/wallet/wallet.types.d.ts +21 -0
- package/lib/client/wallet/wallet.types.js +11 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +24 -0
- package/{dist → lib}/utils/crypto.d.ts +24 -12
- package/lib/utils/crypto.js +147 -0
- package/package.json +11 -11
- package/CHANGELOG.md +0 -3
- package/dist/client/transactions/BaseTransaction.d.ts +0 -6
- package/dist/client/transactions/BaseTransaction.js +0 -2
- package/dist/client/transactions/transactions.types.js +0 -17
- package/dist/client/transactions/transfer/service.transfer.d.ts +0 -12
- package/dist/client/transactions/transfer/service.transfer.js +0 -78
- package/dist/client/transactions/transfer/transfer.types.d.ts +0 -12
- package/dist/client/transactions/transfer/transfer.types.js +0 -2
- package/dist/client/transactions/transfer/validator.d.ts +0 -9
- package/dist/client/transactions/transfer/validator.js +0 -93
- package/dist/client/wallet/constants.d.ts +0 -8
- package/dist/client/wallet/service.account.d.ts +0 -20
- package/dist/client/wallet/service.account.js +0 -35
- package/dist/client/wallet/wallet.types.d.ts +0 -21
- package/dist/client/wallet/wallet.types.js +0 -11
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -14
- package/dist/utils/crypto.js +0 -102
package/dist/utils/crypto.js
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
const constants_1 = __importDefault(require("../client/wallet/constants"));
|
30
|
-
const wasm = __importStar(require("lunesrs"));
|
31
|
-
const cryptoUtils = {
|
32
|
-
fromExistingSeed: (seed, nonce, chain) => {
|
33
|
-
const hidden_seed = wasm.hiddenSeed(nonce, seed);
|
34
|
-
const privateKey = wasm.toPrivateKey(hidden_seed);
|
35
|
-
const publicKey = wasm.toPublicKey(privateKey);
|
36
|
-
const address = wasm.toAddress(1, chain, publicKey);
|
37
|
-
return {
|
38
|
-
nonce: nonce,
|
39
|
-
chain: chain,
|
40
|
-
seed: seed,
|
41
|
-
privateKey: wasm.arrayToBase58(privateKey),
|
42
|
-
publicKey: wasm.arrayToBase58(publicKey),
|
43
|
-
address: wasm.arrayToBase58(address)
|
44
|
-
};
|
45
|
-
},
|
46
|
-
fromPrivateKey: (privateKey, chain) => {
|
47
|
-
const publicKey = wasm.toPublicKey(wasm.base58ToArray(privateKey));
|
48
|
-
const address = wasm.toAddress(1, chain, publicKey);
|
49
|
-
return {
|
50
|
-
seed: "",
|
51
|
-
nonce: 0,
|
52
|
-
chain: chain,
|
53
|
-
privateKey: privateKey,
|
54
|
-
publicKey: wasm.arrayToBase58(publicKey),
|
55
|
-
address: wasm.arrayToBase58(address)
|
56
|
-
};
|
57
|
-
},
|
58
|
-
fromPublicKey: (publicKey, chain) => {
|
59
|
-
const address = wasm.toAddress(1, chain, wasm.base58ToArray(publicKey));
|
60
|
-
return {
|
61
|
-
seed: "",
|
62
|
-
nonce: 0,
|
63
|
-
privateKey: "",
|
64
|
-
chain: chain,
|
65
|
-
publicKey: publicKey,
|
66
|
-
address: wasm.arrayToBase58(address)
|
67
|
-
};
|
68
|
-
},
|
69
|
-
fromAddress: (address, chain) => {
|
70
|
-
return {
|
71
|
-
seed: "",
|
72
|
-
nonce: 0,
|
73
|
-
privateKey: "",
|
74
|
-
publicKey: "",
|
75
|
-
chain: chain,
|
76
|
-
address: address
|
77
|
-
};
|
78
|
-
},
|
79
|
-
fromNewSeed: (nWords, nonce, chain) => {
|
80
|
-
let seed = [];
|
81
|
-
nWords = nWords != undefined ? Math.round(nWords / 3) : 4;
|
82
|
-
for (let i = 0; i < nWords; i++) {
|
83
|
-
for (let n in wasm.randomTripleNumber()) {
|
84
|
-
seed.push(constants_1.default.wordsList[n]);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
return cryptoUtils.fromExistingSeed(seed.join(" "), nonce, chain);
|
88
|
-
},
|
89
|
-
validateAddress: (address, chain) => {
|
90
|
-
return wasm.validateAddress(chain, wasm.base58ToArray(address));
|
91
|
-
},
|
92
|
-
validateSignature: (publicKey, message, signature) => {
|
93
|
-
return wasm.validateSignature(wasm.base58ToArray(publicKey), wasm.base58ToArray(message), wasm.base58ToArray(signature));
|
94
|
-
},
|
95
|
-
fastSignature: (privateKey, message) => {
|
96
|
-
return wasm.arrayToBase58(wasm.fastSignature(wasm.base58ToArray(privateKey), wasm.base58ToArray(message)));
|
97
|
-
},
|
98
|
-
fullSignature: (privateKey, message) => {
|
99
|
-
return wasm.arrayToBase58(wasm.fullSignature(wasm.base58ToArray(privateKey), wasm.base58ToArray(message)));
|
100
|
-
}
|
101
|
-
};
|
102
|
-
exports.default = cryptoUtils;
|