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

New API #30

Closed
frozeman opened this issue Jul 27, 2021 · 1 comment · Fixed by #33
Closed

New API #30

frozeman opened this issue Jul 27, 2021 · 1 comment · Fixed by #33
Assignees
Labels
enhancement New feature or request

Comments

@frozeman
Copy link
Contributor

fetchData()
fetchData('LSP3Profile')
fetchData(['LSP3Profile', 'MyKey'])
getData() > get all Data according to schema: {LSP3Profile: {...}, "LSP3IssuedAssets[]": [...], ...}
getData('LSP3Profile') > {LSP3Profile: {...}}
getData(['LSP3Profile', 'MyKey']) > {LSP3Profile: {...}, MyKey: {}}

encodeData({LSP3Profile: {...}, ...}) > {'LSP3Profile': {key: ..., value: ...}, ...}
encodeData({LSP3Profile: {...}, "LSPIssuedAssets[]": [...]})
> {'LSP3Profile': {key: ..., value: ...}, "LSPIssuedAssets[]": {...}, "LSPIssuedAssets[0]": {...}, "LSPIssuedAssets[1]": {...}}

decodeData({LSP3Profile: {...}, ...}) > {LSP3Profile: {...}, ...}

Encode example:

// encode
let results = encodeData({
  'LSP3Profile': {
    hashFunction: 'keccak256(utf8)',
    hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a',
    url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV'
  }
});

// storing encoded results in a contract
for (const result of results) {
  await myContract.methods.setData(result.key, result.value).send(...);
}
@frozeman
Copy link
Contributor Author

@rryter

@frozeman frozeman added the enhancement New feature or request label Jul 27, 2021
@rryter rryter self-assigned this Jul 30, 2021
This was referenced Jul 30, 2021
@rryter rryter linked a pull request Aug 13, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants