Skip to content

Commit

Permalink
fixing issue in asset schema rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pellicceama committed Oct 31, 2022
1 parent ca5efce commit bc62c4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export * from './tsv';
// .then(console.log)
// .catch(console.error);

// validate('all', '/Users/ap/ama_dev/map3/indexer/tmp/map3xyz-assets/networks/smartchain/assets/smartchain-tokenlist')
// .then(console.log)
// .catch(console.error);
validate('all', '/Users/ap/ama_dev/smartchain-tokenlist/smartchain-tokenlist')
.then(console.log)
.catch(console.error);

// RepoFileGenerator.generate()
// .then(csv => csv.deserialise(DEFAULT_TEMP_DIR))
Expand Down
26 changes: 13 additions & 13 deletions src/model/AssetMap.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { sortObjectKeys } from "../utils";
import { RepoObject } from "./RepoObject";
import { sortObjectKeys } from "../utils";
import { RepoObject } from "./RepoObject";

export class AssetMap extends RepoObject {

from: string;
to: string;
type: MapType;
export class AssetMap extends RepoObject {
from: string;
to: string;
type: MapType;

deserialise(): string {
let parsed = JSON.parse(JSON.stringify(this));
parsed = sortObjectKeys(parsed);
return JSON.stringify(parsed, undefined, 2);
deserialise(): string {
let parsed = JSON.parse(JSON.stringify(this));
parsed = sortObjectKeys(parsed);
return JSON.stringify(parsed, undefined, 2);
}
}
}

export type MapType = 'direct_issuance' | 'bridged' | 'wrapped';
export type MapType = 'direct_issuance' | 'bridged' | 'wrapped';
2 changes: 1 addition & 1 deletion src/validate/rules/network/AssetSchemaRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AssetSchemaRules: ValidationRule[] = [
try {
const split = repoPath.split('/');
const assetDirName = split[split.length - 1];
const isAssetDir = split[split.length - 2].endsWith('-tokenlist') && !split[split.length - 3].endsWith('-tokenlist');
const isAssetDir = split[split.length - 2].endsWith('-tokenlist') && !split[split.length - 1].endsWith('-tokenlist');

if(!isAssetDir) {
return { valid: true, errors: []};
Expand Down

0 comments on commit bc62c4d

Please sign in to comment.