@ellipticltd/aml-utils 0.1.3 → 0.2.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/.idea/aml-utils.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +158 -0
- package/lib/validations.js +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/aml-utils.iml" filepath="$PROJECT_DIR$/.idea/aml-utils.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="beae4972-1969-4895-bbc9-d79f09bb9811" name="Default" comment="">
|
|
5
|
+
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
6
|
+
</list>
|
|
7
|
+
<ignored path="$PROJECT_DIR$/.tmp/" />
|
|
8
|
+
<ignored path="$PROJECT_DIR$/temp/" />
|
|
9
|
+
<ignored path="$PROJECT_DIR$/tmp/" />
|
|
10
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
11
|
+
<option name="TRACKING_ENABLED" value="true" />
|
|
12
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
13
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
14
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
15
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
16
|
+
</component>
|
|
17
|
+
<component name="FileEditorManager">
|
|
18
|
+
<leaf>
|
|
19
|
+
<file leaf-file-name="package.json" pinned="false" current-in-tab="true">
|
|
20
|
+
<entry file="file://$PROJECT_DIR$/package.json">
|
|
21
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
22
|
+
<state relative-caret-position="364">
|
|
23
|
+
<caret line="28" column="24" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" />
|
|
24
|
+
</state>
|
|
25
|
+
</provider>
|
|
26
|
+
</entry>
|
|
27
|
+
</file>
|
|
28
|
+
</leaf>
|
|
29
|
+
</component>
|
|
30
|
+
<component name="Git.Settings">
|
|
31
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
32
|
+
</component>
|
|
33
|
+
<component name="IdeDocumentHistory">
|
|
34
|
+
<option name="CHANGED_PATHS">
|
|
35
|
+
<list>
|
|
36
|
+
<option value="$PROJECT_DIR$/package.json" />
|
|
37
|
+
</list>
|
|
38
|
+
</option>
|
|
39
|
+
</component>
|
|
40
|
+
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
|
41
|
+
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER">
|
|
42
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
43
|
+
</component>
|
|
44
|
+
<component name="JsGulpfileManager">
|
|
45
|
+
<detection-done>true</detection-done>
|
|
46
|
+
<sorting>DEFINITION_ORDER</sorting>
|
|
47
|
+
</component>
|
|
48
|
+
<component name="NodeModulesDirectoryManager">
|
|
49
|
+
<handled-path value="$PROJECT_DIR$/node_modules" />
|
|
50
|
+
</component>
|
|
51
|
+
<component name="NodePackageJsonFileManager">
|
|
52
|
+
<packageJsonPaths>
|
|
53
|
+
<path value="$PROJECT_DIR$/package.json" />
|
|
54
|
+
</packageJsonPaths>
|
|
55
|
+
</component>
|
|
56
|
+
<component name="ProjectFrameBounds" extendedState="6">
|
|
57
|
+
<option name="y" value="23" />
|
|
58
|
+
<option name="width" value="1680" />
|
|
59
|
+
<option name="height" value="1027" />
|
|
60
|
+
</component>
|
|
61
|
+
<component name="ProjectView">
|
|
62
|
+
<navigator proportions="" version="1">
|
|
63
|
+
<foldersAlwaysOnTop value="true" />
|
|
64
|
+
</navigator>
|
|
65
|
+
<panes>
|
|
66
|
+
<pane id="Scope" />
|
|
67
|
+
<pane id="ProjectPane">
|
|
68
|
+
<subPane>
|
|
69
|
+
<expand>
|
|
70
|
+
<path>
|
|
71
|
+
<item name="aml-utils" type="b2602c69:ProjectViewProjectNode" />
|
|
72
|
+
<item name="aml-utils" type="462c0819:PsiDirectoryNode" />
|
|
73
|
+
</path>
|
|
74
|
+
</expand>
|
|
75
|
+
<select />
|
|
76
|
+
</subPane>
|
|
77
|
+
</pane>
|
|
78
|
+
</panes>
|
|
79
|
+
</component>
|
|
80
|
+
<component name="PropertiesComponent">
|
|
81
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
82
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
83
|
+
<property name="node.js.detected.package.eslint" value="true" />
|
|
84
|
+
<property name="node.js.path.for.package.eslint" value="project" />
|
|
85
|
+
<property name="node.js.selected.package.eslint" value="$PROJECT_DIR$/node_modules/eslint" />
|
|
86
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
|
87
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
88
|
+
<property name="nodejs_package_manager_path" value="npm" />
|
|
89
|
+
</component>
|
|
90
|
+
<component name="RunDashboard">
|
|
91
|
+
<option name="ruleStates">
|
|
92
|
+
<list>
|
|
93
|
+
<RuleState>
|
|
94
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
|
95
|
+
</RuleState>
|
|
96
|
+
<RuleState>
|
|
97
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
|
98
|
+
</RuleState>
|
|
99
|
+
</list>
|
|
100
|
+
</option>
|
|
101
|
+
</component>
|
|
102
|
+
<component name="SvnConfiguration">
|
|
103
|
+
<configuration />
|
|
104
|
+
</component>
|
|
105
|
+
<component name="TaskManager">
|
|
106
|
+
<task active="true" id="Default" summary="Default task">
|
|
107
|
+
<changelist id="beae4972-1969-4895-bbc9-d79f09bb9811" name="Default" comment="" />
|
|
108
|
+
<created>1563360614655</created>
|
|
109
|
+
<option name="number" value="Default" />
|
|
110
|
+
<option name="presentableId" value="Default" />
|
|
111
|
+
<updated>1563360614655</updated>
|
|
112
|
+
<workItem from="1563360615721" duration="32000" />
|
|
113
|
+
</task>
|
|
114
|
+
<servers />
|
|
115
|
+
</component>
|
|
116
|
+
<component name="TimeTrackingManager">
|
|
117
|
+
<option name="totallyTimeSpent" value="32000" />
|
|
118
|
+
</component>
|
|
119
|
+
<component name="ToolWindowManager">
|
|
120
|
+
<frame x="0" y="23" width="1680" height="1027" extended-state="6" />
|
|
121
|
+
<editor active="true" />
|
|
122
|
+
<layout>
|
|
123
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24954791" />
|
|
124
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
|
125
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
|
126
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
127
|
+
<window_info anchor="bottom" id="Run" order="2" />
|
|
128
|
+
<window_info anchor="bottom" id="Version Control" />
|
|
129
|
+
<window_info id="npm" side_tool="true" />
|
|
130
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
131
|
+
<window_info anchor="bottom" id="Terminal" />
|
|
132
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
133
|
+
<window_info id="Favorites" side_tool="true" />
|
|
134
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
|
135
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
|
136
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
|
137
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
138
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
|
139
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
|
140
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
|
141
|
+
</layout>
|
|
142
|
+
</component>
|
|
143
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
144
|
+
<option name="version" value="1" />
|
|
145
|
+
</component>
|
|
146
|
+
<component name="VcsContentAnnotationSettings">
|
|
147
|
+
<option name="myLimit" value="2678400000" />
|
|
148
|
+
</component>
|
|
149
|
+
<component name="editorHistoryManager">
|
|
150
|
+
<entry file="file://$PROJECT_DIR$/package.json">
|
|
151
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
152
|
+
<state relative-caret-position="364">
|
|
153
|
+
<caret line="28" column="24" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="24" />
|
|
154
|
+
</state>
|
|
155
|
+
</provider>
|
|
156
|
+
</entry>
|
|
157
|
+
</component>
|
|
158
|
+
</project>
|
package/lib/validations.js
CHANGED
|
@@ -140,6 +140,9 @@ const validations = {
|
|
|
140
140
|
process.env.BITCOIN_NETWORK === 'testnet' ? 'testnet' : 'livenet';
|
|
141
141
|
return typeof str === 'string' && addressValidator.validate(str.trim(), 'BTC', network);
|
|
142
142
|
},
|
|
143
|
+
isBech32Address(str) {
|
|
144
|
+
return /^bc1[ac-hj-np-z02-9]{6,86}|^BC1[AC-HJ-NP-Z02-9]{6,86}/.test(str);
|
|
145
|
+
},
|
|
143
146
|
isHDPublicKey(str) {
|
|
144
147
|
try {
|
|
145
148
|
HDPublicKey(str);
|
|
@@ -205,7 +208,7 @@ const validations = {
|
|
|
205
208
|
},
|
|
206
209
|
bitcoinCash: {
|
|
207
210
|
isAddress(str) {
|
|
208
|
-
return /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}
|
|
211
|
+
return /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}|^(bitcoincash:)?[q|p][a-z0-9]{41}|^(BITCOINCASH:)?[Q|P][A-Z0-9]{41}/.test(str);
|
|
209
212
|
},
|
|
210
213
|
isTxHash(str) {
|
|
211
214
|
if (!V.isHexadecimal(`${str}`)) {
|
|
@@ -216,7 +219,7 @@ const validations = {
|
|
|
216
219
|
},
|
|
217
220
|
litecoin: {
|
|
218
221
|
isAddress(str) {
|
|
219
|
-
return /^[3LM][a-km-zA-HJ-NP-Z1-9]{24,33}
|
|
222
|
+
return /^[3LM][a-km-zA-HJ-NP-Z1-9]{24,33}|^ltc1[ac-hj-np-z02-9]{6,86}|^LTC1[AC-HJ-NP-Z02-9]{6,86}/.test(str);
|
|
220
223
|
},
|
|
221
224
|
isTxHash(str) {
|
|
222
225
|
if (!V.isHexadecimal(`${str}`)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ellipticltd/aml-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Utilities, helpers, validations, type-checking, etc",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "10.1.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"type-check": "0.3.2",
|
|
27
27
|
"validator": "10.10.0",
|
|
28
28
|
"wallet-address-validator": "0.2.4",
|
|
29
|
-
"web3-utils": "1.0.0
|
|
29
|
+
"web3-utils": "1.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@ellipticltd/eslint-config": "0.0.3",
|