Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for mumbai test net usage by doing multiple changes #2

Open
wants to merge 1 commit into
base: testnet-usage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23,054 changes: 20,631 additions & 2,423 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/SignInButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function SignInButton({}: Props) {
// 2. User needs to switch network to Polygon
if (isOnWrongNetwork) {
return (
<button onClick={() => switchNetwork?.(ChainId.Polygon)}>
<button onClick={() => switchNetwork?.(ChainId.Mumbai)}>
Switch Network
</button>
);
Expand Down
192 changes: 167 additions & 25 deletions src/const/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
// 1. export the contract address
export const LENS_CONTRACT_ADDRESS =
"0xDb46d1Dc155634FbC732f92E853b10B288AD5a1d";
"0x60Ae865ee4C725cd04353b5AAb364553f56ceF82";

// 2. export the contract abi
export const LENS_CONTRACT_ABI = [
{
inputs: [
{ internalType: "address", name: "followNFTImpl", type: "address" },
{ internalType: "address", name: "collectNFTImpl", type: "address" },
{
internalType: "uint256",
name: "tokenGuardianCooldown",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{ inputs: [], name: "AlreadyEnabled", type: "error" },
{ inputs: [], name: "CallerNotCollectNFT", type: "error" },
{ inputs: [], name: "CallerNotFollowNFT", type: "error" },
{ inputs: [], name: "CannotInitImplementation", type: "error" },
{ inputs: [], name: "DisablingAlreadyTriggered", type: "error" },
{ inputs: [], name: "DispatcherNotSet", type: "error" },
{ inputs: [], name: "EmergencyAdminCannotUnpause", type: "error" },
{ inputs: [], name: "GuardianEnabled", type: "error" },
{ inputs: [], name: "InitParamsInvalid", type: "error" },
{ inputs: [], name: "Initialized", type: "error" },
{ inputs: [], name: "NotEOA", type: "error" },
{ inputs: [], name: "NotGovernance", type: "error" },
{ inputs: [], name: "NotGovernanceOrEmergencyAdmin", type: "error" },
{ inputs: [], name: "NotOwnerOrApproved", type: "error" },
Expand All @@ -30,7 +36,6 @@ export const LENS_CONTRACT_ABI = [
{ inputs: [], name: "PublishingPaused", type: "error" },
{ inputs: [], name: "SignatureExpired", type: "error" },
{ inputs: [], name: "SignatureInvalid", type: "error" },
{ inputs: [], name: "ZeroSpender", type: "error" },
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -91,6 +96,13 @@ export const LENS_CONTRACT_ABI = [
name: "Transfer",
type: "event",
},
{
inputs: [],
name: "DANGER__disableTokenGuardian",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "to", type: "address" },
Expand All @@ -117,7 +129,7 @@ export const LENS_CONTRACT_ABI = [
},
{
inputs: [
{ internalType: "uint256", name: "tokenId", type: "uint256" },
{ internalType: "uint256", name: "", type: "uint256" },
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
Expand All @@ -126,13 +138,13 @@ export const LENS_CONTRACT_ABI = [
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
name: "",
type: "tuple",
},
],
name: "burnWithSig",
outputs: [],
stateMutability: "nonpayable",
stateMutability: "pure",
type: "function",
},
{
Expand Down Expand Up @@ -259,6 +271,53 @@ export const LENS_CONTRACT_ABI = [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "profileId", type: "uint256" },
{ internalType: "string", name: "contentURI", type: "string" },
{
internalType: "uint256",
name: "profileIdPointed",
type: "uint256",
},
{ internalType: "uint256", name: "pubIdPointed", type: "uint256" },
{ internalType: "bytes", name: "referenceModuleData", type: "bytes" },
{ internalType: "address", name: "collectModule", type: "address" },
{
internalType: "bytes",
name: "collectModuleInitData",
type: "bytes",
},
{ internalType: "address", name: "referenceModule", type: "address" },
{
internalType: "bytes",
name: "referenceModuleInitData",
type: "bytes",
},
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
{ internalType: "bytes32", name: "r", type: "bytes32" },
{ internalType: "bytes32", name: "s", type: "bytes32" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
type: "tuple",
},
],
internalType: "struct DataTypes.CommentWithSigData",
name: "vars",
type: "tuple",
},
],
name: "commentWithSig_Dispatcher",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
Expand Down Expand Up @@ -316,6 +375,13 @@ export const LENS_CONTRACT_ABI = [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "enableTokenGuardian",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
name: "exists",
Expand Down Expand Up @@ -570,14 +636,10 @@ export const LENS_CONTRACT_ABI = [
type: "function",
},
{
inputs: [
{ internalType: "string", name: "name", type: "string" },
{ internalType: "string", name: "symbol", type: "string" },
{ internalType: "address", name: "newGovernance", type: "address" },
],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
inputs: [{ internalType: "address", name: "wallet", type: "address" }],
name: "getTokenGuardianDisablingTimestamp",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
},
{
Expand Down Expand Up @@ -702,6 +764,46 @@ export const LENS_CONTRACT_ABI = [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "profileId", type: "uint256" },
{
internalType: "uint256",
name: "profileIdPointed",
type: "uint256",
},
{ internalType: "uint256", name: "pubIdPointed", type: "uint256" },
{ internalType: "bytes", name: "referenceModuleData", type: "bytes" },
{ internalType: "address", name: "referenceModule", type: "address" },
{
internalType: "bytes",
name: "referenceModuleInitData",
type: "bytes",
},
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
{ internalType: "bytes32", name: "r", type: "bytes32" },
{ internalType: "bytes32", name: "s", type: "bytes32" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
type: "tuple",
},
],
internalType: "struct DataTypes.MirrorWithSigData",
name: "vars",
type: "tuple",
},
],
name: "mirrorWithSig_Dispatcher",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "name",
Expand All @@ -718,8 +820,8 @@ export const LENS_CONTRACT_ABI = [
},
{
inputs: [
{ internalType: "address", name: "spender", type: "address" },
{ internalType: "uint256", name: "tokenId", type: "uint256" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "uint256", name: "", type: "uint256" },
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
Expand All @@ -728,7 +830,7 @@ export const LENS_CONTRACT_ABI = [
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
name: "",
type: "tuple",
},
],
Expand All @@ -739,9 +841,9 @@ export const LENS_CONTRACT_ABI = [
},
{
inputs: [
{ internalType: "address", name: "owner", type: "address" },
{ internalType: "address", name: "operator", type: "address" },
{ internalType: "bool", name: "approved", type: "bool" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "address", name: "", type: "address" },
{ internalType: "bool", name: "", type: "bool" },
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
Expand All @@ -750,13 +852,13 @@ export const LENS_CONTRACT_ABI = [
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
name: "",
type: "tuple",
},
],
name: "permitForAll",
outputs: [],
stateMutability: "nonpayable",
stateMutability: "pure",
type: "function",
},
{
Expand Down Expand Up @@ -828,6 +930,46 @@ export const LENS_CONTRACT_ABI = [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{ internalType: "uint256", name: "profileId", type: "uint256" },
{ internalType: "string", name: "contentURI", type: "string" },
{ internalType: "address", name: "collectModule", type: "address" },
{
internalType: "bytes",
name: "collectModuleInitData",
type: "bytes",
},
{ internalType: "address", name: "referenceModule", type: "address" },
{
internalType: "bytes",
name: "referenceModuleInitData",
type: "bytes",
},
{
components: [
{ internalType: "uint8", name: "v", type: "uint8" },
{ internalType: "bytes32", name: "r", type: "bytes32" },
{ internalType: "bytes32", name: "s", type: "bytes32" },
{ internalType: "uint256", name: "deadline", type: "uint256" },
],
internalType: "struct DataTypes.EIP712Signature",
name: "sig",
type: "tuple",
},
],
internalType: "struct DataTypes.PostWithSigData",
name: "vars",
type: "tuple",
},
],
name: "postWithSig_Dispatcher",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{ internalType: "address", name: "from", type: "address" },
Expand Down
2 changes: 1 addition & 1 deletion src/lib/auth/refreshAccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function refreshAccessToken() {
variables?: TVariables,
options?: RequestInit["headers"]
): Promise<TData> {
const res = await fetch("https://api.lens.dev/", {
const res = await fetch("https://api-mumbai.lens.dev", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/useCreatePost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function useCreatePost() {
referenceModuleInitData,
} = typedData.createPostTypedData.typedData.value;

const result = await lensHubContract.call("postWithSig", {
const result = await lensHubContract.call("postWithSig", [{
profileId: profileId,
contentURI: contentURI,
collectModule,
Expand All @@ -122,7 +122,7 @@ export function useCreatePost() {
s,
deadline: deadline,
},
});
}]);

console.log(result);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/useFollow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function useFollow() {
);

// Call the smart contract function called "followWithSig"
const result = await lensHubContract.call("followWithSig", {
const result = await lensHubContract.call("followWithSig", [{
follower: address,
profileIds: [userId],
datas: value.datas,
Expand All @@ -59,7 +59,7 @@ export function useFollow() {
s,
deadline: value.deadline,
},
});
}]);

console.log(result);
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import Header from "../components/Header";
export default function App({ Component, pageProps }: AppProps) {
// the chainId our app wants to be running on
// for our example the Polygon Mumbai Testnet
const desiredChainId = ChainId.Polygon;
const desiredChainId = ChainId.Mumbai;

// Create a client
const queryClient = new QueryClient();

return (
<ThirdwebProvider desiredChainId={desiredChainId}>
<ThirdwebProvider activeChain="mumbai">
<QueryClientProvider client={queryClient}>
<Header />
<Component {...pageProps} />
Expand Down