[SDK] feat: kvstore.get to return none/undefined when no key found#3819
Open
dnechay wants to merge 2 commits intoescrow-fee-kvstorefrom
Open
[SDK] feat: kvstore.get to return none/undefined when no key found#3819dnechay wants to merge 2 commits intoescrow-fee-kvstorefrom
dnechay wants to merge 2 commits intoescrow-fee-kvstorefrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
dnechay
commented
Mar 11, 2026
| ./scripts/run-unit-test.sh | ||
|
|
||
| run-test: | ||
| make build-contracts |
Collaborator
Author
There was a problem hiding this comment.
This script is used in CI, but locally it makes sense to have just unit-test to not rebuild contracts every time
flopez7
reviewed
Mar 11, 2026
Contributor
flopez7
left a comment
There was a problem hiding this comment.
Since it no longer returns an error if there is no key, let's remove the try catch, as we are interested in logging the other errors.
Comment on lines
213
to
223
| try { | ||
| const reputationOracleAddress = | ||
| await escrowClient.getReputationOracleAddress(webhook.escrowAddress); | ||
| reputationOracleWebhook = (await KVStoreUtils.get( | ||
| webhook.chainId, | ||
| reputationOracleAddress, | ||
| KVStoreKeys.webhookUrl, | ||
| )) as string; | ||
| } catch { | ||
| //Ignore the error | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const reputationOracleAddress = | |
| await escrowClient.getReputationOracleAddress(webhook.escrowAddress); | |
| const reputationOracleWebhook = await KVStoreUtils.get( | |
| webhook.chainId, | |
| reputationOracleAddress, | |
| KVStoreKeys.webhookUrl, | |
| ); |
Comment on lines
+242
to
251
| let exchangeOracleURL: string | undefined; | ||
| try { | ||
| exchangeOracleURL = (await KVStoreUtils.get( | ||
| webhook.chainId, | ||
| await escrowClient.getExchangeOracleAddress(webhook.escrowAddress), | ||
| KVStoreKeys.webhookUrl, | ||
| )) as string; | ||
| } catch { | ||
| //Ignore the error | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const exchangeOracleURL = await KVStoreUtils.get( | |
| webhook.chainId, | |
| await escrowClient.getExchangeOracleAddress(webhook.escrowAddress), | |
| KVStoreKeys.webhookUrl, | |
| ); |
Comment on lines
+314
to
325
| let reputationOracleWebhook: string | undefined; | ||
| try { | ||
| const reputationOracleAddress = | ||
| await escrowClient.getReputationOracleAddress(webhook.escrowAddress); | ||
| reputationOracleWebhook = (await KVStoreUtils.get( | ||
| webhook.chainId, | ||
| reputationOracleAddress, | ||
| KVStoreKeys.webhookUrl, | ||
| )) as string; | ||
| } catch { | ||
| //Ignore the error | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const reputationOracleAddress = | |
| await escrowClient.getReputationOracleAddress(webhook.escrowAddress); | |
| const reputationOracleWebhook = await KVStoreUtils.get( | |
| webhook.chainId, | |
| reputationOracleAddress, | |
| KVStoreKeys.webhookUrl, | |
| ); |
Comment on lines
+134
to
139
| let fee: string | undefined; | ||
| try { | ||
| fee = await KVStoreUtils.get(chainId, address, KVStoreKeys.fee); | ||
| } catch { | ||
| // noop | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const fee = await KVStoreUtils.get(chainId, address, KVStoreKeys.fee); |
Comment on lines
+116
to
121
| let role: string | undefined; | ||
| try { | ||
| role = await KVStoreUtils.get(chainId, address, KVStoreKeys.role); | ||
| } catch { | ||
| // noop | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const role = await KVStoreUtils.get(chainId, address, KVStoreKeys.role); |
Comment on lines
+144
to
149
| let url: string | undefined; | ||
| try { | ||
| url = await KVStoreUtils.get(chainId, address, KVStoreKeys.url); | ||
| } catch { | ||
| // noop | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| const url = await KVStoreUtils.get(chainId, address, KVStoreKeys.url); |
Comment on lines
320
to
+330
| @@ -327,6 +327,7 @@ | |||
| } catch { | |||
| // noop | |||
| } | |||
| operatorStatus = operatorStatus || OperatorStatus.INACTIVE; | |||
Contributor
There was a problem hiding this comment.
Suggested change
| const operatorStatus = (await KVStoreUtils.get( | |
| this.web3ConfigService.reputationNetworkChainId, | |
| this.web3ConfigService.operatorAddress, | |
| userEntity.evmAddress, | |
| )) || OperatorStatus.INACTIVE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue tracking
Freestyle
Context behind the change
Changed
KVStoreUtils.getimplementation in both SDK to returnundefined/Noneinstead of throwing an error. Throwing and error is a bit confusing behavior and usually when value is retrieved SDK consumer checks if the value is there, not empty string and correct, so it's better to return "absence of value" type rather than throw.How has this been tested?
Release plan
As part of major release in parent branch.
Potential risks; What to monitor; Rollback plan
Should be none