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

Support any-chain request links #1268

Merged
merged 10 commits into from
Aug 14, 2024
Merged

Support any-chain request links #1268

merged 10 commits into from
Aug 14, 2024

Conversation

andrewliu08
Copy link
Contributor

@andrewliu08 andrewliu08 commented Aug 13, 2024

#1263

TODO

  • fix issues in daimo-web where DaimoRequestLink is used
  • handle case where the recipient is a Daimo account but the toChain is not base or the toCoin is not USDC

Copy link

vercel bot commented Aug 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
daimo-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 0:40am
daimo-web-stage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 0:40am

recipient={recipient}
onCancel={goBack}
daimoChain={daimoChain}
defaultHomeCoin={(link as DaimoLinkRequest).toCoin ?? toCoin}
Copy link
Member

Choose a reason for hiding this comment

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

DaimoLinkRequest.toCoin isn't nullable, right?

Copy link
Member

@dcposch dcposch left a comment

Choose a reason for hiding this comment

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

LGTM

tests for the the request deeplink web pages:

http://localhost:3000/l/request/hola/1.23/1234
^ should show an unfilled request

http://localhost:3000/l/request?to=hola&n=1.23
^ same

http://localhost:3000/l/request?to=hola&n=1.23&t=usdc&c=11155111
^ ideally show an error since sepolia is not hola's home chain

http://localhost:3000/l/request?to=vitalik.eth&n=1.23&t=usdc&c=11155111
^ show unfilled request, open in app > prefills Sepolia USD

dollars: DollarStr;
dollars?: DollarStr;
toCoin: ForeignToken;
toChain: DAv2Chain;
Copy link
Member

Choose a reason for hiding this comment

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

👍

return null;
}

let toCoin: ForeignToken | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

just : ForeignToken?

@@ -56,6 +58,8 @@ export const ethereumUSDC: ForeignToken = {
logoURI: TokenLogo.USDC,
};

export const ethereumTokens = [ethereumUSDC];
Copy link
Member

Choose a reason for hiding this comment

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

👍

[80002, polygonAmoyTokens],
[43114, avalancheTokens],
[43113, avalancheFujiTokens],
]);
Copy link
Member

Choose a reason for hiding this comment

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

surprised we didn't need this before this PR ^ looks good

@andrewliu08
Copy link
Contributor Author

andrewliu08 commented Aug 14, 2024

http://localhost:3000/l/request?to=hola&n=1.23
^ same

for request links using the new query param format, i've made setting the chain and coin mandatory, so this link wouldn't work. maybe we could default to the user's home coin and home chain after DAv2 ships

const c = url.searchParams.get("c");
const t = url.searchParams.get("t");

if (!to || !c || !t) return null;
Copy link
Member

@dcposch dcposch Aug 14, 2024

Choose a reason for hiding this comment

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

to avoid cross-chain request links to Daimo accounts, we could check here that to is not an account name. eg

// Cross-chain request link destination != Daimo account
if (isValidName(to)) return null;

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