fixes to compile function

pull/5370/head
Joseph Izang 1 year ago
parent 4bd2c4c858
commit a431ccade0
  1. 7
      apps/vyper/src/app/utils/compiler.tsx

@ -36,6 +36,7 @@ export function isCompilationError(output: VyperCompilationOutput): output is Vy
* @param contract The name and content of the contract
*/
export async function compile(url: string, contract: Contract): Promise<VyperCompilationOutput> {
console.log('vyper reloaded!')
if (!contract.name) {
throw new Error('Set your Vyper contract file.')
}
@ -43,12 +44,16 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
if (extension !== 'vy') {
throw new Error('Use extension .vy for Vyper.')
}
const data = new URLSearchParams()
data.append('files', contract.content)
const files = new FormData();
const content = new Blob([contract.content], {
type: 'text/plain'
});
files.append("file", content, 'contract.vy');
files.append("files", content, 'contract.vy')
files.append('vyper_version', '0.3.10')
console.log({ files, contract, content, url })
let response = await fetch(url + '/compile', {
method: 'POST',
headers: {'Content-Type': 'application/json'},

Loading…
Cancel
Save