Integrate C-Chain Support in Avalanche Library #157
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a significant enhancement to the Avalanche library by integrating support for the C-Chain. The changes include the addition of a new enum
ChainType
, modification of theNewAccount
function signature to includeChainType
, and the introduction of a new functiongetEVMAddress
specifically for the C-Chain.Changes Made
New Enum Added:
ChainType
ChainType
with two values:C_CHAIN
for the C-Chain andX_CHAIN
for the X-Chain. This enum allows users to select the desired chain type easily.Updated Function Signature:
NewAccount
NewAccount
function to include an optional parameterchain
with a default value ofChainType.X_CHAIN
. This change enables the creation of accounts specific to the selected chain type.New Function:
getEVMAddress
getEVMAddress
to retrieve the EVM-compatible address for accounts associated with the C-Chain. This function ensures compatibility with Ethereum-style addresses and throws an error if the current signer is not associated with the C-Chain.Impact
ChainType
enum and the updatedNewAccount
function provide more flexibility and clarity for users interacting with different chains in the Avalanche ecosystem.getEVMAddress
function enhances the library's capability to handle C-Chain specific operations, aligning with the growing demand for EVM compatibility.