-
Notifications
You must be signed in to change notification settings - Fork 230
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: more send utilities #1892
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/api/buildSendTransaction.ts
Outdated
to: tokenAddress, | ||
data: transferCallData, | ||
}, | ||
]; |
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.
why does this return an array?
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 doesn't need to, I'll just return the object
} | ||
const parsedAmount = parseUnits(amount, token.decimals); | ||
return { | ||
calls: buildSendTransaction({ |
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 will be a weird response format if there's an error
} | ||
} else if (isAddress(input, { strict: false })) { | ||
return input; | ||
} |
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.
nit: if isAddress then no need to check if its isBasename or isEns? moving this first could remove the else if and short circuit faster
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.
makes sense, updated
src/api/buildSendTransaction.ts
Outdated
} catch (error) { | ||
return { | ||
code: 'AmBSeTa01', // Api Module Build Send Transaction Error 01 | ||
error: `Something went wrong: ${error}`, |
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.
could probably just return error here, i think its implicit that something went wrong
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.
ack, will update to Error: ${error}
return sendTransaction; | ||
} | ||
|
||
const parsedAmount = parseUnits(amount.toString(), token.decimals); |
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.
nit: amount should already be a 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.
yep, you're right, removing the method
What changed? Why?
buildSendTransaction
API endpointuseSendTransaction
hookvalidateAddressInput
wallet utilNotes to reviewers
How has it been tested?