stacks-archive / stacks-transactions-js

The JavaScript library for generating Stacks 2.0 transactions
19 stars 17 forks source link

feat: get map entry #128

Closed friedger closed 3 years ago

friedger commented 3 years ago

Description

As a Blockstack developer, I would like to query the blockchain for data map entries of a contract. This is needed in the same was as read-only function calls. This pull request adds the getMapEntry function which uses helper methods cvToHex and parseMapEntryResponse. Both are exported as well.

For details refer to issue #126

Type of Change

Does this introduce a breaking change?

No, just a new feature

Are documentation updates required?

yes

Testing information

A new test in builder-tests.js was added that calls getMapEntry.

Checklist

friedger commented 3 years ago

getMapEntry has the same functionality as SmartContractsApi.getDataMapEntry of the stacks blockchain api client library. Similar to callReadOnlyFunction. Does it matter that it is duplicated code?

friedger commented 3 years ago

I'll do the cloning...

What about the hexToCV? https://github.com/blockstack/stacks-transactions-js/issues/126#issuecomment-703071291