UNPKG

@campnetwork/origin

Version:
3,049 lines (3,034 loc) 506 kB
'use client'; import React, { createContext, useState, useContext, useEffect, useLayoutEffect, useRef, useSyncExternalStore } from 'react'; import { custom, createWalletClient, createPublicClient, http, zeroAddress, erc20Abi, getAbiItem, formatEther, formatUnits, encodeFunctionData, checksumAddress, parseEther } from 'viem'; import { toAccount } from 'viem/accounts'; import { createSiweMessage } from 'viem/siwe'; import axios from 'axios'; import { WagmiContext, useAccount, useConnectorClient } from 'wagmi'; import ReactDOM, { createPortal } from 'react-dom'; import { useQuery } from '@tanstack/react-query'; /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __classPrivateFieldGet(receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); } function __classPrivateFieldSet(receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; } typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; class APIError extends Error { constructor(message, statusCode) { super(message); this.name = "APIError"; this.statusCode = statusCode || 500; Error.captureStackTrace(this, this.constructor); } toJSON() { return { error: this.name, message: this.message, statusCode: this.statusCode || 500, }; } } class ValidationError extends Error { constructor(message) { super(message); this.name = "ValidationError"; Error.captureStackTrace(this, this.constructor); } toJSON() { return { error: this.name, message: this.message, statusCode: 400, }; } } class AuthenticationError extends Error { constructor(message) { super(message); this.name = "AuthenticationError"; Error.captureStackTrace(this, this.constructor); } toJSON() { return { error: this.name, message: this.message, statusCode: 401, }; } } class WalletError extends Error { constructor(message) { super(message); this.name = "WalletError"; Error.captureStackTrace(this, this.constructor); } toJSON() { return { error: this.name, message: this.message, statusCode: 400, }; } } class ContractError extends Error { constructor(message, options) { super(message); this.name = "ContractError"; this.contractName = options === null || options === void 0 ? void 0 : options.contractName; this.methodName = options === null || options === void 0 ? void 0 : options.methodName; Error.captureStackTrace(this, this.constructor); } toJSON() { return { error: this.name, message: this.message, statusCode: 400, contractName: this.contractName, methodName: this.methodName, }; } } function getErrorMessage(error) { if (error instanceof Error) return error.message; if (typeof error === "string") return error; try { return JSON.stringify(error); } catch (_a) { return String(error); } } const testnet = { id: 123420001114, name: "Basecamp", nativeCurrency: { decimals: 18, name: "Camp", symbol: "CAMP", }, rpcUrls: { default: { http: [ "https://rpc-campnetwork.xyz", "https://rpc.basecamp.t.raas.gelato.cloud", ], }, }, blockExplorers: { default: { name: "Explorer", url: "https://basecamp.cloud.blockscout.com/", }, }, }; const mainnet = { id: 484, name: "Camp Network", nativeCurrency: { decimals: 18, name: "Camp", symbol: "CAMP", }, rpcUrls: { default: { http: ["https://rpc.camp.raas.gelato.cloud/"], }, }, blockExplorers: { default: { name: "Explorer", url: "https://camp.cloud.blockscout.com/", }, }, }; // @ts-ignore let client = null; let publicClient = null; let currentChain = null; const getClient = (provider, name = "window.ethereum", chain, address) => { var _a, _b; if (!provider && !client) { console.warn("Provider is required to create a client."); return null; } const selectedChain = chain || testnet; if (!client || (client.transport.name !== name && provider) || (address !== ((_a = client.account) === null || _a === void 0 ? void 0 : _a.address) && provider) || (currentChain === null || currentChain === void 0 ? void 0 : currentChain.id) !== selectedChain.id) { const obj = { chain: selectedChain, transport: custom(provider, { name: name, }), }; if (address) { obj.account = toAccount(address); } client = createWalletClient(obj); currentChain = selectedChain; if (publicClient && ((_b = publicClient.chain) === null || _b === void 0 ? void 0 : _b.id) !== selectedChain.id) { publicClient = null; } } return client; }; const getPublicClient = (chain) => { var _a; const selectedChain = currentChain || testnet; if (!publicClient || ((_a = publicClient.chain) === null || _a === void 0 ? void 0 : _a.id) !== selectedChain.id) { publicClient = createPublicClient({ chain: selectedChain, transport: http(), }); } return publicClient; }; const setChain = (chain) => { currentChain = chain; publicClient = null; // reset public client to be recreated with new chain }; var ipnftMainnetAbi = [ { type: "constructor", inputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "UPGRADE_INTERFACE_VERSION", inputs: [ ], outputs: [ { name: "", type: "string", internalType: "string" } ], stateMutability: "view" }, { type: "function", name: "appRegistry", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "contract AppRegistry" } ], stateMutability: "view" }, { type: "function", name: "approve", inputs: [ { name: "to", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "balanceOf", inputs: [ { name: "owner", type: "address", internalType: "address" } ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "dataStatus", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "uint8", internalType: "enum IIpNFT.DataStatus" } ], stateMutability: "view" }, { type: "function", name: "disputeModule", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "erc6551Account", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "contract IERC6551Account" } ], stateMutability: "view" }, { type: "function", name: "erc6551Registry", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "contract IERC6551Registry" } ], stateMutability: "view" }, { type: "function", name: "finalizeDelete", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "getAccount", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "account", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "getApproved", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "getTerms", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "tuple", internalType: "struct IIpNFT.LicenseTerms", components: [ { name: "price", type: "uint128", internalType: "uint128" }, { name: "duration", type: "uint32", internalType: "uint32" }, { name: "royaltyBps", type: "uint16", internalType: "uint16" }, { name: "paymentToken", type: "address", internalType: "address" }, { name: "licenseType", type: "uint8", internalType: "enum IIpNFT.LicenseType" } ] } ], stateMutability: "view" }, { type: "function", name: "initialize", inputs: [ { name: "name_", type: "string", internalType: "string" }, { name: "symbol_", type: "string", internalType: "string" }, { name: "maxTermDuration_", type: "uint256", internalType: "uint256" }, { name: "signer_", type: "address", internalType: "address" }, { name: "wCAMP_", type: "address", internalType: "address" }, { name: "minTermDuration_", type: "uint256", internalType: "uint256" }, { name: "minPrice_", type: "uint256", internalType: "uint256" }, { name: "maxRoyaltyBps_", type: "uint256", internalType: "uint256" }, { name: "registry_", type: "address", internalType: "contract IERC6551Registry" }, { name: "implementation_", type: "address", internalType: "contract IERC6551Account" }, { name: "appRegistry_", type: "address", internalType: "contract AppRegistry" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "isApprovedForAll", inputs: [ { name: "owner", type: "address", internalType: "address" }, { name: "operator", type: "address", internalType: "address" } ], outputs: [ { name: "", type: "bool", internalType: "bool" } ], stateMutability: "view" }, { type: "function", name: "markDisputed", inputs: [ { name: "_tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "marketPlace", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "contract IMarketplace" } ], stateMutability: "view" }, { type: "function", name: "maxRoyaltyBps", inputs: [ ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "maxTermDuration", inputs: [ ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "minPrice", inputs: [ ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "minTermDuration", inputs: [ ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "mintWithSignature", inputs: [ { name: "to", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" }, { name: "creatorContentHash", type: "bytes32", internalType: "bytes32" }, { name: "uri", type: "string", internalType: "string" }, { name: "licenseTerms", type: "tuple", internalType: "struct IIpNFT.LicenseTerms", components: [ { name: "price", type: "uint128", internalType: "uint128" }, { name: "duration", type: "uint32", internalType: "uint32" }, { name: "royaltyBps", type: "uint16", internalType: "uint16" }, { name: "paymentToken", type: "address", internalType: "address" }, { name: "licenseType", type: "uint8", internalType: "enum IIpNFT.LicenseType" } ] }, { name: "deadline", type: "uint256", internalType: "uint256" }, { name: "parents", type: "uint256[]", internalType: "uint256[]" }, { name: "isIP", type: "bool", internalType: "bool" }, { name: "appId", type: "string", internalType: "string" }, { name: "signature", type: "bytes", internalType: "bytes" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "name", inputs: [ ], outputs: [ { name: "", type: "string", internalType: "string" } ], stateMutability: "view" }, { type: "function", name: "owner", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "ownerOf", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "pause", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "paused", inputs: [ ], outputs: [ { name: "", type: "bool", internalType: "bool" } ], stateMutability: "view" }, { type: "function", name: "proxiableUUID", inputs: [ ], outputs: [ { name: "", type: "bytes32", internalType: "bytes32" } ], stateMutability: "view" }, { type: "function", name: "renounceOwnership", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "safeTransferFrom", inputs: [ { name: "from", type: "address", internalType: "address" }, { name: "to", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "safeTransferFrom", inputs: [ { name: "from", type: "address", internalType: "address" }, { name: "to", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" }, { name: "data", type: "bytes", internalType: "bytes" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "setAppRegistry", inputs: [ { name: "_appRegistry", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "setApprovalForAll", inputs: [ { name: "operator", type: "address", internalType: "address" }, { name: "approved", type: "bool", internalType: "bool" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "setDisputeModule", inputs: [ { name: "_disputeModule", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "setMarketPlace", inputs: [ { name: "_marketPlace", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "setSigner", inputs: [ { name: "_signer", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "signer", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "supportsInterface", inputs: [ { name: "interfaceId", type: "bytes4", internalType: "bytes4" } ], outputs: [ { name: "", type: "bool", internalType: "bool" } ], stateMutability: "view" }, { type: "function", name: "symbol", inputs: [ ], outputs: [ { name: "", type: "string", internalType: "string" } ], stateMutability: "view" }, { type: "function", name: "tokenInfo", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "tuple", internalType: "struct IIpNFT.TokenInfo", components: [ { name: "tokenURI", type: "string", internalType: "string" }, { name: "isIP", type: "bool", internalType: "bool" }, { name: "contentHash", type: "bytes32", internalType: "bytes32" }, { name: "terms", type: "tuple", internalType: "struct IIpNFT.LicenseTerms", components: [ { name: "price", type: "uint128", internalType: "uint128" }, { name: "duration", type: "uint32", internalType: "uint32" }, { name: "royaltyBps", type: "uint16", internalType: "uint16" }, { name: "paymentToken", type: "address", internalType: "address" }, { name: "licenseType", type: "uint8", internalType: "enum IIpNFT.LicenseType" } ] }, { name: "status", type: "uint8", internalType: "enum IIpNFT.DataStatus" }, { name: "appId", type: "string", internalType: "string" } ] } ], stateMutability: "view" }, { type: "function", name: "tokenURI", inputs: [ { name: "_tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "string", internalType: "string" } ], stateMutability: "view" }, { type: "function", name: "transferFrom", inputs: [ { name: "from", type: "address", internalType: "address" }, { name: "to", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "transferOwnership", inputs: [ { name: "newOwner", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "unpause", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "updateTerms", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" }, { name: "newTerms", type: "tuple", internalType: "struct IIpNFT.LicenseTerms", components: [ { name: "price", type: "uint128", internalType: "uint128" }, { name: "duration", type: "uint32", internalType: "uint32" }, { name: "royaltyBps", type: "uint16", internalType: "uint16" }, { name: "paymentToken", type: "address", internalType: "address" }, { name: "licenseType", type: "uint8", internalType: "enum IIpNFT.LicenseType" } ] } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "upgradeToAndCall", inputs: [ { name: "newImplementation", type: "address", internalType: "address" }, { name: "data", type: "bytes", internalType: "bytes" } ], outputs: [ ], stateMutability: "payable" }, { type: "function", name: "wCAMP", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "event", name: "AccessPurchased", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "buyer", type: "address", indexed: true, internalType: "address" }, { name: "periods", type: "uint32", indexed: false, internalType: "uint32" }, { name: "newExpiry", type: "uint256", indexed: false, internalType: "uint256" }, { name: "amountPaid", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "AgentRegistered", inputs: [ { name: "agentId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "ipNftId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "agentAddress", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "AppRegistryUpdated", inputs: [ { name: "appRegistry", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "Approval", inputs: [ { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "approved", type: "address", indexed: true, internalType: "address" }, { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "ApprovalForAll", inputs: [ { name: "owner", type: "address", indexed: true, internalType: "address" }, { name: "operator", type: "address", indexed: true, internalType: "address" }, { name: "approved", type: "bool", indexed: false, internalType: "bool" } ], anonymous: false }, { type: "event", name: "ChildIpTagged", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "childIp", type: "uint256", indexed: true, internalType: "uint256" }, { name: "parentIp", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "DataDeleted", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "creator", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "DataMinted", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "creator", type: "address", indexed: true, internalType: "address" }, { name: "contentHash", type: "bytes32", indexed: false, internalType: "bytes32" }, { name: "parents", type: "uint256[]", indexed: false, internalType: "uint256[]" } ], anonymous: false }, { type: "event", name: "DisputeAssertion", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "counterEvidenceHash", type: "bytes32", indexed: false, internalType: "bytes32" } ], anonymous: false }, { type: "event", name: "DisputeCancelled", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "DisputeJudged", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "judgement", type: "bool", indexed: false, internalType: "bool" } ], anonymous: false }, { type: "event", name: "DisputeModuleUpdated", inputs: [ { name: "disputeModule", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "DisputeRaised", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "initiator", type: "address", indexed: true, internalType: "address" }, { name: "targetId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "disputeTag", type: "bytes32", indexed: false, internalType: "bytes32" } ], anonymous: false }, { type: "event", name: "Initialized", inputs: [ { name: "version", type: "uint64", indexed: false, internalType: "uint64" } ], anonymous: false }, { type: "event", name: "MarketPlaceUpdated", inputs: [ { name: "marketPlace", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "OwnershipTransferred", inputs: [ { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "ParentIpsSet", inputs: [ { name: "childIpId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "parentIds", type: "uint256[]", indexed: false, internalType: "uint256[]" }, { name: "totalRoyaltyBps", type: "uint16", indexed: false, internalType: "uint16" } ], anonymous: false }, { type: "event", name: "Paused", inputs: [ { name: "account", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "ProtocolFeeUpdated", inputs: [ { name: "newFeeBps", type: "uint16", indexed: false, internalType: "uint16" } ], anonymous: false }, { type: "event", name: "RoyaltyPaid", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "royaltyAmount", type: "uint256", indexed: false, internalType: "uint256" }, { name: "creator", type: "address", indexed: false, internalType: "address" }, { name: "protocolAmount", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "SignerUpdated", inputs: [ { name: "signer", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "StatusUpdated", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "status", type: "uint8", indexed: false, internalType: "enum IIpNFT.DataStatus" } ], anonymous: false }, { type: "event", name: "TermsUpdated", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "newPrice", type: "uint128", indexed: false, internalType: "uint128" }, { name: "newDuration", type: "uint32", indexed: false, internalType: "uint32" }, { name: "newRoyaltyBps", type: "uint16", indexed: false, internalType: "uint16" }, { name: "paymentToken", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "Transfer", inputs: [ { name: "from", type: "address", indexed: true, internalType: "address" }, { name: "to", type: "address", indexed: true, internalType: "address" }, { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "TreasuryUpdated", inputs: [ { name: "newTreasury", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "Unpaused", inputs: [ { name: "account", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "Upgraded", inputs: [ { name: "implementation", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "Voted", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "voter", type: "address", indexed: true, internalType: "address" }, { name: "support", type: "bool", indexed: false, internalType: "bool" }, { name: "weight", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "error", name: "AddressEmptyCode", inputs: [ { name: "target", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC1967InvalidImplementation", inputs: [ { name: "implementation", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC1967NonPayable", inputs: [ ] }, { type: "error", name: "ERC721IncorrectOwner", inputs: [ { name: "sender", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" }, { name: "owner", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721InsufficientApproval", inputs: [ { name: "operator", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" } ] }, { type: "error", name: "ERC721InvalidApprover", inputs: [ { name: "approver", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721InvalidOperator", inputs: [ { name: "operator", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721InvalidOwner", inputs: [ { name: "owner", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721InvalidReceiver", inputs: [ { name: "receiver", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721InvalidSender", inputs: [ { name: "sender", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC721NonexistentToken", inputs: [ { name: "tokenId", type: "uint256", internalType: "uint256" } ] }, { type: "error", name: "EnforcedPause", inputs: [ ] }, { type: "error", name: "ExpectedPause", inputs: [ ] }, { type: "error", name: "FailedCall", inputs: [ ] }, { type: "error", name: "InvalidDeadline", inputs: [ ] }, { type: "error", name: "InvalidDuration", inputs: [ ] }, { type: "error", name: "InvalidInitialization", inputs: [ ] }, { type: "error", name: "InvalidPaymentToken", inputs: [ ] }, { type: "error", name: "InvalidPrice", inputs: [ ] }, { type: "error", name: "InvalidRoyalty", inputs: [ ] }, { type: "error", name: "InvalidSignature", inputs: [ ] }, { type: "error", name: "NotInitializing", inputs: [ ] }, { type: "error", name: "NotTokenOwner", inputs: [ ] }, { type: "error", name: "OwnableInvalidOwner", inputs: [ { name: "owner", type: "address", internalType: "address" } ] }, { type: "error", name: "OwnableUnauthorizedAccount", inputs: [ { name: "account", type: "address", internalType: "address" } ] }, { type: "error", name: "TokenAlreadyExists", inputs: [ ] }, { type: "error", name: "UUPSUnauthorizedCallContext", inputs: [ ] }, { type: "error", name: "UUPSUnsupportedProxiableUUID", inputs: [ { name: "slot", type: "bytes32", internalType: "bytes32" } ] }, { type: "error", name: "Unauthorized", inputs: [ ] } ]; var marketplaceMainnetAbi = [ { type: "constructor", inputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "MAX_PARENTS", inputs: [ ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "UPGRADE_INTERFACE_VERSION", inputs: [ ], outputs: [ { name: "", type: "string", internalType: "string" } ], stateMutability: "view" }, { type: "function", name: "buyAccess", inputs: [ { name: "buyer", type: "address", internalType: "address" }, { name: "tokenId", type: "uint256", internalType: "uint256" }, { name: "expectedPrice", type: "uint256", internalType: "uint256" }, { name: "expectedDuration", type: "uint32", internalType: "uint32" }, { name: "expectedPaymentToken", type: "address", internalType: "address" }, { name: "expectedProtocolFeeBps", type: "uint16", internalType: "uint16" }, { name: "expectedAppFeeBps", type: "uint16", internalType: "uint16" } ], outputs: [ ], stateMutability: "payable" }, { type: "function", name: "hasParentIp", inputs: [ { name: "ipId", type: "uint256", internalType: "uint256" }, { name: "parent", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "bool", internalType: "bool" } ], stateMutability: "view" }, { type: "function", name: "initialize", inputs: [ { name: "dataNFT_", type: "address", internalType: "address" }, { name: "protocolFeeBps_", type: "uint16", internalType: "uint16" }, { name: "treasury_", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "ipToken", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "contract IIpNFT" } ], stateMutability: "view" }, { type: "function", name: "owner", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "parentRoyaltyPercent", inputs: [ { name: "", type: "uint256", internalType: "uint256" }, { name: "", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "uint16", internalType: "uint16" } ], stateMutability: "view" }, { type: "function", name: "pause", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "paused", inputs: [ ], outputs: [ { name: "", type: "bool", internalType: "bool" } ], stateMutability: "view" }, { type: "function", name: "protocolFeeBps", inputs: [ ], outputs: [ { name: "", type: "uint16", internalType: "uint16" } ], stateMutability: "view" }, { type: "function", name: "proxiableUUID", inputs: [ ], outputs: [ { name: "", type: "bytes32", internalType: "bytes32" } ], stateMutability: "view" }, { type: "function", name: "renounceOwnership", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "royaltyStack", inputs: [ { name: "", type: "uint256", internalType: "uint256" } ], outputs: [ { name: "", type: "uint16", internalType: "uint16" } ], stateMutability: "view" }, { type: "function", name: "setParentIpsAndRoyaltyPercents", inputs: [ { name: "childIpId", type: "uint256", internalType: "uint256" }, { name: "parents", type: "uint256[]", internalType: "uint256[]" }, { name: "creator", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "subscriptionExpiry", inputs: [ { name: "", type: "uint256", internalType: "uint256" }, { name: "", type: "address", internalType: "address" } ], outputs: [ { name: "", type: "uint256", internalType: "uint256" } ], stateMutability: "view" }, { type: "function", name: "transferOwnership", inputs: [ { name: "newOwner", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "treasury", inputs: [ ], outputs: [ { name: "", type: "address", internalType: "address" } ], stateMutability: "view" }, { type: "function", name: "unpause", inputs: [ ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "updateProtocolFee", inputs: [ { name: "newFeeBps", type: "uint16", internalType: "uint16" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "updateTreasury", inputs: [ { name: "newTreasury", type: "address", internalType: "address" } ], outputs: [ ], stateMutability: "nonpayable" }, { type: "function", name: "upgradeToAndCall", inputs: [ { name: "newImplementation", type: "address", internalType: "address" }, { name: "data", type: "bytes", internalType: "bytes" } ], outputs: [ ], stateMutability: "payable" }, { type: "event", name: "AccessPurchased", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "buyer", type: "address", indexed: true, internalType: "address" }, { name: "periods", type: "uint32", indexed: false, internalType: "uint32" }, { name: "newExpiry", type: "uint256", indexed: false, internalType: "uint256" }, { name: "amountPaid", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "AgentRegistered", inputs: [ { name: "agentId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "ipNftId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "agentAddress", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "AppRegistryUpdated", inputs: [ { name: "appRegistry", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "ChildIpTagged", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "childIp", type: "uint256", indexed: true, internalType: "uint256" }, { name: "parentIp", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "DataDeleted", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "creator", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "DataMinted", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "creator", type: "address", indexed: true, internalType: "address" }, { name: "contentHash", type: "bytes32", indexed: false, internalType: "bytes32" }, { name: "parents", type: "uint256[]", indexed: false, internalType: "uint256[]" } ], anonymous: false }, { type: "event", name: "DisputeAssertion", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "counterEvidenceHash", type: "bytes32", indexed: false, internalType: "bytes32" } ], anonymous: false }, { type: "event", name: "DisputeCancelled", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "DisputeJudged", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "judgement", type: "bool", indexed: false, internalType: "bool" } ], anonymous: false }, { type: "event", name: "DisputeModuleUpdated", inputs: [ { name: "disputeModule", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "DisputeRaised", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "initiator", type: "address", indexed: true, internalType: "address" }, { name: "targetId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "disputeTag", type: "bytes32", indexed: false, internalType: "bytes32" } ], anonymous: false }, { type: "event", name: "Initialized", inputs: [ { name: "version", type: "uint64", indexed: false, internalType: "uint64" } ], anonymous: false }, { type: "event", name: "MarketPlaceUpdated", inputs: [ { name: "marketPlace", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "OwnershipTransferred", inputs: [ { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, { name: "newOwner", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "ParentIpsSet", inputs: [ { name: "childIpId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "parentIds", type: "uint256[]", indexed: false, internalType: "uint256[]" }, { name: "totalRoyaltyBps", type: "uint16", indexed: false, internalType: "uint16" } ], anonymous: false }, { type: "event", name: "Paused", inputs: [ { name: "account", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "ProtocolFeeUpdated", inputs: [ { name: "newFeeBps", type: "uint16", indexed: false, internalType: "uint16" } ], anonymous: false }, { type: "event", name: "RoyaltyPaid", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "royaltyAmount", type: "uint256", indexed: false, internalType: "uint256" }, { name: "creator", type: "address", indexed: false, internalType: "address" }, { name: "protocolAmount", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "event", name: "SignerUpdated", inputs: [ { name: "signer", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "StatusUpdated", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "status", type: "uint8", indexed: false, internalType: "enum IIpNFT.DataStatus" } ], anonymous: false }, { type: "event", name: "TermsUpdated", inputs: [ { name: "tokenId", type: "uint256", indexed: true, internalType: "uint256" }, { name: "newPrice", type: "uint128", indexed: false, internalType: "uint128" }, { name: "newDuration", type: "uint32", indexed: false, internalType: "uint32" }, { name: "newRoyaltyBps", type: "uint16", indexed: false, internalType: "uint16" }, { name: "paymentToken", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "TreasuryUpdated", inputs: [ { name: "newTreasury", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "Unpaused", inputs: [ { name: "account", type: "address", indexed: false, internalType: "address" } ], anonymous: false }, { type: "event", name: "Upgraded", inputs: [ { name: "implementation", type: "address", indexed: true, internalType: "address" } ], anonymous: false }, { type: "event", name: "Voted", inputs: [ { name: "id", type: "uint256", indexed: true, internalType: "uint256" }, { name: "voter", type: "address", indexed: true, internalType: "address" }, { name: "support", type: "bool", indexed: false, internalType: "bool" }, { name: "weight", type: "uint256", indexed: false, internalType: "uint256" } ], anonymous: false }, { type: "error", name: "AddressEmptyCode", inputs: [ { name: "target", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC1967InvalidImplementation", inputs: [ { name: "implementation", type: "address", internalType: "address" } ] }, { type: "error", name: "ERC1967NonPayable", inputs: [ ] }, { type: "error", name: "EnforcedPause", inputs: [ ] }, { type: "error", name: "ExpectedPause", inputs: [ ] }, { type: "error", name: "FailedCall", inputs: [ ] }, { type: "error", name: "FeesExceedMaximum", inputs: [ ] }, { type: "error", name: "FeesMismatch", inputs: [ ] }, { type: "error", name: "InvalidInitialization", inputs: [ ] }, { type: "error", name: "InvalidLicenseType", inputs: [ ] }, { type: "error", name: "InvalidParentIp", inputs: [ ] }, {