diff --git a/package.json b/package.json index d3879bd..22fa946 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "animate.css": "^4.1.1", "apexcharts": "^3.37.1", "axios": "^1.2.1", + "crypto-js": "^4.1.1", "daisyui": "^3.2.1", "dayjs": "^1.11.6", "ethers": "^6.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a5d0a0..dd7d225 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,9 @@ dependencies: axios: specifier: ^1.2.1 version: 1.2.1 + crypto-js: + specifier: ^4.1.1 + version: 4.1.1 daisyui: specifier: ^3.2.1 version: 3.2.1 @@ -2282,6 +2285,10 @@ packages: which: 2.0.2 dev: true + /crypto-js@4.1.1: + resolution: {integrity: sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==} + dev: false + /css-declaration-sorter@6.3.1(postcss@8.4.20): resolution: {integrity: sha512-fBffmak0bPAnyqc/HO8C3n2sHrp9wcqQz6ES9koRF2/mLOVAx9zIQ3Y7R29sYCteTPqMCwns4WYQoCX91Xl3+w==} engines: {node: ^10 || ^12 || >=14} diff --git a/src/components/Modal/new-deployment.vue b/src/components/Modal/new-deployment.vue index d7aca0a..d9764e5 100644 --- a/src/components/Modal/new-deployment.vue +++ b/src/components/Modal/new-deployment.vue @@ -3,7 +3,7 @@ import { getContainerContract } from "@/utils/contract/container"; import { reactive, onBeforeUnmount } from "vue"; import type { EventLog } from "ethers"; import eventBus from "@/utils/event-bus"; -import { getCurrentSiteName } from "@/utils/shared"; +import { getCurrentSiteName, md5 } from "@/utils/shared"; import { useLang } from "@/hooks/useLang"; const { t } = useLang(); import { useAccountStore } from "@/store/modules/account"; @@ -38,7 +38,10 @@ const listenIfNeeded = () => { contract.on("*", (event: EventLog) => { const name = event.fragment.name; - if (name !== "requestContainerDeployFulfilled") return; + // console.log("event listened", name); + // console.log("event", event); + + if (name !== "RequestContainerDeployFulfilled") return; data.resReady = true; eventBus.emit("deploymentSuccess", true); @@ -61,7 +64,7 @@ const handleSubmit = async () => { `https://stc-test.${getCurrentSiteName( "gw" )}.oneitfarm.com/brige/providers/deployment`, - accountStore.publicKey + md5(accountStore.publicKey) ); await transaction.wait(); diff --git a/src/components/Modal/new-pod.vue b/src/components/Modal/new-pod.vue index 4371040..1ec4b76 100644 --- a/src/components/Modal/new-pod.vue +++ b/src/components/Modal/new-pod.vue @@ -3,14 +3,10 @@ import { getPodContract, PARAM } from "@/utils/contract/pod"; import { reactive, onBeforeUnmount } from "vue"; import type { EventLog } from "ethers"; import eventBus from "@/utils/event-bus"; -import { getCurrentSiteName } from "@/utils/shared"; +import { getCurrentSiteName, md5 } from "@/utils/shared"; import { useAccountStore } from "@/store/modules/account"; const accountStore = useAccountStore(); -defineOptions({ - name: "pod-modal" -}); - const data = reactive({ res: "", loading: false, @@ -56,7 +52,7 @@ const handleSubmit = async () => { `https://stc-test.${getCurrentSiteName( "gw" )}.oneitfarm.com/brige/providers/pod`, - accountStore.publicKey + md5(accountStore.publicKey) ); await transaction.wait(); diff --git a/src/utils/shared.ts b/src/utils/shared.ts index 4629812..163f440 100644 --- a/src/utils/shared.ts +++ b/src/utils/shared.ts @@ -5,6 +5,7 @@ import { useModalStore } from "@/store/modules/modal"; import moment from "moment"; import { getConfig } from "@/config"; import type { EthersError } from "ethers"; +import CryptoJS from "crypto-js"; export function formatTime(timeStr, formatStr = "YYYY/MM/DD HH:mm:ss") { if (!timeStr) { @@ -148,3 +149,7 @@ export function handleEtherError(error: EthersError) { window.alert(error.info?.error?.message || msg(error.code)); } + +export function md5(str: string) { + return CryptoJS.MD5(str).toString(); +}