Skip to content

Commit

Permalink
Merge pull request #47 from skalenetwork/cors
Browse files Browse the repository at this point in the history
Add spare ABI urls
  • Loading branch information
DimaStebaev authored Feb 20, 2024
2 parents bd56733 + b08a775 commit d866207
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- stable
- beta
- develop
push:
tags:
- 'custom-release-*'

env:
NODE_VERSION: 18
PYTHON_VERSION: 3.11
Expand Down
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"**/node_modules/**",
"**/__pycache__/**",
"**/requirements.txt",
"**/*.egg-info/**"
"**/*.egg-info/**",
"**/lib/**"
],
"dictionaries": ["domain-terms", "libraries", "names", "skale-terms", "solidity"],
"dictionaryDefinitions": [
Expand Down
50 changes: 35 additions & 15 deletions typescript/base/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
/* eslint-env node */
module.exports = {
extends: [
'eslint:all',
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
"extends": [
"eslint:all",
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
rules: {
"object-curly-spacing": [ "error", "always" ],
"padded-blocks": [ "error", "never" ],
"one-var": ["error", "never"]
},
ignorePatterns: [
"ignorePatterns": [
"lib/**",
"debug.ts"
]
};
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
"capitalized-comments": [
"error",
"always",
{
"ignoreConsecutiveComments": true
}
],
"multiline-comment-style": [
"error",
"separate-lines"
],
"object-curly-spacing": [
"error",
"always"
],
"one-var": [
"error",
"never"
],
"padded-blocks": [
"error",
"never"
]
}
};
27 changes: 22 additions & 5 deletions typescript/base/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,30 @@ export abstract class Project<ContractType> {
}

async downloadAbiFile (version: string) {
const response = await axios.get(this.getAbiUrl(version));
return response.data as SkaleABIFile;
const exceptions = [];
for (const abiUrl of this.getAbiUrls(version)) {
try {
// Await expression should be executed only
// when it failed on the previous iteration
// eslint-disable-next-line no-await-in-loop
const response = await axios.get(abiUrl);
return response.data as SkaleABIFile;
} catch (exception) {
exceptions.push(exception);
}
}
throw new Error(exceptions.toString());
}

getAbiUrl (version: string) {
return `${this.githubRepo}releases/download/` +
`${version}/${this.getAbiFilename(version)}`;
getAbiUrls (version: string) {
return [
`${this.githubRepo}releases/download/` +
`${version}/${this.getAbiFilename(version)}`,
`${this.githubRepo.replace(
"github.com",
"raw.githubusercontent.com"
)}abi/${this.getAbiFilename(version)}`
];
}

abstract getAbiFilename(version: string): string;
Expand Down

0 comments on commit d866207

Please sign in to comment.