Skip to content

Commit

Permalink
sdk: initial avax support
Browse files Browse the repository at this point in the history
Change-Id: I54ba771d1ad764379027cddfe500375fa440966f
  • Loading branch information
chase-45 committed Dec 10, 2021
1 parent 57919f6 commit 0b6b5f3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions sdk/js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.1.4

initial AVAX testnet support

## 0.1.3

### Added
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@certusone/wormhole-sdk",
"version": "0.1.3",
"version": "0.1.4",
"description": "SDK for interacting with Wormhole",
"homepage": "https://wormholenetwork.com",
"main": "./lib/cjs/index.js",
Expand Down
15 changes: 10 additions & 5 deletions sdk/js/src/utils/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ import {
CHAIN_ID_TERRA,
CHAIN_ID_POLYGON,
CHAIN_ID_ETHEREUM_ROPSTEN,
CHAIN_ID_AVAX,
} from "./consts";
import { humanAddress, canonicalAddress, isNativeDenom } from "../terra";
import { PublicKey } from "@solana/web3.js";
import { hexValue, hexZeroPad, stripZeros } from "ethers/lib/utils";
import { arrayify, zeroPad } from "@ethersproject/bytes";

export const isEVMChain = (chainId: ChainId) =>
chainId === CHAIN_ID_ETH ||
chainId === CHAIN_ID_BSC ||
chainId === CHAIN_ID_ETHEREUM_ROPSTEN ||
chainId === CHAIN_ID_POLYGON;
export const isEVMChain = (chainId: ChainId) => {
return (
chainId === CHAIN_ID_ETH ||
chainId === CHAIN_ID_BSC ||
chainId === CHAIN_ID_ETHEREUM_ROPSTEN ||
chainId === CHAIN_ID_AVAX ||
chainId === CHAIN_ID_POLYGON
);
};

export const isHexNativeTerra = (h: string) => h.startsWith("01");
export const nativeTerraHexToDenom = (h: string) =>
Expand Down
3 changes: 2 additions & 1 deletion sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export type ChainId = 1 | 2 | 3 | 4 | 5 | 10001;
export type ChainId = 1 | 2 | 3 | 4 | 5 | 6 | 10001;
export const CHAIN_ID_SOLANA: ChainId = 1;
export const CHAIN_ID_ETH: ChainId = 2;
export const CHAIN_ID_TERRA: ChainId = 3;
export const CHAIN_ID_BSC: ChainId = 4;
export const CHAIN_ID_POLYGON: ChainId = 5;
export const CHAIN_ID_AVAX: ChainId = 6;
export const CHAIN_ID_ETHEREUM_ROPSTEN: ChainId = 10001;

export const WSOL_ADDRESS = "So11111111111111111111111111111111111111112";
Expand Down

0 comments on commit 0b6b5f3

Please sign in to comment.