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", diff --git a/src/lib/index.ts b/src/lib/index.ts index 2a59b4d..cc59cfa 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', + srcTxId: 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; +} + + +