sdk/js: esm and cjs builds
Change-Id: I9ddb372ac872675f5b906d523ff5237e4f65ecb1
This commit is contained in:
parent
8ea4e9889e
commit
f085e4e15c
|
@ -1,7 +1,7 @@
|
|||
import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
||||
import migrateTokensTx from "@certusone/wormhole-sdk/lib/migration/migrateTokens";
|
||||
import getPoolAddress from "@certusone/wormhole-sdk/lib/migration/poolAddress";
|
||||
import getToCustodyAddress from "@certusone/wormhole-sdk/lib/migration/toCustodyAddress";
|
||||
import migrateTokensTx from "@certusone/wormhole-sdk/lib/esm/migration/migrateTokens";
|
||||
import getPoolAddress from "@certusone/wormhole-sdk/lib/esm/migration/poolAddress";
|
||||
import getToCustodyAddress from "@certusone/wormhole-sdk/lib/esm/migration/toCustodyAddress";
|
||||
import { makeStyles, Typography } from "@material-ui/core";
|
||||
import {
|
||||
ASSOCIATED_TOKEN_PROGRAM_ID,
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
getOriginalAssetEth,
|
||||
getOriginalAssetSol,
|
||||
WormholeWrappedNFTInfo,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
|
|
|
@ -290,7 +290,7 @@ export default function Recovery() {
|
|||
(async () => {
|
||||
try {
|
||||
const { parse_vaa } = await import(
|
||||
"@certusone/wormhole-sdk/lib/solana/core/bridge"
|
||||
"@certusone/wormhole-sdk/lib/esm/solana/core/bridge"
|
||||
);
|
||||
const parsedVAA = parse_vaa(hexToUint8Array(recoverySignedVAA));
|
||||
if (!cancelled) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
NFTImplementation,
|
||||
TokenImplementation,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { WormholeAbi__factory } from "@certusone/wormhole-sdk/lib/ethers-contracts/abi";
|
||||
import { WormholeAbi__factory } from "@certusone/wormhole-sdk/lib/esm/ethers-contracts/abi";
|
||||
import { getAddress as getEthAddress } from "@ethersproject/address";
|
||||
import React, { useCallback } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import {
|
||||
getOriginalAssetEth as getOriginalAssetEthNFT,
|
||||
getOriginalAssetSol as getOriginalAssetSolNFT,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import { useEffect } from "react";
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import {
|
||||
getForeignAssetEth as getForeignAssetEthNFT,
|
||||
getForeignAssetSol as getForeignAssetSolNFT,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { BigNumber } from "@ethersproject/bignumber";
|
||||
import { arrayify } from "@ethersproject/bytes";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
isNFTVAASolanaNative,
|
||||
redeemOnEth,
|
||||
redeemOnSolana,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { arrayify } from "@ethersproject/bytes";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { WalletContextState } from "@solana/wallet-adapter-react";
|
||||
|
@ -106,7 +106,7 @@ async function solana(
|
|||
const isNative = await isNFTVAASolanaNative(signedVAA);
|
||||
if (!isNative) {
|
||||
const { parse_vaa } = await import(
|
||||
"@certusone/wormhole-sdk/lib/solana/core/bridge"
|
||||
"@certusone/wormhole-sdk/lib/esm/solana/core/bridge"
|
||||
);
|
||||
const parsedVAA = parse_vaa(signedVAA);
|
||||
const { originChain, originAddress, tokenId } = parseNFTPayload(
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
import {
|
||||
transferFromEth,
|
||||
transferFromSolana,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { WalletContextState } from "@solana/wallet-adapter-react";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
getOriginalAssetEth as getOriginalAssetEthNFT,
|
||||
getOriginalAssetSol as getOriginalAssetSolNFT,
|
||||
WormholeWrappedNFTInfo,
|
||||
} from "@certusone/wormhole-sdk/lib/nft_bridge";
|
||||
} from "@certusone/wormhole-sdk/lib/esm/nft_bridge";
|
||||
import { Web3Provider } from "@certusone/wormhole-sdk/node_modules/@ethersproject/providers";
|
||||
import { ethers } from "@certusone/wormhole-sdk/node_modules/ethers";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
# Changelog
|
||||
|
||||
## 0.0.11
|
||||
## 0.1.0
|
||||
|
||||
### Added
|
||||
|
||||
separate cjs and esm builds
|
||||
|
||||
updateWrappedOnSolana
|
||||
|
||||
top-level export getSignedVAAWithRetry
|
||||
|
||||
## 0.0.10
|
||||
|
||||
### Added
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
{
|
||||
"name": "@certusone/wormhole-sdk",
|
||||
"version": "0.0.10",
|
||||
"version": "0.1.0",
|
||||
"description": "SDK for interacting with Wormhole",
|
||||
"homepage": "https://wormholenetwork.com",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"main": "./lib/cjs/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
"./lib/**/*"
|
||||
],
|
||||
"repository": "https://github.com/certusone/wormhole/tree/dev.v2/sdk/js",
|
||||
"scripts": {
|
||||
"build-contracts": "npm run build --prefix ../../ethereum && node scripts/copyContracts.js && typechain --target=ethers-v5 --out-dir=src/ethers-contracts contracts/*.json",
|
||||
"build-abis": "typechain --target=ethers-v5 --out-dir=src/ethers-contracts/abi src/abi/Wormhole.abi.json",
|
||||
"build-deps": "npm run build-abis && npm run build-contracts",
|
||||
"build-lib": "tsc && node scripts/copyEthersTypes.js && node scripts/copyWasm.js",
|
||||
"build-lib": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node scripts/copyEthersTypes.js && node scripts/copyWasm.js",
|
||||
"build-all": "npm run build-deps && npm run build-lib",
|
||||
"test": "jest --config jestconfig.json --verbose",
|
||||
"build": "npm run build-all",
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
const fs = require("fs");
|
||||
fs.readdirSync("src/ethers-contracts").forEach((file) => {
|
||||
if (file.endsWith(".d.ts")) {
|
||||
fs.copyFileSync(
|
||||
`src/ethers-contracts/${file}`,
|
||||
`lib/ethers-contracts/${file}`
|
||||
);
|
||||
}
|
||||
});
|
||||
["lib/esm", "lib/cjs"].forEach((buildPath) => {
|
||||
fs.readdirSync("src/ethers-contracts").forEach((file) => {
|
||||
if (file.endsWith(".d.ts")) {
|
||||
fs.copyFileSync(
|
||||
`src/ethers-contracts/${file}`,
|
||||
`${buildPath}/ethers-contracts/${file}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
fs.readdirSync("src/ethers-contracts/abi").forEach((file) => {
|
||||
if (file.endsWith(".d.ts")) {
|
||||
fs.copyFileSync(
|
||||
`src/ethers-contracts/abi/${file}`,
|
||||
`lib/ethers-contracts/abi/${file}`
|
||||
);
|
||||
}
|
||||
fs.readdirSync("src/ethers-contracts/abi").forEach((file) => {
|
||||
if (file.endsWith(".d.ts")) {
|
||||
fs.copyFileSync(
|
||||
`src/ethers-contracts/abi/${file}`,
|
||||
`${buildPath}/ethers-contracts/abi/${file}`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,65 +1,67 @@
|
|||
const fs = require("fs");
|
||||
fs.copyFileSync(
|
||||
"src/solana/core/bridge_bg.wasm",
|
||||
"lib/solana/core/bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/core-node/bridge_bg.wasm",
|
||||
"lib/solana/core-node/bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/core/bridge_bg.wasm.d.ts",
|
||||
"lib/solana/core/bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/core-node/bridge_bg.wasm.d.ts",
|
||||
"lib/solana/core-node/bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/nft/nft_bridge_bg.wasm",
|
||||
"lib/solana/nft/nft_bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/nft-node/nft_bridge_bg.wasm",
|
||||
"lib/solana/nft-node/nft_bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/nft/nft_bridge_bg.wasm.d.ts",
|
||||
"lib/solana/nft/nft_bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/nft-node/nft_bridge_bg.wasm.d.ts",
|
||||
"lib/solana/nft-node/nft_bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/token/token_bridge_bg.wasm",
|
||||
"lib/solana/token/token_bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/token-node/token_bridge_bg.wasm",
|
||||
"lib/solana/token-node/token_bridge_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/token/token_bridge_bg.wasm.d.ts",
|
||||
"lib/solana/token/token_bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/token-node/token_bridge_bg.wasm.d.ts",
|
||||
"lib/solana/token-node/token_bridge_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/migration/wormhole_migration_bg.wasm",
|
||||
"lib/solana/migration/wormhole_migration_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/migration-node/wormhole_migration_bg.wasm",
|
||||
"lib/solana/migration-node/wormhole_migration_bg.wasm"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/migration/wormhole_migration_bg.wasm.d.ts",
|
||||
"lib/solana/migration/wormhole_migration_bg.wasm.d.ts"
|
||||
);
|
||||
fs.copyFileSync(
|
||||
"src/solana/migration-node/wormhole_migration_bg.wasm.d.ts",
|
||||
"lib/solana/migration-node/wormhole_migration_bg.wasm.d.ts"
|
||||
);
|
||||
["lib/esm", "lib/cjs"].forEach((buildPath) => {
|
||||
fs.copyFileSync(
|
||||
`src/solana/core/bridge_bg.wasm`,
|
||||
`${buildPath}/solana/core/bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/core-node/bridge_bg.wasm`,
|
||||
`${buildPath}/solana/core-node/bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/core/bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/core/bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/core-node/bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/core-node/bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/nft/nft_bridge_bg.wasm`,
|
||||
`${buildPath}/solana/nft/nft_bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/nft-node/nft_bridge_bg.wasm`,
|
||||
`${buildPath}/solana/nft-node/nft_bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/nft/nft_bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/nft/nft_bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/nft-node/nft_bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/nft-node/nft_bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/token/token_bridge_bg.wasm`,
|
||||
`${buildPath}/solana/token/token_bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/token-node/token_bridge_bg.wasm`,
|
||||
`${buildPath}/solana/token-node/token_bridge_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/token/token_bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/token/token_bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/token-node/token_bridge_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/token-node/token_bridge_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/migration/wormhole_migration_bg.wasm`,
|
||||
`${buildPath}/solana/migration/wormhole_migration_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/migration-node/wormhole_migration_bg.wasm`,
|
||||
`${buildPath}/solana/migration-node/wormhole_migration_bg.wasm`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/migration/wormhole_migration_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/migration/wormhole_migration_bg.wasm.d.ts`
|
||||
);
|
||||
fs.copyFileSync(
|
||||
`src/solana/migration-node/wormhole_migration_bg.wasm.d.ts`,
|
||||
`${buildPath}/solana/migration-node/wormhole_migration_bg.wasm.d.ts`
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
export * from "./getSignedVAA";
|
||||
export * from "./getSignedVAAWithRetry";
|
||||
|
|
|
@ -383,7 +383,7 @@ describe("Integration Tests", () => {
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
done(
|
||||
"An error occurred while trying to attest from Solana to Ethereum"
|
||||
"An error occurred while trying to send from Solana to Ethereum"
|
||||
);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"outDir": "./lib/cjs"
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"outDir": "./lib",
|
||||
"outDir": "./lib/esm",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"downlevelIteration": true,
|
||||
|
|
Loading…
Reference in New Issue