From 0e4b3c4f284a1a2493505f8ead073a9dda329de6 Mon Sep 17 00:00:00 2001 From: Zainab Elgohary <40770501+zaelgohary@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:57:41 +0300 Subject: [PATCH] Fix content in script editor (#1212) --- packages/UI/examples/html-tag-example/index.html | 9 ++++++--- packages/UI/src/utils/threefoldSignerProvider.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/UI/examples/html-tag-example/index.html b/packages/UI/examples/html-tag-example/index.html index 14dd4f6c1e..177f6bc209 100644 --- a/packages/UI/examples/html-tag-example/index.html +++ b/packages/UI/examples/html-tag-example/index.html @@ -7,17 +7,20 @@ Threefold UI - + - + + - + \ No newline at end of file diff --git a/packages/UI/src/utils/threefoldSignerProvider.ts b/packages/UI/src/utils/threefoldSignerProvider.ts index 002590f901..8991341402 100644 --- a/packages/UI/src/utils/threefoldSignerProvider.ts +++ b/packages/UI/src/utils/threefoldSignerProvider.ts @@ -1,10 +1,15 @@ import axios from "axios"; -import { sign, type SignReturn } from "./sign"; +import { KeypairType, sign, type SignReturn } from "./sign"; import { type AcceptConfig, type ErrorType, type RequestData, type SignProps, ThreefoldProvider } from "./types"; export default class ThreefoldSigner extends ThreefoldProvider { private MNEMONIC = import.meta.env.VITE_MNEMONIC; + private CONFIG: AcceptConfig = { + scriptContent: "", + pdfData: "", + keypairType: KeypairType.sr25519, + }; async use(props: SignProps): Promise { console.warn("Using the normal provider, Please make sure that you provide the mnemonic in the .env file."); @@ -29,6 +34,8 @@ export default class ThreefoldSigner extends ThreefoldProvider { let data: SignReturn; try { + this.CONFIG = config; + if (config.pdfData) { data = await sign(config.pdfData, this.MNEMONIC, config.keypairType); return await this.__request(data); @@ -45,6 +52,7 @@ export default class ThreefoldSigner extends ThreefoldProvider { // eslint-disable-next-line @typescript-eslint/no-unused-vars private async __request(data: SignReturn, account?: boolean): Promise { const requestBody: RequestData = { + content: this.CONFIG.scriptContent, pdfUrl: this.props.pdfurl, pubkey: data.publicKey, signature: data.signature,