From 154799bc7807f0db481bb0cc3cb2fc7bec5a185c Mon Sep 17 00:00:00 2001 From: Lorimer Jenkins <90644448+LorimerJenkins@users.noreply.github.com> Date: Sun, 27 Aug 2023 17:29:06 +0100 Subject: [PATCH 1/3] feat: deployWarpContractFromTx --- src/lib/index.ts | 45 ++++++++++++++++++++++++++++++++++++++++++++- src/types/index.ts | 18 +++++++++++++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/lib/index.ts b/src/lib/index.ts index 2a59b4d..50f9c99 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -49,6 +49,8 @@ import { DecryptDataReturnProps, DeployWarpContractProps, DeployWarpContractReturnProps, + DeployWarpContractFromTxProps, + DeployWarpContractFromTxReturnProps } from "../types/index.js"; @@ -735,6 +737,46 @@ export async function Othent(params: useOthentProps): Promise { + params.tags ??= [] + params.testNet ??= false + let networkType + if (params.testNet === true) { + networkType = 'testNet' + } else { + networkType = 'mainNet' + } + const auth0 = await getAuth0Client(); + const authParams = { transaction_input: JSON.stringify({ + othentFunction: 'deployWarpContractFromTx', + deployWarpContractFromTx: params.srcTxId, + + }) } + const accessToken = await getTokenSilently(auth0, authParams) + const JWT = accessToken.id_token + return await axios({ + method: 'POST', + url: 'https://server.othent.io/deploy-warp-contract-from-tx', + data: { + srcTxId: params.srcTxId, + contractState: params.state, + JWT: JWT, + tags: params.tags, + network: networkType + } + }) + .then(response => { + return response.data; + }) + .catch(error => { + console.log(error.response.data); + throw error; + }); + } + + + @@ -759,7 +801,8 @@ export async function Othent(params: useOthentProps): Promise { diff --git a/src/types/index.ts b/src/types/index.ts index b8e1f00..eecbe70 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -23,6 +23,8 @@ export interface useOthentReturnProps { readCustomContract(params: readCustomContractProps): Promise, verifyArweaveData(params: verifyArweaveDataProps): Promise, verifyBundlrData(params: verifyBundlrDataProps): Promise, + deployWarpContract(params: DeployWarpContractProps): Promise, + deployWarpContractFromTx(params: DeployWarpContractFromTxProps): Promise } @@ -375,7 +377,7 @@ export interface DecryptDataReturnProps { -// Verify bundlr data +// Deploy warp contract export interface DeployWarpContractProps { contractSrc: string, state: object, @@ -389,6 +391,20 @@ export interface DeployWarpContractReturnProps { +// Deploy warp contract from tx +export interface DeployWarpContractFromTxProps { + srcTxId: string, + state: object, + tags?: { name: string, value: string }[], + testNet?: boolean +} +export interface DeployWarpContractFromTxReturnProps { + contractTxId: string; + srcTxId?: string; +} + + + From 90b35c3b189a272ae25a652b0efea39b828f2b65 Mon Sep 17 00:00:00 2001 From: Lorimer Jenkins <90644448+LorimerJenkins@users.noreply.github.com> Date: Sun, 27 Aug 2023 17:29:22 +0100 Subject: [PATCH 2/3] chore: update package number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c654d40..da44783 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "othent", - "version": "1.0.641", + "version": "1.0.642", "description": "Merging Web2 to Web3 user logins with a familiar and simple interface", "main": "dist/index.js", "module": "dist/index.mjs", From ce3508944a3a04f75c1b65a6a25d2855c11b3f57 Mon Sep 17 00:00:00 2001 From: Lorimer Jenkins <90644448+LorimerJenkins@users.noreply.github.com> Date: Sun, 27 Aug 2023 17:31:18 +0100 Subject: [PATCH 3/3] chore: change auth var --- src/lib/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/index.ts b/src/lib/index.ts index 50f9c99..cc59cfa 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -750,7 +750,7 @@ export async function Othent(params: useOthentProps): Promise