Skip to content

Commit ebf5e85

Browse files
committed
feat: aded aptos route
1 parent f43e66e commit ebf5e85

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

studio-backend/src/compile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export async function compileAptos(project: Project): Promise<string | string[]>
102102
}
103103
}
104104

105-
export async function compile(project: Project): Promise<string | string[]> {
105+
export async function compileSui(project: Project): Promise<string | string[]> {
106106

107107
// Created temporary project in user directory
108108
const tempProjectPath = `${TEMP_DIR}/${project.package}`;

studio-backend/src/index.ts

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cors from 'cors';
22
import express from 'express';
3-
import { compile, publish } from './compile';
3+
import { compileSui, compileAptos, publish } from './compile';
44
import { getObjectDetails, getPackageDetails } from './object-details';
55

66
const app = express();
@@ -46,14 +46,29 @@ app.get('/projects', (req, res) => {
4646
// res.send(projects);
4747
// });
4848

49-
app.post('/compile', async (req, res) => {
49+
app.post('/compileSui', async (req, res) => {
5050
const project = req.body;
5151

5252
// console.log(project);
53-
console.log('compiling project...')
53+
console.log('compiling Sui project...')
5454

5555
// Call compile function
56-
const compileResult = await compile(project);
56+
const compileResult = await compileSui(project);
57+
58+
// console.log(compileResult)
59+
60+
res.send(compileResult);
61+
62+
});
63+
64+
app.post('/compileAptos', async (req, res) => {
65+
const project = req.body;
66+
67+
// console.log(project);
68+
console.log('compiling Aptos project...')
69+
70+
// Call compile function
71+
const compileResult = await compileAptos(project);
5772

5873
// console.log(compileResult)
5974

studio-backend/src/test/suiCompile.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { compile } from "../compile"
1+
import { compileSui } from "../compile"
22
import { Project } from '../schema/user-schema'
33
import * as fs from 'fs';
44

@@ -24,6 +24,6 @@ test("Tests Sui compile", async () => {
2424
},
2525
],
2626
};
27-
const byteCode = await compile(project);
27+
const byteCode = await compileSui(project);
2828
console.log(byteCode)
2929
})

0 commit comments

Comments
 (0)