@xrplkit/xls26 2.1.0 → 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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/readme.md +38 -28
  3. package/xls26.js +56 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xrplkit/xls26",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "main": "xls26.js",
6
6
  "dependencies": {
7
7
  "@xrplkit/toml": "1.0.0"
package/readme.md CHANGED
@@ -22,24 +22,28 @@ console.log(xls26Data)
22
22
 
23
23
  ```toml
24
24
  [[ISSUERS]]
25
- address = "rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr"
26
- name = "CasinoCoin"
25
+ address = "rHXuEaRYnnJHbDeuBH5w8yPh5uwNVh5zAg"
26
+ name = "Aesthetes"
27
27
 
28
- [[TOKENS]]
29
- issuer = "rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr"
30
- currency = "CSC"
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
- [[TOKENS.WEBLINKS]]
41
- url = "https://twitter.com/CasinoCoin"
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: 'rCSCManTZ8ME9EoLrSHHYKW8PPwWMgkwr',
53
- name: 'CasinoCoin'
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://casinocoin.im',
66
- type: 'website',
60
+ url: 'https://aesthetes.art',
61
+ type: 'info',
67
62
  title: 'Official Website'
68
63
  },
69
64
  {
70
- url: 'https://twitter.com/CasinoCoin',
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
- 'website',
9
+ 'info',
10
10
  'socialmedia',
11
+ 'community',
11
12
  'support',
12
- 'sourcecode',
13
13
  'whitepaper',
14
- 'audit',
15
- 'report'
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 = [
@@ -143,6 +150,31 @@ const weblinkFields = [
143
150
  },
144
151
  ]
145
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
+ ]
146
178
 
147
179
  export function parse(str){
148
180
  try{
@@ -154,6 +186,7 @@ export function parse(str){
154
186
  let issuers = []
155
187
  let tokens = []
156
188
  let issues = []
189
+ let advisories = []
157
190
 
158
191
 
159
192
  if(toml.ISSUERS){
@@ -224,11 +257,27 @@ export function parse(str){
224
257
  }
225
258
  }
226
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
+
227
275
 
228
276
  return {
229
277
  issuers,
230
278
  tokens,
231
- issues
279
+ issues,
280
+ advisories
232
281
  }
233
282
  }
234
283
 
@@ -253,12 +302,12 @@ function parseStanza(stanza, schemas){
253
302
  try{
254
303
  validate(value)
255
304
  }catch(issue){
256
- issues.push(`${key} field: ${issue}`)
305
+ issues.push(`${k} field: ${issue}`)
257
306
  break
258
307
  }
259
308
  }
260
309
 
261
- parsed[k] = value
310
+ parsed[key] = value
262
311
  break
263
312
  }
264
313