-
Notifications
You must be signed in to change notification settings - Fork 16
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
Use evm inputs for issuers #2226
Conversation
40d748f
to
acc1043
Compare
PR deployed in Google Cloud |
PR deployed in Google Cloud |
acc1043
to
02f7a57
Compare
function handleBlur(e: React.FocusEvent<HTMLInputElement>) { | ||
const address = e.target.value | ||
if (address && !exists) { | ||
onAdd(addressToHex(address)) |
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.
Is this the desired behaviour? If so, it should check that it's a valid address (check if truncated
is truthy)
02f7a57
to
323355f
Compare
value?: string | ||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void | ||
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void |
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 don't think you have to explicitly declare these three types, they should already be included in the type React.InputHTMLAttributes<HTMLInputElement
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.
Yes, you are right ! - thanks
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 work Katty! Just a few more things to clarify and then I think it's good to go! I think we can now remove the dropdown next to the input since the network is now implied by the address, buuuut @hieronx will we still need it to differentiate between the different EVM chains for liquidity pools? I think we also need some kind of icon for the evm wallets here, maybe just the ethereum logo for now? I also tried submitting the transaction but it failed: |
Yeah we still need to differentiate between EVM chains. For the Centrifuge network, the input could be either an EVM address or a Substrate/Centrifuge address. For all other networks, it's always an EVM address. |
Yeah we still need to differentiate between EVM chains. How do we currently differentiate the two? |
@kattylucy that was in response to Sophia's question. The dropdown is for selecting the network |
33df005
to
89930f2
Compare
89930f2
to
3ab99ab
Compare
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.
Left one more comment to clean up a bit but already looks good to me 🔥 nice work pushing this one through!
React.useEffect(() => { | ||
const fetchChainId = async () => { | ||
const id = await cent.getChainId() | ||
setChainId(id) | ||
} | ||
|
||
fetchChainId() | ||
}, [cent]) |
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 would make a good hook
@@ -156,6 +158,15 @@ function AOForm({ | |||
transferAllowlist: { receiverDeposit }, | |||
} = useCentrifugeConsts() | |||
|
|||
React.useEffect(() => { | |||
const fetchChainId = async () => { | |||
const id = await cent.getChainId() |
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 the wrong chain id. you'll need to use useCentEvmChainId()
...inputProps | ||
}: AddressInputProps) { | ||
const defaultId = React.useId() | ||
id ??= defaultId | ||
|
||
const [inputVal, setInputVal] = React.useState<string>(value) |
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.
the state doesn't seem necessary. the effect can use the value
prop. using state here can lead to a bug when the value is changed outside the component, causing the effect not to run
9a29ce0
to
ab6c3c3
Compare
ab6c3c3
to
902f2fc
Compare
centrifuge-js/src/utils/index.ts
Outdated
@@ -137,6 +137,8 @@ export function computeMultisig(multisig: Multisig): ComputedMultisig { | |||
} | |||
|
|||
export function evmToSubstrateAddress(address: string, chainId: number) { | |||
if (!chainId) return |
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.
better to throw in that case
Use the address input that we have for CFG transfers, that supports both EVM addresses and Centrifuge addresses
#2221
Approvals
Impact
Pool managers on Create pool page
Investor input for Centrifuge Chain on Investors tab
AO wallets on Access tab
Receiving address on Fees tab