-
Notifications
You must be signed in to change notification settings - Fork 212
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(inter-protocol): add amm liquidity script #5938
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.
I noted some non-blocking requests. I this were production code I'd Request Changes but since this is just utility a script and it's in a fast-moving part of the codebase, I'll approve and leave updates to your discretion.
// /** @type {<K extends string,V>(es: [K,V][]) => Record<K,V>} */ | ||
// const recordFromEntries = Object.fromEntries; |
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.
remove dead code
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.
removed
// /** @type {<K extends string,V>(es: [K,V][]) => Record<K,V>} */ | ||
// const recordFromEntries = Object.fromEntries; | ||
|
||
const getOfferResult = async (instance, wallet, walletAdmin) => { |
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 adding types
let result; | ||
console.log('awaiting offers...'); | ||
for await (const offers of makeNotifierFromAsyncIterable(offerIt)) { | ||
console.log('offers iterator:', offers); |
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 is a next of the iterator, not the iterator itself
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.
fixed
status === 'complete' && invitationQuery.instance === instance, | ||
) | ||
.forEach(async ({ id }) => { | ||
result = await E(wallet).lookup('offerResult', id); |
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.
should this really run for each offer? seems like you want to .find
the first match. In which case you don't need a separate filter
.
result = offers.find(… )
if (result) break;
|
||
/** | ||
* | ||
* @param { any } homeP |
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 blocking, but do we have a type for this somewhere?
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.
It used to be import('./user-bundle').HomeBundle
which was unresolved, not sure where it came from. And I couldn't find anything else in agoric-sdk
that defines a proper type for homeP
// const iNot = E(wb).getIssuersNotifier(); | ||
// const { value: iEntries } = await E(iNot).getUpdateSince(); | ||
// const issuers = recordFromEntries(iEntries); | ||
// console.log(issuers); |
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.
dead code. if it's meant to be used for additional diagnostics, put it behind a flag to enable such diagnostics
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.
removed
const offerConfig = { | ||
id: `${now()}`, | ||
invitation, | ||
// installationHandle: amm.installation, |
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.
dead
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.
removed
Thanks, yea I'd rather just move forward with the next PR, it takes significant time to start a local chain and test this script from scratch. |
@arirubinstein note this perhaps obsoletes https://github.com/Agoric/inter-protocol-bootstrap/blob/main/add-initial-liquidity.js |
* feat(inter-protocol): add amm liquidity script * fix: remove dead code Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
refs: #5354