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

Update Tools Documentation #1155

Open
wants to merge 1 commit into
base: main
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tools/libraries/erc725js/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are 3 main ways to use _erc725.js_.

### Option 1: use a schema for encoding / decoding data

Create an instance of `ERC725` with just a [schema](https://docs.lukso.tech/tools/libraries/erc725js/schemas). **Useful for just encoding / decoding data.**
Create an instance of `ERC725` with just a [schema](https://docs.lukso.tech/tools/erc725js/schemas). **Useful for just encoding / decoding data.**

```js
import ERC725, { ERC725JSONSchema } from '@erc725/erc725.js';
Expand Down
91 changes: 46 additions & 45 deletions docs/tools/libraries/erc725js/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,13 @@ ERC725.encodeData(
import ERC725 from '@erc725/erc725.js';

const schemas = [
{
name: 'AddressPermissions:AllowedCalls:<address>',
key: '0x4b80742de2bf393a64c70000<address>',
keyType: 'MappingWithGrouping',
valueType: '(bytes4,address,bytes4,bytes4)[CompactBytesArray]',
valueContent: '(BitArray,Address,Bytes4,Bytes4)',
}
{
name: 'AddressPermissions:AllowedCalls:<address>',
key: '0x4b80742de2bf393a64c70000<address>',
keyType: 'MappingWithGrouping',
valueType: '(bytes4,address,bytes4,bytes4)[CompactBytesArray]',
valueContent: '(BitArray,Address,Bytes4,Bytes4)',
}
];

ERC725.encodeData(
Expand All @@ -530,23 +530,25 @@ ERC725.encodeData(
keyName: 'AddressPermissions:AllowedCalls:<address>',
dynamicKeyParts: "0xcafecafecafecafecafecafecafecafecafecafe"
value: [
'0x00000003', // CALL and TRANSFERVALUE
'0xCA41e4ea94c8fA99889c8EA2c8948768cBaf4bc0', // addresses are decoded as checksummed
'0x3e89ad98', // LSP0 interface ID
'0xffffffff', // any function
],
[
'0x00000002', // CALL only
'0xF70Ce3b58f275A4c28d06C98615760dDe774DE57',
'0xffffffff', // any standard interface ID
'0x760d9bba', // function selector of `transfer(address,address,uint256,bool,bytes)`
],
[
'0x00000001', // TRANSFERVALUE only
'0xd3236aa1B8A4dDe5eA375fd1F2Fb5c354e686c9f',
'0xffffffff', // any standard interface ID
'0xffffffff', // any function
],
[
'0x00000003', // CALL and TRANSFERVALUE
'0xCA41e4ea94c8fA99889c8EA2c8948768cBaf4bc0', // addresses are decoded as checksummed
'0x3e89ad98', // LSP0 interface ID
'0xffffffff', // any function
],
[
'0x00000002', // CALL only
'0xF70Ce3b58f275A4c28d06C98615760dDe774DE57',
'0xffffffff', // any standard interface ID
'0x760d9bba', // function selector of `transfer(address,address,uint256,bool,bytes)`
],
[
'0x00000001', // TRANSFERVALUE only
'0xd3236aa1B8A4dDe5eA375fd1F2Fb5c354e686c9f',
'0xffffffff', // any standard interface ID
'0xffffffff', // any function
],
]
},
],
schemas,
Expand Down Expand Up @@ -1123,9 +1125,9 @@ myErc725.decodeValueType(
// [ 10, 20, 30 ]

myErc725.decodeValueType(
'uint256[CompactBytesArray]'',
'0x0020000000000000000000000000000000000000000000000000000000000000000500200000000000000000000000000000000000000000000000000000000000000008'
)
'uint256[CompactBytesArray]',
'0x0020000000000000000000000000000000000000000000000000000000000000000500200000000000000000000000000000000000000000000000000000000000000008',
);
// [ 5, 8 ]
```

Expand Down Expand Up @@ -1941,8 +1943,8 @@ await myErc725.isValidSignature(
// false
```

[lsp6 keymanager permissions]: ../../../standards/access-control/lsp6-key-manager#permissions
[lsp6 keymanager standard]: ../../../standards/access-control/lsp6-key-manager
[lsp6 keymanager permissions]: ../../../../../standards/universal-profile/lsp6-key-manager#permissions
[lsp6 keymanager standard]: https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager
[lsp-2 erc725yjsonschema]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md

### supportsInterface
Expand All @@ -1967,18 +1969,18 @@ The `interfaceId` is not the most secure way to check for a standard, as they co

Either a string of the hexadecimal `interfaceID` as defined by [ERC165](https://eips.ethereum.org/EIPS/eip-165) or one of the predefined interface names:

| interfaceName | Standard |
| :------------------------------ | :------------------------------------------------------------------------------------------------------ |
| `ERC1271` | [EIP-1271: Standard Signature Validation Method for Contracts](https://eips.ethereum.org/EIPS/eip-1271) |
| `ERC725X` | [EIP-725: General execution standard](https://eips.ethereum.org/EIPS/eip-725) |
| `ERC725Y` | [EIP-725: General key-value store](https://eips.ethereum.org/EIPS/eip-725) |
| `LSP0ERC725Account` | [LSP-0: ERC725 Account](../../../standards/accounts/lsp0-erc725account) |
| `LSP1UniversalReceiver` | [LSP-1: Universal Receiver](../../../standards/accounts/lsp1-universal-receiver) |
| `LSP1UniversalReceiverDelegate` | [LSP-1: Universal Receiver Delegate](../../../standards/accounts/lsp1-universal-receiver-delegate) |
| `LSP6KeyManager` | [LSP-6: Key Manager](../../../standards/access-control/lsp6-key-manager) |
| `LSP7DigitalAsset` | [LSP-7: Digital Asset](../../../standards/tokens/LSP7-Digital-Asset.md) |
| `LSP8IdentifiableDigitalAsset` | [LSP-8: Identifiable Digital Asset](../../../standards/tokens/LSP8-Identifiable-Digital-Asset.md) |
| `LSP9Vault` | [LSP-9: Vault](../../../standards/accounts/lsp9-vault) |
| interfaceName | Standard |
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------- |
| `ERC1271` | [EIP-1271: Standard Signature Validation Method for Contracts](https://eips.ethereum.org/EIPS/eip-1271) |
| `ERC725X` | [EIP-725: General execution standard](https://eips.ethereum.org/EIPS/eip-725) |
| `ERC725Y` | [EIP-725: General key-value store](https://eips.ethereum.org/EIPS/eip-725) |
| `LSP0ERC725Account` | [LSP-0: ERC725 Account](https://docs.lukso.tech/standards/universal-profile/lsp0-erc725account) |
| `LSP1UniversalReceiver` | [LSP-1: Universal Receiver](https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver) |
| `LSP1UniversalReceiverDelegate` | [LSP-1: Universal Receiver Delegate](https://docs.lukso.tech/standards/universal-profile/lsp1-universal-receiver-delegate) |
| `LSP6KeyManager` | [LSP-6: Key Manager](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager) |
| `LSP7DigitalAsset` | [LSP-7: Digital Asset](https://docs.lukso.tech/standards/nft-2.0/LSP7-Digital-Asset) |
| `LSP8IdentifiableDigitalAsset` | [LSP-8: Identifiable Digital Asset](https://docs.lukso.tech/standards/nft-2.0/LSP8-Identifiable-Digital-Asset) |
| `LSP9Vault` | [LSP-9: Vault](https://docs.lukso.tech/standards/universal-profile/lsp9-vault) |

:::info

Expand Down Expand Up @@ -2556,8 +2558,7 @@ myErc725.checkPermissions(requiredPermissions, grantedPermissions);
ERC725.checkPermissions(requiredPermissions, grantedPermissions);
```

Check if the required permissions are included in the granted permissions
as defined by the [LSP6 KeyManager Standard](../../../standards/access-control/lsp6-key-manager.md).
Check if the required permissions are included in the granted permissions as defined by the [LSP6 KeyManager Standard](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager).

:::info

Expand Down Expand Up @@ -2631,7 +2632,7 @@ myErc725.checkPermissions(requiredPermissions, grantedPermissions);
ERC725.encodePermissions(permissions);
```

Encodes permissions into a hexadecimal string as defined by the [LSP6 KeyManager Standard](../../../standards/access-control/lsp6-key-manager.md).
Encodes permissions into a hexadecimal string as defined by the [LSP6 KeyManager Standard](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager).

:::info

Expand Down Expand Up @@ -2712,7 +2713,7 @@ myErc725.encodePermissions({
ERC725.decodePermissions(permission);
```

Decodes permissions from hexadecimal defined by the [LSP6 KeyManager Standard](../../../standards/access-control/lsp6-key-manager.md).
Decodes permissions from hexadecimal defined by the [LSP6 KeyManager Standard](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager).

:::info

Expand Down
4 changes: 2 additions & 2 deletions docs/tools/libraries/erc725js/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ For more details on schemas, see the [**official specification** of the LSP2 ERC

:::

The ⚒️ [erc725.js](https://npmjs.com/package/@erc725/erc725.js) library works with [ERC725Y JSON schemas](../../../standards/metadata/lsp2-json-schema). These schemas are JSON structures that tell developers and programs how to decode and encode 🗂️ [ERC725Y data keys](../../../standards/erc725#erc725y-generic-data-keyvalue-store) from any [ERC725Y](https://eips.ethereum.org/EIPS/eip-725) smart contract.. You need to load the required schemas of the data keys you want to fetch when initializing the `ERC725` class.
The ⚒️ [erc725.js](https://npmjs.com/package/@erc725/erc725.js) library works with [ERC725Y JSON schemas](../../standards/generic-standards/lsp2-json-schema). These schemas are JSON structures that tell developers and programs how to decode and encode 🗂️ [ERC725Y data keys](../../standards/lsp-background/erc725#erc725y-generic-data-keyvalue-store) from any [ERC725Y](https://eips.ethereum.org/EIPS/eip-725) smart contract.. You need to load the required schemas of the data keys you want to fetch when initializing the `ERC725` class.

The most common and standard schemas are available directly within the _erc725.js_ library. But you can also create and load your own ERC725Y JSON schemas if you want to use custom data keys.
The most common and standard schemas are [available](../../tools/erc725js/schemas.md) directly within the _erc725.js_ library. But you can also create and load your own ERC725Y JSON schemas if you want to use custom data keys.

_A quick reference for keys used in schema definitions can be seen below_

Expand Down