customize_account

This commit is contained in:
Luk Lu
2023-03-10 22:05:09 +08:00
parent 90dda262da
commit b34b3b4cd5
3 changed files with 17 additions and 1 deletions

14
ticc.js
View File

@@ -941,6 +941,20 @@ class TicCrypto {
return this.secword_to_account({ secword, coin, coinFamily, world, pass, pathSeed, pathIndex, path, tool, hasher })
}
/**
*
* @param {*} param0
* @returns
* Example: ({addressFormat:'0x.*55$', coin:'PEX', coinFamily:'ETH})
*/
static customize_account ({ addressFormat = '^.*$', secwordFormat = '^.*$', ...rest } = {}) {
let acc = this.randomize_account(rest)
while (!new RegExp(addressFormat).test(acc.address) || !new RegExp(secwordFormat).test(acc.secword)) {
acc = this.randomize_account(rest)
}
return acc
}
/**
* 生成随机的字符串
*