Closed fhildeb closed 8 months ago
One thing I did notice is that for a single item (not array) the return is also not an array, but that should not affect a single key array input when looking at getData. For a single key it will return the value also without array notation.
const data = await getDataMultiple(erc725Options, [keyOrKeys]);
return data[0];
So I believe since fetchData uses getData instead of getDataMultiple it's not getting an array in the single item case. But it doesn't explain the single array input case.
Tested with an other data key like AddressPermissions:Permissions:<address>
works.
let lsp6Result = await erc725js.getData([{ keyName: 'AddressPermissions:Permissions:<address>', dynamicKeyParts: '0x9139def55c73c12bcda9c44f12326686e3948634' }]);
It looks like it has to do with the fact that the valueType / valueContent is a tuple, and the error occurs here:
This is the error I get:
let c = await erc725.getData([{ keyName: 'LSP4CreatorsMap:<address>', dynamicKeyParts: '0x9139def55c73c12bcda9c44f12326686e3948634' }]);
Uncaught TypeError: Cannot read properties of null (reading 'length')
at async /Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/<repl>.ts:1:33
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at getDataMultiple (/Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/getData.ts:131:20)
at decodeData (/Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/decodeData.ts:345:17)
at Array.map (<anonymous>)
at /Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/decodeData.ts:345:36
at processDataInput (/Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/decodeData.ts:340:14)
at decodeKey (/Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/decodeData.ts:272:35)
at decodeTupleKeyValue (/Users/jeancavallera/Repositories/LUKSO/dApps-Projects/lukso-playground/node_modules/@erc725/erc725.js/src/lib/decodeData.ts:161:13)
Same error on my side, verified
Solved and closed within #378
I'm submitting a bug report
Issue
Dynamic key parts of ERC725Y storage can only be fetched when I provide more than keys:
However, fetching only one key does not work for any dynamic objects it seems.
a) It neither works with a single key
b) Nor an array with a single key:
Why is this a problem
fetchData
orgetData
calls, causing problems in automationWhat I would like to know
Could someone explain
Related Links
src/lib/decodeData.ts