Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spare ABI urls #47

Merged
merged 3 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading