From ce2ce1e78c7debc61bb5bde466b5fcf60998bcfb Mon Sep 17 00:00:00 2001 From: Joseph Tary Date: Thu, 11 Apr 2024 19:20:17 -0700 Subject: [PATCH 1/3] feat: add endpoint for PkpHelperV2 contract --- index.ts | 5 +++ lit.ts | 68 +++++++++++++++++++++++++++++++++++++ models/index.ts | 12 +++++++ routes/auth/mintAndFetch.ts | 36 +++++++++++++++++++- 4 files changed, 120 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 7a65b86..9408b97 100644 --- a/index.ts +++ b/index.ts @@ -53,6 +53,7 @@ import { import { fetchPKPsHandler, mintNextAndAddAuthMethodsHandler, + mintNextAndAddAuthMethodsHandlerV2, } from "./routes/auth/mintAndFetch"; import config from "./config"; @@ -214,6 +215,10 @@ app.post("/store-condition", storeConditionHandler); // --- Mint PKP for authorized account app.post("/mint-next-and-add-auth-methods", mintNextAndAddAuthMethodsHandler); +// --- Mint PKP for authorized account using v2 of the helper contract +app.post("/mint-next-and-add-auth-methods-v2", mintNextAndAddAuthMethodsHandlerV2); + + // --- Fetch PKPs tied to authorized account app.post("/fetch-pkps-by-auth-method", fetchPKPsHandler); diff --git a/lit.ts b/lit.ts index c5d489d..b044393 100644 --- a/lit.ts +++ b/lit.ts @@ -119,6 +119,19 @@ function getPkpNftContractAbiPath() { } } +async function getPkpHelperV2Contract() { + // TODO: add support local paths for serrano and cayenne + + switch (config.network) { + case "manzano": + return getContractFromWorker('manzano', 'PKPHelperV2'); + case "habanero": + return getContractFromWorker('habanero', 'PKPHelperV2'); + } + + throw new Error("Unsupported network"); +} + async function getPkpHelperContract() { switch (config.network) { case "serrano": @@ -217,6 +230,61 @@ export async function storeConditionWithSigner( return tx; } +export async function mintPKPV3({ + keyType, + permittedAuthMethodTypes, + permittedAuthMethodIds, + permittedAuthMethodPubkeys, + permittedAuthMethodScopes, + addPkpEthAddressAsPermittedAddress, + pkpEthAddressScopes, + sendPkpToItself, + burnPkp, +}: { + keyType: string; + permittedAuthMethodTypes: string[]; + permittedAuthMethodIds: string[]; + permittedAuthMethodPubkeys: string[]; + permittedAuthMethodScopes: string[][]; + addPkpEthAddressAsPermittedAddress: boolean; + pkpEthAddressScopes: string[][]; + sendPkpToItself: boolean; + burnPkp: boolean; +}): Promise { + console.log( + "In mintPKPV2", + keyType, + permittedAuthMethodTypes, + permittedAuthMethodIds, + permittedAuthMethodPubkeys, + permittedAuthMethodScopes, + addPkpEthAddressAsPermittedAddress, + sendPkpToItself, + ); + + console.log('config.network:', config.network); + + const pkpHelper = await getPkpHelperV2Contract(); + const pkpNft = await getPkpNftContract(); + + // first get mint cost + const mintCost = await pkpNft.mintCost(); + const tx = await pkpHelper.mintNextAndAddAuthMethods( + keyType, + permittedAuthMethodTypes, + permittedAuthMethodIds, + permittedAuthMethodPubkeys, + permittedAuthMethodScopes, + addPkpEthAddressAsPermittedAddress, + pkpEthAddressScopes, + sendPkpToItself, + burnPkp, + { value: mintCost }, + ); + console.log("tx", tx); + return tx; +} + export async function mintPKPV2({ keyType, permittedAuthMethodTypes, diff --git a/models/index.ts b/models/index.ts index 183d60c..337d776 100644 --- a/models/index.ts +++ b/models/index.ts @@ -13,6 +13,18 @@ export interface OTPAuthVerifyRegistrationRequest { accessToken: string; } +export interface MintNextAndAddAuthMethodsV2Request { + keyType: string; + permittedAuthMethodTypes: string[]; + permittedAuthMethodIds: string[]; + permittedAuthMethodPubkeys: string[]; + permittedAuthMethodScopes: string[][]; + addPkpEthAddressAsPermittedAddress: boolean; + pkpEthAddressScopes: string[][]; + sendPkpToItself: boolean; + burnPkp: boolean; +} + export interface MintNextAndAddAuthMethodsRequest { keyType: string; permittedAuthMethodTypes: string[]; diff --git a/routes/auth/mintAndFetch.ts b/routes/auth/mintAndFetch.ts index f765e6c..06c480b 100644 --- a/routes/auth/mintAndFetch.ts +++ b/routes/auth/mintAndFetch.ts @@ -1,14 +1,48 @@ import { Request } from "express"; import { Response } from "express-serve-static-core"; import { ParsedQs } from "qs"; -import { getPKPsForAuthMethod, mintPKPV2 } from "../../lit"; +import { getPKPsForAuthMethod, mintPKPV2, mintPKPV3 } from "../../lit"; import { AuthMethodVerifyToFetchResponse, FetchRequest, MintNextAndAddAuthMethodsRequest, MintNextAndAddAuthMethodsResponse, + MintNextAndAddAuthMethodsV2Request, } from "../../models"; +export async function mintNextAndAddAuthMethodsHandlerV2( + req: Request< + {}, + MintNextAndAddAuthMethodsResponse, + MintNextAndAddAuthMethodsV2Request, + ParsedQs, + Record + >, + res: Response< + MintNextAndAddAuthMethodsResponse, + Record, + number + >, +) { + // mint PKP for user + try { + const mintTx = await mintPKPV3(req.body); + console.info("Minted PKP", { + requestId: mintTx.hash, + }); + return res.status(200).json({ + requestId: mintTx.hash, + }); + } catch (err) { + console.error("Unable to mint PKP", { + err, + }); + return res.status(500).json({ + error: `Unable to mint PKP`, + }); + } +} + export async function mintNextAndAddAuthMethodsHandler( req: Request< {}, From 55255b563b602f99bc5ee0570f7649d77f90b290 Mon Sep 17 00:00:00 2001 From: Joseph Tary Date: Fri, 12 Apr 2024 12:46:57 -0700 Subject: [PATCH 2/3] feat: add ABIs for PKPHelperV2 --- config/index.ts | 8 + contracts/cayenne/PKPHelperV2.json | 340 +++++++++++++++++++++++++++++ contracts/serrano/PKPHelperV2.json | 340 +++++++++++++++++++++++++++++ lit.ts | 24 +- models/index.ts | 1 + 5 files changed, 708 insertions(+), 5 deletions(-) create mode 100644 contracts/cayenne/PKPHelperV2.json create mode 100644 contracts/serrano/PKPHelperV2.json diff --git a/config/index.ts b/config/index.ts index dc01a08..3b96c28 100644 --- a/config/index.ts +++ b/config/index.ts @@ -9,10 +9,12 @@ const { SERRANO_ACCESS_CONTROL_CONDITIONS_ADDRESS, SERRANO_PKP_NFT_ADDRESS, SERRANO_PKP_HELPER_ADDRESS, + SERRANO_PKP_HELPER_V2_ADDRESS, SERRANO_PKP_PERMISSIONS_ADDRESS, CAYENNE_ACCESS_CONTROL_CONDITIONS_ADDRESS, CAYENNE_PKP_NFT_ADDRESS, CAYENNE_PKP_HELPER_ADDRESS, + CAYENNE_PKP_HELPER_V2_ADDRESS, CAYENNE_PKP_PERMISSIONS_ADDRESS, NETWORK, USE_SOLO_NET, @@ -33,6 +35,9 @@ const baseConfig = { pkpHelperAddress: SERRANO_PKP_HELPER_ADDRESS || "0x8bB62077437D918891F12c7F35d9e1B78468bF11", + pkpHelperV2Address: + SERRANO_PKP_HELPER_V2_ADDRESS || + "0x0", pkpPermissionsAddress: SERRANO_PKP_PERMISSIONS_ADDRESS || "0x4Aed2F242E806c58758677059340e29E6B5b7619", @@ -47,6 +52,9 @@ const baseConfig = { pkpHelperAddress: CAYENNE_PKP_HELPER_ADDRESS || "0xDe905Fde36562270AA6FEeBAbC5aB1f440f733c2", + pkpHelperV2Address: + CAYENNE_PKP_HELPER_V2_ADDRESS || + "0x0", pkpPermissionsAddress: CAYENNE_PKP_PERMISSIONS_ADDRESS || "0x9a0a6DD9D229eEfa5119cEB237c90D843d5e1003", diff --git a/contracts/cayenne/PKPHelperV2.json b/contracts/cayenne/PKPHelperV2.json new file mode 100644 index 0000000..c4f6c98 --- /dev/null +++ b/contracts/cayenne/PKPHelperV2.json @@ -0,0 +1,340 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "pkpEthAddressScopes", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + }, + { + "internalType": "bool", + "name": "burnPkp", + "type": "bool" + } + ], + "internalType": "struct PKPHelperV2.NewPKPParams", + "name": "params", + "type": "tuple" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "pkpEthAddressScopes", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + }, + { + "internalType": "bool", + "name": "burnPkp", + "type": "bool" + } + ], + "internalType": "struct PKPHelperV2.NewPKPParams", + "name": "params", + "type": "tuple" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/contracts/serrano/PKPHelperV2.json b/contracts/serrano/PKPHelperV2.json new file mode 100644 index 0000000..c4f6c98 --- /dev/null +++ b/contracts/serrano/PKPHelperV2.json @@ -0,0 +1,340 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "pkpEthAddressScopes", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + }, + { + "internalType": "bool", + "name": "burnPkp", + "type": "bool" + } + ], + "internalType": "struct PKPHelperV2.NewPKPParams", + "name": "params", + "type": "tuple" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "uint256[]", + "name": "pkpEthAddressScopes", + "type": "uint256[]" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + }, + { + "internalType": "bool", + "name": "burnPkp", + "type": "bool" + } + ], + "internalType": "struct PKPHelperV2.NewPKPParams", + "name": "params", + "type": "tuple" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/lit.ts b/lit.ts index b044393..b463624 100644 --- a/lit.ts +++ b/lit.ts @@ -95,6 +95,15 @@ function getAccessControlConditionsContract() { } } +function getPkpHelperV2ContractAbiPath() { + switch (config.network) { + case "serrano": + return "./contracts/serrano/PKPHelperV2.json"; + case "cayenne": + return "./contracts/cayenne/PKPHelperV2.json"; + } +} + function getPkpHelperContractAbiPath() { if (config.useSoloNet) { return "./contracts/serrano/SoloNetPKPHelper.json"; @@ -120,22 +129,27 @@ function getPkpNftContractAbiPath() { } async function getPkpHelperV2Contract() { - // TODO: add support local paths for serrano and cayenne - switch (config.network) { + case "serrano": + return getContract( + getPkpHelperV2ContractAbiPath()!, + config?.serranoContract?.pkpHelperV2Address as string, + ); + case "cayenne": + return getContract( + getPkpHelperV2ContractAbiPath()!, + config?.cayenneContracts?.pkpHelperV2Address as string, + ); case "manzano": return getContractFromWorker('manzano', 'PKPHelperV2'); case "habanero": return getContractFromWorker('habanero', 'PKPHelperV2'); } - - throw new Error("Unsupported network"); } async function getPkpHelperContract() { switch (config.network) { case "serrano": - return getContract( getPkpHelperContractAbiPath()!, config?.serranoContract?.pkpHelperAddress as string, diff --git a/models/index.ts b/models/index.ts index 337d776..e8e5261 100644 --- a/models/index.ts +++ b/models/index.ts @@ -141,6 +141,7 @@ export interface SessionSigSignedMessage { export interface Contract { accessControlConditionsAddress: string; pkpHelperAddress: string; + pkpHelperV2Address: string; pkpPermissionsAddress: string; pkpNftAddress: string; } From e998a1e9a9781c88aa954281273c04c261c1e9ac Mon Sep 17 00:00:00 2001 From: Joseph Tary Date: Fri, 19 Apr 2024 16:18:52 -0700 Subject: [PATCH 3/3] fix: remove pkphelperv2 info for serrano and cayenne --- config/index.ts | 8 -------- lit.ts | 14 +++----------- models/index.ts | 2 +- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/config/index.ts b/config/index.ts index 3b96c28..dc01a08 100644 --- a/config/index.ts +++ b/config/index.ts @@ -9,12 +9,10 @@ const { SERRANO_ACCESS_CONTROL_CONDITIONS_ADDRESS, SERRANO_PKP_NFT_ADDRESS, SERRANO_PKP_HELPER_ADDRESS, - SERRANO_PKP_HELPER_V2_ADDRESS, SERRANO_PKP_PERMISSIONS_ADDRESS, CAYENNE_ACCESS_CONTROL_CONDITIONS_ADDRESS, CAYENNE_PKP_NFT_ADDRESS, CAYENNE_PKP_HELPER_ADDRESS, - CAYENNE_PKP_HELPER_V2_ADDRESS, CAYENNE_PKP_PERMISSIONS_ADDRESS, NETWORK, USE_SOLO_NET, @@ -35,9 +33,6 @@ const baseConfig = { pkpHelperAddress: SERRANO_PKP_HELPER_ADDRESS || "0x8bB62077437D918891F12c7F35d9e1B78468bF11", - pkpHelperV2Address: - SERRANO_PKP_HELPER_V2_ADDRESS || - "0x0", pkpPermissionsAddress: SERRANO_PKP_PERMISSIONS_ADDRESS || "0x4Aed2F242E806c58758677059340e29E6B5b7619", @@ -52,9 +47,6 @@ const baseConfig = { pkpHelperAddress: CAYENNE_PKP_HELPER_ADDRESS || "0xDe905Fde36562270AA6FEeBAbC5aB1f440f733c2", - pkpHelperV2Address: - CAYENNE_PKP_HELPER_V2_ADDRESS || - "0x0", pkpPermissionsAddress: CAYENNE_PKP_PERMISSIONS_ADDRESS || "0x9a0a6DD9D229eEfa5119cEB237c90D843d5e1003", diff --git a/lit.ts b/lit.ts index b463624..6112163 100644 --- a/lit.ts +++ b/lit.ts @@ -130,21 +130,13 @@ function getPkpNftContractAbiPath() { async function getPkpHelperV2Contract() { switch (config.network) { - case "serrano": - return getContract( - getPkpHelperV2ContractAbiPath()!, - config?.serranoContract?.pkpHelperV2Address as string, - ); - case "cayenne": - return getContract( - getPkpHelperV2ContractAbiPath()!, - config?.cayenneContracts?.pkpHelperV2Address as string, - ); case "manzano": return getContractFromWorker('manzano', 'PKPHelperV2'); case "habanero": return getContractFromWorker('habanero', 'PKPHelperV2'); } + + throw new Error(`PKPHelperV2 contract not available for network ${config.network}`); } async function getPkpHelperContract() { @@ -266,7 +258,7 @@ export async function mintPKPV3({ burnPkp: boolean; }): Promise { console.log( - "In mintPKPV2", + "In mintPKPV3", keyType, permittedAuthMethodTypes, permittedAuthMethodIds, diff --git a/models/index.ts b/models/index.ts index e8e5261..dba6373 100644 --- a/models/index.ts +++ b/models/index.ts @@ -141,7 +141,7 @@ export interface SessionSigSignedMessage { export interface Contract { accessControlConditionsAddress: string; pkpHelperAddress: string; - pkpHelperV2Address: string; + pkpHelperV2Address?: string; pkpPermissionsAddress: string; pkpNftAddress: string; }