Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions studio-backend/src/compile-and-publish.ts

This file was deleted.

45 changes: 2 additions & 43 deletions studio-backend/src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function compile(project: Project): Promise<string | string[]> {
version = "0.0.1"

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework", rev = "devnet" }
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "testnet" }

[addresses]
${addresses}
Expand Down Expand Up @@ -135,7 +135,7 @@ export async function test(project: Project): Promise<TestReturn> {
version = "0.0.1"

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework", rev = "devnet" }
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "testnet" }

[addresses]
${addresses}
Expand Down Expand Up @@ -232,46 +232,5 @@ export async function test(project: Project): Promise<TestReturn> {
}
}

export async function publish (compiledModules: string[]) {
dotenv.config();
if (process.env.RECOVERY_PHRASE === undefined) {
throw new Error('RECOVERY_PHRASE is not defined');
}
// connect to local RPC server
const provider = new JsonRpcProvider();
const keyPair = Ed25519Keypair.deriveKeypair(process.env.RECOVERY_PHRASE)
const signer = new RawSigner(keyPair, provider);
// await provider.requestSuiFromFaucet(
// await signer.getAddress()
// );
console.log(`Signer address: ${await signer.getAddress()}`);

// publish the compiled modules

try {
// const publishTxn = await signer.publish({
// compiledModules: compiledModules,
// gasBudget: 10000,
// });
// console.log(publishTxn)

const publishTxn = await signer.signAndExecuteTransaction({
kind: 'publish',
data: {
compiledModules: compiledModules,
gasBudget: 10000
},
});

console.log(publishTxn);

return publishTxn;
} catch (error: any) {
console.log(error);
}


}



15 changes: 1 addition & 14 deletions studio-backend/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cors from 'cors';
import express from 'express';
import { compile, publish, test } from './compile';
import { compile, test } from './compile';
import { getObjectDetails, getPackageDetails } from './object-details';

const app = express();
Expand Down Expand Up @@ -76,19 +76,6 @@ app.post('/test', async (req, res) => {

});

app.post('/publish', async (req, res) => {
const compiledModules = req.body.compiledModules;

// console.log(compiledModules);
console.log('publishing modules...')

// Call compile function
const compileResult = await publish(compiledModules);

res.send(compileResult);

});

