@xrplkit/xls26 2.0.2 → 2.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/package.json +1 -1
- package/readme.md +38 -28
- package/xls26.js +63 -7
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -22,24 +22,28 @@ console.log(xls26Data)
|
|
|
22
22
|
|
|
23
23
|
```toml
|
|
24
24
|
[[ISSUERS]]
|
|
25
|
-
address = "
|
|
26
|
-
name = "
|
|
25
|
+
address = "rHXuEaRYnnJHbDeuBH5w8yPh5uwNVh5zAg"
|
|
26
|
+
name = "Aesthetes"
|
|
27
27
|
|
|
28
|
-
[[
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
name = "CasinoCoin"
|
|
32
|
-
desc = "CasinoCoin (CSC) is a digital currency, developed specifically for the regulated gaming industry."
|
|
33
|
-
icon = "https://static.xrplmeta.org/icons/csc.png"
|
|
34
|
-
|
|
35
|
-
[[TOKENS.WEBLINKS]]
|
|
36
|
-
url = "https://casinocoin.im"
|
|
37
|
-
type = "website"
|
|
28
|
+
[[ISSUERS.WEBLINKS]]
|
|
29
|
+
url = "https://aesthetes.art"
|
|
30
|
+
type = "info"
|
|
38
31
|
title = "Official Website"
|
|
39
32
|
|
|
40
|
-
[[
|
|
41
|
-
url = "https://twitter.com/
|
|
33
|
+
[[ISSUERS.WEBLINKS]]
|
|
34
|
+
url = "https://twitter.com/aesthetes_art"
|
|
42
35
|
type = "socialmedia"
|
|
36
|
+
|
|
37
|
+
[[TOKENS]]
|
|
38
|
+
issuer = "rHXuEaRYnnJHbDeuBH5w8yPh5uwNVh5zAg"
|
|
39
|
+
currency = "ELS"
|
|
40
|
+
name = "Elysian"
|
|
41
|
+
desc = "The first Token for the Art and NFT Industry running on the XRPL."
|
|
42
|
+
icon = "https://static.xrplmeta.org/icons/els.png"
|
|
43
|
+
|
|
44
|
+
[[TOKENS.WEBLINKS]]
|
|
45
|
+
url = "https://twitter.com/Elysianers"
|
|
46
|
+
type = "community"
|
|
43
47
|
```
|
|
44
48
|
|
|
45
49
|
|
|
@@ -49,30 +53,36 @@ type = "socialmedia"
|
|
|
49
53
|
{
|
|
50
54
|
issuers: [
|
|
51
55
|
{
|
|
52
|
-
address: '
|
|
53
|
-
name: '
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
tokens: [
|
|
57
|
-
{
|
|
58
|
-
currency: 'CSC',
|
|
59
|
-
issuer: 'rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr',
|
|
60
|
-
name: 'CasinoCoin',
|
|
61
|
-
desc: 'CasinoCoin (CSC) is a digital currency, developed specifically for the regulated gaming industry.',
|
|
62
|
-
icon: 'https://static.xrplmeta.org/icons/csc.png',
|
|
56
|
+
address: 'rHXuEaRYnnJHbDeuBH5w8yPh5uwNVh5zAg',
|
|
57
|
+
name: 'Aesthetes',
|
|
63
58
|
weblinks: [
|
|
64
59
|
{
|
|
65
|
-
url: 'https://
|
|
66
|
-
type: '
|
|
60
|
+
url: 'https://aesthetes.art',
|
|
61
|
+
type: 'info',
|
|
67
62
|
title: 'Official Website'
|
|
68
63
|
},
|
|
69
64
|
{
|
|
70
|
-
url: 'https://twitter.com/
|
|
65
|
+
url: 'https://twitter.com/aesthetes_art',
|
|
71
66
|
type: 'socialmedia'
|
|
72
67
|
}
|
|
73
68
|
]
|
|
74
69
|
}
|
|
75
70
|
],
|
|
71
|
+
tokens: [
|
|
72
|
+
{
|
|
73
|
+
currency: 'ELS',
|
|
74
|
+
issuer: 'rHXuEaRYnnJHbDeuBH5w8yPh5uwNVh5zAg',
|
|
75
|
+
name: 'Elysian',
|
|
76
|
+
desc: 'The first Token for the Art and NFT Industry running on the XRPL.',
|
|
77
|
+
icon: 'https://static.xrplmeta.org/icons/els.png',
|
|
78
|
+
weblinks: [
|
|
79
|
+
{
|
|
80
|
+
url: 'https://twitter.com/Elysianers',
|
|
81
|
+
type: 'community'
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
],
|
|
76
86
|
issues: []
|
|
77
87
|
}
|
|
78
88
|
|
package/xls26.js
CHANGED
|
@@ -6,13 +6,20 @@
|
|
|
6
6
|
import { parse as parseToml } from '@xrplkit/toml'
|
|
7
7
|
|
|
8
8
|
const validWeblinkTypes = [
|
|
9
|
-
'
|
|
9
|
+
'info',
|
|
10
10
|
'socialmedia',
|
|
11
|
+
'community',
|
|
11
12
|
'support',
|
|
12
|
-
'sourcecode',
|
|
13
13
|
'whitepaper',
|
|
14
|
-
'
|
|
15
|
-
|
|
14
|
+
'certificate'
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const validAdvisoryTypes = [
|
|
18
|
+
'scam',
|
|
19
|
+
'spam',
|
|
20
|
+
'illegal',
|
|
21
|
+
'offensive',
|
|
22
|
+
'hijacked'
|
|
16
23
|
]
|
|
17
24
|
|
|
18
25
|
const issuerFields = [
|
|
@@ -39,6 +46,13 @@ const issuerFields = [
|
|
|
39
46
|
throw 'has to be a non empty string'
|
|
40
47
|
}
|
|
41
48
|
},
|
|
49
|
+
{
|
|
50
|
+
key: 'domain',
|
|
51
|
+
validate: v => {
|
|
52
|
+
if(typeof v !== 'string' || v.length === 0)
|
|
53
|
+
throw 'has to be a non empty string'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
42
56
|
{
|
|
43
57
|
key: 'icon',
|
|
44
58
|
alternativeKeys: ['avatar'],
|
|
@@ -136,6 +150,31 @@ const weblinkFields = [
|
|
|
136
150
|
},
|
|
137
151
|
]
|
|
138
152
|
|
|
153
|
+
const advisoryFields = [
|
|
154
|
+
{
|
|
155
|
+
key: 'address',
|
|
156
|
+
essential: true,
|
|
157
|
+
validate: v => {
|
|
158
|
+
if(!/^[rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz]{25,35}$/.test(v))
|
|
159
|
+
throw 'is not a valid XRPL address'
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: 'type',
|
|
164
|
+
validate: v => {
|
|
165
|
+
if(!validAdvisoryTypes.includes(v))
|
|
166
|
+
throw `has to be one of (${validAdvisoryTypes.join(', ')})`
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
key: 'description',
|
|
171
|
+
alternativeKeys: ['desc'],
|
|
172
|
+
validate: v => {
|
|
173
|
+
if(typeof v !== 'string' || v.length === 0)
|
|
174
|
+
throw 'has to be a non empty string'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
139
178
|
|
|
140
179
|
export function parse(str){
|
|
141
180
|
try{
|
|
@@ -147,6 +186,7 @@ export function parse(str){
|
|
|
147
186
|
let issuers = []
|
|
148
187
|
let tokens = []
|
|
149
188
|
let issues = []
|
|
189
|
+
let advisories = []
|
|
150
190
|
|
|
151
191
|
|
|
152
192
|
if(toml.ISSUERS){
|
|
@@ -217,11 +257,27 @@ export function parse(str){
|
|
|
217
257
|
}
|
|
218
258
|
}
|
|
219
259
|
|
|
260
|
+
if(toml.ADVISORIES){
|
|
261
|
+
for(let stanza of toml.ADVISORIES){
|
|
262
|
+
let { valid, parsed: advisory, issues: advisoryIssues } = parseStanza(stanza, advisoryFields)
|
|
263
|
+
|
|
264
|
+
if(valid)
|
|
265
|
+
advisories.push(advisory)
|
|
266
|
+
|
|
267
|
+
issues.push(
|
|
268
|
+
...advisoryIssues.map(
|
|
269
|
+
issue => `[[ADVISORIES]] ${issue}`
|
|
270
|
+
)
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
220
275
|
|
|
221
276
|
return {
|
|
222
277
|
issuers,
|
|
223
278
|
tokens,
|
|
224
|
-
issues
|
|
279
|
+
issues,
|
|
280
|
+
advisories
|
|
225
281
|
}
|
|
226
282
|
}
|
|
227
283
|
|
|
@@ -246,12 +302,12 @@ function parseStanza(stanza, schemas){
|
|
|
246
302
|
try{
|
|
247
303
|
validate(value)
|
|
248
304
|
}catch(issue){
|
|
249
|
-
issues.push(`${
|
|
305
|
+
issues.push(`${k} field: ${issue}`)
|
|
250
306
|
break
|
|
251
307
|
}
|
|
252
308
|
}
|
|
253
309
|
|
|
254
|
-
parsed[
|
|
310
|
+
parsed[key] = value
|
|
255
311
|
break
|
|
256
312
|
}
|
|
257
313
|
|