-
Notifications
You must be signed in to change notification settings - Fork 8
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
/send checks UI mvp #643
base: dev
Are you sure you want to change the base?
/send checks UI mvp #643
Conversation
Vercel Unique URL: https://sendapp-azqkjv8px-0xsend.vercel.app |
labels=labels, | ||
resource_deps = [ | ||
"yarn:install", | ||
"anvil:mainnet", |
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 remove this.
"anvil:mainnet", |
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'd add a salt to the DeploySendCheck.s.sol
so that it uses CREATE2
and the wagmi cli will pick it up automatically.
SendCheck sendCheck = new SendCheck(); |
SendCheck sendCheck = new SendCheck{salt: keccak256("SendCheck")}();
packages/wagmi/src/generated.ts
Outdated
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 couldn't get my address filled in here due to not using CREATE2
but CREATE
instead.
I needed this patch to get my address filled in. If we patch the deploy script to use CREATE2
, then we don't need this patch.
diff --git a/packages/wagmi/wagmi.config.ts b/packages/wagmi/wagmi.config.ts
index 539cbef2..d1dd47d2 100644
--- a/packages/wagmi/wagmi.config.ts
+++ b/packages/wagmi/wagmi.config.ts
@@ -6,6 +6,9 @@ import { erc20Abi } from 'viem'
import { base, baseSepolia, mainnet, sepolia } from 'viem/chains'
import { localhost, baseLocal } from './src/chains'
import { iEntryPointAbi } from './src'
+import debug from 'debug'
+
+const log = debug('wagmi:config')
const broadcasts = (
await globby([`${process.cwd()}/../contracts/broadcast/**/run-latest.json`])
@@ -14,6 +17,8 @@ const broadcasts = (
if (!broadcasts.length) throw new Error('No broadcasts found.')
const deployments = await broadcasts.reduce(async (accP, file) => {
+ log('processing', file)
+
const acc = await accP
const data = await import(file, {
assert: { type: 'json' },
@@ -27,7 +32,7 @@ const deployments = await broadcasts.reduce(async (accP, file) => {
transactions
.filter((tx) => {
if (!tx.transactionType) throw new Error(`No transactionType found in ${file}`)
- return tx.transactionType === 'CREATE2'
+ return tx.transactionType === 'CREATE2' || tx.transactionType === 'CREATE'
})
.map((tx) => {
const { contractAddress, contractName } = tx
} | ||
|
||
const userOp = getClaimSendCheckUserOp(claimSendCheckUserOpProps as ClaimSendCheckUserOpProps) | ||
const receipt = await claimSendCheck(userOp) |
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.
we need to submit this user op to a new API endpoint that is connected to an EOA account that will submit it on behalf of the user (if they don't have any USDC balance). To start, we can just do it for all user ops.
@@ -56,4 +56,8 @@ contract SendCheck { | |||
delete checks[ephemeralAddress]; | |||
check.token.safeTransfer(msg.sender, check.amount); | |||
} | |||
|
|||
function getCheck(address ephemeralAddress) external view returns (Check memory) { |
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.
nice. I like how this types the return address in viem.
I looked at trying sendCheck.read.checks(ephemeralAddress)
but it does not return it as the struct.
queryProps? | ||
): UseQueryResult<SendCheckData> => { | ||
return useQuery({ | ||
queryKey: ['sendCheckData'], |
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.
you want it to update if the ephemeralAddress changes
queryKey: ['sendCheckData'], | |
queryKey: ['sendCheckData', ephemeralAddress], |
* Get a token's goin gecko id from its contract address | ||
* @param {Hex} contractAddress - token contract address | ||
*/ | ||
export const useCoinGeckoTokenId = (contractAddress: Hex, queryParams?): UseQueryResult<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.
Interesting, did not know about this. Did useTokenMarketData
not work for you?
} | ||
|
||
return ( | ||
<Button onPress={onPress} theme="green" px="$15" br={12} disabledStyle={{ opacity: 0.5 }}> |
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.
<Button onPress={onPress} theme="green" px="$15" br={12} disabledStyle={{ opacity: 0.5 }}> | |
import { useLink } from 'solito/link' | |
// ... | |
<Button {...useLink({ href: '/checks' })} theme="green" px="$15" br={12} disabledStyle={{ opacity: 0.5 }}> |
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.
We also have a <LinkableButton/>
Component that does the same thing
https://github.com/0xsend/sendapp/blob/dev/packages/ui/src/components/LinkableButton.tsx
return sendToken as Hex | ||
}, [sendToken]) | ||
|
||
const parsedAmount: bigint = useMemo(() => { |
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.
don't forget to multiply by the token decimals.
No description provided.