app.post('/object-details', async (req, res) => {
const objectId = req.body.objectId as string;
const rpc = req.body.rpc as string;
Expand Down
22 changes: 11 additions & 11 deletions studio-backend/src/object-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { JsonRpcProvider } from "@mysten/sui.js";


export async function getObjectDetails(objectId: string, rpc?: string) {
const provider = new JsonRpcProvider(rpc);
const objectDetails = await provider.getObject(objectId);
// const provider = new JsonRpcProvider(rpc);
// const objectDetails = await provider.getObject(objectId);

return objectDetails;
// return objectDetails;
}

export async function getPackageDetails(packageId: string, rpc?: string) {
console.log('1')
const provider = new JsonRpcProvider(rpc);
// console.log('provider', provider)
console.log('2')
const packageDetails = await provider.getNormalizedMoveModulesByPackage(packageId);
console.log('packageDetails', packageDetails)
console.log('3')
return packageDetails;
// console.log('1')
// const provider = new JsonRpcProvider(rpc);
// // console.log('provider', provider)
// console.log('2')
// const packageDetails = await provider.getNormalizedMoveModulesByPackage(packageId);
// console.log('packageDetails', packageDetails)
// console.log('3')
// return packageDetails;
}
7 changes: 2 additions & 5 deletions studio-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
"private": true,
"dependencies": {
"@monaco-editor/react": "^4.4.6",
"@mysten/sui.js": "^0.18.0",
"@mysten/wallet-adapter-react": "^11.0.0",
"@mysten/wallet-kit": "^0.1.2",
"@suiet/wallet-adapter": "^0.0.18",
"@suiet/wallet-kit": "^0.1.10",
"@mysten/sui.js": "^0.32.2",
"@suiet/wallet-kit": "^0.2.7",
"@types/node": "^16.7.13",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.0",
Expand Down
23 changes: 0 additions & 23 deletions studio-frontend/src/components/BuildInnerSidebar.css

This file was deleted.

8 changes: 4 additions & 4 deletions studio-frontend/src/components/DeployInnerSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { decimalify } from "../utils/decimal";
import { network } from "../utils/network";

const disabledWallets = [
"Martian Sui Wallet",
]
// "Martian Sui Wallet",
] as string[]

function DeployInnerSidebar(
props: {
Expand Down Expand Up @@ -190,7 +190,7 @@ function DeployInnerSidebar(
<div>
<h2 className='font-semibold'>Gas balance:</h2>
<p className="text-center text-neutral-content font-mono text-opacity-90">
{loading ? "Loading balance..." : `${decimalify(balance, 9)} Sui`}
{/* {loading ? "Loading balance..." : `${decimalify(balance, 9)} Sui`}
{!loading &&
<label
tabIndex={0}
Expand All @@ -202,7 +202,7 @@ function DeployInnerSidebar(
>
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>
</label>
}
} */}
</p>
</div>
<div>
Expand Down
70 changes: 35 additions & 35 deletions studio-frontend/src/components/PackageFunction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,41 +248,41 @@ function PackageFunction(

let moveCallTxn;

try {
moveCallTxn = await wallet.signAndExecuteTransaction({
transaction: {
kind: 'moveCall',
data: {
packageObjectId: props.packageAddress,
module: props.moduleName,
function: functionName,
typeArguments: functionTypeArguments,
arguments: functionArguments,
gasBudget: 300000
}
}
});
} catch (e) {
console.log('error', e)
console.log('error.message', (e as any).message.includes('wallet not connected'))
if ((e as any).message.includes('wallet not connected')) {
console.log('here')
props.setFailTxn("Wallet not connected");
} else {
props.setFailTxn("");
}
return;
}

console.log('move call txn', moveCallTxn);

if (moveCallTxn.effects.status?.status == 'success' || (moveCallTxn.effects as any).effects.status.status == 'success') {
props.setSuccessTxn(moveCallTxn.certificate.transactionDigest);
} else {
props.setFailTxn(moveCallTxn.certificate.transactionDigest);
}

props.refreshHandler();
// try {
// moveCallTxn = await wallet.signAndExecuteTransaction({
// transaction: {
// kind: 'moveCall',
// data: {
// packageObjectId: props.packageAddress,
// module: props.moduleName,
// function: functionName,
// typeArguments: functionTypeArguments,
// arguments: functionArguments,
// gasBudget: 300000
// }
// }
// });
// } catch (e) {
// console.log('error', e)
// console.log('error.message', (e as any).message.includes('wallet not connected'))
// if ((e as any).message.includes('wallet not connected')) {
// console.log('here')
// props.setFailTxn("Wallet not connected");
// } else {
// props.setFailTxn("");
// }
// return;
// }

// console.log('move call txn', moveCallTxn);

// if (moveCallTxn.effects.status?.status == 'success' || (moveCallTxn.effects as any).effects.status.status == 'success') {
// props.setSuccessTxn(moveCallTxn.certificate.transactionDigest);
// } else {
// props.setFailTxn(moveCallTxn.certificate.transactionDigest);
// }

// props.refreshHandler();
}


Expand Down
1 change: 0 additions & 1 deletion studio-frontend/src/components/PackageStruct.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useState } from 'react';
import { ConnectButton, useWallet, WalletKitProvider } from "@mysten/wallet-kit";
import { extractMutableReference } from '@mysten/sui.js';
import { shortenAddress } from '../utils/address-shortener';

Expand Down
1 change: 0 additions & 1 deletion studio-frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import reportWebVitals from './reportWebVitals';

import { BrowserRouter, Routes, Route } from "react-router-dom";

import { WalletKitProvider } from "@mysten/wallet-kit";

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
Expand Down
Loading