Skip to content

Commit

Permalink
fix: update transaction validation
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 committed Jan 7, 2024
1 parent e98dfe8 commit 4230b13
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
run: |
echo "WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}" > .env
echo "ANKR_TOKEN=${{ secrets.ANKR_TOKEN }}" >> .env
echo "SCREENING_API_URL=${{ secrets.SCREENING_API_URL }}" >> .env
- name: Build
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
echo "WALLET_CONNECT_PROJECT_ID=${{ secrets.WALLET_CONNECT_PROJECT_ID }}" > .env
echo "ANKR_TOKEN=${{ secrets.ANKR_TOKEN }}" >> .env
echo "SCREENING_API_URL=${{ secrets.SCREENING_API_URL }}" >> .env
- name: Build
run: |
Expand Down
17 changes: 11 additions & 6 deletions composables/useScreening.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/* import { $fetch } from "ofetch"; */
import { useMemoize } from "@vueuse/core";
import { $fetch } from "ofetch";

/* Returns void if address screening was successful */
/* Fails if address screening was unsuccessful */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const validateAddress = useMemoize(async (address: string) => {
/* const response = await $fetch(`${env.API_URL}/check-address/${address}`); */
// TODO: remove mock
await new Promise((resolve) => setTimeout(resolve, 1000));
// throw new Error("We were unable to process this transaction...");
const runtimeConfig = useRuntimeConfig();
if (!runtimeConfig.public.screeningApiUrl) {
return;
}
const url = new URL(runtimeConfig.public.screeningApiUrl);
url.searchParams.append("address", address);
const response = await $fetch(url.toString());
if (!response.result) {
throw new Error("We were unable to process this transaction...");
}
});

export default () => {
Expand Down
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default defineNuxtConfig({
turnstileKey: process.env.TURNSTILE_KEY,
nodeType: process.env.NODE_TYPE as undefined | "memory" | "dockerized" | "hyperchain",
ankrToken: process.env.ANKR_TOKEN,
screeningApiUrl: process.env.SCREENING_API_URL,
},
},
pinia: {
Expand Down

0 comments on commit 4230b13

Please sign in to comment.