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

fix: Repair isDataAuthentic #474

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ab9b7f1
Merge pull request #404 from ERC725Alliance/develop
CJ42 Apr 3, 2024
e168469
chore(main): release 0.24.1
github-actions[bot] Apr 3, 2024
74a1e1d
Merge pull request #405 from ERC725Alliance/release-please--branches-…
CJ42 Apr 3, 2024
8f5df3f
Merge pull request #412 from ERC725Alliance/develop
richtera Apr 11, 2024
09c669d
chore(main): release 0.24.2
github-actions[bot] Apr 11, 2024
6dd7b89
Merge pull request #414 from ERC725Alliance/release-please--branches-…
CJ42 Apr 11, 2024
df2795a
Merge pull request #417 from ERC725Alliance/develop
CJ42 Apr 18, 2024
bb2599e
chore(main): release 0.25.0
github-actions[bot] Apr 18, 2024
7dd36ac
Merge pull request #418 from ERC725Alliance/release-please--branches-…
CJ42 Apr 18, 2024
1c3093f
Merge pull request #421 from ERC725Alliance/develop
CJ42 Apr 18, 2024
031101d
chore(main): release 0.25.0
github-actions[bot] Apr 18, 2024
7e5588f
Merge pull request #422 from ERC725Alliance/release-please--branches-…
CJ42 Apr 18, 2024
db05495
Merge pull request #424 from ERC725Alliance/develop
CJ42 Apr 18, 2024
c8a4e73
chore(main): release 0.25.0
github-actions[bot] Apr 18, 2024
e802af8
Merge pull request #425 from ERC725Alliance/release-please--branches-…
CJ42 Apr 18, 2024
035f80c
Merge pull request #434 from ERC725Alliance/develop
CJ42 May 13, 2024
aca29c4
Merge pull request #440 from ERC725Alliance/develop
CJ42 May 14, 2024
5b6b1b7
chore(main): release 0.26.0
github-actions[bot] May 14, 2024
ff3dc8c
Merge pull request #435 from ERC725Alliance/release-please--branches-…
CJ42 May 15, 2024
45dbd78
Merge pull request #445 from ERC725Alliance/develop
CJ42 May 15, 2024
fecc5f0
chore(main): release 0.26.0
github-actions[bot] May 15, 2024
e097f99
Merge pull request #446 from ERC725Alliance/release-please--branches-…
CJ42 May 15, 2024
98b56d9
Merge pull request #452 from ERC725Alliance/develop
CJ42 May 29, 2024
7e5aecc
chore(main): release 0.27.0
github-actions[bot] May 29, 2024
ea64bdf
Merge pull request #453 from ERC725Alliance/release-please--branches-…
CJ42 May 29, 2024
57fbc2a
Merge branch 'develop'
richtera Jul 9, 2024
8b3bc06
Merge pull request #468 from ERC725Alliance/rebase-to-main
CJ42 Jul 12, 2024
95d5675
chore(main): release 0.27.1
github-actions[bot] Jul 12, 2024
979b634
Merge pull request #469 from ERC725Alliance/release-please--branches-…
CJ42 Jul 12, 2024
74e730e
docs: update schema docs page to latest content
CJ42 Jul 12, 2024
65960aa
docs: move sentence from docs learn page into _erc725.js_ docs
CJ42 Jul 17, 2024
194b357
test: refactor test to use correct tuple of CompactBytesArray for All…
CJ42 Jul 17, 2024
0c1032a
docs: document how to encode / decode tuple of CompactBytesArray with…
CJ42 Jul 17, 2024
06cc24c
fix: Make explicitely sure that method === 0x0000000 is also ignored …
richtera Sep 12, 2024
96a3ef0
fix: Compile temporary patch
richtera Sep 12, 2024
1f0e740
fix: Patch version
richtera Sep 12, 2024
3fe394d
fix: Repair patchIPFSUrlsIfApplicable to only map urls starting with …
richtera Sep 17, 2024
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
63 changes: 63 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,69 @@

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.27.1](https://github.com/ERC725Alliance/erc725.js/compare/v0.27.0...v0.27.1) (2024-07-12)


### Bug Fixes

* Normalize tests and add name as a constant in the schema. Add nonDynamicName to capture resolved schema names. ([95dabb2](https://github.com/ERC725Alliance/erc725.js/commit/95dabb22c3958b94014eed2b460a5e2dcce4684d))
* Repair and use dynamicName and dynamicKeyParts. ([2874516](https://github.com/ERC725Alliance/erc725.js/commit/2874516343fee7259367f84f19f071081be5f61f))
* Repair limitation ([b0ffa5b](https://github.com/ERC725Alliance/erc725.js/commit/b0ffa5b1051015268c552b53b4334e0795295e1d))
* Repair tests and 0x prefix for dynamic fields in some places. ([cef4e15](https://github.com/ERC725Alliance/erc725.js/commit/cef4e15587cb9dbc993606098851698fc77cd6b8))
* Some cleanup, remove global-agent, some new minor upgrades ([239c98c](https://github.com/ERC725Alliance/erc725.js/commit/239c98c35233ad1188b74e971d9b5f993273b092))

## [0.27.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.26.0...v0.27.0) (2024-05-29)


### Features

* allow to pass `number` directly in array when encoding tuples ([f6b4a9d](https://github.com/ERC725Alliance/erc725.js/commit/f6b4a9df803f1c63d53067ca3b67604219502cda))
* export `mapPermission` function and don't make it throw an error ([08e72d6](https://github.com/ERC725Alliance/erc725.js/commit/08e72d61f37d8e3d8b70b5b0bf7cb355687f3546))
* export function to get verification method ([f426a31](https://github.com/ERC725Alliance/erc725.js/commit/f426a31239f708775e5ab2829ccd0e206da43988))
* export method `isDataAuthentic` as static, single method or member of class ([0c7ba98](https://github.com/ERC725Alliance/erc725.js/commit/0c7ba987540e0684e803ca8d722aa4b0b5d04fde))
* return `dynamicKeyName` and `dynamicKeyPart` for `getSchema` with Array ([8b86092](https://github.com/ERC725Alliance/erc725.js/commit/8b860926f6a8e5a733c3d01321bf888a19b79f12))


### Bug Fixes

* allow to decode `0x` as `0` for keyType `Array` ([fde9f5d](https://github.com/ERC725Alliance/erc725.js/commit/fde9f5da07dfe87f1459266515b58bca58eacbcd))

## [0.26.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.25.0...v0.26.0) (2024-05-14)

### Features

- add `dynamicPart` in schema returned by `getSchema` ([12d34d2](https://github.com/ERC725Alliance/erc725.js/commit/12d34d2d8a80656ae9b4efeb1ec72bcf2426b6e5))
- add support for `bytesN` valueType from 1 to 32 ([1db6f2f](https://github.com/ERC725Alliance/erc725.js/commit/1db6f2faebaccdcc39455b4a3dbae05c6416271a))
- allow to use `decodeData` to decode Array length only ([5ddb12d](https://github.com/ERC725Alliance/erc725.js/commit/5ddb12d43ce399e166e159be9faf364f9647c705))
- export `getSchema` as a standalone function outside of class instance ([8558c71](https://github.com/ERC725Alliance/erc725.js/commit/8558c71b0cc077636db64506fc8407a8bc179c13))
- include also `dynamicKeyPart` in the schema return by `getSchema` ([30dda33](https://github.com/ERC725Alliance/erc725.js/commit/30dda3398d35a019b97790524834f12489607f2b))

### Bug Fixes

- encode `uintN` with correct padding and bytes length ([f8dc5ae](https://github.com/ERC725Alliance/erc725.js/commit/f8dc5ae9651ce953b2ff9808dfb3671126adace0))
- Ignore formatting in package.json inside of biome ([33a80dd](https://github.com/ERC725Alliance/erc725.js/commit/33a80dd5368028cb55ab68ea940c176790595806))
- valueContent from `bytes32` -> `Bytes32` for `LSP8ReferenceContract` ([dffc421](https://github.com/ERC725Alliance/erc725.js/commit/dffc421bea06c659d30f47ecead0be1385072248))

## [0.25.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.24.2...v0.25.0) (2024-04-18)

### Features

- export methods for encoding/decoding dataSourceWithHash and valueContent ([b1e0ed9](https://github.com/ERC725Alliance/erc725.js/commit/b1e0ed98718acce90f1db6917728394ab8aeb4fa))

## [0.24.2](https://github.com/ERC725Alliance/erc725.js/compare/v0.24.1...v0.24.2) (2024-04-11)

### Bug Fixes

- Apply suggestions. ([e9c3d81](https://github.com/ERC725Alliance/erc725.js/commit/e9c3d81875ef2861791753c1285defc096ddbdac))
- Minimize changes ([cc31b5f](https://github.com/ERC725Alliance/erc725.js/commit/cc31b5f8b185743a5e783a04a7a8b4b158268fda))
- Repair data: urls from not triggering the baseURI test. ([c26ab3e](https://github.com/ERC725Alliance/erc725.js/commit/c26ab3e51b1f027044df467ab4e2f0c6a00dff5d))

## [0.24.1](https://github.com/ERC725Alliance/erc725.js/compare/v0.24.0...v0.24.1) (2024-04-03)

### Bug Fixes

- Add missing exports due to merge conflict. ([2e14cd5](https://github.com/ERC725Alliance/erc725.js/commit/2e14cd5b4a5a1f51222c1056bd4220be2a09a02d))

## [0.24.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.23.1...v0.24.0) (2024-04-02)

### Features
Expand Down
4 changes: 4 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ const verifiableURI = encodeDataSourceWithHash(
Try running the code snippets below within your browser using [StackBlitz](https://stackblitz.com/edit/erc725js-instantiation?devtoolsheight=66&file=index.js).
:::

The _erc725.js_ contains multiple functionalities such as reading and decoding data. A full list is available under the [**Methods**](./methods.md) page.

For fetching data, it is possible to query one data key (as a `string` name) or multiple data keys at once by passing an array parameter, as shown below.

```js
await erc725.getOwner();
// > '0x28D25E70819140daF65b724158D00c373D1a18ee'
Expand Down
115 changes: 114 additions & 1 deletion docs/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 1
title: 'Methods'
---

import CodeSandbox from "../../../src/components/CodeSandbox";
import CodeSandbox from "@site/src/components/CodeSandbox";

<CodeSandbox />

Expand Down Expand Up @@ -508,6 +508,64 @@ ERC725.encodeData(

</details>

<details>
<summary>Encode a tuple of <code>CompactBytesArray</code></summary>

```ts title="Encode a tuple of CompactBytesArray"
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)',
}
];

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
],
},
],
schemas,
);
/**
{
keys: [
'0x4b80742de2bf393a64c70000cafecafecafecafecafecafecafecafecafecafe', // -> data key for `AddressPermissions:AllowedCalls:0xcafecafecafecafecafecafecafecafecafecafe`
],
values: [
'0x002000000003ca41e4ea94c8fa99889c8ea2c8948768cbaf4bc03e89ad98ffffffff002000000002f70ce3b58f275a4c28d06c98615760dde774de57ffffffff760d9bba002000000001d3236aa1b8a4dde5ea375fd1f2fb5c354e686c9fffffffffffffffff', // (bytes4,address,bytes4,bytes4)[CompactBytesArray]
],
}
*/

```

</details>

---

### encodeKeyName
Expand Down Expand Up @@ -965,6 +1023,61 @@ ERC725.decodeData(
*/
```

#### Tuple of CompactBytesArray Example

```ts title="Decode a tuple of CompactBytesArray"
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)',
}
];

ERC725.decodeData(
[
{
keyName: 'AddressPermissions:AllowedCalls:<address>',
dynamicKeyParts: "0xcafecafecafecafecafecafecafecafecafecafe"
value: '0x002000000003ca41e4ea94c8fa99889c8ea2c8948768cbaf4bc03e89ad98ffffffff002000000002f70ce3b58f275a4c28d06c98615760dde774de57ffffffff760d9bba002000000001d3236aa1b8a4dde5ea375fd1f2fb5c354e686c9fffffffffffffffff'
},
],
schemas,
);

/**
{
key: '0x4b80742de2bf393a64c70000cafecafecafecafecafecafecafecafecafecafe',
name: 'AddressPermissions:AllowedCalls:cafecafecafecafecafecafecafecafecafecafe',
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
]
]
}
*/

```

### decodeValueType

```js
Expand Down
12 changes: 8 additions & 4 deletions docs/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ sidebar_position: 2

# Schemas

The `@erc725/erc725.js` library contains a range of standard [LSP ERC725 JSON schemas](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md).
:::info 📄 Schema Specification

Schemas allow erc725.js to know how to decode and encode data written in an [ERC725Y](https://eips.ethereum.org/EIPS/eip-725) smart contract.
For more details on schemas, see the [**official specification** of the LSP2 ERC725 JSON schemas](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md) standard specification

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

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.

[Official Documentation](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md).
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_

- `name`: An arbitrary name
- `key`: The sha3 hash of the name
Expand Down
Loading
Loading