Skip to content

Commit

Permalink
Merge pull request #170 from ERC725Alliance/develop
Browse files Browse the repository at this point in the history
Release v0.13.0
  • Loading branch information
Hugoo authored Jun 2, 2022
2 parents ebea7f5 + a7602d7 commit 0c75f63
Show file tree
Hide file tree
Showing 30 changed files with 1,348 additions and 635 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.13.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.12.0...v0.13.0) (2022-06-02)

### ⚠ BREAKING CHANGES

- remove old LSP2 Key Types (Bytes20..)

### Features

- add dynamic keys for encodeKeyName ([#168](https://github.com/ERC725Alliance/erc725.js/issues/168)) ([fc614b0](https://github.com/ERC725Alliance/erc725.js/commit/fc614b0b92d3b5c7b86586f4be7e3200ea9680cf))

### improvement

- change fetchData output to non object ([1d4d570](https://github.com/ERC725Alliance/erc725.js/commit/1d4d57077a7766b3490477efb20f194fc4e00da4))
- remove old LSP2 Key Types (Bytes20..) ([1e1cd43](https://github.com/ERC725Alliance/erc725.js/commit/1e1cd43e7693db5f12200aef6e282fa14e655ec3))

## [0.12.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.11.1...v0.12.0) (2022-05-19)

### ⚠ BREAKING CHANGES
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Web3 from 'web3';
const schema = [
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b6b89135626455000000000000000000000000abe425d6',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
keyType: 'Mapping',
valueContent: '0xabe425d6',
valueType: 'bytes',
Expand Down
66 changes: 39 additions & 27 deletions docs/classes/ERC725.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ const decodedDataOneKey = erc725.decodeData({
const decodedDataManyKeys = erc725.decodeData({
LSP3Profile:
'0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178',
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
{
key: '0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0',
key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
value:
'0x0000000000000000000000000000000000000000000000000000000000000002',
},
{
key: '0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000000',
key: '0x7c8c3416d6cda87cd42c71ea1843df2800000000000000000000000000000000',
value: '0xd94353d9b005b3c0a9da169b768a31c57844e490',
},
{
key: '0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000001',
key: '0x7c8c3416d6cda87cd42c71ea1843df2800000000000000000000000000000001',
value: '0xdaea594e385fc724449e3118b2db7e86dfba1826',
},
],
Expand All @@ -77,7 +77,7 @@ const decodedDataManyKeys = erc725.decodeData({
hashFunction: 'keccak256(utf8)',
url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx',
},
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
'0xD94353D9B005B3c0A9Da169b768a31C57844e490',
'0xDaea594E385Fc724449E3118B2Db7E86dFBa1826',
]
Expand Down Expand Up @@ -157,7 +157,11 @@ myErc725.decodePermissions('0x00000000000000000000000000000000000000000000000000
## encodeData

```js
erc725.encodeData(data);
erc725.encodeData(data [, schemas]);
```

```js
ERC725.encodeData(data, schemas);
```

Encode the data of a smart contract according to your `ERC725JSONSchema` so that you can store the information in smart contracts.
Expand All @@ -170,9 +174,10 @@ When encoding JSON, it is possible to pass in the JSON object and the URL where

#### Parameters

| Name | Type | Description |
| :----- | :----- | :---------------------------------------------------------------------------------- |
| `data` | Object | An object with one or many properties containing the data that needs to be encoded. |
| Name | Type | Description |
| :-------- | :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data` | Object | An object with one or many properties containing the data that needs to be encoded. |
| `schemas` | ERC725JSONSchema[] | An array of extra [LSP-2 ERC725YJSONSchema] objects that can be used to find the schema. If called on an instance, it is optional and it will be concatenated with the schema provided on instantiation. |

The key can be either the named key (i.e. `LSP3Profile`) or the hashed key (with or without `0x` prefix, i.e. `0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5` or `5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5`).

Expand Down Expand Up @@ -252,7 +257,7 @@ const encodedDataManyKeys = erc725.encodeData({
hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361',
url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx',
},
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
'0xD94353D9B005B3c0A9Da169b768a31C57844e490',
'0xDaea594E385Fc724449E3118B2Db7E86dFBa1826',
],
Expand All @@ -262,9 +267,9 @@ const encodedDataManyKeys = erc725.encodeData({
{
keys: [
'0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5',
'0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0',
'0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000000',
'0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000001',
'0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
'0x7c8c3416d6cda87cd42c71ea1843df2800000000000000000000000000000000',
'0x7c8c3416d6cda87cd42c71ea1843df2800000000000000000000000000000001',
'0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47',
],
values: [
Expand All @@ -283,7 +288,7 @@ const encodedDataManyKeys = erc725.encodeData({
## encodeKeyName

```js
ERC725.encodeKeyName(keyName);
ERC725.encodeKeyName(keyName [, dynamicKeyParts]);
```

Hashes a key name for use on an [ERC725Y contract](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725y) according to the [LSP2 ERC725Y JSON Schema Standard](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md).
Expand All @@ -296,9 +301,10 @@ Hashes a key name for use on an [ERC725Y contract](https://github.com/ethereum/E

#### Parameters

| Name | Type | Description |
| :-------- | :----- | :------------------------------- |
| `keyName` | string | The key name you want to encode. |
| Name | Type | Description |
| :--------------------------- | :----------------------------- | :----------------------------------------- |
| `keyName` | string | The key name you want to encode. |
| `dynamicKeyParts` (optional) | string or <br/> string[&nbsp;] | The variables used to encode the key name. |

#### Returns

Expand All @@ -313,12 +319,18 @@ The hash must be retrievable from the ERC725Y contract via the [getData](#getdat
```javascript title="Encode the key name"
ERC725.encodeKeyName('LSP3Profile');
// '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5'
ERC725.encodeKeyName('SupportedStandards:ERC725Account');
// '0xeafec4d89fa9619884b6b89135626455000000000000000000000000afdeb5d6'
ERC725.encodeKeyName('SupportedStandards:LSP3UniversalProfile');
// '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38'
ERC725.encodeKeyName(
'AddressPermissions:Permissions:cafecafecafecafecafecafecafecafecafecafe',
);
// '0x4b80742d0000000082ac0000cafecafecafecafecafecafecafecafecafecafe'
// '0x4b80742de2bf82acb3630000cafecafecafecafecafecafecafecafecafecafe'
ERC725.encodeKeyName('MyKeyName:<bool>', 'true');
// '0x35e6950bc8d21a1699e500000000000000000000000000000000000000000001'
ERC725.encodeKeyName('MyKeyName:<bytes2>:<uint32>', ['ffff', '4081242941']);
// 0x35e6950bc8d20000ffff000000000000000000000000000000000000f342d33d
ERC725.encodeKeyName('MyKeyName:<uint32>', ['4081242941']);
// 0x35e6950bc8d21a1699e5000000000000000000000000000000000000f342d33d

// This method is also available on the instance:
myErc725.encodeKeyName('LSP3Profile');
Expand Down Expand Up @@ -441,7 +453,7 @@ const dataAllKeys = await erc725.fetchData();
}
},
LSP1UniversalReceiverDelegate: '0x50A02EF693fF6961A7F9178d1e53CC8BbE1DaD68',
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
'0xc444009d38d3046bb0cF81Fa2Cd295ce46A67C78',
'0x4fEbC3491230571F6e1829E46602e3b110215A2E',
'0xB92a8DdA288638491AEE5C2a003D4CAbfa47aE3F',
Expand Down Expand Up @@ -552,7 +564,7 @@ const dataAllKeys = await erc725.getData();
url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV'
},
LSP1UniversalReceiverDelegate: '0x50A02EF693fF6961A7F9178d1e53CC8BbE1DaD68',
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
'0xc444009d38d3046bb0cF81Fa2Cd295ce46A67C78',
'0x4fEbC3491230571F6e1829E46602e3b110215A2E',
'0xB92a8DdA288638491AEE5C2a003D4CAbfa47aE3F',
Expand Down Expand Up @@ -614,9 +626,9 @@ Returns the contract owner and is not directly related to ERC725 specifications.

#### Parameters

| Name | Type | Description |
| :------------------- | :----- | :---------------------------------------- |
| `address` (optional) | string | The contract or EOA address of the owner. |
| Name | Type | Description |
| :------------------- | :----- | :-------------------------------------------------- |
| `address` (optional) | string | The contract address you wish to find the owner of. |

If no address is set, will return the owner of the contract used to initialise the ERC725 class.

Expand Down Expand Up @@ -702,8 +714,8 @@ erc725.getSchema([
valueType: 'bytes'
},
'0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000001': {
name: 'LSP3IssuedAssets[1]',
key: '0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0',
name: 'LSP12IssuedAssets[1]',
key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
keyType: 'Singleton',
valueContent: 'Address',
valueType: 'address'
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Web3 from 'web3';
const schemas = [
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b6b89135626455000000000000000000000000abe425d6',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
keyType: 'Mapping',
valueContent: '0xabe425d6',
valueType: 'bytes',
Expand Down
8 changes: 4 additions & 4 deletions docs/writing-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ERC725 } from '@erc725/erc725.js';
export const schemas = [
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b6b89135626455000000000000000000000000abe425d6',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
keyType: 'Mapping',
valueContent: '0xabe425d6',
valueType: 'bytes',
Expand All @@ -48,8 +48,8 @@ export const schemas = [
valueType: 'address',
},
{
name: 'LSP3IssuedAssets[]',
key: '0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0',
name: 'LSP12IssuedAssets[]',
key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
keyType: 'Array',
valueContent: 'Address',
valueType: 'address',
Expand Down Expand Up @@ -78,7 +78,7 @@ const encodedData = myERC725.encodeData({
hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361',
url: 'ifps://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx',
},
'LSP3IssuedAssets[]': [
'LSP12IssuedAssets[]': [
'0xD94353D9B005B3c0A9Da169b768a31C57844e490',
'0xDaea594E385Fc724449E3118B2Db7E86dFBa1826',
],
Expand Down
Loading

0 comments on commit 0c75f63

Please sign in to comment.