@xrplkit/xls26 2.5.0 → 2.6.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/xls26.js +24 -2
package/package.json
CHANGED
package/xls26.js
CHANGED
|
@@ -104,7 +104,7 @@ const issuerFields = [
|
|
|
104
104
|
}
|
|
105
105
|
]
|
|
106
106
|
|
|
107
|
-
const
|
|
107
|
+
const iouTokenFields = [
|
|
108
108
|
{
|
|
109
109
|
key: 'currency',
|
|
110
110
|
alternativeKeys: ['code'],
|
|
@@ -171,6 +171,28 @@ const tokenFields = [
|
|
|
171
171
|
}
|
|
172
172
|
]
|
|
173
173
|
|
|
174
|
+
const mpTokenFields = [
|
|
175
|
+
{
|
|
176
|
+
key: 'mpt_issuance_id',
|
|
177
|
+
required: true,
|
|
178
|
+
validate: v => {
|
|
179
|
+
if(!/^[0-9a-fA-F]{48}$/.test(v))
|
|
180
|
+
throw 'is not a valid mpt_issuance_id'
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: 'trust_level',
|
|
185
|
+
required: true,
|
|
186
|
+
validate: v => {
|
|
187
|
+
if(v !== parseInt(v))
|
|
188
|
+
throw 'must be a integer'
|
|
189
|
+
|
|
190
|
+
if(v < 0 || v > 3)
|
|
191
|
+
throw 'must be between 0 and 3'
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
|
|
174
196
|
const urlFields = [
|
|
175
197
|
{
|
|
176
198
|
key: 'url',
|
|
@@ -271,7 +293,7 @@ export function parse(str){
|
|
|
271
293
|
}
|
|
272
294
|
|
|
273
295
|
for(let stanza of (toml.TOKENS || toml.CURRENCIES || [])){
|
|
274
|
-
let { valid, parsed: token, issues: tokenIssues } = parseStanza(stanza,
|
|
296
|
+
let { valid, parsed: token, issues: tokenIssues } = parseStanza(stanza, stanza['mpt_issuance_id'] != null ? mpTokenFields : iouTokenFields)
|
|
275
297
|
|
|
276
298
|
issues.push(
|
|
277
299
|
...tokenIssues.map(
|