customize_account

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

2
.gitignore vendored
View File

@ -70,7 +70,7 @@ _desktop.ini
/db.json /db.json
# wo # wo
envar-*.gitignore.js *.gitignore.*
# 服务端 # 服务端
/_archive/* /_archive/*
/_datastore/* /_datastore/*

View File

@ -8,7 +8,9 @@
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步 # 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
*.sfignore *.sfignore
*.sfignore.*
*.sfignore/ *.sfignore/
*.sfignore.*/
.DS_Store .DS_Store
*/.DS_Store */.DS_Store

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 }) 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
}
/** /**
* 生成随机的字符串 * 生成随机的字符串
* *