From 00a3ec82aefce7511838ac0b581430b35b9b10a2 Mon Sep 17 00:00:00 2001 From: CJ42 Date: Mon, 6 May 2024 14:36:09 +0100 Subject: [PATCH] docs: simplify README --- README.md | 34 +++++++---- docs/examples.md | 21 ------- docs/overview.md | 151 ----------------------------------------------- 3 files changed, 21 insertions(+), 185 deletions(-) delete mode 100644 docs/examples.md delete mode 100644 docs/overview.md diff --git a/README.md b/README.md index f4f7c7e6..a21dbf00 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

@erc725/erc725.js

-

Allows for interacting with ERC725Y compliant contracts on an EVM blockchain.

+

Allows for to read, encode and decode data from ERC725Y compliant contracts using ERC725Y JSON schemas.

@@ -27,6 +27,8 @@ ## Installation +> If you install it on the backend side, you may need to also install [`isomorphic-fetch`](https://www.npmjs.com/package/isomorphic-fetch). + ```shell script npm install @erc725/erc725.js ``` @@ -37,11 +39,11 @@ import { ERC725 } from '@erc725/erc725.js'; import ERC725 from '@erc725/erc725.js'; ``` -If you install it on the backend side, you may need to also install [`isomorphic-fetch`](https://www.npmjs.com/package/isomorphic-fetch). - ## Instantiation -You need to initialise the ERC725 object with a [schema](https://docs.lukso.tech/tools/erc725js/schemas), a contract address, and an RPC URL. +> If you are using ES6 `import` statements in Node.js, make sure your file has a `.mjs` extension, or that your project is set up to support ES6 modules. + +You can initialize the ERC725 object with a [schema](https://docs.lukso.tech/tools/erc725js/schemas), a contract address, and an RPC URL. ```js const address = '0x0Dc07C77985fE31996Ed612F568eb441afe5768D'; @@ -52,15 +54,14 @@ const config = { }; ``` -### TypeScript - -> If you are using ES6 `import` statements in Node.js, make sure your file has a `.mjs` extension, or that your project is set up to support ES6 modules. +

