Skip to content

Commit

Permalink
Merge pull request #602 from lukso-network/fix-prettier
Browse files Browse the repository at this point in the history
Improve prettier
  • Loading branch information
Hugoo authored Aug 14, 2023
2 parents 950c09c + 3947c3f commit ef2db4c
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Install ⚙️
run: yarn install --frozen-lockfile

- name: Lint 🎨
run: yarn run lint
- name: Prettier 🎨
run: yarn run prettier

- name: Build 🛠
run: yarn build
Expand Down
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
CODEOWNERS
CODEOWNERS

# The files are autogenerated
docs/contracts
7 changes: 1 addition & 6 deletions docs/guides/browser-extension/install-browser-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ Click on link below to download the extension, based on the browser to which you

### :inbox_tray: **[Download from Chrome Web Store](https://chrome.google.com/webstore/detail/universal-profiles/abpickdkkbnbcoepogfhkhennhfhehfn) (Chrome / Brave)**


### :inbox_tray: **[Download Archive](https://storage.googleapis.com/up-browser-extension/universalprofile-extension-v1.4.0-mv2.zip) (All other browsers)**

## Unpack the archive

Open your download folder and unpack the ZIP archive by opening the file.

## Install the extension
## Install the extension

<Tabs>
<TabItem value="chrome" label="Chrome / Brave">
Expand All @@ -60,8 +59,6 @@ Open your download folder and unpack the ZIP archive by opening the file.

![Chrome Store view](/img/extension/chrome-store.png)



</TabItem>
<TabItem value="edge" label="Edge">

Expand Down Expand Up @@ -148,8 +145,6 @@ Open the extension by clicking its icon from the menu bar.

![Step 5 - Opera: Open Extension](/img/extension/opera5.png)



</TabItem>
<TabItem value="firefox" label="Firefox">

Expand Down
16 changes: 16 additions & 0 deletions docs/guides/digital-assets/transfer-lsp7-digital-asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Finally we send the transaction and transfer the tokens from a Universal Profile

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```javascript
// execute the token transfer through the UP
await myUniversalProfile.methods.execute(
Expand All @@ -186,10 +188,14 @@ await myUniversalProfile.methods.execute(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">

<!-- prettier-ignore-start -->

```javascript
// execute the token transfer through the UP
await myUniversalProfile
Expand All @@ -202,6 +208,8 @@ await myUniversalProfile
);
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
Expand All @@ -212,6 +220,8 @@ await myUniversalProfile

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```javascript
import LSP7Mintable from '@lukso/lsp-smart-contracts/artifacts/LSP7Mintable.json';
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
Expand Down Expand Up @@ -256,10 +266,14 @@ await myUniversalProfile.methods.execute(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">

<!-- prettier-ignore-start -->

```javascript
import LSP7Mintable from '@lukso/lsp-smart-contracts/artifacts/LSP7Mintable.json';
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
Expand Down Expand Up @@ -303,6 +317,8 @@ await myUniversalProfile
);
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
16 changes: 16 additions & 0 deletions docs/guides/key-manager/give-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ const PRIVATE_KEY = '0x...'; // your EOA private key (previously created)

<TabItem value="ethersjs" label="ethers.js">

<!-- prettier-ignore-start -->

