-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: returning correct ledger id in tokeninfo (#163) #222
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
44b83a1
to
05905ed
Compare
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
b9c91be
to
8f0580f
Compare
src/forwarder/mirror-node-client.js
Outdated
* | ||
* @returns {string} | ||
*/ | ||
getLedgerId() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't depend on the mirrorNodeUrl
, we need to devise another approach to get the ledgerId
.
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
3f3f633
to
94819e8
Compare
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
f1f4919
to
55396a8
Compare
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
55396a8
to
bf16abf
Compare
test/plugin/.testConfig.js
Outdated
@@ -26,7 +26,7 @@ module.exports = { | |||
*/ | |||
projectTestConfig: { | |||
mocha: { | |||
timeout: 30000, | |||
timeout: 60000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore this, I found out there were some tests failing due to timeouts as well. However, we need to see where this issue is coming from. By incrementing the timeout we are just masking the issue.
src/slotmap.js
Outdated
/** | ||
* @param {number|undefined} chainId | ||
*/ | ||
const init = chainId => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const init = chainId => { | |
const setLedgerId = chainId => { |
src/slotmap.js
Outdated
@@ -24,6 +24,16 @@ const { | |||
storageLayout: { storage, types }, | |||
} = require('../out/HtsSystemContract.sol/HtsSystemContract.json'); | |||
|
|||
let ledgerId = '0x00'; | |||
/** | |||
* @param {number|undefined} chainId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does undefined
come from?
…od (#167) Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
Signed-off-by: Mariusz Jasuwienas <mariusz.jasuwienas@arianelabs.com>
* | ||
* @param {number} chainId | ||
*/ | ||
const setLedgerId = chainId => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's export this one from index.d.ts
. Also we can move the doc comments there, so consumers can take advantage of the js docs.
nit: convert to function
.
@@ -28,6 +28,8 @@ const { getHtsCode, getHtsStorageAt, HTSAddress, LONG_ZERO_PREFIX, getHIP719Code | |||
/** @type {Partial<import('hardhat/types').HardhatNetworkForkingConfig>} */ | |||
const { url: forkUrl, mirrorNodeUrl, workerPort, localAddresses = [] } = workerData; | |||
|
|||
require('../slotmap').setLedgerId(workerData.chainId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import setLedgerId
in the require('..')
that is above.
require('../slotmap').setLedgerId(workerData.chainId); | |
setLedgerId(workerData.chainId); |
We should treat exported modules in declated package.json
as independent. All external used functions/classes/consts should be imported from an index.js
declared in package.json
. This way is easier to consumers to also use the package.
@@ -339,4 +352,4 @@ class PersistentStorageMap { | |||
} | |||
} | |||
|
|||
module.exports = { packValues, slotMapOf, PersistentStorageMap }; | |||
module.exports = { packValues, slotMapOf, PersistentStorageMap, setLedgerId }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also export setLedgerId
through index.js
.
Description:
The Ledger ID returned in TokenInfo will now provide the correct value.
Related issue(s):
Fixes #163
Notes for reviewer:
Checklist