Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #31 from Othent/chore--warp-testnet-support-readCu…
Browse files Browse the repository at this point in the history
…stomContract

Chore  warp testnet support read custom contract
  • Loading branch information
LorimerJenkins authored Aug 11, 2023
2 parents 1c34645 + 7df85e0 commit 73bf362
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "othent",
"version": "1.0.64",
"version": "1.0.641",
"description": "Merging Web2 to Web3 user logins with a familiar and simple interface",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
9 changes: 8 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,17 @@ export async function Othent(params: useOthentProps): Promise<useOthentReturnPro

// Read custom contract
async function readCustomContract(params: readCustomContractProps): Promise<readCustomContractReturnProps> {
params.testNet ??= false
let networkType
if (params.testNet === true) {
networkType = 'testNet'
} else {
networkType = 'mainNet'
}
return await axios({
method: 'POST',
url: 'https://server.othent.io/read-custom-contract',
data: { contract_id: params.contract_id }
data: { contract_id: params.contract_id, network: networkType }
})
.then(response => {
return response.data;
Expand Down
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ export interface JWKBackupTxnReturnProps {

// Read custom contract
export interface readCustomContractProps {
contract_id: string
contract_id: string,
testNet?: boolean
}
export interface readCustomContractReturnProps {
state: object,
Expand Down

0 comments on commit 73bf362

Please sign in to comment.