Skip to content

Conversation

graham-chainlink
Copy link
Collaborator

Spiking - introducing AddressToBytes which converts string to bytes for each of the support chain family.

This is originated from this use case raised by support ticket

Spiking - introducing AddressToBytes which converts string to bytes for each of the support chain family.

This is originated from [this use case raised by support ticket](https://chainlink-core.slack.com/archives/C08QF1BEW4T/p1756934131485399)
Copy link

changeset-bot bot commented Sep 5, 2025

⚠️ No Changeset found

Latest commit: c6dfb21

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@graham-chainlink
Copy link
Collaborator Author

May be superseeded by #386 soon

github-merge-queue bot pushed a commit that referenced this pull request Sep 9, 2025
Context:
https://chainlink-core.slack.com/archives/C08QF1BEW4T/p1756934131485399

Design thoughts:
Initially i went with [this
design](#376)
where i introduced the AddressToBytes method to the blockchain
interface. However i didn quite like this approach because
`AddressToBytes` feels out of place in the blockchain interface (it
could be its own interface, and to convert address, we dont need the
`chain` struct) and this also forces all implementations of blockchain
to implement `AddressToBytes`.

So i went with the approach in this PR, introducing a new interface call
AddressConverter and using the strategy pattern for each chain to
provide the conversion functionality. This decouples the Address
conversion logic from the Blockchain interface.


This commit adds support for converting string address to bytes for each
of the supported chain.

### ToBytes
```
		ethChain := e.BlockChains.EVMChains()[0]
		bytes, err := address.ToBytesForFamily(ethChain.Family(), "0x742d35Cc6634C0532925a3b8D4c8C1B8c4c8C1B8")
```


JIRA: https://smartcontract-it.atlassian.net/browse/CLD-606
@graham-chainlink graham-chainlink deleted the ggoh/spike/addresstobytes branch September 9, 2025 14:36
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.

1 participant