diff --git a/CHANGELOG.md b/CHANGELOG.md index 8564e9ec..1f2bc714 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,17 @@ 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.5.8](https://github.com/ERC725Alliance/erc725.js/compare/v0.5.7...v0.5.8) (2021-08-13) +### [0.6.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.5.7...v0.6.0) (2021-08-13) +### Feature + +- **API:** Adjusted API to be more consistent + - https://github.com/ERC725Alliance/erc725.js/issues/30 + - https://github.com/ERC725Alliance/erc725.js/pull/31 ### Bug Fixes -* **mocha:** increase timeout time ([b7ce1a0](https://github.com/ERC725Alliance/erc725.js/commit/b7ce1a07711b8251f4447d613c4c5a522b5e263f)) +- **mocha:** increase timeout time ([b7ce1a0](https://github.com/ERC725Alliance/erc725.js/commit/b7ce1a07711b8251f4447d613c4c5a522b5e263f)) ### [0.5.7](https://github.com/ERC725Alliance/erc725.js/compare/v0.2.0...v0.5.7) (2021-07-30) diff --git a/docs/technical-reference/README.md b/docs/technical-reference/README.md index 352f5eed..c1dc89e9 100644 --- a/docs/technical-reference/README.md +++ b/docs/technical-reference/README.md @@ -1,4 +1,4 @@ -# erc725.js - v0.5.7 +# @erc725/erc725.js - v0.6.0 ## Classes @@ -24,7 +24,7 @@ Renames and exports: [ERC725](classes/ERC725.md) #### Defined in -[types/ERC725JSONSchema.ts:3](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L3) +[types/ERC725JSONSchema.ts:3](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L3) ___ @@ -34,7 +34,7 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:5](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L5) +[types/ERC725JSONSchema.ts:5](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L5) ___ @@ -44,7 +44,7 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:15](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L15) +[types/ERC725JSONSchema.ts:15](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L15) ## Functions @@ -72,7 +72,7 @@ ___ #### Defined in -[lib/utils.ts:388](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/lib/utils.ts#L388) +[lib/utils.ts:388](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/lib/utils.ts#L388) ___ @@ -97,4 +97,4 @@ KeyValuePair[] An array of key-value objects #### Defined in -[lib/utils.ts:462](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/lib/utils.ts#L462) +[lib/utils.ts:462](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/lib/utils.ts#L462) diff --git a/docs/technical-reference/classes/ERC725.md b/docs/technical-reference/classes/ERC725.md index 56f8bd28..05617191 100644 --- a/docs/technical-reference/classes/ERC725.md +++ b/docs/technical-reference/classes/ERC725.md @@ -6,8 +6,8 @@ This package is currently in early stages of development,
use only for test ## Type parameters -| Name | Type | Description | -| :------ | :------ | :------ | +| Name | Type | Description | +| :------- | :---------------------- | :----------------------------------------- | | `Schema` | extends `GenericSchema` | **Work in progress, nothing to see here**. | ## Constructors @@ -24,22 +24,22 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/instantiation #### Type parameters -| Name | Type | -| :------ | :------ | +| Name | Type | +| :------- | :---------------------- | | `Schema` | extends `GenericSchema` | #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | -| `schema` | [`ERC725JSONSchema`](../interfaces/ERC725JSONSchema.md)[] | More information available here: [LSP-2-ERC725YJSONSchema](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md) | -| `address?` | `any` | Address of the ERC725 contract you want to interact with | -| `provider?` | `any` | | -| `config?` | [`ERC725Config`](../interfaces/ERC725Config.md) | Configuration object. | +| Name | Type | Description | +| :---------- | :-------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | +| `schema` | [`ERC725JSONSchema`](../interfaces/ERC725JSONSchema.md)[] | More information available here: [LSP-2-ERC725YJSONSchema](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md) | +| `address?` | `any` | Address of the ERC725 contract you want to interact with | +| `provider?` | `any` | | +| `config?` | [`ERC725Config`](../interfaces/ERC725Config.md) | Configuration object. | #### Defined in -[index.ts:93](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L93) +[index.ts:93](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L93) ## Properties @@ -49,17 +49,17 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/instantiation #### Type declaration -| Name | Type | -| :------ | :------ | -| `address?` | `string` | -| `config` | [`ERC725Config`](../interfaces/ERC725Config.md) | -| `provider?` | `any` | -| `providerType?` | ``null`` \| `ProviderType` | -| `schema` | [`ERC725JSONSchema`](../interfaces/ERC725JSONSchema.md)[] | +| Name | Type | +| :-------------- | :-------------------------------------------------------- | +| `address?` | `string` | +| `config` | [`ERC725Config`](../interfaces/ERC725Config.md) | +| `provider?` | `any` | +| `providerType?` | `null` \| `ProviderType` | +| `schema` | [`ERC725JSONSchema`](../interfaces/ERC725JSONSchema.md)[] | #### Defined in -[index.ts:72](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L72) +[index.ts:72](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L72) ## Methods @@ -77,8 +77,8 @@ It does the `decoding` and `fetching` of external references for you automatical #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | +| Name | Type | Description | +| :----- | :------- | :------------------------------------- | | `data` | `Object` | An object with one or many properties. | #### Returns @@ -97,9 +97,9 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/decodeData.js #### Defined in -[index.ts:338](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L338) +[index.ts:337](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L337) -___ +--- ### encodeData @@ -109,8 +109,8 @@ To be able to store your data on the blockchain, you need to encode it according #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | +| Name | Type | Description | +| :----- | :------- | :----------------------------------------------------------------------------------- | | `data` | `Object` | An object with one or many properties, containing the data that needs to be encoded. | #### Returns @@ -131,7 +131,6 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/encodeData.js https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/encodeData.js#L39-L67 ``` -``` :::tip When encoding JSON it is possible to pass in the JSON object and the URL where it is available publicly. The JSON will be hashed with `keccak256`. @@ -139,9 +138,9 @@ The JSON will be hashed with `keccak256`. #### Defined in -[index.ts:311](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L311) +[index.ts:310](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L310) -___ +--- ### fetchData @@ -149,7 +148,7 @@ ___ Since [`getData`](ERC725.md#getdata) exclusively returns data that is stored on the blockchain, `fetchData` comes in handy. Additionally to the data from the blockchain, `fetchData` also returns data from IPFS or HTTP(s) endpoints -stored as [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl), or [`ASSETURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#asseturl). +stored as [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl) or [`ASSETURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#asseturl). :::info To ensure **data authenticity** `fetchData` compares the `hash` of the fetched JSON with the `hash` stored on the blockchain. @@ -157,8 +156,8 @@ To ensure **data authenticity** `fetchData` compares the `hash` of the fetched J #### Parameters -| Name | Type | Description | -| :------ | :------ | :------ | +| Name | Type | Description | +| :----------- | :--------------------- | :------------------------------------------------------------------------------------------------------- | | `keyOrKeys?` | `string` \| `string`[] | The name (or the encoded name as the schema ‘key’) of the schema element in the class instance’s schema. | #### Returns @@ -181,9 +180,9 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/fetchData.js# #### Defined in -[index.ts:230](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L230) +[index.ts:230](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L230) -___ +--- ### getData @@ -193,7 +192,7 @@ Gets **decoded data** for one, many or all keys of the specified `ERC725` smart- When omitting the `keyOrKeys` parameter, it will get all the keys (as per [ERC725JSONSchema](../interfaces/ERC725JSONSchema.md) definition). :::caution -Data returned by this function does not contain external data of [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl), +Data returned by this function does not contain external data of [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl) or [`ASSETURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#asseturl) schema elements. If you would like to receive everything in one go, you can use [`fetchData`](ERC725.md#fetchdata) for that. @@ -201,8 +200,8 @@ If you would like to receive everything in one go, you can use [`fetchData`](ERC #### Parameters -| Name | Type | -| :------ | :------ | +| Name | Type | +| :------------ | :--------------------- | | `keysOrKeys?` | `string` \| `string`[] | #### Returns @@ -225,9 +224,9 @@ https://github.com/ERC725Alliance/erc725.js/tree/main/examples/src/getData.js#L4 #### Defined in -[index.ts:182](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L182) +[index.ts:182](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L182) -___ +--- ### getOwner @@ -238,8 +237,8 @@ Not directly related to ERC725 specifications. #### Parameters -| Name | Type | -| :------ | :------ | +| Name | Type | +| :--------- | :------- | | `address?` | `string` | #### Returns @@ -249,17 +248,17 @@ Not directly related to ERC725 specifications. The address of the contract owner as stored in the contract. :::warning - This method is not yet supported when using the `graph` provider type. +This method is not yet supported when using the `graph` provider type. ::: ```javascript title="Example" await myERC725.getOwner(); // '0x94933413384997F9402cc07a650e8A34d60F437A' -await myERC725.getOwner("0x3000783905Cc7170cCCe49a4112Deda952DDBe24"); +await myERC725.getOwner('0x3000783905Cc7170cCCe49a4112Deda952DDBe24'); // '0x7f1b797b2Ba023Da2482654b50724e92EB5a7091' ``` #### Defined in -[index.ts:366](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/index.ts#L366) +[index.ts:365](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/index.ts#L365) diff --git a/docs/technical-reference/interfaces/ERC725Config.md b/docs/technical-reference/interfaces/ERC725Config.md index ad7ff8eb..a44fbfd4 100644 --- a/docs/technical-reference/interfaces/ERC725Config.md +++ b/docs/technical-reference/interfaces/ERC725Config.md @@ -8,12 +8,13 @@ ```js title=Example const config = { - ipfsGateway: 'https://ipfs.lukso.network/ipfs/' + ipfsGateway: 'https://ipfs.lukso.network/ipfs/', }; ``` + Make sure to use the following format: `/ipfs/`.
Another example: `https://cloudflare-ipfs.com/ipfs/` #### Defined in -[types/Config.ts:11](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/Config.ts#L11) +[types/Config.ts:11](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/Config.ts#L11) diff --git a/docs/technical-reference/interfaces/ERC725JSONSchema.md b/docs/technical-reference/interfaces/ERC725JSONSchema.md index f8404294..a679aee3 100644 --- a/docs/technical-reference/interfaces/ERC725JSONSchema.md +++ b/docs/technical-reference/interfaces/ERC725JSONSchema.md @@ -9,6 +9,7 @@ valueType: "bytes", }, ``` + :::info Detailed information available on [LSP-2-ERC725YJSONSchema](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md) ::: @@ -21,9 +22,9 @@ Detailed information available on [LSP-2-ERC725YJSONSchema](https://github.com/l #### Defined in -[types/ERC725JSONSchema.ts:47](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L47) +[types/ERC725JSONSchema.ts:47](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L47) -___ +--- ### elementKeyType @@ -31,9 +32,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:48](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L48) +[types/ERC725JSONSchema.ts:48](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L48) -___ +--- ### elementValueContent @@ -41,9 +42,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:49](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L49) +[types/ERC725JSONSchema.ts:49](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L49) -___ +--- ### elementValueType @@ -51,9 +52,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:50](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L50) +[types/ERC725JSONSchema.ts:50](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L50) -___ +--- ### key @@ -61,9 +62,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:43](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L43) +[types/ERC725JSONSchema.ts:43](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L43) -___ +--- ### keyType @@ -71,9 +72,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:44](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L44) +[types/ERC725JSONSchema.ts:44](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L44) -___ +--- ### name @@ -81,9 +82,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:42](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L42) +[types/ERC725JSONSchema.ts:42](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L42) -___ +--- ### valueContent @@ -91,9 +92,9 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:45](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L45) +[types/ERC725JSONSchema.ts:45](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L45) -___ +--- ### valueType @@ -101,4 +102,4 @@ ___ #### Defined in -[types/ERC725JSONSchema.ts:46](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/ERC725JSONSchema.ts#L46) +[types/ERC725JSONSchema.ts:46](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/ERC725JSONSchema.ts#L46) diff --git a/docs/technical-reference/interfaces/KeyValuePair.md b/docs/technical-reference/interfaces/KeyValuePair.md index d6ca8e9e..5475f2f1 100644 --- a/docs/technical-reference/interfaces/KeyValuePair.md +++ b/docs/technical-reference/interfaces/KeyValuePair.md @@ -8,7 +8,7 @@ #### Defined in -[types/encodeData/JSONURL.ts:4](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/encodeData/JSONURL.ts#L4) +[types/encodeData/JSONURL.ts:4](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/encodeData/JSONURL.ts#L4) ___ @@ -18,4 +18,4 @@ ___ #### Defined in -[types/encodeData/JSONURL.ts:5](https://github.com/ERC725Alliance/erc725.js/blob/8d9f3d2/src/types/encodeData/JSONURL.ts#L5) +[types/encodeData/JSONURL.ts:5](https://github.com/ERC725Alliance/erc725.js/blob/596689d/src/types/encodeData/JSONURL.ts#L5) diff --git a/package.json b/package.json index a69c44e6..19028544 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "erc725.js", - "version": "0.5.8", + "name": "@erc725/erc725.js", + "version": "0.6.0", "description": "Library to interact with ERC725 smart contracts", "main": "build/main/index.js", "typings": "build/main/index.d.ts", @@ -11,7 +11,7 @@ "build:module": "tsc -p tsconfig.module.json", "test": "npm run lint && env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' nyc --reporter=text --reporter=lcov mocha", "lint": "eslint . --ext .ts", - "prepare-publish": "rm -rf build && npm run build && npm test && standard-version", + "prepare-publish": "rm -rf build && npm run build && npm test", "docs:generate": "npm run docs:generate:markdown", "docs:generate:markdown": "typedoc --options typedoc.json", "docs:generate:html": "typedoc --options typedoc.html.json"