Skip to content

Commit

Permalink
update to latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
barnjamin committed Jan 4, 2024
1 parent 7379c4a commit a3b8268
Show file tree
Hide file tree
Showing 17 changed files with 485 additions and 286 deletions.
3 changes: 1 addition & 2 deletions sdk/js-connect/core/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"module": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
"files": [
"lib/**/*",
"src/**/*"
"lib/**/*"
],
"dependencies": {
"@scure/base": "^1.1.3"
Expand Down
52 changes: 30 additions & 22 deletions sdk/js-connect/core/base/src/constants/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,37 @@ const circleAPIs = [

// https://developers.circle.com/stablecoin/docs/cctp-technical-reference#domain-list
const circleDomains = [
["Ethereum", 0],
["Ethereum", 0],
["Avalanche", 1],
["Optimism", 2],
["Arbitrum", 3],
["Base", 6],
["Optimism", 2],
["Arbitrum", 3],
["Solana", 5],
["Base", 6],
] as const satisfies MapLevel<Chain, number>;

const usdcContracts = [[
"Mainnet", [
["Ethereum", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
["Avalanche", "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"],
["Arbitrum", "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"],
["Optimism", "0x179522635726710dd7d2035a81d856de4aa7836c"],
["Base", "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"],
]], [
"Testnet", [
["Avalanche", "0x5425890298aed601595a70AB815c96711a31Bc65"],
["Arbitrum", "0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63"],
["Ethereum", "0x07865c6e87b9f70255377e024ace6630c1eaa37f"],
["Optimism", "0xe05606174bac4A6364B31bd0eCA4bf4dD368f8C6"],
["Base", "0xf175520c52418dfe19c8098071a252da48cd1c19"],
]],
const usdcContracts = [
[
"Mainnet",
[
["Ethereum", "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],
["Avalanche", "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"],
["Arbitrum", "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"],
["Optimism", "0x179522635726710dd7d2035a81d856de4aa7836c"],
["Solana", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"],
["Base", "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"],
],
],
[
"Testnet",
[
["Avalanche", "0x5425890298aed601595a70AB815c96711a31Bc65"],
["Arbitrum", "0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63"],
["Ethereum", "0x07865c6e87b9f70255377e024ace6630c1eaa37f"],
["Optimism", "0xe05606174bac4A6364B31bd0eCA4bf4dD368f8C6"],
["Solana", "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"],
["Base", "0xf175520c52418dfe19c8098071a252da48cd1c19"],
],
],
] as const satisfies MapLevel<Network, MapLevel<Chain, string>>;

export const [circleChains, circleChainIds] = zip(circleDomains);
Expand All @@ -46,8 +55,7 @@ export const circleAPI = constMap(circleAPIs);

export const usdcContract = constMap(usdcContracts);

export const isCircleChain = (chain: string): chain is CircleChain =>
circleChainId.has(chain);
export const isCircleChain = (chain: string): chain is CircleChain => circleChainId.has(chain);

export const isCircleChainId = (chainId: number): chainId is CircleChainId =>
circleChainIdToChain.has(chainId);
Expand Down Expand Up @@ -85,7 +93,7 @@ export const toCircleChainId = (chain: number | bigint | string): CircleChainId
throw Error(`Cannot convert to ChainId: ${chain}`);
};

export const toCircleChain = (chain: number | string | bigint): Chain => {
export const toCircleChain = (chain: number | string | bigint): CircleChain => {
switch (typeof chain) {
case "string":
if (isCircleChain(chain)) return chain;
Expand Down
7 changes: 7 additions & 0 deletions sdk/js-connect/core/base/src/constants/contracts/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,12 @@ export const circleContracts = [[
wormholeRelayer: "",
wormhole: "0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c",
}],
[
"Solana", {
tokenMessenger: 'CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3',
messageTransmitter: 'CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd',
wormholeRelayer:"",
wormhole:""
}]
]],
] as const satisfies MapLevel<Network, MapLevel<Chain, CircleContracts>>;
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@ import { MapLevel } from "../../utils";
import { Network } from "../networks";
import { Chain } from "../chains";

export const tokenBridgeRelayerContracts = [[
"Mainnet", [
["Ethereum", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Bsc", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Polygon", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Avalanche", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Fantom", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Celo", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Sui", "0x57f4e0ba41a7045e29d435bc66cc4175f381eb700e6ec16d4fdfe92e5a4dff9f"],
["Solana", "3vxKRPwUTiEkeUVyoZ9MXFe1V71sRLbLqu1gRYaWmehQ"],
["Base", "0xaE8dc4a7438801Ec4edC0B035EcCCcF3807F4CC1"],
["Moonbeam", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
]], [
"Testnet", [
["Ethereum", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Bsc", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Polygon", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Avalanche", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Fantom", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Celo", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Sui", "0xb30040e5120f8cb853b691cb6d45981ae884b1d68521a9dc7c3ae881c0031923"],
["Solana", "3bPRWXqtSfUaCw3S4wdgvypQtsSzcmvDeaqSqPDkncrg"],
["Base", "0xae8dc4a7438801ec4edc0b035eccccf3807f4cc1"],
["Moonbeam", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
]],
export const tokenBridgeRelayerContracts = [
[
"Mainnet",
[
["Ethereum", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Bsc", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Polygon", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Avalanche", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Fantom", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Celo", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
["Sui", "0x57f4e0ba41a7045e29d435bc66cc4175f381eb700e6ec16d4fdfe92e5a4dff9f"],
["Solana", "3vxKRPwUTiEkeUVyoZ9MXFe1V71sRLbLqu1gRYaWmehQ"],
["Base", "0xaE8dc4a7438801Ec4edC0B035EcCCcF3807F4CC1"],
["Moonbeam", "0xcafd2f0a35a4459fa40c0517e17e6fa2939441ca"],
],
],
[
"Testnet",
[
["Ethereum", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Bsc", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Polygon", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Avalanche", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Fantom", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Celo", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Sui", "0xb30040e5120f8cb853b691cb6d45981ae884b1d68521a9dc7c3ae881c0031923"],
["Base", "0xae8dc4a7438801ec4edc0b035eccccf3807f4cc1"],
["Moonbeam", "0x9563a59c15842a6f322b10f69d1dd88b41f2e97b"],
["Solana", "3bPRWXqtSfUaCw3S4wdgvypQtsSzcmvDeaqSqPDkncrg"],
],
],
] as const satisfies MapLevel<Network, MapLevel<Chain, string>>;
37 changes: 37 additions & 0 deletions sdk/js-connect/core/base/src/constants/guardians.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { RoArray, constMap } from "../utils";
import { Network } from "./networks";

const guardianNamesAndKeys = [
[
"Mainnet",
[
["JumpCrypto", "0x58CC3AE5C097b213cE3c81979e1B9f9570746AA5"],
["Staked", "0xfF6CB952589BDE862c25Ef4392132fb9D4A42157"],
["Figment", "0x114De8460193bdf3A2fCf81f86a09765F4762fD1"],
["ChainodeTech", "0x107A0086b32d7A0977926A205131d8731D39cbEB"],
["Inotel", "0x8C82B2fd82FaeD2711d59AF0F2499D16e726f6b2"],
["HashQuark", "0x11b39756C042441BE6D8650b69b54EbE715E2343"],
["Chainlayer", "0x54Ce5B4D348fb74B958e8966e2ec3dBd4958a7cd"],
["xLabs", "0x15e7cAF07C4e3DC8e7C469f92C8Cd88FB8005a20"],
["Forbole", "0x74a3bf913953D695260D88BC1aA25A4eeE363ef0"],
["StakingFund", "0x000aC0076727b35FBea2dAc28fEE5cCB0fEA768e"],
["MoonletWallet", "0xAF45Ced136b9D9e24903464AE889F5C8a723FC14"],
["P2PValidator", "0xf93124b7c738843CBB89E864c862c38cddCccF95"],
["01Node", "0xD2CC37A4dc036a8D232b48f62cDD4731412f4890"],
["MCF", "0xDA798F6896A3331F64b48c12D1D57Fd9cbe70811"],
["Everstake", "0x71AA1BE1D36CaFE3867910F99C09e347899C19C3"],
["ChorusOne", "0x8192b6E7387CCd768277c17DAb1b7a5027c0b3Cf"],
["Syncnode", "0x178e21ad2E77AE06711549CFBB1f9c7a9d8096e8"],
["Triton", "0x5E1487F35515d02A92753504a8D75471b9f49EdB"],
["StakingFacilities", "0x6FbEBc898F403E4773E95feB15E80C9A99c8348d"],
],
],
["Testnet", [["Testnet guardian", "0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]]],
["Devnet", [["", ""]]],
] as const satisfies RoArray<readonly [Network, RoArray<readonly [string, string]>]>;

export const guardianKeys = constMap(guardianNamesAndKeys);
export const guardianNames = constMap(guardianNamesAndKeys, [[0, 2], 1]);

export const devnetGuardianPrivateKey =
"cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0";
27 changes: 23 additions & 4 deletions sdk/js-connect/core/base/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
export { Network } from "./networks";
export { ProtocolName } from "./protocols";
export { Chain, ChainId, isChain, toChainId, toChain, chains, chainToChainId, chainIdToChain } from "./chains";
export { Platform, PlatformToChains, ChainToPlatform, PlatformAddressFormat, isPlatform, platformToChains, chainToPlatform } from "./platforms";
export {
Chain,
ChainId,
isChain,
toChainId,
toChain,
chains,
chainToChainId,
chainIdToChain,
} from "./chains";
export {
Platform,
PlatformToChains,
ChainToPlatform,
PlatformAddressFormat,
isPlatform,
platformToChains,
chainToPlatform,
platformToAddressFormat,
} from "./platforms";

export * as platform from './platforms'
export * as chain from './chains'
export * as platform from "./platforms";
export * as chain from "./chains";
export * as network from "./networks";
export * as finality from "./finality";
export * as decimals from "./decimals";
Expand All @@ -13,3 +31,4 @@ export * as rpc from "./rpc";
export * as nativeChainIds from "./nativeChainIds";
export * as circle from "./circle";
export * as contracts from "./contracts";
export * as guardians from "./guardians";
Loading

0 comments on commit a3b8268

Please sign in to comment.