pull/5370/head
Joseph Izang 1 year ago
parent a431ccade0
commit 615bb0237e
  1. 6
      apps/vyper/src/app/utils/compiler.tsx

@ -44,14 +44,12 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
if (extension !== 'vy') { if (extension !== 'vy') {
throw new Error('Use extension .vy for Vyper.') throw new Error('Use extension .vy for Vyper.')
} }
const data = new URLSearchParams()
data.append('files', contract.content)
const files = new FormData(); const files = new FormData();
const content = new Blob([contract.content], { const content = new Blob([contract.content], {
type: 'text/plain' type: 'text/plain'
}); });
files.append("files", content, 'contract.vy') files.append("files", content, `${contract.name}.vy`)
files.append('vyper_version', '0.3.10') files.append('vyper_version', '0.3.10')
console.log({ files, contract, content, url }) console.log({ files, contract, content, url })
let response = await fetch(url + '/compile', { let response = await fetch(url + '/compile', {
@ -59,7 +57,7 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
body: files body: files
}) })
console.log('compile done...')
if (response.status === 404) { if (response.status === 404) {
throw new Error(`Vyper compiler not found at "${url}".`) throw new Error(`Vyper compiler not found at "${url}".`)
} }

Loading…
Cancel
Save