Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Jan 15, 2025
1 parent 203a1f2 commit 6737a03
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion src/utilities/aptosAssistant.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { RequestData } from '../webview/panel/src/utilities/commends';
import { RequestData } from '../webview/panel/src/utilities/commands';

const getContent = (str: string) => {
const { choices } = JSON.parse(str);
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/authCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ClientSecret,
UrlAuthCode,
UrlCallback,
} from '../webview/activitybar/src/utilities/commends';
} from '../webview/activitybar/src/utilities/commands';

const exchangeAuthCodeForJwt = async (
authCode: string,
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/fileWatcher.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { COMMENDS } from '../webview/activitybar/src/utilities/commends';
import { COMMANDS } from '../webview/activitybar/src/utilities/commands';
import { ByteDump } from '../webview/activitybar/src/utilities/cli';

const MoveToml = 'Move.toml';
Expand Down Expand Up @@ -125,7 +125,7 @@ export class FileWathcer {

private updateWebview() {
this._view.webview.postMessage({
command: COMMENDS.PackageList,
command: COMMANDS.PackageList,
data: this._packages.map(({ path, content }) => {
return {
path,
Expand Down
8 changes: 4 additions & 4 deletions src/webview/activitybar/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { vscode } from './utilities/vscode';
import { Account } from './components/Account';
import { ExplorerPackage } from './components/ExplorerPackage';
import { Workspace } from './components/Workspace';
import { COMMENDS } from './utilities/commends';
import { COMMANDS } from './utilities/commands';
import { IAccount, STATE } from './recoil';

function App() {
Expand All @@ -20,7 +20,7 @@ function App() {
useEffect(() => {
const handleMessage = async (
event: MessageEvent<{
command: COMMENDS;
command: COMMANDS;
data: {
hasTerminal: boolean;
account?: IAccount;
Expand All @@ -29,7 +29,7 @@ function App() {
) => {
const message = event.data;
switch (message.command) {
case COMMENDS.Env:
case COMMANDS.Env:
{
const { hasTerminal: terminal, account: loaddedAccount } =
message.data;
Expand All @@ -49,7 +49,7 @@ function App() {

if (!initialized.current) {
initialized.current = true;
vscode.postMessage({ command: COMMENDS.Env });
vscode.postMessage({ command: COMMANDS.Env });
}

return () => {
Expand Down
14 changes: 7 additions & 7 deletions src/webview/activitybar/src/components/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useRecoilState } from 'recoil';
import { createNonce } from '../utilities/createNonce';
import { googleLogin } from '../utilities/googleLogin';
import { vscode } from '../utilities/vscode';
import { COMMENDS } from '../utilities/commends';
import { COMMANDS } from '../utilities/commands';
import { getBalance } from '../utilities/getBalance';
import { createProof } from '../utilities/createProof';
import { faucet } from '../utilities/faucet';
Expand Down Expand Up @@ -51,7 +51,7 @@ export const Account = ({ client }: { client: Aptos | undefined }) => {

const handleLogout = async () => {
vscode.postMessage({
command: COMMENDS.StoreAccount,
command: COMMANDS.StoreAccount,
data: undefined,
});
setState(() => ({ packages: {} }));
Expand All @@ -69,7 +69,7 @@ export const Account = ({ client }: { client: Aptos | undefined }) => {
}
} catch (error) {
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: `${error}`,
});
} finally {
Expand All @@ -87,13 +87,13 @@ export const Account = ({ client }: { client: Aptos | undefined }) => {

const handleMessage = async (
event: MessageEvent<{
command: COMMENDS;
command: COMMANDS;
data: string;
}>,
) => {
const message = event.data;
switch (message.command) {
case COMMENDS.LoginJwt:
case COMMANDS.LoginJwt:
if (state.account && message.data && !!client) {
try {
const { address, proof, salt } = await createProof(
Expand All @@ -114,7 +114,7 @@ export const Account = ({ client }: { client: Aptos | undefined }) => {
},
}));
vscode.postMessage({
command: COMMENDS.StoreAccount,
command: COMMANDS.StoreAccount,
data: {
...state.account,
zkAddress: {
Expand All @@ -127,7 +127,7 @@ export const Account = ({ client }: { client: Aptos | undefined }) => {
});
} catch (error) {
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: `${error}`,
});
} finally {
Expand Down
18 changes: 9 additions & 9 deletions src/webview/activitybar/src/components/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@vscode/webview-ui-toolkit/react';
import { Aptos } from '@aptos-labs/ts-sdk';
import { vscode } from '../utilities/vscode';
import { COMMENDS } from '../utilities/commends';
import { COMMANDS } from '../utilities/commands';
import { SpinButton } from './SpinButton';
import { STATE } from '../recoil';
import { packagePublish } from '../utilities/packagePublish';
Expand Down Expand Up @@ -41,7 +41,7 @@ export const Workspace = ({
const handleMessage = async (event: any) => {
const message = event.data;
switch (message.command) {
case COMMENDS.PackageList:
case COMMANDS.PackageList:
{
const temp = (
message.data as { path: string; content: string }[]
Expand Down Expand Up @@ -69,7 +69,7 @@ export const Workspace = ({
}
}
break;
case COMMENDS.Deploy:
case COMMANDS.Deploy:
try {
if (!!state.account?.zkAddress && !!client) {
const { packageId } = await packagePublish(
Expand Down Expand Up @@ -133,7 +133,7 @@ export const Workspace = ({
if (path) {
setState((oldState) => ({ ...oldState, ...packageSelect(path) }));
vscode.postMessage({
command: COMMENDS.PackageSelect,
command: COMMANDS.PackageSelect,
data: path,
});
}
Expand Down Expand Up @@ -192,7 +192,7 @@ export const Workspace = ({
onClick={() => {
state.path &&
vscode.postMessage({
command: COMMENDS.CLI,
command: COMMANDS.CLI,
data: runBuild(state.path, !!(state as any).move2),
});
}}
Expand All @@ -213,7 +213,7 @@ export const Workspace = ({
onClick={() => {
state.path &&
vscode.postMessage({
command: COMMENDS.CLI,
command: COMMANDS.CLI,
data: runProve(state.path, !!(state as any).move2),
});
}}
Expand Down Expand Up @@ -243,7 +243,7 @@ export const Workspace = ({
onClick={() => {
state.path &&
vscode.postMessage({
command: COMMENDS.CLI,
command: COMMANDS.CLI,
data: runTest(state.path, !!(state as any).move2),
});
}}
Expand All @@ -264,7 +264,7 @@ export const Workspace = ({
onClick={() => {
state.path &&
vscode.postMessage({
command: COMMENDS.CLI,
command: COMMANDS.CLI,
data: runFormatter(state.path),
});
}}
Expand All @@ -290,7 +290,7 @@ export const Workspace = ({
if (selected) {
setIsLoading(true);
vscode.postMessage({
command: COMMENDS.Deploy,
command: COMMANDS.Deploy,
data: selected.path,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum COMMENDS {
export enum COMMANDS {
Env = 'env',
Login = 'google:login',
LoginJwt = 'google:jwt',
Expand Down
4 changes: 2 additions & 2 deletions src/webview/activitybar/src/utilities/googleLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SHA256 from 'crypto-js/sha256';
import Base64 from 'crypto-js/enc-base64';
import * as querystring from 'querystring';
import { vscode } from './vscode';
import { ClientId, COMMENDS, UrlCallback } from './commends';
import { ClientId, COMMANDS, UrlCallback } from './commands';

const generateLoginUrl = (
state: string,
Expand Down Expand Up @@ -33,7 +33,7 @@ export const googleLogin = async (nonce: string) => {
.replace(/=+$/, '');

vscode.postMessage({
command: COMMENDS.Login,
command: COMMANDS.Login,
data: {
url: generateLoginUrl(state, codeChallenge, nonce),
state,
Expand Down
6 changes: 3 additions & 3 deletions src/webview/activitybar/src/utilities/loadPackageData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Aptos, MoveModuleBytecode } from '@aptos-labs/ts-sdk';
import { vscode } from './vscode';
import { COMMENDS } from './commends';
import { COMMANDS } from './commands';

export const loadPackageData = async (
client: Aptos | undefined,
Expand All @@ -18,14 +18,14 @@ export const loadPackageData = async (
return modules;
} catch (error) {
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: `${error}`,
});
return undefined;
}
}
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: 'client is undefined',
});
return undefined;
Expand Down
6 changes: 3 additions & 3 deletions src/webview/activitybar/src/utilities/moveView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SimpleEntryFunctionArgumentTypes,
} from '@aptos-labs/ts-sdk';
import { vscode } from './vscode';
import { COMMENDS } from './commends';
import { COMMANDS } from './commands';

export const moveView = async (
client: Aptos,
Expand All @@ -23,13 +23,13 @@ export const moveView = async (
};
const res = await client.view({ payload });
vscode.postMessage({
command: COMMENDS.OutputInfo,
command: COMMANDS.OutputInfo,
data: JSON.stringify(res, null, 4),
});
return res;
} catch (error) {
vscode.postMessage({
command: COMMENDS.OutputError,
command: COMMANDS.OutputError,
data: JSON.stringify(error, null, 4),
});
throw new Error(`${error}`);
Expand Down
12 changes: 6 additions & 6 deletions src/webview/activitybar/src/utilities/signAndExcute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@aptos-labs/ts-sdk';
import { IAccount } from '../recoil';
import { vscode } from './vscode';
import { COMMENDS } from './commends';
import { COMMANDS } from './commands';

export const signAndExcute = async (
account: IAccount,
Expand All @@ -32,27 +32,27 @@ export const signAndExcute = async (
const res = await client.waitForTransaction({ transactionHash: hash });
if (!res.success) {
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: `error: ${res.hash}`,
});
vscode.postMessage({
command: COMMENDS.OutputError,
command: COMMANDS.OutputError,
data: JSON.stringify(res, null, 4),
});
throw new Error(`error: ${res.hash}`);
}
vscode.postMessage({
command: COMMENDS.MsgInfo,
command: COMMANDS.MsgInfo,
data: `success: ${account.nonce.network}:${res.hash}`,
});
vscode.postMessage({
command: COMMENDS.OutputInfo,
command: COMMANDS.OutputInfo,
data: JSON.stringify(res, null, 4),
});
return res;
} catch (error) {
vscode.postMessage({
command: COMMENDS.MsgError,
command: COMMANDS.MsgError,
data: `${error}`,
});
throw new Error(`${error}`);
Expand Down
Loading

0 comments on commit 6737a03

Please sign in to comment.