```javascript title="Load account from a private key"
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import { ethers } from 'ethers';
Expand All @@ -166,6 +168,8 @@ const myUniversalProfileAddress = '0x...';
const PRIVATE_KEY = '0x...'; // your EOA private key (previously created)
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
Expand Down Expand Up @@ -248,6 +252,8 @@ We will then encode this permission data keys in a `setData(...)` payload and in

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```js
// step 3.3 - send the transaction
await myUniversalProfile.methods.setData(
Expand All @@ -259,17 +265,23 @@ await myUniversalProfile.methods.setData(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">

<!-- prettier-ignore-start -->

```js
// step 3.3 - send the transaction
await myUniversalProfile
.connect(account)
.setData(data.keys, data.values);
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
Expand All @@ -280,6 +292,8 @@ await myUniversalProfile

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```js
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import { ERC725 } from '@erc725/erc725.js';
Expand Down Expand Up @@ -351,6 +365,8 @@ async function grantPermissions() {
grantPermissions();
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">
Expand Down
11 changes: 7 additions & 4 deletions docs/guides/universal-profile/edit-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ const universalProfileContract = new web3.eth.Contract(

The final step is to edit our `LSP3Profile` key on our Universal Profile with the new value obtained in **Step 3**. We can easily access the key-value pair from the encoded data obtained with erc725.js.

<!-- prettier-ignore-start -->

```javascript title="Preparing and executing the setData transaction"
// Step 4.3 - Update LSP3Profile metadata on our Universal Profile
await universalProfileContract.methods.setData(
Expand All @@ -330,6 +332,8 @@ await universalProfileContract.methods.setData(
).send({ from: myEOA.address, gasLimit: 300_000 });
```

<!-- prettier-ignore-end -->

## Final Code

Below is the complete code snippet of this guide, with all the steps compiled together.
Expand Down Expand Up @@ -442,10 +446,9 @@ async function editProfileInfo() {
);

// Step 4.3 - Set data (updated LSP3Profile metadata) on our Universal Profile
await universalProfileContract.methods.setData(
encodedData.keys,
encodedData.values,
).send({ from: myEOA.address, gasLimit: 300_000 });
await universalProfileContract.methods
.setData(encodedData.keys, encodedData.values)
.send({ from: myEOA.address, gasLimit: 300_000 });
}
editProfileInfo();
```
Expand Down
13 changes: 13 additions & 0 deletions docs/guides/universal-profile/interact-with-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ The final step is to pass the encoded calldata to the Universal Profile. Since w

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```typescript title="Send transaction"
await universalProfile.methods.execute(
OPERATION_CALL,
Expand All @@ -224,10 +226,14 @@ await universalProfile.methods.execute(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">

<!-- prettier-ignore-start -->

```typescript title="Send transaction"
await universalProfile
.connect(EOA)
Expand All @@ -239,6 +245,8 @@ await universalProfile
);
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
Expand All @@ -249,6 +257,8 @@ await universalProfile

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```typescript title="Final code"
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import TargetContractABI from './TargetContractABI.json';
Expand Down Expand Up @@ -294,6 +304,7 @@ await universalProfile.methods.execute(

<TabItem value="ethersjs" label="ethers.js">


```typescript title="Final code"
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import TargetContractABI from './TargetContractABI.json';
Expand Down Expand Up @@ -339,6 +350,8 @@ await universalProfile
);
```

<!-- prettier-ignore-end -->

</TabItem>

</Tabs>
8 changes: 8 additions & 0 deletions docs/guides/vault/restrict-addresses-to-vaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ Finally we will send a transaction that will update the Universal Profile Allowe

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```typescript title="Set the data key on the Universal Profile"
// Set the AllowedCalls data key on the Universal Profile
await universalProfile.methods.setData(
Expand All @@ -217,6 +219,8 @@ await universalProfile.methods.setData(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">
Expand All @@ -238,6 +242,8 @@ await universalProfile

<TabItem value="web3js" label="web3.js">

<!-- prettier-ignore-start -->

```typescript title="Setting Allowed Addresses for the 3rd party address"
import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json';
import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants.js';
Expand Down Expand Up @@ -288,6 +294,8 @@ await universalProfile.methods.setData(
});
```

<!-- prettier-ignore-end -->

</TabItem>

<TabItem value="ethersjs" label="ethers.js">
Expand Down
2 changes: 1 addition & 1 deletion docs/standards/nft-2.0/LSP4-Digital-Asset-Metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sidebar_position: 2

## Introduction

The existing tokens and NFTs standards offer limited functionalities to attach information to the contracts themselves. As an example, the ERC20 and ERC721 standards only define a **`name()`**, **`symbol()`**, and **`tokenURI()`** functions. This makes it difficult to add information more specific to the asset (_e.g., an icon, the asset creator(s) , the utility or motive of the token, the community behind it, etc...). Such information is crucial to make each token or NFT descriptive and customised.
The existing tokens and NFTs standards offer limited functionalities to attach information to the contracts themselves. As an example, the ERC20 and ERC721 standards only define a **`name()`**, **`symbol()`**, and **`tokenURI()`** functions. This makes it difficult to add information more specific to the asset (e.g., an icon, the asset creator(s) , the utility or motive of the token, the community behind it, etc...). Such information is crucial to make each token or NFT descriptive and customised.

**LSP4-DigitalAsset-Metadata** solves this problem by defining a set of data keys to describe a **Digital Asset** using [ERC725Y](https://github.com/ERC725Alliance/ERC725/blob/main/docs/ERC-725.md#erc725y) as a backbone. ERC725Y enables smart contracts to have very flexible and extensible storage. With ERC725Y, any information or metadata can be attached to the token or NFT.

Expand Down
1 change: 0 additions & 1 deletion docs/standards/universal-profile/lsp12-issued-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,3 @@ The full **verification flow** for an asset should contain a check on the **asse
- **Step 2:** Should check on the address retrieved in **Step 1** that the address of the asset being checked, matches one of the assets addresses stored in the **[LSP12IssuedAssets Array](#lsp12issuedassets)** of the UniversalProfile.

![Checking LSP12IssuedAssets Array on UP](../../../static/img/standards/lsp12/lsp12-issuedassets3.jpeg)

Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ await LSP4DigitalAssetMetadata.uploadMetadata(

#### Upload Custom LSP4 Metadata Example

<!-- prettier-ignore-start -->

```javascript title="Uploading LSP4Metadata using custom upload options"
await LSP4DigitalAssetMetadata.uploadMetadata(
{
Expand Down Expand Up @@ -438,6 +440,7 @@ await lspFactory.LSP4DigitalAssetMetadata.uploadMetadata({
}
*/
```
<!-- prettier-ignore-end -->

[ipfs-http-client library]: https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client#createoptions
[lsp4]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"write-heading-ids": "docusaurus write-heading-ids",
"docs:tools:sync": "bash scripts/tools-sync.sh",
"docs:contracts:sync": "bash scripts/contracts-sync.sh",
"lint": "prettier --check \"src/**/*.js\""
"prettier": "prettier \"src/**/*.js\" \"docs/**/*.md\" --check"
},
"dependencies": {
"@docusaurus/core": "^2.4.0",
Expand Down

0 comments on commit ef2db4c

Please sign in to comment.