Extend instantiation of the contract
@@ -69,7 +71,7 @@ const myERC725 = new ERC725(schemas, address, provider, config);
```js
-// 1. Encode data using `encodeData`
+// 1. Encode the data using the `encodeData` function.
const encodedData = myERC725.encodeData({
LSP3Profile: {
hashFunction: 'keccak256(utf8)',
@@ -83,10 +85,10 @@ const encodedData = myERC725.encodeData({
LSP1UniversalReceiverDelegate: '0x1183790f29BE3cDfD0A102862fEA1a4a30b3AdAb',
});
-// 2. Flatten encoded data using `flattenEncodedData`
+// 2. Flatten the encoded data using the `flattenEncodedData` function.
const dataToSaveOnChain = flattenEncodedData(encodedDataManyKeys);
-// 3. Get a reference to the desired contract
+// 3. Get an ABI (JSON Interface) of the desired contract, in order to reference it.
const erc725Contract = new web3.eth.Contract(
[
// NOTE: We are not loading the full contract ABI, only the function we need
@@ -112,7 +114,7 @@ const erc725Contract = new web3.eth.Contract(
ERC725_ADDRESS, // replace this with the desired value
);
-// 4. Iterate on flattenedData and call `setData`
+// 4. Iterate on `flattenedData` and call `setData` on the smart contract.
await Promise.all(
dataToSaveOnChain.map(async ({ key, value }) => {
return erc725Contract.methods.setData(key, value).send();
From 59fba3756fb483077a4e365a3c04905375f72be3 Mon Sep 17 00:00:00 2001
From: fhildeb