Skip to content

Conversation

ernest-nowacki
Copy link
Contributor

I don't like the fact that I'm passing chainSelector for every capability now in callCapability but this might be a good lead.

Comment on lines 179 to 199
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`;
}
}
Copy link
Contributor Author

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?

Comment on lines +15 to +23
const STORAGE_ABI = [
{
inputs: [],
name: "get",
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
stateMutability: "view",
type: "function",
},
] as const;
Copy link
Contributor Author

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.

@ernest-nowacki ernest-nowacki marked this pull request as ready for review August 20, 2025 09:00
@ernest-nowacki ernest-nowacki requested a review from a team as a code owner August 20, 2025 09:00
@ernest-nowacki ernest-nowacki merged commit d4764bd into main Aug 20, 2025
5 checks passed
@ernest-nowacki ernest-nowacki deleted the feat/on-chain branch August 20, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants