-
Notifications
You must be signed in to change notification settings - Fork 206
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
Wallet UI services #5949
Wallet UI services #5949
Conversation
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.
No blockers. I assume you've tested manually
try { | ||
await E(offer.actions).accept(); | ||
} catch (e) { | ||
setPendingOffers({ offerId: id, isPending: false }); | ||
console.error('Failed to accept offer', e); | ||
} |
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.
with this try
, returned promise will now resolve even if accept
fails. I don't know if anything is actually paying attention to the result (there's no return type) but I think it would be safer to keep this function sync and return the failed promise.
try { | |
await E(offer.actions).accept(); | |
} catch (e) { | |
setPendingOffers({ offerId: id, isPending: false }); | |
console.error('Failed to accept offer', e); | |
} | |
return E(offer.actions).accept().catch(e => { | |
setPendingOffers({ offerId: id, isPending: false }); | |
console.error('Failed to accept offer', e); | |
}); |
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.
That's better, done thanks
give = proposalTemplate.give ?? {}; | ||
want = proposalTemplate.want ?? {}; | ||
args = proposalTemplate.arguments; | ||
} |
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.
is it intended that ! proposalForDisplay && ! proposalTemplate
result in give = {}
etc? Consider including an explanation.
} | |
} else { | |
// leave default values | |
} |
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.
Yes, added an explanation
@@ -0,0 +1,44 @@ | |||
import { makeNotifierKit } from '@agoric/notifier'; | |||
|
|||
export const getIssuerService = signSpendAction => { |
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.
consider typing
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.
Done
|
||
export const getIssuerService = signSpendAction => { | ||
const suggestions = new Map(); | ||
const { notifier, updater } = makeNotifierKit(); |
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.
not worth changing right now but for the future consider makePublishKit
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.
Added TODO
6607b6f
to
a1e470b
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.
looks good.
In particular, test coverage for marshal-contexts.js
is still 100%
/** @type {IdTable<number, Payment>} */ | ||
/** @type {IdTable<number, unknown>} */ |
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.
oops! Thanks for fixing that.
/** @type {IdTable<number, PurseActions>} */ | ||
/** @type {IdTable<number, Purse>} */ |
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.
yes, I was probably getting ahead of myself with PurseActions
.
@@ -1205,7 +1205,7 @@ test('lib-wallet performAction suggestIssuer', async t => { | |||
type: 'suggestIssuer', | |||
data: { petname: 'bucksIssuer', boardId: bucksIssuerBoardId }, | |||
}); | |||
const done = await wallet.performAction({ action }); | |||
const done = await wallet.performAction({ spendAction: action }); |
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.
suggestIssuer is a spendAction
? I suppose that's correct but just a sort of de-optimization.
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.
I haven't tried getting a non-spend action end-to-end working, I assumed that was still needing design but perhaps this can be the first one we try with. We can revisit.
@@ -241,17 +241,19 @@ const defaultMakePresence = iface => { | |||
*/ | |||
export const makeImportContext = (makePresence = defaultMakePresence) => { | |||
const walletObjects = { | |||
/** @type {IdTable<number, PurseActions>} */ |
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.
ouch... why did we have to take that out? Can we make it IdTable<number, unknown>
? or even IdTable<number, *>
? Using *
(aka any
) should include a justification comment.
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.
Added it back with unknown
a1d1934
to
4938df1
Compare
refs: #5354