-
Notifications
You must be signed in to change notification settings - Fork 2
EVM read support #10
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
EVM read support #10
Conversation
let chainSelectorSupport = ""; | ||
let constructorParams = `private readonly mode: Mode = ${service.name}Capability.DEFAULT_MODE`; | ||
|
||
if (isEvmClient && capOption.labels) { | ||
const chainSelectorLabel = capOption.labels.ChainSelector as any; | ||
if ( | ||
chainSelectorLabel?.kind?.case === "uint64Label" && | ||
chainSelectorLabel?.kind?.value?.defaults | ||
) { | ||
const defaults = chainSelectorLabel.kind.value.defaults; | ||
chainSelectorSupport = ` | ||
/** Available chain selectors */ | ||
static readonly SUPPORTED_CHAINS = { | ||
${Object.entries(defaults) | ||
.map(([key, value]) => ` "${key}": ${value}n`) | ||
.join(",\n")} | ||
} as const;`; | ||
|
||
constructorParams = `private readonly mode: Mode = ${service.name}Capability.DEFAULT_MODE,\n private readonly chainSelector?: bigint`; | ||
} | ||
} |
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 sections smells a bit. Looks too tightly coupled with EVM Capability while generator should just work for any chain capability.
Wonder if Go code does extra, not-so-out-of-the-box magic for EVM Capability too?
const STORAGE_ABI = [ | ||
{ | ||
inputs: [], | ||
name: "get", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
] as const; |
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.
Probably should just import (or double check with CRE CLI / SDK GO how they handle loading).
Fine for initial tests.
I don't like the fact that I'm passing chainSelector for every capability now in callCapability but this might be a good lead.