+ TypeScript ```ts import { ERC725, ERC725JSONSchema } from '@erc725/erc725.js'; -// Part of LSP3-UniversalProfile Schema -// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md +// Part of LSP3-Profile-Metadata Schema +// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-Profile-Metadata.md const schemas: ERC725JSONSchema[] = [ { name: 'SupportedStandards:LSP3Profile', @@ -88,13 +89,16 @@ const schemas: ERC725JSONSchema[] = [ const erc725 = new ERC725(schemas, address, RPC_URL, config); ``` -### JavaScript +
+ +
+ Javascript ```js -import { ERC725 } require('@erc725/erc725.js'); +const { ERC725 } = require('@erc725/erc725.js'); -// Part of LSP3-UniversalProfile Schema -// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md +// Part of LSP3-Profile-Metadata Schema +// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-Profile-Metadata.md const schemas = [ { name: 'SupportedStandards:LSP3Profile', @@ -122,8 +126,12 @@ const schemas = [ const erc725 = new ERC725(schemas, address, RPC_URL, config); ``` +
+ ## Usage +> See the **Getting Started** pages for more examples on how to use )_erc725.js_ + ```js await myErc725.getOwner(); // > '0x28D25E70819140daF65b724158D00c373D1a18ee' diff --git a/docs/examples.md b/docs/examples.md deleted file mode 100644 index 2ad7e894..00000000 --- a/docs/examples.md +++ /dev/null @@ -1,21 +0,0 @@ -# Examples - -- Fetch data from smart contracts + decode in one go! - -- Create basic schemas - -- Encode / Decode Links to external sources (`VerifiableURI`) - -- Map infos to specific addresses or identifiers - - - Using Dynamic Keys - -- Create Lists with keyType Arrays - - - Adding - - Deleting - - Updating - -- Store multiple infos under one data key with tuples - -- Use `CompactBytesArray` for efficient storing + retrieval diff --git a/docs/overview.md b/docs/overview.md deleted file mode 100644 index 2e74d2ab..00000000 --- a/docs/overview.md +++ /dev/null @@ -1,151 +0,0 @@ -# Overview - -## Types - -- ERC725JSONSchema, -- ERC725JSONSchemaKeyType, -- ERC725JSONSchemaValueContent, -- ERC725JSONSchemaValueType, -- Permissions, -- ERC725Config, -- KeyValuePair, -- ProviderTypes -- DynamicNameSchema -- DecodeDataInput, -- DecodeDataOutput, -- EncodeDataInput, -- FetchDataOutput, - -_there is even more..._ - -## Encoding utilities - -- encodeData -- encodeKey -> necessary? -- encodeKeyName -- encodeKeyValue -- encodeArrayKey -- encodeValueType, -- encodeValueContent, - -## Decoding utilities - -- decodeData -- decodeKey -- decodeKeyPart -- decodeKeyValue -- decodeMappingKey -- decodeValueType, -- decodeValueContent, - -## Permissions utilities - -- encodePermissions -- decodePermissions -- checkPermissions -- mapPermission -> Super useful! - -## Fetching data - -- getDataFromExternalSources -- ERC725.getData -- ERC725.fetchData -- ERC725.getOwner -- ERC725.isValidSignature - -**These to be discussed** - -- getArrayValues -- getDataMultiple -- getData - -## External Data Source utilities (`VerifiableURI` and `JSONURI`) - -- encodeDataSourceWithHash, -- decodeDataSourceWithHash, -- getVerificationMethod -- hashData -- isDataAuthentic - -## Schema utilities - -- getSchema -- getSchemaElement -- getSchemaElementForDynamicKeyName -- validateSchemas -- generateSchemasFromDynamicKeys - -## Dynamic Keys utilities - -- encodeDynamicKeyPart -- encodeDynamicMapping -- encodeDynamicMappingWithGrouping -- encodeDynamicKeyName -- generateDynamicKeyName -- isDynamicKeyPart -- isDynamicKeyName -- splitMultiDynamicKeyNamePart - -## Helpers - -- convertIPFSGatewayUrl -- duplicateMultiTypeERC725SchemaEntry -- guessKeyTypeFromKeyName -- isValidUintSize -- isValidByteSize -- isValueContentLiteralHex -- isValid32ByteHexString - -## Tuple utilities - -- encodeTupleKeyValue -- decodeTupleKeyValue -- isValidTuple - ---- - -These functions are not exported (yet!) - -- validateSchemas -- duplicateMultiTypeERC725SchemaEntry -- convertIPFSGatewayUrl -- generateSchemasFromDynamicKeys -- encodeKeyValue -- guessKeyTypeFromKeyName -> can be renamed to `get`? -- encodeTupleKeyValue -- encodeKey -> necessary? -- isValidTuple -- decodeKeyValue -- getVerificationMethod -- hashData -- isDataAuthentic -- splitMultiDynamicKeyNamePart -- isValidUintSize -- isValidByteSize -- isValueContentLiteralHex -- getSchemaElementForDynamicKeyName -- getSchemaElement -- getArrayValues -- getDataMultiple -- getData -- encodeDynamicKeyPart -- encodeDynamicMapping -- encodeDynamicMappingWithGrouping -- encodeDynamicKeyName -- generateDynamicKeyName -- isValid32ByteHexString -- mapPermission -> Super useful! -- isDynamicKeyPart -- decodeKeyPart -- isValidTuple -- decodeTupleKeyValue -> strange we don't have `encodeTupleKeyValue` -- decodeKey - -These types should be exported: - -- DynamicNameSchema -- DecodeDataInput, -- DecodeDataOutput, -- EncodeDataInput, -- FetchDataOutput, -- there is even more...