Skip to content

Commit

Permalink
feat: test mint
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansonhkg committed Jul 19, 2024
1 parent cf92cab commit d8c406c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 59 deletions.
28 changes: 19 additions & 9 deletions lit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@ import redisClient from "./lib/redisClient";
import { AuthMethodType, PKP, StoreConditionWithSigner } from "./models";
import { Sequencer } from "./lib/sequencer";
import { parseEther } from "ethers/lib/utils";
import { LitNodeClientNodeJs } from "@lit-protocol/lit-node-client-nodejs";
import { CapacityToken } from "lit";
import { LIT_NETWORK_VALUES } from "@lit-protocol/constants";
import {
manzano,
datilDev,
datilTest,
habanero,
datil,
} from "@lit-protocol/contracts";
// import {
// manzano,
// datilDev,
// datilTest,
// habanero,
// datil,
// } from "@lit-protocol/contracts";

// @ts-ignore
import datil from "@lit-protocol/contracts/prod/datil.json";
// @ts-ignore
import datilDev from "@lit-protocol/contracts/prod/datil-dev.json";
// @ts-ignore
import datilTest from "@lit-protocol/contracts/prod/datil-test.json";
// @ts-ignore
import habanero from "@lit-protocol/contracts/prod/habanero.json";
// @ts-ignore
import manzano from "@lit-protocol/contracts/prod/manzano.json";

function getContractFromWorker(
network: LIT_NETWORK_VALUES,
Expand Down Expand Up @@ -45,7 +55,7 @@ function getContractFromWorker(
throw new Error(`Unsupported network: ${network}`);
}

const contractList = contractsDataRes.data;
const contractList = contractsDataRes.data as any;

console.log(
`Attempting to get contract "${contractName} from "${network}"`,
Expand Down
98 changes: 49 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"name": "relay-server",
"version": "1.0.0",
"description": "Relay Server for facilitating interactions with Lit Protocol smart contracts.",
"main": "index.js",
"scripts": {
"dev": "nodemon index.ts",
"start": "node dist/index.js",
"build": "tsc",
"postinstall": "cp patch/ethersCompat.d.ts node_modules/siwe/dist/ethersCompat.d.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@lit-protocol/constants": "^6.2.1",
"@lit-protocol/contracts": "^0.0.25",
"@lit-protocol/lit-node-client-nodejs": "^6.2.0",
"@simplewebauthn/server": "6.2.1",
"base64url": "^3.0.1",
"cbor": "^8.1.0",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"elliptic": "^6.5.4",
"ethereum-cryptography": "^2.1.3",
"ethers": "~5.6.8",
"express": "^4.17.1",
"express-rate-limit": "^6.6.0",
"google-auth-library": "^8.7.0",
"js-base64": "^3.7.2",
"node-fetch": "^2.6.0",
"rate-limit-redis": "^3.0.1",
"redis": "^4.4.0",
"siwe": "^2.3.2",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@types/cbor": "^6.0.0",
"@types/cors": "^2.8.12",
"@types/elliptic": "^6.4.14",
"@types/express": "^4.17.13",
"@types/jwk-to-pem": "^2.0.1",
"@types/node": "^16.7.4",
"@types/node-fetch": "^2.5.12",
"nodemon": "^2.0.12",
"ts-node": "^10.2.1",
"typescript": "^4.4.2"
}
"name": "relay-server",
"version": "1.0.0",
"description": "Relay Server for facilitating interactions with Lit Protocol smart contracts.",
"main": "index.js",
"scripts": {
"dev": "nodemon index.ts",
"start": "node dist/index.js",
"build": "tsc",
"postinstall": "cp patch/ethersCompat.d.ts node_modules/siwe/dist/ethersCompat.d.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@lit-protocol/constants": "^6.2.1",
"@lit-protocol/contracts": "^0.0.31",
"@lit-protocol/lit-node-client-nodejs": "^6.2.0",
"@simplewebauthn/server": "6.2.1",
"base64url": "^3.0.1",
"cbor": "^8.1.0",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"elliptic": "^6.5.4",
"ethereum-cryptography": "^2.1.3",
"ethers": "~5.6.8",
"express": "^4.17.1",
"express-rate-limit": "^6.6.0",
"google-auth-library": "^8.7.0",
"js-base64": "^3.7.2",
"node-fetch": "^2.6.0",
"rate-limit-redis": "^3.0.1",
"redis": "^4.4.0",
"siwe": "^2.3.2",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@types/cbor": "^6.0.0",
"@types/cors": "^2.8.12",
"@types/elliptic": "^6.4.14",
"@types/express": "^4.17.13",
"@types/jwk-to-pem": "^2.0.1",
"@types/node": "^16.7.4",
"@types/node-fetch": "^2.5.12",
"nodemon": "^2.0.12",
"ts-node": "^10.2.1",
"typescript": "^4.4.2"
}
}
4 changes: 3 additions & 1 deletion routes/auth/mintAndFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export async function mintNextAndAddAuthMethodsHandler(
err,
});
return res.status(500).json({
error: `[mintNextAndAddAuthMethodsHandler] Unable to mint PKP`,
error: `[mintNextAndAddAuthMethodsHandler] Unable to mint PKP ${JSON.stringify(
err,
)}`,
});
}
}
Expand Down

0 comments on commit d8c406c

Please sign in to comment.