Skip to content

Commit d112b00

Browse files
committed
fix compiler url
1 parent fe958dd commit d112b00

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

apps/vyper/src/app/utils/compiler.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
8282
[contractName] : { content : contract.content }
8383
}
8484
}
85-
console.log('compilePackage', `${url}compile`)
86-
let response = await axios.post(`${url}compile`, compilePackage )
85+
let response
86+
if (url.endsWith('/')) {
87+
response = await axios.post(`${url}compile`, compilePackage )
88+
} else {
89+
response = await axios.post(`${url}/compile`, compilePackage )
90+
}
8791

8892
if (response.status === 404) {
8993
throw new Error(`Vyper compiler not found at "${url}".`)
@@ -97,17 +101,17 @@ console.log('compilePackage', `${url}compile`)
97101
response = null
98102
let result: any
99103

100-
const status = await (await axios.get(url + 'status/' + compileCode , {
104+
const status = await (await axios.get(url + '/status/' + compileCode , {
101105
method: 'Get'
102106
})).data
103107
if (status === 'SUCCESS') {
104-
result = await(await axios.get(url + 'artifacts/' + compileCode , {
108+
result = await(await axios.get(url + '/artifacts/' + compileCode , {
105109
method: 'Get'
106110
})).data
107111

108112
return result
109113
} else if (status === 'FAILED') {
110-
const intermediate = await(await axios.get(url + 'exceptions/' + compileCode , {
114+
const intermediate = await(await axios.get(url + '/exceptions/' + compileCode , {
111115
method: 'Get'
112116
})).data
113117
return intermediate
@@ -189,7 +193,7 @@ export async function compileContract(contract: string, compilerUrl: string, set
189193
title: 'Compiling'
190194
})
191195
// try {
192-
let output = await compile(compilerUrl, _contract)
196+
const output = await compile(compilerUrl, _contract)
193197
if (output && output[0] && output[0].status === 'failed') {
194198
remixClient.changeStatus({
195199
key: 'failed',

0 commit comments

Comments
 (0)