Skip to content

Commit

Permalink
Feat: Avalanche C-chain has to be referenced as ETH protocol
Browse files Browse the repository at this point in the history
Solution: Change the ChainType when you are using Avax from a web3 provider
  • Loading branch information
Rgascoin committed Oct 24, 2022
1 parent 7d25754 commit b79ca11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/accounts/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export class AvalancheAccount extends Account {
}

override GetChain(): Chain {
return Chain.AVAX;
if (this.signer) return Chain.AVAX;
if (this.provider) return Chain.ETH;

throw new Error("Cannot determine chain");
}

/**
Expand Down Expand Up @@ -86,7 +89,7 @@ export class AvalancheAccount extends Account {
const bintools = BinTools.getInstance();
return bintools.cb58Encode(signatureBuffer);
} else if (this.provider) {
return await this.provider.signMessage(digest);
return await this.provider.signMessage(buffer);
}

throw new Error("Cannot sign message");
Expand Down

0 comments on commit b79ca11

Please sign in to comment.