-
Notifications
You must be signed in to change notification settings - Fork 360
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
Allow contract config to suggest relative's template #3837
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
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's a little convoluted but it looks good
function getAddresses( | ||
value: ContractValue | undefined, | ||
template?: string, | ||
): EthereumAddress[] { | ||
if (Array.isArray(value)) { | ||
return value.flatMap((v) => getAddresses(v, template)) | ||
} else if (typeof value === 'object') { | ||
return Object.values(value).flatMap((v) => getAddresses(v, template)) | ||
} else if (typeof value === 'string') { | ||
try { | ||
return [EthereumAddress(value)] | ||
} catch { | ||
return [] | ||
} | ||
} | ||
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.
Is template
here really used anywhere?
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.
Good spot, will be removed.
Resolves L2B-5660
This PR includes a simple use of a suggested templates in zora, as an example.
Implementation deals with situations where:
field.target.template
).