-
Notifications
You must be signed in to change notification settings - Fork 5
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
✨ (signer-eth) [DSDK-652]: Add web3checks support #656
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
abd32a2
to
6e943ad
Compare
6e943ad
to
2aa1145
Compare
if (web3Checks.isLeft()) { | ||
return null; | ||
} else { | ||
const web3ChecksValue = web3Checks.unsafeCoerce(); |
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.
[COULD] I think you could simplify this using the caseOf
functions on the Either:
return web3Checks.caseOf({
Right: checks => ({
type: ClearSignContectType.WEB3_CHECK,
payload: checks.descriptor,
certificate: checks.certificates
}),
Left: () => null,
});
WDYT ?
); | ||
} | ||
|
||
const certificate = await this._certificateLoader.loadCertificate({ |
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.
[ASK] Can this async method fail ? If yes, probably should wrap it in a try catch or something ?
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 method may fail, but explicit result checking is unnecessary as failure is handled later
|
||
async load( | ||
web3CheckContext: Web3CheckContext, | ||
): Promise<Either<Error, Web3Checks>> { |
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.
[ASK] Vanilla Errors here ? (new Error())
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.
These errors are used only internally, what do you suggest ?
import { type Web3CheckContext, type Web3Checks } from "./web3CheckTypes"; | ||
|
||
export interface Web3CheckContextLoader { | ||
load(web3CheckContext: Web3CheckContext): Promise<Either<Error, Web3Checks>>; |
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.
[ASK] I guess same question, vanilla Errors here ?
const { deviceModelId } = this.api.getDeviceSessionState(); | ||
|
||
const parsed = mapper.mapTransactionToSubset(transaction); | ||
parsed.ifLeft((err) => { |
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.
[COULD] Same here, you could leverage the Either caseOf functions
const { subset, serializedTransaction } = mapper
.mapTransactionToSubset(transaction)
.caseOf({
Right: parsed => parsed,
Left: (err) => { throw err }
});
I feel it's better than using unsafeCoerce
. WDYT ?
I'm not so sure on this one as we do a throw here so.... maybe there is a better solution
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.
Throwing on tasks is safe since the device action catches it. this method avoid using unsafeCoerce
and is an equivalent so can add it 👍
2aa1145
to
9a8c9ce
Compare
packages/signer/context-module/src/web3-check/data/Web3CheckDto.ts
Outdated
Show resolved
Hide resolved
packages/signer/context-module/src/web3-check/data/HttpWeb3CheckDataSource.ts
Outdated
Show resolved
Hide resolved
packages/signer/context-module/src/pki/model/PkiCertificateInfo.ts
Outdated
Show resolved
Hide resolved
packages/signer/context-module/src/web3-check/data/HttpWeb3CheckDataSource.ts
Outdated
Show resolved
Hide resolved
packages/signer/signer-eth/src/internal/app-binder/task/GetWeb3CheckTask.ts
Show resolved
Hide resolved
...ges/signer/signer-eth/src/internal/app-binder/task/ProvideTransactionFieldDescriptionTask.ts
Show resolved
Hide resolved
445fbd5
to
d3d49aa
Compare
d3d49aa
to
85c3a5e
Compare
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.
lgtm
09666b9
to
85c3a5e
Compare
📝 Description
Add web3checks support:
context-module
web3checks
step in thesignTransactionDA
url
param available to edit in thesample
❓ Context
✅ Checklist
Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.
🧐 Checklist for the PR Reviewers