Skip to content
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

Add logic to support setting networking keys, transferring, and re-ticketing on L2 #640

Merged
merged 8 commits into from
Sep 30, 2021

Conversation

yosoyubik
Copy link
Contributor

This only adds the logic to support the correct calls to the Roller, the new UI/UX should be addressed in a separate PR

@yosoyubik yosoyubik marked this pull request as draft September 29, 2021 17:37
@yosoyubik yosoyubik marked this pull request as ready for review September 30, 2021 05:02
Comment on lines 168 to 172
const proxy = isOwnerProxy(starInfo.ownership!, _wallet.address)
? 'own'
: isSpawnProxy(starInfo.ownership!, _wallet.address)
? 'spawn'
: undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this logic is repeated in multiple places. That is probably fine for now, but if we anticipate using it in more places, we should consider extracting it to its own helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I can make wrappers around these calls


// }
const pointDetails = await api.getPoint(_point);
// const proxy = getProxy(pointDetails.ownership!, _wallet.address);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// const proxy = getProxy(pointDetails.ownership!, _wallet.address);

throw new Error("Error: Address doesn't match proxy");
console.log('operator', operator);

const nonce = await api.getNonce({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a great design decision to push the nonce management to the backend. simplifies the frontend significantly

});
if (currentL2) {
console.log(newWallet.value);
// FIXME: the useEffect is called twice, which is fine since the duplicate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is not a showstopper, we can ignore it for now, and I can take a look at this in a follow up PR

Copy link
Collaborator

@tomholford tomholford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few minor comments that don't necessarily require changes, so feel free to merge

@@ -32,7 +32,7 @@
"@types/styled-components": "^5.1.10",
"@types/styled-system": "^5.1.11",
"@types/styled-system__css": "^5.0.15",
"@urbit/roller-api": "^0.1.8",
"@urbit/roller-api": "^0.1.9",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was addressed in #641, does this branch need to be rebased on roller?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look locally if there's any conflicts, although the merge message here says that all is fine

proxy: string,
nonce: number,
urbitWallet: any
networkSeed: any,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better choice than any in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use string here, from the urbit-key-generation repo this should be a hex-encoded string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...although this is a Maybe (Just/Nothing) from folktale, and that doesn't seem to support typescript? origamitower/folktale#65

@yosoyubik yosoyubik merged commit a737f35 into roller Sep 30, 2021
@yosoyubik yosoyubik deleted the single-l2-calls branch September 30, 2021 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants