-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from ensdomains/feat/unnamed-evm-coins
feat: support unknown evm chains
- Loading branch information
Showing
8 changed files
with
106 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { describe, expect, test } from "bun:test"; | ||
import { | ||
coinTypeToEvmChainId, | ||
evmChainIdToCoinType, | ||
isEvmCoinType, | ||
} from "./evm.js"; | ||
|
||
describe("isEvmCoinType()", () => { | ||
test("non evm coin type", () => { | ||
expect(isEvmCoinType(1000)).toBeFalse(); | ||
}); | ||
test("evm coin type", () => { | ||
expect(isEvmCoinType(2147483658)).toBeTrue(); | ||
}); | ||
}); | ||
|
||
describe("evmChainIdToCoinType()", () => { | ||
test("normal chainId", () => { | ||
expect(evmChainIdToCoinType(10)).toBe(2147483658); | ||
}); | ||
test("chainId too large", () => { | ||
expect(() => evmChainIdToCoinType(2147483648)).toThrow("Invalid chainId"); | ||
}); | ||
}); | ||
|
||
describe("coinTypeToEvmChainId()", () => { | ||
test("non evm coin type", () => { | ||
expect(() => coinTypeToEvmChainId(1000)).toThrow( | ||
"Coin type is not an EVM chain" | ||
); | ||
}); | ||
test("evm coin type", () => { | ||
expect(coinTypeToEvmChainId(2147483658)).toBe(10); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters