-
Notifications
You must be signed in to change notification settings - Fork 3
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: support non-vbank purses #37
Conversation
res(val); | ||
stop(); |
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: Conceptually, shouldn't it stop as soon as it got the value? If it were async you could imagine that by the time the resolve was done another value would have been watched. I don't see how that would be possible in this synchronous function but it still seems more appropriate to stop immediately upon receiving the one value.
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.
Sure, swapped them around. Yea it doesn't matter in without an await.
@@ -201,10 +201,30 @@ export const makeAgoricChainStorageWatcher = ( | |||
return () => stopWatching(pathKey, subscriber as Subscriber<unknown>); | |||
}; | |||
|
|||
const queryOnce = <T>(path: [AgoricChainStoragePathKind, string]) => |
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.
remark: nice use of generic. eventually I'd like agoric-sdk to export a schema of types for each storage path so that the type can be inferred from the path string.
}); | ||
|
||
const queryBoardAux = <T>(boardObjects: unknown[]) => { | ||
const boardIds = boardObjects.map(o => marshaller.toCapData(o).slots[0]); |
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.
important: the callback taking slot[0] is making some assumptions. please extract it into a function with some documentation on why that assumption is safe
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
@@ -110,6 +110,29 @@ describe('makeAgoricChainStorageWatcher', () => { | |||
expect(await value).toEqual(expected); | |||
}); | |||
|
|||
it('can do single queries', async () => { | |||
const expected = 126560000000; | |||
const path = 'published.vitest.unserializedValue'; |
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.
Important: is published
necessary? if not remove it and if so explain in a 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.
No just to illustrate, removed
let agoricBrands; | ||
let nonBankPurses; | ||
let brandToBoardAux; |
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.
important: the is a lot of state in this large scope. it's hard to keep track of the possible states and types.
please reduce the access to these vars to only the functions that need them. a block may suffice.
please also annotate their types.
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
7f34d23
to
dfa49e2
Compare
97733aa
to
61717a4
Compare
refs Agoric/wallet-app#116
Testing
Tested with https://github.com/samsiegart/simple-game (using
yarn link @agoric/rpc
andyarn link @agoric/web-components
on this branch locally). Running a local chain against Agoric/agoric-sdk#8147Also: chainapsis/keplr-wallet@master...samsiegart:keplr-wallet:agoric-asset-support