jcc_wallet 2.0.0 → 3.0.0
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/package.json +29 -25
- package/lib/constant/index.d.ts +0 -8
- package/lib/constant/index.js +0 -18
- package/lib/constant/index.js.map +0 -1
- package/lib/eth/index.d.ts +0 -36
- package/lib/eth/index.js +0 -98
- package/lib/eth/index.js.map +0 -1
- package/lib/hd/constant.d.ts +0 -26
- package/lib/hd/constant.js +0 -56
- package/lib/hd/constant.js.map +0 -1
- package/lib/hd/ethereum.plugin.d.ts +0 -4
- package/lib/hd/ethereum.plugin.js +0 -101
- package/lib/hd/ethereum.plugin.js.map +0 -1
- package/lib/hd/index.d.ts +0 -227
- package/lib/hd/index.js +0 -394
- package/lib/hd/index.js.map +0 -1
- package/lib/hd/plugins.d.ts +0 -1
- package/lib/hd/plugins.js +0 -33
- package/lib/hd/plugins.js.map +0 -1
- package/lib/hd/swtc.plugin.d.ts +0 -5
- package/lib/hd/swtc.plugin.js +0 -72
- package/lib/hd/swtc.plugin.js.map +0 -1
- package/lib/hd/tron.plugin.d.ts +0 -4
- package/lib/hd/tron.plugin.js +0 -67
- package/lib/hd/tron.plugin.js.map +0 -1
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -62
- package/lib/index.js.map +0 -1
- package/lib/jingchangWallet/index.d.ts +0 -272
- package/lib/jingchangWallet/index.js +0 -758
- package/lib/jingchangWallet/index.js.map +0 -1
- package/lib/moac/index.d.ts +0 -28
- package/lib/moac/index.js +0 -58
- package/lib/moac/index.js.map +0 -1
- package/lib/types/index.d.ts +0 -90
- package/lib/types/index.js +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/util/index.d.ts +0 -21
- package/lib/util/index.js +0 -90
- package/lib/util/index.js.map +0 -1
- package/lib/x-wallet/index.d.ts +0 -21
- package/lib/x-wallet/index.js +0 -84
- package/lib/x-wallet/index.js.map +0 -1
package/lib/hd/index.d.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { BIP44Chain, BIP44ChainMap, getBIP44Chain } from "./constant";
|
|
2
|
-
export { BIP44Chain, BIP44ChainMap, getBIP44Chain };
|
|
3
|
-
export declare class HDWallet {
|
|
4
|
-
private _secret;
|
|
5
|
-
private _mnemonic;
|
|
6
|
-
private _address;
|
|
7
|
-
private _keypair;
|
|
8
|
-
private _path;
|
|
9
|
-
/**
|
|
10
|
-
* generate mnemonic
|
|
11
|
-
*
|
|
12
|
-
* @static
|
|
13
|
-
* @param {number} len strength of random bytes, default 128
|
|
14
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
15
|
-
* @returns {string} return mnemonic string, spilt by blank
|
|
16
|
-
*/
|
|
17
|
-
static generateMnemonic: (len?: number, language?: string) => string;
|
|
18
|
-
/**
|
|
19
|
-
* get secret from mnemonic, obey encode rule base58 for jingtum
|
|
20
|
-
*
|
|
21
|
-
* @static
|
|
22
|
-
* @param {string} mnemonic mnemonic words
|
|
23
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
24
|
-
* @returns {string} return secret string
|
|
25
|
-
*/
|
|
26
|
-
static getSecretFromMnemonic: (mnemonic: string, language?: string) => string;
|
|
27
|
-
/**
|
|
28
|
-
* get mnemonic from secret, obey encode rule base58 for jingtum
|
|
29
|
-
*
|
|
30
|
-
* @static
|
|
31
|
-
* @param {string} secret secret string
|
|
32
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
33
|
-
* @returns {string} return mnemonic word list
|
|
34
|
-
*/
|
|
35
|
-
static getMnemonicFromSecret: (secret: string, language?: string) => string;
|
|
36
|
-
/**
|
|
37
|
-
* get keypair from secret
|
|
38
|
-
*
|
|
39
|
-
* @static
|
|
40
|
-
* @param {string} secret secret string
|
|
41
|
-
* @returns {object} return keypair object
|
|
42
|
-
*/
|
|
43
|
-
static getKeypairFromSecret: (secret: string) => any;
|
|
44
|
-
/**
|
|
45
|
-
* get hd wallet key pair
|
|
46
|
-
*
|
|
47
|
-
* @static
|
|
48
|
-
* @param {string} rootSecret root secret
|
|
49
|
-
* @param {number} chain chain index number
|
|
50
|
-
* @param {number} account bip44 account index for purpose
|
|
51
|
-
* @param {number} index bip44 last level index
|
|
52
|
-
* @returns {IKeyPair} return keypair object
|
|
53
|
-
*/
|
|
54
|
-
static getHDKeypair: (rootSecret: string, chain: number, account: number, index: number) => IKeyPair;
|
|
55
|
-
/**
|
|
56
|
-
* generate hd wallet
|
|
57
|
-
*
|
|
58
|
-
* @static
|
|
59
|
-
* @param {any} opt options of generate, like:
|
|
60
|
-
* {
|
|
61
|
-
* len: 128/160/192/224/256, default is 128, determines number of mnemonic word
|
|
62
|
-
* language: english default/chinese_simplified/chinese_traditional/czech/korean/french/japanese/... see also:bip39 https://github.com/bitcoinjs/bip39/tree/master/ts_src/wordlists
|
|
63
|
-
* }
|
|
64
|
-
* @returns {object} return hd wallet object
|
|
65
|
-
*/
|
|
66
|
-
static generate: (opt: any) => HDWallet;
|
|
67
|
-
/**
|
|
68
|
-
* create hd wallet from secret
|
|
69
|
-
*
|
|
70
|
-
* @static
|
|
71
|
-
* @param {string} secret secret string
|
|
72
|
-
* @returns {object} return hd wallet object
|
|
73
|
-
*/
|
|
74
|
-
static fromSecret: (secret: string) => HDWallet;
|
|
75
|
-
/**
|
|
76
|
-
* create hd wallet from mnemonic
|
|
77
|
-
*
|
|
78
|
-
* @static
|
|
79
|
-
* @param {IMnemonic} mnemonic object like
|
|
80
|
-
* {mnemonic: "abc abc ...", language: "english"}
|
|
81
|
-
* @returns {object} return hd wallet object
|
|
82
|
-
*/
|
|
83
|
-
static fromMnemonic: (mnemonic: IMnemonic) => HDWallet;
|
|
84
|
-
/**
|
|
85
|
-
* create hd wallet from keypair
|
|
86
|
-
*
|
|
87
|
-
* @static
|
|
88
|
-
* @param {IKeyPair} keypair object like
|
|
89
|
-
* {publicKey: "public key...", privateKey: "private key..."}
|
|
90
|
-
* @returns {object} return hd wallet object
|
|
91
|
-
*/
|
|
92
|
-
static fromKeypair: (keypair: IKeyPair) => HDWallet;
|
|
93
|
-
/**
|
|
94
|
-
* generate hd wallet
|
|
95
|
-
*
|
|
96
|
-
* @param {any} opt options of generate, like:
|
|
97
|
-
* {
|
|
98
|
-
* mnemonic: "world list", // optional
|
|
99
|
-
* // see also:bip39 https://github.com/bitcoinjs/bip39/tree/master/ts_src/wordlists
|
|
100
|
-
* // language attribute appears with mnemonic attribute
|
|
101
|
-
* language: english default/chinese_simplified/...
|
|
102
|
-
* secret: "secret string", // optional, default this coding rules of SWTC chain
|
|
103
|
-
* keypair: {privateKey: "xxxx", publicKey: "xxxx"}
|
|
104
|
-
* }
|
|
105
|
-
* way of create hd wallet
|
|
106
|
-
* 1. {mnemonic: "xxx", language:"english"}
|
|
107
|
-
* 2. {secret: "xxxx"}
|
|
108
|
-
* 3. {keypair: {....}, path:{....}}
|
|
109
|
-
* @returns {object} return hd wallet object
|
|
110
|
-
*/
|
|
111
|
-
constructor(opt: any);
|
|
112
|
-
/**
|
|
113
|
-
* hd wallet is root or not
|
|
114
|
-
*
|
|
115
|
-
* @returns {boolean} return hd wallet root or not
|
|
116
|
-
*/
|
|
117
|
-
isRoot: () => boolean;
|
|
118
|
-
/**
|
|
119
|
-
* generate hd wallet by derive path, obey BIP44 protocol
|
|
120
|
-
*
|
|
121
|
-
* @param {any} opt options of derive, like:
|
|
122
|
-
* {
|
|
123
|
-
* chain: BIP44Chain.ETH, //chain code defined in bip44
|
|
124
|
-
* account: 0, // account for what purpose
|
|
125
|
-
* change: 0, // optional attrube,default always 0, for change account after transfer
|
|
126
|
-
* index: 0, // accout index
|
|
127
|
-
* }
|
|
128
|
-
* @returns {object} return hd wallet object
|
|
129
|
-
*/
|
|
130
|
-
deriveWallet: (opt: any) => HDWallet;
|
|
131
|
-
/**
|
|
132
|
-
* get wallet secret
|
|
133
|
-
*
|
|
134
|
-
* @returns {string} return wallet secret
|
|
135
|
-
*/
|
|
136
|
-
secret: () => string;
|
|
137
|
-
/**
|
|
138
|
-
* get wallet mnemonic
|
|
139
|
-
*
|
|
140
|
-
* @returns {IMnemonic} return IMnemonic object
|
|
141
|
-
*/
|
|
142
|
-
mnemonic: () => IMnemonic;
|
|
143
|
-
/**
|
|
144
|
-
* get chain of hd wallet
|
|
145
|
-
*
|
|
146
|
-
* @returns {string} return chain of hd wallet
|
|
147
|
-
*/
|
|
148
|
-
chain: () => string;
|
|
149
|
-
/**
|
|
150
|
-
* get address of hd wallet
|
|
151
|
-
*
|
|
152
|
-
* @returns {string} return address of hd wallet
|
|
153
|
-
*/
|
|
154
|
-
address: () => string;
|
|
155
|
-
/**
|
|
156
|
-
* check address valid or not
|
|
157
|
-
* @param {string} address
|
|
158
|
-
* @returns {boolean} true valid, false invalid
|
|
159
|
-
*/
|
|
160
|
-
isValidAddress: (address: string) => boolean;
|
|
161
|
-
/**
|
|
162
|
-
* check secret valid or not
|
|
163
|
-
*
|
|
164
|
-
* @param {string} secret
|
|
165
|
-
* @returns {boolean} true valid, false invalid
|
|
166
|
-
*/
|
|
167
|
-
isValidSecret: (address: string) => boolean;
|
|
168
|
-
/**
|
|
169
|
-
* hash message
|
|
170
|
-
*
|
|
171
|
-
* @param {string} message
|
|
172
|
-
* @returns {string} return hash of message
|
|
173
|
-
*/
|
|
174
|
-
hash: (message: string) => string;
|
|
175
|
-
/**
|
|
176
|
-
* sign message
|
|
177
|
-
* @notice how to operate message(raw or hashed) is different in native sdk of different chain
|
|
178
|
-
* to avoid confusion, we assume that native sdk will automatically hashed message
|
|
179
|
-
* if not the case of native sdk, we hash this message in lower level(plugin), for example ethereum sdk
|
|
180
|
-
* @param {string} message
|
|
181
|
-
* @returns {string} return signature string
|
|
182
|
-
*/
|
|
183
|
-
sign: (message: string) => string;
|
|
184
|
-
/**
|
|
185
|
-
* verify signature valid or not
|
|
186
|
-
*
|
|
187
|
-
* @param {string} message origin message
|
|
188
|
-
* @param {string} signature signature
|
|
189
|
-
* @param {string} address account which sign
|
|
190
|
-
* @param {IKeyPair} keypair keypair object, usually to provide public key, private key not required
|
|
191
|
-
*
|
|
192
|
-
* @returns {boolean} true valid, false invalid
|
|
193
|
-
*/
|
|
194
|
-
verify: (messgae: string, signature: string, address?: string, keypair?: IKeyPair) => boolean;
|
|
195
|
-
/**
|
|
196
|
-
* recover address/account from signature
|
|
197
|
-
*
|
|
198
|
-
* @param {string} message origin message
|
|
199
|
-
* @param {string} signature signature
|
|
200
|
-
*
|
|
201
|
-
* @returns {string} return address
|
|
202
|
-
*/
|
|
203
|
-
recover: (messgae: string, signature: string) => string;
|
|
204
|
-
/**
|
|
205
|
-
* get specified chain wallet api
|
|
206
|
-
*
|
|
207
|
-
* @returns {IHDPlugin} return hd plugin object
|
|
208
|
-
*/
|
|
209
|
-
getWalletApi: () => IHDPlugin;
|
|
210
|
-
/**
|
|
211
|
-
* get keypair of hd wallet
|
|
212
|
-
*
|
|
213
|
-
* @returns {IKeyPair} return keypair of message
|
|
214
|
-
*/
|
|
215
|
-
keypair: () => IKeyPair;
|
|
216
|
-
/**
|
|
217
|
-
* get path of hd wallet
|
|
218
|
-
*
|
|
219
|
-
* @returns {IBIP44Path} return path of wallet
|
|
220
|
-
*/
|
|
221
|
-
path: () => IBIP44Path;
|
|
222
|
-
/**
|
|
223
|
-
* set keypair
|
|
224
|
-
* @param {IKeyPair} keypair
|
|
225
|
-
*/
|
|
226
|
-
setKeypair: (keypair: IKeyPair) => void;
|
|
227
|
-
}
|
package/lib/hd/index.js
DELETED
|
@@ -1,394 +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
|
-
exports.HDWallet = exports.getBIP44Chain = exports.BIP44ChainMap = exports.BIP44Chain = void 0;
|
|
30
|
-
var wallet_1 = require("@swtc/wallet");
|
|
31
|
-
var BIP39 = __importStar(require("bip39"));
|
|
32
|
-
var bip32_1 = __importDefault(require("bip32"));
|
|
33
|
-
var ecc = __importStar(require("tiny-secp256k1"));
|
|
34
|
-
var constant_1 = require("./constant");
|
|
35
|
-
Object.defineProperty(exports, "BIP44Chain", { enumerable: true, get: function () { return constant_1.BIP44Chain; } });
|
|
36
|
-
Object.defineProperty(exports, "BIP44ChainMap", { enumerable: true, get: function () { return constant_1.BIP44ChainMap; } });
|
|
37
|
-
Object.defineProperty(exports, "getBIP44Chain", { enumerable: true, get: function () { return constant_1.getBIP44Chain; } });
|
|
38
|
-
var plugins_1 = require("./plugins");
|
|
39
|
-
var addressCodec = wallet_1.KeyPair.addressCodec;
|
|
40
|
-
var HDWallet = /** @class */ (function () {
|
|
41
|
-
/**
|
|
42
|
-
* generate hd wallet
|
|
43
|
-
*
|
|
44
|
-
* @param {any} opt options of generate, like:
|
|
45
|
-
* {
|
|
46
|
-
* mnemonic: "world list", // optional
|
|
47
|
-
* // see also:bip39 https://github.com/bitcoinjs/bip39/tree/master/ts_src/wordlists
|
|
48
|
-
* // language attribute appears with mnemonic attribute
|
|
49
|
-
* language: english default/chinese_simplified/...
|
|
50
|
-
* secret: "secret string", // optional, default this coding rules of SWTC chain
|
|
51
|
-
* keypair: {privateKey: "xxxx", publicKey: "xxxx"}
|
|
52
|
-
* }
|
|
53
|
-
* way of create hd wallet
|
|
54
|
-
* 1. {mnemonic: "xxx", language:"english"}
|
|
55
|
-
* 2. {secret: "xxxx"}
|
|
56
|
-
* 3. {keypair: {....}, path:{....}}
|
|
57
|
-
* @returns {object} return hd wallet object
|
|
58
|
-
*/
|
|
59
|
-
function HDWallet(opt) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
/**
|
|
62
|
-
* hd wallet is root or not
|
|
63
|
-
*
|
|
64
|
-
* @returns {boolean} return hd wallet root or not
|
|
65
|
-
*/
|
|
66
|
-
this.isRoot = function () {
|
|
67
|
-
return _this._path.chain + _this._path.account + _this._path.change + _this._path.index === 0;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* generate hd wallet by derive path, obey BIP44 protocol
|
|
71
|
-
*
|
|
72
|
-
* @param {any} opt options of derive, like:
|
|
73
|
-
* {
|
|
74
|
-
* chain: BIP44Chain.ETH, //chain code defined in bip44
|
|
75
|
-
* account: 0, // account for what purpose
|
|
76
|
-
* change: 0, // optional attrube,default always 0, for change account after transfer
|
|
77
|
-
* index: 0, // accout index
|
|
78
|
-
* }
|
|
79
|
-
* @returns {object} return hd wallet object
|
|
80
|
-
*/
|
|
81
|
-
this.deriveWallet = function (opt) {
|
|
82
|
-
if (isNaN(opt.chain) || isNaN(opt.account) || isNaN(opt.index)) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
var hdKeypair = HDWallet.getHDKeypair(_this._secret, opt.chain, opt.account, opt.index);
|
|
86
|
-
return new HDWallet({
|
|
87
|
-
keypair: hdKeypair,
|
|
88
|
-
path: { chain: opt.chain, account: opt.account, change: 0, index: opt.index }
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* get wallet secret
|
|
93
|
-
*
|
|
94
|
-
* @returns {string} return wallet secret
|
|
95
|
-
*/
|
|
96
|
-
this.secret = function () {
|
|
97
|
-
return _this._secret;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* get wallet mnemonic
|
|
101
|
-
*
|
|
102
|
-
* @returns {IMnemonic} return IMnemonic object
|
|
103
|
-
*/
|
|
104
|
-
this.mnemonic = function () {
|
|
105
|
-
return _this._mnemonic;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* get chain of hd wallet
|
|
109
|
-
*
|
|
110
|
-
* @returns {string} return chain of hd wallet
|
|
111
|
-
*/
|
|
112
|
-
this.chain = function () {
|
|
113
|
-
return _this.isRoot() ? constant_1.BIP44ChainMap.get(constant_1.BIP44Chain.SWTC) : constant_1.BIP44ChainMap.get(_this._path.chain);
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* get address of hd wallet
|
|
117
|
-
*
|
|
118
|
-
* @returns {string} return address of hd wallet
|
|
119
|
-
*/
|
|
120
|
-
this.address = function () {
|
|
121
|
-
if (!_this._address) {
|
|
122
|
-
var chain = _this.chain();
|
|
123
|
-
_this._address = (0, plugins_1.getPluginByType)(chain).address(_this._secret ? _this._secret : _this._keypair, chain);
|
|
124
|
-
}
|
|
125
|
-
return _this._address;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* check address valid or not
|
|
129
|
-
* @param {string} address
|
|
130
|
-
* @returns {boolean} true valid, false invalid
|
|
131
|
-
*/
|
|
132
|
-
this.isValidAddress = function (address) {
|
|
133
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).isValidAddress(address);
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* check secret valid or not
|
|
137
|
-
*
|
|
138
|
-
* @param {string} secret
|
|
139
|
-
* @returns {boolean} true valid, false invalid
|
|
140
|
-
*/
|
|
141
|
-
this.isValidSecret = function (address) {
|
|
142
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).isValidSecret(address);
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* hash message
|
|
146
|
-
*
|
|
147
|
-
* @param {string} message
|
|
148
|
-
* @returns {string} return hash of message
|
|
149
|
-
*/
|
|
150
|
-
this.hash = function (message) {
|
|
151
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).hash(message);
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* sign message
|
|
155
|
-
* @notice how to operate message(raw or hashed) is different in native sdk of different chain
|
|
156
|
-
* to avoid confusion, we assume that native sdk will automatically hashed message
|
|
157
|
-
* if not the case of native sdk, we hash this message in lower level(plugin), for example ethereum sdk
|
|
158
|
-
* @param {string} message
|
|
159
|
-
* @returns {string} return signature string
|
|
160
|
-
*/
|
|
161
|
-
this.sign = function (message) {
|
|
162
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).sign(message, _this._keypair.privateKey);
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* verify signature valid or not
|
|
166
|
-
*
|
|
167
|
-
* @param {string} message origin message
|
|
168
|
-
* @param {string} signature signature
|
|
169
|
-
* @param {string} address account which sign
|
|
170
|
-
* @param {IKeyPair} keypair keypair object, usually to provide public key, private key not required
|
|
171
|
-
*
|
|
172
|
-
* @returns {boolean} true valid, false invalid
|
|
173
|
-
*/
|
|
174
|
-
this.verify = function (messgae, signature, address, keypair) {
|
|
175
|
-
if (!address) {
|
|
176
|
-
address = _this.address();
|
|
177
|
-
}
|
|
178
|
-
if (!keypair) {
|
|
179
|
-
keypair = _this._keypair;
|
|
180
|
-
}
|
|
181
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).verify(messgae, signature, address, keypair);
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* recover address/account from signature
|
|
185
|
-
*
|
|
186
|
-
* @param {string} message origin message
|
|
187
|
-
* @param {string} signature signature
|
|
188
|
-
*
|
|
189
|
-
* @returns {string} return address
|
|
190
|
-
*/
|
|
191
|
-
this.recover = function (messgae, signature) {
|
|
192
|
-
return (0, plugins_1.getPluginByType)(_this.chain()).recover(messgae, signature);
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* get specified chain wallet api
|
|
196
|
-
*
|
|
197
|
-
* @returns {IHDPlugin} return hd plugin object
|
|
198
|
-
*/
|
|
199
|
-
this.getWalletApi = function () {
|
|
200
|
-
return (0, plugins_1.getPluginByType)(_this.chain());
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* get keypair of hd wallet
|
|
204
|
-
*
|
|
205
|
-
* @returns {IKeyPair} return keypair of message
|
|
206
|
-
*/
|
|
207
|
-
this.keypair = function () {
|
|
208
|
-
return _this._keypair;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* get path of hd wallet
|
|
212
|
-
*
|
|
213
|
-
* @returns {IBIP44Path} return path of wallet
|
|
214
|
-
*/
|
|
215
|
-
this.path = function () {
|
|
216
|
-
return _this._path;
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* set keypair
|
|
220
|
-
* @param {IKeyPair} keypair
|
|
221
|
-
*/
|
|
222
|
-
this.setKeypair = function (keypair) {
|
|
223
|
-
_this._keypair = keypair;
|
|
224
|
-
};
|
|
225
|
-
if (!opt) {
|
|
226
|
-
throw new Error("undefined parameters: " + opt);
|
|
227
|
-
}
|
|
228
|
-
this._path = {
|
|
229
|
-
chain: 0,
|
|
230
|
-
account: 0,
|
|
231
|
-
change: 0,
|
|
232
|
-
index: 0
|
|
233
|
-
};
|
|
234
|
-
if (opt.mnemonic) {
|
|
235
|
-
this._secret = HDWallet.getSecretFromMnemonic(opt.mnemonic, opt.language);
|
|
236
|
-
this._keypair = HDWallet.getKeypairFromSecret(this._secret);
|
|
237
|
-
this._mnemonic = { mnemonic: opt.mnemonic, language: opt.language };
|
|
238
|
-
return this;
|
|
239
|
-
}
|
|
240
|
-
if (opt.secret) {
|
|
241
|
-
this._secret = opt.secret;
|
|
242
|
-
this._keypair = HDWallet.getKeypairFromSecret(this._secret);
|
|
243
|
-
this._mnemonic = { mnemonic: HDWallet.getMnemonicFromSecret(this._secret, opt.language), language: opt.language };
|
|
244
|
-
return this;
|
|
245
|
-
}
|
|
246
|
-
// wallet create by keypair, which only for sign message and tx
|
|
247
|
-
if (opt.keypair) {
|
|
248
|
-
if (opt.path) {
|
|
249
|
-
this._keypair = opt.keypair;
|
|
250
|
-
this._mnemonic = null;
|
|
251
|
-
this._secret = null;
|
|
252
|
-
this._path = opt.path;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
this._keypair = opt.keypair;
|
|
256
|
-
this._mnemonic = null;
|
|
257
|
-
this._secret = null;
|
|
258
|
-
}
|
|
259
|
-
return this;
|
|
260
|
-
}
|
|
261
|
-
// parameter error;
|
|
262
|
-
throw new Error("invalid parameters: " + opt);
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* generate mnemonic
|
|
266
|
-
*
|
|
267
|
-
* @static
|
|
268
|
-
* @param {number} len strength of random bytes, default 128
|
|
269
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
270
|
-
* @returns {string} return mnemonic string, spilt by blank
|
|
271
|
-
*/
|
|
272
|
-
HDWallet.generateMnemonic = function (len, language) {
|
|
273
|
-
if (len === void 0) { len = 128; }
|
|
274
|
-
if (language === void 0) { language = "english"; }
|
|
275
|
-
BIP39.setDefaultWordlist(language);
|
|
276
|
-
return BIP39.generateMnemonic(len);
|
|
277
|
-
};
|
|
278
|
-
/**
|
|
279
|
-
* get secret from mnemonic, obey encode rule base58 for jingtum
|
|
280
|
-
*
|
|
281
|
-
* @static
|
|
282
|
-
* @param {string} mnemonic mnemonic words
|
|
283
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
284
|
-
* @returns {string} return secret string
|
|
285
|
-
*/
|
|
286
|
-
HDWallet.getSecretFromMnemonic = function (mnemonic, language) {
|
|
287
|
-
if (language === void 0) { language = "english"; }
|
|
288
|
-
BIP39.setDefaultWordlist(language);
|
|
289
|
-
var entropy = BIP39.mnemonicToEntropy(mnemonic);
|
|
290
|
-
return addressCodec.encodeSeed(Buffer.from(entropy, "hex"));
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* get mnemonic from secret, obey encode rule base58 for jingtum
|
|
294
|
-
*
|
|
295
|
-
* @static
|
|
296
|
-
* @param {string} secret secret string
|
|
297
|
-
* @param {string} language localized word list, default is english. see also https://github.com/bitcoinjs/BIP39
|
|
298
|
-
* @returns {string} return mnemonic word list
|
|
299
|
-
*/
|
|
300
|
-
HDWallet.getMnemonicFromSecret = function (secret, language) {
|
|
301
|
-
if (language === void 0) { language = "english"; }
|
|
302
|
-
BIP39.setDefaultWordlist(language);
|
|
303
|
-
var entropy = addressCodec.decodeSeed(secret).bytes;
|
|
304
|
-
return BIP39.entropyToMnemonic(entropy);
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* get keypair from secret
|
|
308
|
-
*
|
|
309
|
-
* @static
|
|
310
|
-
* @param {string} secret secret string
|
|
311
|
-
* @returns {object} return keypair object
|
|
312
|
-
*/
|
|
313
|
-
HDWallet.getKeypairFromSecret = function (secret) {
|
|
314
|
-
return wallet_1.KeyPair.deriveKeypair(secret);
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* get hd wallet key pair
|
|
318
|
-
*
|
|
319
|
-
* @static
|
|
320
|
-
* @param {string} rootSecret root secret
|
|
321
|
-
* @param {number} chain chain index number
|
|
322
|
-
* @param {number} account bip44 account index for purpose
|
|
323
|
-
* @param {number} index bip44 last level index
|
|
324
|
-
* @returns {IKeyPair} return keypair object
|
|
325
|
-
*/
|
|
326
|
-
HDWallet.getHDKeypair = function (rootSecret, chain, account, index) {
|
|
327
|
-
if (account === void 0) { account = 0; }
|
|
328
|
-
var bip44Chain = (0, constant_1.getBIP44Chain)(chain);
|
|
329
|
-
if (bip44Chain.length === 0) {
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
|
-
/* tslint:disable:no-bitwise */
|
|
333
|
-
var chainIdx = (bip44Chain[0][0] << 1) >> 1;
|
|
334
|
-
var mnemonic = HDWallet.getMnemonicFromSecret(rootSecret);
|
|
335
|
-
var seed = BIP39.mnemonicToSeedSync(mnemonic);
|
|
336
|
-
var bip32 = (0, bip32_1.default)(ecc);
|
|
337
|
-
var b32 = bip32.fromSeed(seed);
|
|
338
|
-
var privateKey = b32.derivePath("m/44'/".concat(chainIdx, "'/").concat(account, "'/0/").concat(index)).privateKey;
|
|
339
|
-
return wallet_1.KeyPair.deriveKeypair(privateKey.toString("hex"));
|
|
340
|
-
};
|
|
341
|
-
/**
|
|
342
|
-
* generate hd wallet
|
|
343
|
-
*
|
|
344
|
-
* @static
|
|
345
|
-
* @param {any} opt options of generate, like:
|
|
346
|
-
* {
|
|
347
|
-
* len: 128/160/192/224/256, default is 128, determines number of mnemonic word
|
|
348
|
-
* language: english default/chinese_simplified/chinese_traditional/czech/korean/french/japanese/... see also:bip39 https://github.com/bitcoinjs/bip39/tree/master/ts_src/wordlists
|
|
349
|
-
* }
|
|
350
|
-
* @returns {object} return hd wallet object
|
|
351
|
-
*/
|
|
352
|
-
HDWallet.generate = function (opt) {
|
|
353
|
-
if (!opt) {
|
|
354
|
-
opt = {};
|
|
355
|
-
}
|
|
356
|
-
var mnemonic = HDWallet.generateMnemonic(opt.len, opt.language);
|
|
357
|
-
return new HDWallet({ mnemonic: mnemonic, language: opt.language });
|
|
358
|
-
};
|
|
359
|
-
/**
|
|
360
|
-
* create hd wallet from secret
|
|
361
|
-
*
|
|
362
|
-
* @static
|
|
363
|
-
* @param {string} secret secret string
|
|
364
|
-
* @returns {object} return hd wallet object
|
|
365
|
-
*/
|
|
366
|
-
HDWallet.fromSecret = function (secret) {
|
|
367
|
-
return new HDWallet({ secret: secret });
|
|
368
|
-
};
|
|
369
|
-
/**
|
|
370
|
-
* create hd wallet from mnemonic
|
|
371
|
-
*
|
|
372
|
-
* @static
|
|
373
|
-
* @param {IMnemonic} mnemonic object like
|
|
374
|
-
* {mnemonic: "abc abc ...", language: "english"}
|
|
375
|
-
* @returns {object} return hd wallet object
|
|
376
|
-
*/
|
|
377
|
-
HDWallet.fromMnemonic = function (mnemonic) {
|
|
378
|
-
return new HDWallet({ mnemonic: mnemonic.mnemonic, language: mnemonic.language });
|
|
379
|
-
};
|
|
380
|
-
/**
|
|
381
|
-
* create hd wallet from keypair
|
|
382
|
-
*
|
|
383
|
-
* @static
|
|
384
|
-
* @param {IKeyPair} keypair object like
|
|
385
|
-
* {publicKey: "public key...", privateKey: "private key..."}
|
|
386
|
-
* @returns {object} return hd wallet object
|
|
387
|
-
*/
|
|
388
|
-
HDWallet.fromKeypair = function (keypair) {
|
|
389
|
-
return new HDWallet({ keypair: keypair });
|
|
390
|
-
};
|
|
391
|
-
return HDWallet;
|
|
392
|
-
}());
|
|
393
|
-
exports.HDWallet = HDWallet;
|
|
394
|
-
//# sourceMappingURL=index.js.map
|
package/lib/hd/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hd/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,2CAA+B;AAC/B,gDAAiC;AACjC,kDAAsC;AACtC,uCAAsE;AAK7D,2FALA,qBAAU,OAKA;AAAE,8FALA,wBAAa,OAKA;AAAE,8FALA,wBAAa,OAKA;AAJjD,qCAA4C;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,MAAM,QAAA,EAAE,CAAC,CAAC;IAClC,CAAC,AAFuB,CAEtB;IAEF;;;;;;;OAOG;IACW,qBAAY,GAAG,UAAC,QAAmB;QAC/C,OAAO,IAAI,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpF,CAAC,AAFyB,CAExB;IAEF;;;;;;;OAOG;IACW,oBAAW,GAAG,UAAC,OAAiB;QAC5C,OAAO,IAAI,QAAQ,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IACnC,CAAC,AAFwB,CAEvB;IAoPJ,eAAC;CAAA,AAjYD,IAiYC;AAjYY,4BAAQ"}
|
package/lib/hd/plugins.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getPluginByType<T extends IHDPlugin>(type: string): T;
|
package/lib/hd/plugins.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPluginByType = void 0;
|
|
4
|
-
var ethereum_plugin_1 = require("./ethereum.plugin");
|
|
5
|
-
var ethereum_plugin_2 = require("./ethereum.plugin");
|
|
6
|
-
var ethereum_plugin_3 = require("./ethereum.plugin");
|
|
7
|
-
var ethereum_plugin_4 = require("./ethereum.plugin");
|
|
8
|
-
var tron_plugin_1 = require("./tron.plugin");
|
|
9
|
-
// import { plugin as swtcPlugin } from "./swtc.plugin";
|
|
10
|
-
// import { plugin as bvcadtPlugin } from "./swtc.plugin";
|
|
11
|
-
// import { plugin as callPlugin } from "./swtc.plugin";
|
|
12
|
-
// import { plugin as ripplePlugin } from "./ripple.plugin";
|
|
13
|
-
// import { plugin as streamPlugin } from "./swtc.plugin";
|
|
14
|
-
// import { plugin as bizainPlugin } from "./swtc.plugin";
|
|
15
|
-
var swtc_plugin_1 = require("./swtc.plugin");
|
|
16
|
-
var pluginMap = {
|
|
17
|
-
ethereum: ethereum_plugin_1.plugin,
|
|
18
|
-
bsc: ethereum_plugin_2.plugin,
|
|
19
|
-
heco: ethereum_plugin_3.plugin,
|
|
20
|
-
polygon: ethereum_plugin_4.plugin,
|
|
21
|
-
tron: tron_plugin_1.plugin,
|
|
22
|
-
bvcadt: (0, swtc_plugin_1.XWallet)("bvcadt"),
|
|
23
|
-
call: (0, swtc_plugin_1.XWallet)("call"),
|
|
24
|
-
ripple: (0, swtc_plugin_1.XWallet)("ripple"),
|
|
25
|
-
stream: (0, swtc_plugin_1.XWallet)("stream"),
|
|
26
|
-
bizain: (0, swtc_plugin_1.XWallet)("bizain"),
|
|
27
|
-
jingtum: (0, swtc_plugin_1.XWallet)("jingtum")
|
|
28
|
-
};
|
|
29
|
-
function getPluginByType(type) {
|
|
30
|
-
return pluginMap[type];
|
|
31
|
-
}
|
|
32
|
-
exports.getPluginByType = getPluginByType;
|
|
33
|
-
//# sourceMappingURL=plugins.js.map
|
package/lib/hd/plugins.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/hd/plugins.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAC7D,qDAAwD;AACxD,qDAAyD;AACzD,qDAA4D;AAC5D,6CAAqD;AACrD,wDAAwD;AACxD,0DAA0D;AAC1D,wDAAwD;AACxD,4DAA4D;AAC5D,0DAA0D;AAC1D,0DAA0D;AAC1D,6CAAwC;AAMxC,IAAM,SAAS,GAAe;IAC5B,QAAQ,EAAE,wBAAc;IACxB,GAAG,EAAE,wBAAS;IACd,IAAI,EAAE,wBAAU;IAChB,OAAO,EAAE,wBAAa;IACtB,IAAI,EAAE,oBAAU;IAChB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,IAAI,EAAE,IAAA,qBAAO,EAAC,MAAM,CAAC;IACrB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,OAAO,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,SAAgB,eAAe,CAAsB,IAAY;IAC/D,OAAO,SAAS,CAAC,IAAI,CAAM,CAAC;AAC9B,CAAC;AAFD,0CAEC"}
|