-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9442f57
commit 20edd21
Showing
11 changed files
with
95 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const axios = require('axios').default; | ||
|
||
export class RequestFailedError extends Error { } | ||
|
||
export class MetadataAPI { | ||
constructor(baseURL) { | ||
this.api = axios.create({ | ||
baseURL: baseURL, | ||
timeout: 10000, | ||
responseType: 'json' | ||
}); | ||
} | ||
|
||
get(network, address) { | ||
let query = { | ||
"query":`query GetContractMetadata($address: String, $network: String) { | ||
contract_metadata( | ||
where: {contract: {_eq: $address}, network: {_eq: $network}} | ||
) { | ||
network | ||
contract | ||
error | ||
link | ||
metadata | ||
retry_count | ||
status | ||
} | ||
}`, | ||
"variables": { | ||
"address":`${address}`, | ||
"network":`${network}`, | ||
}, | ||
"operationName":"GetContractMetadata" | ||
} | ||
|
||
return this.api.post("v1/graphql", query) | ||
.then((res) => { | ||
if (res.status !== 200) { | ||
throw new RequestFailedError(res); | ||
} | ||
if (res.data.data.contract_metadata.length > 0) { | ||
return res.data.data.contract_metadata[0] | ||
} | ||
return null | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
src/views/contract/MetadataTab/CustomFields/AuthorsField.vue
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/views/contract/MetadataTab/CustomFields/ErrorsField.vue
This file was deleted.
Oops, something went wrong.
96 changes: 0 additions & 96 deletions
96
src/views/contract/MetadataTab/CustomFields/FieldsWrapper.vue
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/views/contract/MetadataTab/CustomFields/LicenseField.vue
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
src/views/contract/MetadataTab/CustomFields/SourcesField.vue
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.