diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index c8843f2..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - env: { - browser: true, - es2021: true, - node: true, - }, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 12, - sourceType: 'module', - }, - plugins: ['@typescript-eslint', 'prettier'], - rules: { - 'prettier/prettier': 'error', - '@typescript-eslint/no-explicit-any': 'off', - }, -}; diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..df62db4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,19 @@ +{ + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "plugins": ["@typescript-eslint", "prettier"], + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "rules": { + "prettier/prettier": "error", + "@typescript-eslint/no-explicit-any": "off" + }, + "ignorePatterns": ["smart-contracts-hardhat/"] +} diff --git a/.github/workflows/build-lint.yaml b/.github/workflows/build-lint.yaml index 86a7987..c4e9d20 100644 --- a/.github/workflows/build-lint.yaml +++ b/.github/workflows/build-lint.yaml @@ -13,7 +13,6 @@ on: jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a9e5d44 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +smart-contract-hardhat \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index d00fc29..dc75c8a 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,23 +1,6 @@ { - "plugins": ["prettier-plugin-solidity"], - "overrides": [ - { - "files": ["*.js", "*.ts"], - "options": { - "tabWidth": 2, - "printWidth": 100, - "trailingComma": "all", - "singleQuote": true, - "semi": true - } - }, - { - "files": "*.sol", - "options": { - "tabWidth": 4, - "printWidth": 80, - "compiler": "0.8.15" - } - } - ] + "trailingComma": "all", + "tabWidth": 2, + "semi": true, + "singleQuote": true } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8dce5bf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# 💁‍♂️ Contributing to LUKSO Playground + +We're thrilled you're interested in contributing to the LUKSO Playground! This space is dedicated to providing developers with code snippets and tools for interacting with LUKSO standards efficiently. + +## Getting Started + +1. Create a fork of this repository. +2. Clone your repository to make changes. +3. Follow the installation within the [README.md](./README.md) + +## Making Changes + +1. **Create a separate branch**: For each new feature, docs, or fix, create a new branch in your fork like the following structure: `feature/feature-name` or `fix/issue-fix`, `docs/added-content`. The naming helps organize your contributions and separates them from your main branch. +2. **Commit your changes**: After running `npm run build` and applying styles using `prettier`, you can commit your local changes to your branch. Please ensure that changes are regularly pulled from the `main` branch of the original repository to stay up-to-date and avoid conflicts. +3. **Submit a pull request**: Once your changes are ready and tested, you can push the latest changes to your GitHub fork and `submit a pull request` to this repository. Please provide a clear and detailed explanation of the changes and why they are needed. Include any relevant `issue numbers`. +4. **Review Process**: The project maintainers will review your pull request. Be open to feedback and be prepared to make further changes if requested. Once approved, a maintainer will `merge` your changes into the `main` branch. + +## Contribution Guidelines + +To ensure a smooth contribution process for everyone, please follow these guidelines: + +- **Maintain Generality**: This repository is designed as a generic foundation for developers to start building with LSPs efficiently. Contributions should not introduce features too specific or outside of the LSP ecosystem. +- **Follow Code Styles**: Follow the coding conventions used throughout the project, including indentation, naming conventions, and comments. +- **Build and Test**: Ensure your code does not break the existing functionality. Add tests for any new features or fixes when possible. Any upcoming features should not break existing scripts or contracts. +- **Create Documentation**: Add or update any relevant documentation with your changes, especially if adding new features. + +## Report Bugs + +If you've found issues within contracts or scripts, please [open a new issue](https://github.com/lukso-network/lukso-playground/issues). diff --git a/README.md b/README.md index 53d9f79..ae41f5b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Please check the versions used in the [`package.json`](./package.json) > A lot of these scripts should run with `ts-node` in development environnements, but you might be encountering issues because of ESM dependencies. -**The scripts will be run using [`bun`](https://bun.sh/docs/installation) and `bunx`. Make sure you have `bun` installed first.** +**This repository uses the [bun](https://bun.sh) toolkit to manage packages and run scripts.Make sure to [install it](https://bun.sh/docs/installation) first.** Then clone this repository and install its dependencies. @@ -38,7 +38,7 @@ cd lukso-playground && bun install ### Run locally -Run the Typescript code of one file within the terminal using `bun`. +Run the TypeScript code of one file within the terminal using `bun`. ```bash bun file-path/script.ts @@ -51,7 +51,3 @@ We highly recommend that developers fetch and store profile or asset data using - IPFS Gateway: `https://api.universalprofile.cloud/ipfs` > LUKSO does not provide an official gateway for uploading asset data. - -### Run in browser - -Open this project on [StackBlitz](https://stackblitz.com/github/lukso-network/lukso-playground) and start coding right away. diff --git a/digital-assets/backend-token-transaction.ts b/digital-assets/backend-token-transaction.ts index c119d46..d46d513 100644 --- a/digital-assets/backend-token-transaction.ts +++ b/digital-assets/backend-token-transaction.ts @@ -11,7 +11,11 @@ const controller = '0x...'; // Replace with the controller address // Instantiate the profile contract with an address const userProfileAddress = '0x...'; // Replace with the user's profile address -const myUniversalProfile = new ethers.Contract(userProfileAddress, UniversalProfile.abi, provider); +const myUniversalProfile = new ethers.Contract( + userProfileAddress, + UniversalProfile.abi, + provider, +); // Instantiate the token contract with an address const tokenAddress = '0x...'; // Replace with the token contract address diff --git a/digital-assets/encode-metadata.ts b/digital-assets/encode-metadata.ts index e14caef..764460e 100644 --- a/digital-assets/encode-metadata.ts +++ b/digital-assets/encode-metadata.ts @@ -1,6 +1,6 @@ import { ERC725 } from '@erc725/erc725.js'; +import { EncodeDataInput } from '@erc725/erc725.js/build/main/src/types/decodeData.js'; import LSP4DigitalAssetSchema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; -import { EncodeDataInput } from '@erc725/erc725.js/build/main/src/types/decodeData'; const LSP4SampleJSON = { LSP4Metadata: { @@ -71,11 +71,19 @@ const lsp4SampleMetadata: EncodeDataInput[] = [ // Encode the new LSP4 metadata as Verifiable URI // https://docs.lukso.tech/tools/erc725js/classes/ERC725#encodedata -const encodedLSP4Metadata = ERC725.encodeData(lsp4SampleMetadata, LSP4DigitalAssetSchema); +const encodedLSP4Metadata = ERC725.encodeData( + lsp4SampleMetadata, + LSP4DigitalAssetSchema, +); console.log(encodedLSP4Metadata); const decodedLSP4Metadata = ERC725.decodeData( - [{ keyName: encodedLSP4Metadata.keys[0], value: encodedLSP4Metadata.values[0] }], + [ + { + keyName: encodedLSP4Metadata.keys[0], + value: encodedLSP4Metadata.values[0], + }, + ], LSP4DigitalAssetSchema, ); diff --git a/digital-assets/extract-asset-data.ts b/digital-assets/extract-asset-data.ts index a25bb2a..834d56c 100644 --- a/digital-assets/extract-asset-data.ts +++ b/digital-assets/extract-asset-data.ts @@ -8,7 +8,8 @@ const IPFS_GATEWAY = 'https://api.universalprofile.cloud/ipfs'; // 💡 Note: You can debug any smart contract by using the ERC725 Tools // 👉 https://erc725-inspect.lukso.tech/inspector?address=0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb&network=mainnet -const SAMPLE_ASSET_CONTRACT_ADDRESS = '0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb'; +const SAMPLE_ASSET_CONTRACT_ADDRESS = + '0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb'; // Parameters for the ERC725 instance const config = { ipfsGateway: IPFS_GATEWAY }; @@ -51,7 +52,10 @@ async function getAssetProperties(assetJSON: any) { try { // Check if images are available - if (assetJSON.value.LSP4Metadata.images && assetJSON.value.LSP4Metadata.images.length > 0) { + if ( + assetJSON.value.LSP4Metadata.images && + assetJSON.value.LSP4Metadata.images.length > 0 + ) { assetImageData = assetJSON.value.LSP4Metadata.images; for (const imageData of assetImageData[0]) { // Assuming the first set of images is what we want @@ -61,16 +65,24 @@ async function getAssetProperties(assetJSON: any) { url: imageData.url.replace('ipfs://', IPFS_GATEWAY), }); } - console.log('Asset Image Links: ' + JSON.stringify(assetImageLinks, undefined, 2) + '\n'); - - fullSizeAssetImage = assetImageLinks.length > 0 ? assetImageLinks[0].url : null; + console.log( + 'Asset Image Links: ' + + JSON.stringify(assetImageLinks, undefined, 2) + + '\n', + ); + + fullSizeAssetImage = + assetImageLinks.length > 0 ? assetImageLinks[0].url : null; console.log('Full Size Asset Image Link: ' + fullSizeAssetImage + '\n'); } else { console.log('Asset does not have image data \n'); } // Check if icons are available - if (assetJSON.value.LSP4Metadata.icon && assetJSON.value.LSP4Metadata.icon.length > 0) { + if ( + assetJSON.value.LSP4Metadata.icon && + assetJSON.value.LSP4Metadata.icon.length > 0 + ) { iconImageData = assetJSON.value.LSP4Metadata.icon; for (const iconData of iconImageData) { assetIconLinks.push({ @@ -78,9 +90,14 @@ async function getAssetProperties(assetJSON: any) { }); } - console.log('Asset Icon Links: ' + JSON.stringify(assetIconLinks, undefined, 2) + '\n'); + console.log( + 'Asset Icon Links: ' + + JSON.stringify(assetIconLinks, undefined, 2) + + '\n', + ); - fullSizeIconImage = assetIconLinks.length > 0 ? assetIconLinks[0].url : null; + fullSizeIconImage = + assetIconLinks.length > 0 ? assetIconLinks[0].url : null; console.log('Full Size Icon Image Link: ' + fullSizeIconImage + '\n'); } else { console.log('Asset does not have icon data'); diff --git a/digital-assets/fetch-tokenid-metadata.ts b/digital-assets/fetch-tokenid-metadata.ts index 26ce54b..050a6ea 100644 --- a/digital-assets/fetch-tokenid-metadata.ts +++ b/digital-assets/fetch-tokenid-metadata.ts @@ -2,7 +2,10 @@ import { ethers } from 'ethers'; import { ERC725 } from '@erc725/erc725.js'; import lsp4Schema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; -import { INTERFACE_IDS, ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants'; +import { + INTERFACE_IDS, + ERC725YDataKeys, +} from '@lukso/lsp-smart-contracts/constants'; import lsp8Artifact from '@lukso/lsp-smart-contracts/artifacts/LSP8IdentifiableDigitalAsset.json'; async function fetchTokenIdMetadata() { @@ -16,13 +19,20 @@ async function fetchTokenIdMetadata() { const provider = new ethers.JsonRpcProvider(RPC_URL); // Create contract instance - const myAsset = new ethers.Contract(SAMPLE_LSP8_ASSET, lsp8Artifact.abi, provider); + const myAsset = new ethers.Contract( + SAMPLE_LSP8_ASSET, + lsp8Artifact.abi, + provider, + ); - const isLSP8 = await myAsset.supportsInterface(INTERFACE_IDS.LSP8IdentifiableDigitalAsset); + const isLSP8 = await myAsset.supportsInterface( + INTERFACE_IDS.LSP8IdentifiableDigitalAsset, + ); if (isLSP8) { // Token ID as Bytes32 value (1) - const tokenID = '0x0000000000000000000000000000000000000000000000000000000000000001'; + const tokenID = + '0x0000000000000000000000000000000000000000000000000000000000000001'; // Get the encoded asset metadata const tokenIdMetadata = await myAsset.getDataForTokenId( @@ -40,7 +50,10 @@ async function fetchTokenIdMetadata() { }, ]); - console.log('Contract Metadata: ', JSON.stringify(decodedMetadata, undefined, 2)); + console.log( + 'Contract Metadata: ', + JSON.stringify(decodedMetadata, undefined, 2), + ); // Prepare IPFS link to fetch const contentID = decodedMetadata[0].value.url.replace('ipfs://', ''); diff --git a/interface-detection/erc165-interface-check.ts b/interface-detection/erc165-interface-check.ts index 0fd981d..a467651 100644 --- a/interface-detection/erc165-interface-check.ts +++ b/interface-detection/erc165-interface-check.ts @@ -9,7 +9,8 @@ import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; // 💡 Note: You can debug any smart contract by using the ERC725 Tools // 👉 https://erc725-inspect.lukso.tech/inspector?address=0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb&network=mainnet -const SAMPLE_ASSET_CONTRACT_ADDRESS = '0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb'; +const SAMPLE_ASSET_CONTRACT_ADDRESS = + '0x61b083f1fb63ba2F064990f01B233B547ED4F5Cb'; // https://docs.lukso.tech/networks/mainnet/parameters const RPC_URL = 'https://rpc.lukso.gateway.fm'; @@ -20,20 +21,27 @@ const myAsset = new ERC725(lsp4Schema, SAMPLE_ASSET_CONTRACT_ADDRESS, RPC_URL, { const isLSP7 = await myAsset.supportsInterface(INTERFACE_IDS.LSP7DigitalAsset); -const isLSP8 = await myAsset.supportsInterface(INTERFACE_IDS.LSP8IdentifiableDigitalAsset); +const isLSP8 = await myAsset.supportsInterface( + INTERFACE_IDS.LSP8IdentifiableDigitalAsset, +); if (isLSP7) { - console.log(`✅ The contract: ${SAMPLE_ASSET_CONTRACT_ADDRESS} supports the LSP7 interface ID`); + console.log( + `✅ The contract: ${SAMPLE_ASSET_CONTRACT_ADDRESS} supports the LSP7 interface ID`, + ); } if (isLSP8) { - console.log(`✅ The contract: ${SAMPLE_ASSET_CONTRACT_ADDRESS} supports the LSP8 interface ID`); + console.log( + `✅ The contract: ${SAMPLE_ASSET_CONTRACT_ADDRESS} supports the LSP8 interface ID`, + ); } const provider = new ethers.JsonRpcProvider(RPC_URL); // 💡 Note: You can debug any smart contract by using the ERC725 Tools // 👉 https://erc725-inspect.lukso.tech/inspector?address=0xe65e927d0eccaaab6972170b489d3c1455955116&network=mainnet -const universalProfileContractAddress = '0xe65e927d0eccaaab6972170b489d3c1455955116'; +const universalProfileContractAddress = + '0xe65e927d0eccaaab6972170b489d3c1455955116'; // Create an instance of the Universal Profile const myProfileContract = new ethers.Contract( @@ -42,7 +50,9 @@ const myProfileContract = new ethers.Contract( provider, ); -const isLSP0 = await myProfileContract.supportsInterface(INTERFACE_IDS.LSP0ERC725Account); +const isLSP0 = await myProfileContract.supportsInterface( + INTERFACE_IDS.LSP0ERC725Account, +); if (isLSP0) { console.log( diff --git a/key-manager/set-permissions.ts b/key-manager/set-permissions.ts index caaaa32..f055e8b 100644 --- a/key-manager/set-permissions.ts +++ b/key-manager/set-permissions.ts @@ -1,5 +1,8 @@ import { ethers } from 'ethers'; -import { PERMISSIONS, ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants'; +import { + PERMISSIONS, + ERC725YDataKeys, +} from '@lukso/lsp-smart-contracts/constants'; import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; // Connect to the LUKSO Testnet @@ -9,7 +12,8 @@ const provider = new ethers.JsonRpcProvider(RPC_ENDPOINT); const myUniversalProfileAddress = '0x9fc7e5095A054dfA3c6b237E0e5d686638394248'; const myKeyManagerAddress = '0x87fa9105cA247897Acb4F12Ddf6EC3CEF23F6059'; -const walletPrivateKey = '0x...'; // Replace with your wallet's private key +const walletPrivateKey = + '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'; // Replace with your wallet's private key const wallet = new ethers.Wallet(walletPrivateKey, provider); const universalProfile = new ethers.Contract( @@ -26,9 +30,11 @@ const bobPermissions = PERMISSIONS.SETDATA; async function setPermission() { try { const permissionData = [ - ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + bobAddress.substring(2), // allow Bob to setData on your UP + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + + bobAddress.substring(2), // allow Bob to setData on your UP ERC725YDataKeys.LSP6['AddressPermissions[]'].length, // length of AddressPermissions[] - ERC725YDataKeys.LSP6['AddressPermissions[]'].index + '00000000000000000000000000000001', // add Bob's address into the list of permissions + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + + '00000000000000000000000000000001', // add Bob's address into the list of permissions ]; const permissionParams = [ diff --git a/metadata-detection/digital-asset-check.ts b/metadata-detection/digital-asset-check.ts index 4976866..aa4c357 100644 --- a/metadata-detection/digital-asset-check.ts +++ b/metadata-detection/digital-asset-check.ts @@ -6,7 +6,12 @@ import lsp4Schema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; const assetContractAddress = '0x86e817172b5c07f7036bf8aa46e2db9063743a83'; // Initatiate erc725.js -const erc725js = new ERC725(lsp4Schema, assetContractAddress, 'https://rpc.lukso.gateway.fm', {}); +const erc725js = new ERC725( + lsp4Schema, + assetContractAddress, + 'https://rpc.lukso.gateway.fm', + {}, +); // Verify if the standard is supported (value !== null) // 📚 https://docs.lukso.tech/standards/tokens/LSP4-Digital-Asset-Metadata#supportedstandardslsp4digitalasset @@ -14,7 +19,9 @@ const data = await erc725js.getData('SupportedStandards:LSP4DigitalAsset'); const isLSP4 = data.value !== null; if (isLSP4) { - console.log(`✅ The contract: ${assetContractAddress} supports the LSP4DigitalAsset standard`); + console.log( + `✅ The contract: ${assetContractAddress} supports the LSP4DigitalAsset standard`, + ); } else { console.log( `❌ The address: ${assetContractAddress} does not supports the LSP4DigitalAsset standard`, diff --git a/metadata-detection/profile-check.ts b/metadata-detection/profile-check.ts index 9388b73..11c8bdb 100644 --- a/metadata-detection/profile-check.ts +++ b/metadata-detection/profile-check.ts @@ -20,7 +20,9 @@ const data = await erc725js.getData('SupportedStandards:LSP3Profile'); const isLSP3 = data.value !== null; if (isLSP3) { - console.log(`✅ The contract: ${profileContractAddress} supports the LSP3Profile standard`); + console.log( + `✅ The contract: ${profileContractAddress} supports the LSP3Profile standard`, + ); } else { console.log( `❌ The address: ${profileContractAddress} does not supports the LSP3Profile standard`, diff --git a/metadata-detection/vault-check.ts b/metadata-detection/vault-check.ts index b1c88b4..893ce87 100644 --- a/metadata-detection/vault-check.ts +++ b/metadata-detection/vault-check.ts @@ -19,7 +19,11 @@ const data = await erc725js.getData('SupportedStandards:LSP9Vault'); const isLSP9 = data.value !== null; if (isLSP9) { - console.log(`✅ The contract: ${vaultContractAddress} supports the LSP9Vault standard`); + console.log( + `✅ The contract: ${vaultContractAddress} supports the LSP9Vault standard`, + ); } else { - console.log(`❌ The address: ${vaultContractAddress} does not supports the LSP9Vault standard`); + console.log( + `❌ The address: ${vaultContractAddress} does not supports the LSP9Vault standard`, + ); } diff --git a/package.json b/package.json index a92a049..77e072f 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ }, "homepage": "https://github.com/lukso-network/lukso-playground#readme", "scripts": { - "lint": "eslint . --ext .ts,.js", - "lint:fix": "eslint . --ext .ts,.js --fix" + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "devDependencies": { "@erc725/erc725.js": "^0.23.0", diff --git a/smart-contracts-hardhat/.eslintrc.json b/smart-contracts-hardhat/.eslintrc.json new file mode 100644 index 0000000..53818c2 --- /dev/null +++ b/smart-contracts-hardhat/.eslintrc.json @@ -0,0 +1,13 @@ +{ + "ignorePatterns": ["artifacts/", "cache/", "dist/", "types/", "contracts.ts"], + "plugins": ["@typescript-eslint/eslint-plugin", "prettier"], + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "rules": { + "prettier/prettier": "error", + "@typescript-eslint/no-explicit-any": "off" + }, + "root": true +} diff --git a/smart-contracts-hardhat/.prettierrc b/smart-contracts-hardhat/.prettierrc new file mode 100644 index 0000000..d00fc29 --- /dev/null +++ b/smart-contracts-hardhat/.prettierrc @@ -0,0 +1,23 @@ +{ + "plugins": ["prettier-plugin-solidity"], + "overrides": [ + { + "files": ["*.js", "*.ts"], + "options": { + "tabWidth": 2, + "printWidth": 100, + "trailingComma": "all", + "singleQuote": true, + "semi": true + } + }, + { + "files": "*.sol", + "options": { + "tabWidth": 4, + "printWidth": 80, + "compiler": "0.8.15" + } + } + ] +} diff --git a/smart-contracts-hardhat/README.md b/smart-contracts-hardhat/README.md index 725ac3b..d1eca63 100644 --- a/smart-contracts-hardhat/README.md +++ b/smart-contracts-hardhat/README.md @@ -9,6 +9,8 @@ This project is used as a guide to show how to setup HardHat to interact with ** ## Setup +**This Hardhat repository uses the [bun](https://bun.sh) package manager. Make sure to [install it](https://bun.sh/docs/installation) first.** + Install the dependencies ```bash diff --git a/smart-contracts-hardhat/bun.lockb b/smart-contracts-hardhat/bun.lockb index 77769ac..da7d3d0 100755 Binary files a/smart-contracts-hardhat/bun.lockb and b/smart-contracts-hardhat/bun.lockb differ diff --git a/smart-contracts-hardhat/package.json b/smart-contracts-hardhat/package.json index f192d32..b9ec641 100644 --- a/smart-contracts-hardhat/package.json +++ b/smart-contracts-hardhat/package.json @@ -5,7 +5,9 @@ }, "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^3.0.0", + "@typescript-eslint/eslint-plugin": "^7.0.2", "dotenv": "^16.3.1", + "eslint": "^8.56.0", "ethers": "^6.10.0", "hardhat": "^2.19.5", "prettier": "^3.2.5", diff --git a/transfer-lyx/backend-lyx-transaction.ts b/transfer-lyx/backend-lyx-transaction.ts index 979d5cc..edc376e 100644 --- a/transfer-lyx/backend-lyx-transaction.ts +++ b/transfer-lyx/backend-lyx-transaction.ts @@ -13,7 +13,11 @@ const controller = '0x...'; // Replace with the controller address // Instantiate Universal Profile const userProfileAddress = '0x...'; // Replace with the user's profile address -const myUniversalProfile = new ethers.Contract(userProfileAddress, UniversalProfile.abi, provider); +const myUniversalProfile = new ethers.Contract( + userProfileAddress, + UniversalProfile.abi, + provider, +); (async () => { try { diff --git a/universal-profile/extract-profile-data.ts b/universal-profile/extract-profile-data.ts index 7797f25..1e89581 100644 --- a/universal-profile/extract-profile-data.ts +++ b/universal-profile/extract-profile-data.ts @@ -109,7 +109,10 @@ async function fetchPictureData(address: string) { } for (const i in profileImagesIPFS) { - profileImageLinks.push([i, profileImagesIPFS[i].url.replace('ipfs://', IPFS_GATEWAY)]); + profileImageLinks.push([ + i, + profileImagesIPFS[i].url.replace('ipfs://', IPFS_GATEWAY), + ]); } fullSizeBackgroundImg = backgroundImageLinks[0][1]; @@ -119,10 +122,14 @@ async function fetchPictureData(address: string) { console.log('Fullsize Background Image: ' + fullSizeBackgroundImg + '\n'); console.log('Fullsize Background Image: ' + fullSizeProfileImg + '\n'); console.log( - 'Background Image Links: ' + JSON.stringify(backgroundImageLinks, undefined, 2) + '\n', + 'Background Image Links: ' + + JSON.stringify(backgroundImageLinks, undefined, 2) + + '\n', ); console.log( - 'Background Image Links: ' + JSON.stringify(profileImageLinks, undefined, 2) + '\n', + 'Background Image Links: ' + + JSON.stringify(profileImageLinks, undefined, 2) + + '\n', ); } catch (error) { return console.log('Could not fetch images: ', error); diff --git a/universal-profile/fetch-json-data.ts b/universal-profile/fetch-json-data.ts index 4942a17..46731e7 100644 --- a/universal-profile/fetch-json-data.ts +++ b/universal-profile/fetch-json-data.ts @@ -27,5 +27,7 @@ const receivedAssetsDataKey = await erc725js.fetchData('LSP5ReceivedAssets[]'); console.log(receivedAssetsDataKey); // Fetch the profile's universal receiver -const universalReceiverDataKey = await erc725js.fetchData('LSP1UniversalReceiverDelegate'); +const universalReceiverDataKey = await erc725js.fetchData( + 'LSP1UniversalReceiverDelegate', +); console.log(universalReceiverDataKey); diff --git a/universal-profile/get-controller-permissions.ts b/universal-profile/get-controller-permissions.ts index cdd1968..a6934bf 100644 --- a/universal-profile/get-controller-permissions.ts +++ b/universal-profile/get-controller-permissions.ts @@ -19,7 +19,10 @@ async function getPermissionedAddresses() { const result = await erc725.getData('AddressPermissions[]'); if (!result) { - console.error('No controllers listed under UP at address ', myUniversalProfileAddress); + console.error( + 'No controllers listed under UP at address ', + myUniversalProfileAddress, + ); } if (Array.isArray(result.value)) { @@ -33,11 +36,14 @@ async function getPermissionedAddresses() { }); // Decode the permission of each address - const decodedPermission = erc725.decodePermissions(addressPermission.value as string); + const decodedPermission = erc725.decodePermissions( + addressPermission.value as string, + ); // Display the permission in a readable format console.log( - `decoded permission for ${address} = ` + JSON.stringify(decodedPermission, null, 2), + `decoded permission for ${address} = ` + + JSON.stringify(decodedPermission, null, 2), ); } } diff --git a/universal-profile/register-asset-backend.ts b/universal-profile/register-asset-backend.ts index 09cf244..f26b43d 100644 --- a/universal-profile/register-asset-backend.ts +++ b/universal-profile/register-asset-backend.ts @@ -36,9 +36,14 @@ const provider = new ethers.JsonRpcProvider(RPC_ENDPOINT); const myWallet = new ethers.Wallet(PRIVATE_KEY, provider); // 1. encode the data keys related to LSP12IssuedAssets[] -const erc725 = new ERC725(LSP12Schema, UNIVERSAL_PROFILE_ADDRESS, RPC_ENDPOINT, { - ipfsGateway: 'https://api.universalprofile.cloud/ipfs', -}); +const erc725 = new ERC725( + LSP12Schema, + UNIVERSAL_PROFILE_ADDRESS, + RPC_ENDPOINT, + { + ipfsGateway: 'https://api.universalprofile.cloud/ipfs', + }, +); const allAssetAddresses = issuedAssets.map((asset) => asset.address);