Browse Source

sdk/js: migrate ethers contracts and solana wasm

Change-Id: Ibb66962eaa6bbb95d2845e4277b406bf36df7044
Evan Gray 4 years ago
parent
commit
1c2e7444e8

+ 28 - 362
bridge_ui/package-lock.json

@@ -7,10 +7,8 @@
     "": {
       "name": "test_ui",
       "version": "0.1.0",
-      "hasInstallScript": true,
       "dependencies": {
         "@certusone/wormhole-sdk": "file:..\\sdk\\js",
-        "@improbable-eng/grpc-web": "^0.13.0",
         "@material-ui/core": "^4.12.2",
         "@material-ui/icons": "^4.11.2",
         "@metamask/detect-provider": "^1.2.0",
@@ -19,29 +17,26 @@
         "@solana/spl-token": "^0.1.6",
         "@solana/wallet-base": "^0.0.1",
         "@solana/web3.js": "^1.22.0",
-        "@typechain/ethers-v5": "^7.0.1",
-        "bridge": "file:rust_modules\\core",
         "ethers": "^5.4.1",
         "react": "^17.0.2",
         "react-dom": "^17.0.2",
         "react-redux": "^7.2.4",
         "react-router-dom": "^5.2.0",
         "react-scripts": "4.0.3",
-        "redux": "^3.7.2",
-        "token-bridge": "file:rust_modules\\token"
+        "redux": "^3.7.2"
       },
       "devDependencies": {
         "@craco/craco": "^6.2.0",
-        "@openzeppelin/contracts": "^4.2.0",
         "@truffle/hdwallet-provider": "^1.4.1",
-        "copy-dir": "^1.3.0",
         "prettier": "^2.3.2",
         "truffle": "^5.4.1",
         "wasm-loader": "^1.3.0"
       }
     },
     "../sdk/js": {
+      "name": "@certusone/wormhole-sdk",
       "version": "0.0.1",
+      "hasInstallScript": true,
       "license": "Apache-2.0",
       "dependencies": {
         "@improbable-eng/grpc-web": "^0.14.0",
@@ -50,7 +45,10 @@
         "rxjs": "^7.3.0"
       },
       "devDependencies": {
+        "@openzeppelin/contracts": "^4.2.0",
+        "@typechain/ethers-v5": "^7.0.1",
         "@types/long": "^4.0.1",
+        "copy-dir": "^1.3.0",
         "prettier": "^2.3.2",
         "tslint": "^6.1.3",
         "tslint-config-prettier": "^1.18.0",
@@ -4040,6 +4038,8 @@
       "version": "0.13.0",
       "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.13.0.tgz",
       "integrity": "sha512-vaxxT+Qwb7GPqDQrBV4vAAfH0HywgOLw6xGIKXd9Q8hcV63CQhmS3p4+pZ9/wVvt4Ph3ZDK9fdC983b9aGMUFg==",
+      "dev": true,
+      "optional": true,
       "dependencies": {
         "browser-headers": "^0.4.0"
       },
@@ -5088,13 +5088,6 @@
         "node": ">=10"
       }
     },
-    "node_modules/@openzeppelin/contracts": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.2.0.tgz",
-      "integrity": "sha512-LD4NnkKpHHSMo5z9MvFsG4g1xxZUDqV3A3Futu3nvyfs4wPwXxqOgMaxOoa2PeyGL2VNeSlbxT54enbQzGcgJQ==",
-      "dev": true,
-      "license": "MIT"
-    },
     "node_modules/@pmmmwh/react-refresh-webpack-plugin": {
       "version": "0.4.3",
       "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.3.tgz",
@@ -6967,19 +6960,6 @@
         "async-limiter": "~1.0.0"
       }
     },
-    "node_modules/@typechain/ethers-v5": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-7.0.1.tgz",
-      "integrity": "sha512-mXEJ7LG0pOYO+MRPkHtbf30Ey9X2KAsU0wkeoVvjQIn7iAY6tB3k3s+82bbmJAUMyENbQ04RDOZit36CgSG6Gg==",
-      "peerDependencies": {
-        "@ethersproject/abi": "^5.0.0",
-        "@ethersproject/bytes": "^5.0.0",
-        "@ethersproject/providers": "^5.0.0",
-        "ethers": "^5.1.3",
-        "typechain": "^5.0.0",
-        "typescript": ">=4.0.0"
-      }
-    },
     "node_modules/@types/accepts": {
       "version": "1.3.5",
       "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
@@ -8744,18 +8724,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/array-back": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz",
-      "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==",
-      "peer": true,
-      "dependencies": {
-        "typical": "^2.6.1"
-      },
-      "engines": {
-        "node": ">=4"
-      }
-    },
     "node_modules/array-flatten": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
@@ -10414,10 +10382,6 @@
         "node": ">=8"
       }
     },
-    "node_modules/bridge": {
-      "resolved": "rust_modules/core",
-      "link": true
-    },
     "node_modules/brorand": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
@@ -10426,7 +10390,9 @@
     "node_modules/browser-headers": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/browser-headers/-/browser-headers-0.4.1.tgz",
-      "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg=="
+      "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg==",
+      "dev": true,
+      "optional": true
     },
     "node_modules/browser-process-hrtime": {
       "version": "1.0.0",
@@ -11594,20 +11560,6 @@
         "node": ">= 0.8"
       }
     },
-    "node_modules/command-line-args": {
-      "version": "4.0.7",
-      "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-4.0.7.tgz",
-      "integrity": "sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==",
-      "peer": true,
-      "dependencies": {
-        "array-back": "^2.0.0",
-        "find-replace": "^1.0.3",
-        "typical": "^2.6.1"
-      },
-      "bin": {
-        "command-line-args": "bin/cli.js"
-      }
-    },
     "node_modules/commander": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@@ -12000,12 +11952,6 @@
         "node": ">=0.10.0"
       }
     },
-    "node_modules/copy-dir": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/copy-dir/-/copy-dir-1.3.0.tgz",
-      "integrity": "sha512-Q4+qBFnN4bwGwvtXXzbp4P/4iNk0MaiGAzvQ8OiMtlLjkIKjmNN689uVzShSM0908q7GoFHXIPx4zi75ocoaHw==",
-      "dev": true
-    },
     "node_modules/core-js": {
       "version": "3.15.2",
       "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.15.2.tgz",
@@ -16512,31 +16458,6 @@
         "node": ">=6"
       }
     },
-    "node_modules/find-replace": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz",
-      "integrity": "sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=",
-      "peer": true,
-      "dependencies": {
-        "array-back": "^1.0.4",
-        "test-value": "^2.1.0"
-      },
-      "engines": {
-        "node": ">=4.0.0"
-      }
-    },
-    "node_modules/find-replace/node_modules/array-back": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz",
-      "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=",
-      "peer": true,
-      "dependencies": {
-        "typical": "^2.6.0"
-      },
-      "engines": {
-        "node": ">=0.12.0"
-      }
-    },
     "node_modules/find-up": {
       "version": "4.1.0",
       "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
@@ -17532,7 +17453,9 @@
     "node_modules/google-protobuf": {
       "version": "3.17.3",
       "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.17.3.tgz",
-      "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg=="
+      "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==",
+      "dev": true,
+      "optional": true
     },
     "node_modules/got": {
       "version": "9.6.0",
@@ -29540,6 +29463,7 @@
       "version": "2.3.2",
       "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
       "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
+      "dev": true,
       "bin": {
         "prettier": "bin-prettier.js"
       },
@@ -34444,31 +34368,6 @@
         "node": ">=8"
       }
     },
-    "node_modules/test-value": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz",
-      "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=",
-      "peer": true,
-      "dependencies": {
-        "array-back": "^1.0.3",
-        "typical": "^2.6.0"
-      },
-      "engines": {
-        "node": ">=0.10.0"
-      }
-    },
-    "node_modules/test-value/node_modules/array-back": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz",
-      "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=",
-      "peer": true,
-      "dependencies": {
-        "typical": "^2.6.0"
-      },
-      "engines": {
-        "node": ">=0.12.0"
-      }
-    },
     "node_modules/text-encoding-utf-8": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz",
@@ -34789,10 +34688,6 @@
         "node": ">=0.6"
       }
     },
-    "node_modules/token-bridge": {
-      "resolved": "rust_modules/token",
-      "link": true
-    },
     "node_modules/tough-cookie": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
@@ -34862,15 +34757,6 @@
       "resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz",
       "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA=="
     },
-    "node_modules/ts-essentials": {
-      "version": "7.0.2",
-      "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.2.tgz",
-      "integrity": "sha512-qWPVC1xZGdefbsgFP7tPo+bsgSA2ZIXL1XeEe5M2WoMZxIOr/HbsHxP/Iv75IFhiMHMDGL7cOOwi5SXcgx9mHw==",
-      "peer": true,
-      "peerDependencies": {
-        "typescript": ">=3.7.0"
-      }
-    },
     "node_modules/ts-invariant": {
       "version": "0.4.4",
       "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz",
@@ -35019,71 +34905,6 @@
         "node": ">= 0.6"
       }
     },
-    "node_modules/typechain": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/typechain/-/typechain-5.1.2.tgz",
-      "integrity": "sha512-FuaCxJd7BD3ZAjVJoO+D6TnqKey3pQdsqOBsC83RKYWKli5BDhdf0TPkwfyjt20TUlZvOzJifz+lDwXsRkiSKA==",
-      "peer": true,
-      "dependencies": {
-        "@types/prettier": "^2.1.1",
-        "command-line-args": "^4.0.7",
-        "debug": "^4.1.1",
-        "fs-extra": "^7.0.0",
-        "glob": "^7.1.6",
-        "js-sha3": "^0.8.0",
-        "lodash": "^4.17.15",
-        "mkdirp": "^1.0.4",
-        "prettier": "^2.1.2",
-        "ts-essentials": "^7.0.1"
-      },
-      "bin": {
-        "typechain": "dist/cli/cli.js"
-      }
-    },
-    "node_modules/typechain/node_modules/fs-extra": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
-      "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
-      "peer": true,
-      "dependencies": {
-        "graceful-fs": "^4.1.2",
-        "jsonfile": "^4.0.0",
-        "universalify": "^0.1.0"
-      },
-      "engines": {
-        "node": ">=6 <7 || >=8"
-      }
-    },
-    "node_modules/typechain/node_modules/jsonfile": {
-      "version": "4.0.0",
-      "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
-      "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
-      "peer": true,
-      "optionalDependencies": {
-        "graceful-fs": "^4.1.6"
-      }
-    },
-    "node_modules/typechain/node_modules/mkdirp": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
-      "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
-      "peer": true,
-      "bin": {
-        "mkdirp": "bin/cmd.js"
-      },
-      "engines": {
-        "node": ">=10"
-      }
-    },
-    "node_modules/typechain/node_modules/universalify": {
-      "version": "0.1.2",
-      "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
-      "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
-      "peer": true,
-      "engines": {
-        "node": ">= 4.0.0"
-      }
-    },
     "node_modules/typedarray": {
       "version": "0.0.6",
       "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -35140,12 +34961,6 @@
         "typescript-compare": "^0.0.2"
       }
     },
-    "node_modules/typical": {
-      "version": "2.6.1",
-      "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz",
-      "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=",
-      "peer": true
-    },
     "node_modules/ua-parser-js": {
       "version": "0.7.28",
       "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz",
@@ -38793,14 +38608,6 @@
       "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
       "dev": true,
       "optional": true
-    },
-    "rust_modules/core": {
-      "name": "bridge",
-      "version": "0.1.0"
-    },
-    "rust_modules/token": {
-      "name": "token-bridge",
-      "version": "0.1.0"
     }
   },
   "dependencies": {
@@ -40153,8 +39960,11 @@
       "version": "file:../sdk/js",
       "requires": {
         "@improbable-eng/grpc-web": "^0.14.0",
+        "@openzeppelin/contracts": "^4.2.0",
         "@solana/web3.js": "^1.24.0",
+        "@typechain/ethers-v5": "^7.0.1",
         "@types/long": "^4.0.1",
+        "copy-dir": "^1.3.0",
         "prettier": "^2.3.2",
         "protobufjs": "^6.11.2",
         "rxjs": "^7.3.0",
@@ -41740,6 +41550,8 @@
       "version": "0.13.0",
       "resolved": "https://registry.npmjs.org/@improbable-eng/grpc-web/-/grpc-web-0.13.0.tgz",
       "integrity": "sha512-vaxxT+Qwb7GPqDQrBV4vAAfH0HywgOLw6xGIKXd9Q8hcV63CQhmS3p4+pZ9/wVvt4Ph3ZDK9fdC983b9aGMUFg==",
+      "dev": true,
+      "optional": true,
       "requires": {
         "browser-headers": "^0.4.0"
       }
@@ -42507,12 +42319,6 @@
         }
       }
     },
-    "@openzeppelin/contracts": {
-      "version": "4.2.0",
-      "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.2.0.tgz",
-      "integrity": "sha512-LD4NnkKpHHSMo5z9MvFsG4g1xxZUDqV3A3Futu3nvyfs4wPwXxqOgMaxOoa2PeyGL2VNeSlbxT54enbQzGcgJQ==",
-      "dev": true
-    },
     "@pmmmwh/react-refresh-webpack-plugin": {
       "version": "0.4.3",
       "resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.3.tgz",
@@ -44117,12 +43923,6 @@
         }
       }
     },
-    "@typechain/ethers-v5": {
-      "version": "7.0.1",
-      "resolved": "https://registry.npmjs.org/@typechain/ethers-v5/-/ethers-v5-7.0.1.tgz",
-      "integrity": "sha512-mXEJ7LG0pOYO+MRPkHtbf30Ey9X2KAsU0wkeoVvjQIn7iAY6tB3k3s+82bbmJAUMyENbQ04RDOZit36CgSG6Gg==",
-      "requires": {}
-    },
     "@types/accepts": {
       "version": "1.3.5",
       "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
@@ -45595,15 +45395,6 @@
       "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
       "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ="
     },
-    "array-back": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz",
-      "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==",
-      "peer": true,
-      "requires": {
-        "typical": "^2.6.1"
-      }
-    },
     "array-flatten": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
@@ -46993,9 +46784,6 @@
         "fill-range": "^7.0.1"
       }
     },
-    "bridge": {
-      "version": "file:rust_modules/core"
-    },
     "brorand": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
@@ -47004,7 +46792,9 @@
     "browser-headers": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/browser-headers/-/browser-headers-0.4.1.tgz",
-      "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg=="
+      "integrity": "sha512-CA9hsySZVo9371qEHjHZtYxV2cFtVj5Wj/ZHi8ooEsrtm4vOnl9Y9HmyYWk9q+05d7K3rdoAE0j3MVEFVvtQtg==",
+      "dev": true,
+      "optional": true
     },
     "browser-process-hrtime": {
       "version": "1.0.0",
@@ -47981,17 +47771,6 @@
         "delayed-stream": "~1.0.0"
       }
     },
-    "command-line-args": {
-      "version": "4.0.7",
-      "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-4.0.7.tgz",
-      "integrity": "sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==",
-      "peer": true,
-      "requires": {
-        "array-back": "^2.0.0",
-        "find-replace": "^1.0.3",
-        "typical": "^2.6.1"
-      }
-    },
     "commander": {
       "version": "4.1.1",
       "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@@ -48332,12 +48111,6 @@
       "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
       "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
     },
-    "copy-dir": {
-      "version": "1.3.0",
-      "resolved": "https://registry.npmjs.org/copy-dir/-/copy-dir-1.3.0.tgz",
-      "integrity": "sha512-Q4+qBFnN4bwGwvtXXzbp4P/4iNk0MaiGAzvQ8OiMtlLjkIKjmNN689uVzShSM0908q7GoFHXIPx4zi75ocoaHw==",
-      "dev": true
-    },
     "core-js": {
       "version": "3.15.2",
       "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.15.2.tgz",
@@ -52009,27 +51782,6 @@
         }
       }
     },
-    "find-replace": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz",
-      "integrity": "sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=",
-      "peer": true,
-      "requires": {
-        "array-back": "^1.0.4",
-        "test-value": "^2.1.0"
-      },
-      "dependencies": {
-        "array-back": {
-          "version": "1.0.4",
-          "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz",
-          "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=",
-          "peer": true,
-          "requires": {
-            "typical": "^2.6.0"
-          }
-        }
-      }
-    },
     "find-up": {
       "version": "4.1.0",
       "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
@@ -52815,7 +52567,9 @@
     "google-protobuf": {
       "version": "3.17.3",
       "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.17.3.tgz",
-      "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg=="
+      "integrity": "sha512-OVPzcSWIAJ+d5yiHyeaLrdufQtrvaBrF4JQg+z8ynTkbO3uFcujqXszTumqg1cGsAsjkWnI+M5B1xZ19yR4Wyg==",
+      "dev": true,
+      "optional": true
     },
     "got": {
       "version": "9.6.0",
@@ -62521,7 +62275,8 @@
     "prettier": {
       "version": "2.3.2",
       "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz",
-      "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ=="
+      "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==",
+      "dev": true
     },
     "pretty-bytes": {
       "version": "5.6.0",
@@ -66478,27 +66233,6 @@
         "minimatch": "^3.0.4"
       }
     },
-    "test-value": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz",
-      "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=",
-      "peer": true,
-      "requires": {
-        "array-back": "^1.0.3",
-        "typical": "^2.6.0"
-      },
-      "dependencies": {
-        "array-back": {
-          "version": "1.0.4",
-          "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz",
-          "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=",
-          "peer": true,
-          "requires": {
-            "typical": "^2.6.0"
-          }
-        }
-      }
-    },
     "text-encoding-utf-8": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz",
@@ -66781,9 +66515,6 @@
       "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
       "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
     },
-    "token-bridge": {
-      "version": "file:rust_modules/token"
-    },
     "tough-cookie": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
@@ -66837,13 +66568,6 @@
       "resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz",
       "integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA=="
     },
-    "ts-essentials": {
-      "version": "7.0.2",
-      "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.2.tgz",
-      "integrity": "sha512-qWPVC1xZGdefbsgFP7tPo+bsgSA2ZIXL1XeEe5M2WoMZxIOr/HbsHxP/Iv75IFhiMHMDGL7cOOwi5SXcgx9mHw==",
-      "peer": true,
-      "requires": {}
-    },
     "ts-invariant": {
       "version": "0.4.4",
       "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz",
@@ -66963,58 +66687,6 @@
         "mime-types": "~2.1.24"
       }
     },
-    "typechain": {
-      "version": "5.1.2",
-      "resolved": "https://registry.npmjs.org/typechain/-/typechain-5.1.2.tgz",
-      "integrity": "sha512-FuaCxJd7BD3ZAjVJoO+D6TnqKey3pQdsqOBsC83RKYWKli5BDhdf0TPkwfyjt20TUlZvOzJifz+lDwXsRkiSKA==",
-      "peer": true,
-      "requires": {
-        "@types/prettier": "^2.1.1",
-        "command-line-args": "^4.0.7",
-        "debug": "^4.1.1",
-        "fs-extra": "^7.0.0",
-        "glob": "^7.1.6",
-        "js-sha3": "^0.8.0",
-        "lodash": "^4.17.15",
-        "mkdirp": "^1.0.4",
-        "prettier": "^2.1.2",
-        "ts-essentials": "^7.0.1"
-      },
-      "dependencies": {
-        "fs-extra": {
-          "version": "7.0.1",
-          "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
-          "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
-          "peer": true,
-          "requires": {
-            "graceful-fs": "^4.1.2",
-            "jsonfile": "^4.0.0",
-            "universalify": "^0.1.0"
-          }
-        },
-        "jsonfile": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
-          "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
-          "peer": true,
-          "requires": {
-            "graceful-fs": "^4.1.6"
-          }
-        },
-        "mkdirp": {
-          "version": "1.0.4",
-          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
-          "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
-          "peer": true
-        },
-        "universalify": {
-          "version": "0.1.2",
-          "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
-          "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
-          "peer": true
-        }
-      }
-    },
     "typedarray": {
       "version": "0.0.6",
       "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@@ -67064,12 +66736,6 @@
         "typescript-compare": "^0.0.2"
       }
     },
-    "typical": {
-      "version": "2.6.1",
-      "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz",
-      "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=",
-      "peer": true
-    },
     "ua-parser-js": {
       "version": "0.7.28",
       "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.28.tgz",

+ 2 - 10
bridge_ui/package.json

@@ -4,7 +4,6 @@
   "private": true,
   "dependencies": {
     "@certusone/wormhole-sdk": "file:..\\sdk\\js",
-    "@improbable-eng/grpc-web": "^0.13.0",
     "@material-ui/core": "^4.12.2",
     "@material-ui/icons": "^4.11.2",
     "@metamask/detect-provider": "^1.2.0",
@@ -13,24 +12,19 @@
     "@solana/spl-token": "^0.1.6",
     "@solana/wallet-base": "^0.0.1",
     "@solana/web3.js": "^1.22.0",
-    "@typechain/ethers-v5": "^7.0.1",
-    "bridge": "file:rust_modules\\core",
     "ethers": "^5.4.1",
     "react": "^17.0.2",
     "react-dom": "^17.0.2",
     "react-redux": "^7.2.4",
     "react-router-dom": "^5.2.0",
     "react-scripts": "4.0.3",
-    "redux": "^3.7.2",
-    "token-bridge": "file:rust_modules\\token"
+    "redux": "^3.7.2"
   },
   "scripts": {
-    "postinstall": "npm run build-contracts",
     "start": "craco start",
     "build": "npm run build-contracts && craco build",
     "test": "npm run build-contracts && craco test",
-    "eject": "react-scripts eject",
-    "build-contracts": "npm run build --prefix ../ethereum && node scripts/copyContracts.js && typechain --target=ethers-v5 --out-dir=src/ethers-contracts contracts/*.json"
+    "eject": "react-scripts eject"
   },
   "eslintConfig": {
     "extends": [
@@ -52,9 +46,7 @@
   },
   "devDependencies": {
     "@craco/craco": "^6.2.0",
-    "@openzeppelin/contracts": "^4.2.0",
     "@truffle/hdwallet-provider": "^1.4.1",
-    "copy-dir": "^1.3.0",
     "prettier": "^2.3.2",
     "truffle": "^5.4.1",
     "wasm-loader": "^1.3.0"

+ 0 - 2
bridge_ui/scripts/copyContracts.js

@@ -1,2 +0,0 @@
-const copydir = require("copy-dir");
-copydir.sync("../ethereum/build/contracts", "./contracts");

+ 5 - 2
bridge_ui/src/hooks/useGetBalanceEffect.ts

@@ -1,11 +1,14 @@
-import { CHAIN_ID_ETH, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
+import {
+  CHAIN_ID_ETH,
+  CHAIN_ID_SOLANA,
+  TokenImplementation__factory,
+} from "@certusone/wormhole-sdk";
 import { Connection, PublicKey } from "@solana/web3.js";
 import { formatUnits } from "ethers/lib/utils";
 import { useEffect } from "react";
 import { useDispatch, useSelector } from "react-redux";
 import { useEthereumProvider } from "../contexts/EthereumProviderContext";
 import { useSolanaWallet } from "../contexts/SolanaWalletContext";
-import { TokenImplementation__factory } from "../ethers-contracts";
 import {
   selectTransferSourceAsset,
   selectTransferSourceChain,

+ 12 - 5
bridge_ui/src/utils/attestFrom.ts

@@ -1,5 +1,11 @@
-import { getSignedVAA, ixFromRust } from "@certusone/wormhole-sdk";
-import { CHAIN_ID_ETH, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
+import {
+  CHAIN_ID_ETH,
+  CHAIN_ID_SOLANA,
+  getSignedVAA,
+  ixFromRust,
+  Bridge__factory,
+  Implementation__factory,
+} from "@certusone/wormhole-sdk";
 import Wallet from "@project-serum/sol-wallet-adapter";
 import {
   Connection,
@@ -10,7 +16,6 @@ import {
 } from "@solana/web3.js";
 import { ethers } from "ethers";
 import { arrayify, zeroPad } from "ethers/lib/utils";
-import { Bridge__factory, Implementation__factory } from "../ethers-contracts";
 import {
   ETH_BRIDGE_ADDRESS,
   ETH_TOKEN_BRIDGE_ADDRESS,
@@ -78,7 +83,7 @@ export async function attestFromSolana(
   console.log("payer:", payerAddress);
   console.log("token:", mintAddress);
   console.log("nonce:", nonce);
-  const bridge = await import("bridge");
+  const bridge = await import("@certusone/wormhole-sdk/lib/solana/core/bridge");
   const feeAccount = await bridge.fee_collector_address(SOL_BRIDGE_ADDRESS);
   const bridgeStatePK = new PublicKey(bridge.state_address(SOL_BRIDGE_ADDRESS));
   // TODO: share connection in context?
@@ -97,7 +102,9 @@ export async function attestFromSolana(
   });
   // TODO: pass in connection
   // Add transfer instruction to transaction
-  const { attest_ix, emitter_address } = await import("token-bridge");
+  const { attest_ix, emitter_address } = await import(
+    "@certusone/wormhole-sdk/lib/solana/token/token_bridge"
+  );
   const messageKey = Keypair.generate();
   const ix = ixFromRust(
     attest_ix(

+ 9 - 4
bridge_ui/src/utils/createWrappedOn.ts

@@ -7,10 +7,13 @@ import {
   ETH_TOKEN_BRIDGE_ADDRESS,
 } from "./consts";
 import { ethers } from "ethers";
-import { Bridge__factory } from "../ethers-contracts";
 import { postVaa } from "./postVaa";
-import { CHAIN_ID_ETH, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
-import { ixFromRust } from "@certusone/wormhole-sdk";
+import {
+  CHAIN_ID_ETH,
+  CHAIN_ID_SOLANA,
+  ixFromRust,
+  Bridge__factory,
+} from "@certusone/wormhole-sdk";
 
 export async function createWrappedOnEth(
   provider: ethers.providers.Web3Provider | undefined,
@@ -39,7 +42,9 @@ export async function createWrappedOnSolana(
   console.log("VAA:", signedVAA);
   // TODO: share connection in context?
   const connection = new Connection(SOLANA_HOST, "confirmed");
-  const { create_wrapped_ix } = await import("token-bridge");
+  const { create_wrapped_ix } = await import(
+    "@certusone/wormhole-sdk/lib/solana/token/token_bridge"
+  );
 
   await postVaa(
     connection,

+ 8 - 3
bridge_ui/src/utils/getForeignAsset.ts

@@ -1,8 +1,11 @@
-import { ChainId, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
+import {
+  ChainId,
+  CHAIN_ID_SOLANA,
+  Bridge__factory,
+} from "@certusone/wormhole-sdk";
 import { Connection, PublicKey } from "@solana/web3.js";
 import { ethers } from "ethers";
 import { arrayify, isHexString, zeroPad } from "ethers/lib/utils";
-import { Bridge__factory } from "../ethers-contracts";
 import {
   ETH_TOKEN_BRIDGE_ADDRESS,
   SOLANA_HOST,
@@ -50,7 +53,9 @@ export async function getForeignAssetSol(
   originAsset: string
 ) {
   if (!isHexString(originAsset)) return null;
-  const { wrapped_address } = await import("token-bridge");
+  const { wrapped_address } = await import(
+    "@certusone/wormhole-sdk/lib/solana/token/token_bridge"
+  );
   // TODO: address conversion may be more complex than this
   const originAssetBytes = zeroPad(
     arrayify(originAsset, { hexPad: "left" }),

+ 4 - 2
bridge_ui/src/utils/getIsWrappedAsset.ts

@@ -1,6 +1,6 @@
+import { Bridge__factory } from "@certusone/wormhole-sdk";
 import { Connection, PublicKey } from "@solana/web3.js";
 import { ethers } from "ethers";
-import { Bridge__factory } from "../ethers-contracts";
 import {
   ETH_TOKEN_BRIDGE_ADDRESS,
   SOLANA_HOST,
@@ -32,7 +32,9 @@ export async function getIsWrappedAssetEth(
  */
 export async function getIsWrappedAssetSol(mintAddress: string) {
   if (!mintAddress) return false;
-  const { wrapped_meta_address } = await import("token-bridge");
+  const { wrapped_meta_address } = await import(
+    "@certusone/wormhole-sdk/lib/solana/token/token_bridge"
+  );
   const wrappedMetaAddress = wrapped_meta_address(
     SOL_TOKEN_BRIDGE_ADDRESS,
     new PublicKey(mintAddress).toBytes()

+ 2 - 2
bridge_ui/src/utils/getOriginalAsset.ts

@@ -2,11 +2,11 @@ import {
   ChainId,
   CHAIN_ID_ETH,
   CHAIN_ID_SOLANA,
+  TokenImplementation__factory,
 } from "@certusone/wormhole-sdk";
 import { Connection, PublicKey } from "@solana/web3.js";
 import { ethers } from "ethers";
 import { arrayify } from "ethers/lib/utils";
-import { TokenImplementation__factory } from "../ethers-contracts";
 import { uint8ArrayToHex } from "./array";
 import { SOLANA_HOST, SOL_TOKEN_BRIDGE_ADDRESS } from "./consts";
 import { getIsWrappedAssetEth } from "./getIsWrappedAsset";
@@ -55,7 +55,7 @@ export async function getOriginalAssetSol(
   if (mintAddress) {
     // TODO: share some of this with getIsWrappedAssetSol, like a getWrappedMetaAccountAddress or something
     const { parse_wrapped_meta, wrapped_meta_address } = await import(
-      "token-bridge"
+      "@certusone/wormhole-sdk/lib/solana/token/token_bridge"
     );
     const wrappedMetaAddress = wrapped_meta_address(
       SOL_TOKEN_BRIDGE_ADDRESS,

+ 4 - 2
bridge_ui/src/utils/postVaa.ts

@@ -20,7 +20,7 @@ export async function postVaa(
     parse_guardian_set,
     verify_signatures_ix,
     post_vaa_ix,
-  } = await import("bridge");
+  } = await import("@certusone/wormhole-sdk/lib/solana/core/bridge");
   let bridge_state = await getBridgeState(connection, bridge_id);
   let guardian_addr = new PublicKey(
     guardian_set_address(bridge_id, bridge_state.guardianSetIndex)
@@ -80,7 +80,9 @@ async function getBridgeState(
   connection: Connection,
   bridge_id: string
 ): Promise<BridgeState> {
-  const { parse_state, state_address } = await import("bridge");
+  const { parse_state, state_address } = await import(
+    "@certusone/wormhole-sdk/lib/solana/core/bridge"
+  );
   let bridge_state = new PublicKey(state_address(bridge_id));
   let acc = await connection.getAccountInfo(bridge_state);
   if (acc?.data === undefined) {

+ 15 - 12
bridge_ui/src/utils/redeemOn.ts

@@ -1,21 +1,24 @@
-import { ethers } from "ethers";
-import { Bridge__factory } from "../ethers-contracts";
 import {
-  ETH_TOKEN_BRIDGE_ADDRESS,
-  SOL_BRIDGE_ADDRESS,
-  SOL_TOKEN_BRIDGE_ADDRESS,
-  SOLANA_HOST,
-} from "./consts";
+  Bridge__factory,
+  CHAIN_ID_ETH,
+  CHAIN_ID_SOLANA,
+  ixFromRust,
+} from "@certusone/wormhole-sdk";
 import Wallet from "@project-serum/sol-wallet-adapter";
-import { Connection, PublicKey, Transaction } from "@solana/web3.js";
-import { postVaa } from "./postVaa";
 import {
   ASSOCIATED_TOKEN_PROGRAM_ID,
   Token,
   TOKEN_PROGRAM_ID,
 } from "@solana/spl-token";
-import { CHAIN_ID_ETH, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
-import { ixFromRust } from "@certusone/wormhole-sdk";
+import { Connection, PublicKey, Transaction } from "@solana/web3.js";
+import { ethers } from "ethers";
+import {
+  ETH_TOKEN_BRIDGE_ADDRESS,
+  SOLANA_HOST,
+  SOL_BRIDGE_ADDRESS,
+  SOL_TOKEN_BRIDGE_ADDRESS,
+} from "./consts";
+import { postVaa } from "./postVaa";
 
 export async function redeemOnEth(
   provider: ethers.providers.Web3Provider | undefined,
@@ -47,7 +50,7 @@ export async function redeemOnSolana(
   // TODO: share connection in context?
   const connection = new Connection(SOLANA_HOST, "confirmed");
   const { complete_transfer_wrapped_ix, complete_transfer_native_ix } =
-    await import("token-bridge");
+    await import("@certusone/wormhole-sdk/lib/solana/token/token_bridge");
 
   await postVaa(
     connection,

+ 7 - 8
bridge_ui/src/utils/transferFrom.ts

@@ -1,8 +1,12 @@
-import { getSignedVAA, ixFromRust } from "@certusone/wormhole-sdk";
 import {
+  Bridge__factory,
   ChainId,
   CHAIN_ID_ETH,
   CHAIN_ID_SOLANA,
+  getSignedVAA,
+  Implementation__factory,
+  ixFromRust,
+  TokenImplementation__factory,
 } from "@certusone/wormhole-sdk";
 import Wallet from "@project-serum/sol-wallet-adapter";
 import { Token, TOKEN_PROGRAM_ID } from "@solana/spl-token";
@@ -15,11 +19,6 @@ import {
 } from "@solana/web3.js";
 import { ethers } from "ethers";
 import { arrayify, formatUnits, parseUnits, zeroPad } from "ethers/lib/utils";
-import {
-  Bridge__factory,
-  Implementation__factory,
-  TokenImplementation__factory,
-} from "../ethers-contracts";
 import { hexToUint8Array } from "./array";
 import {
   ETH_BRIDGE_ADDRESS,
@@ -141,7 +140,7 @@ export async function transferFromSolana(
   console.log("fee:", fee);
   console.log("target:", targetAddressStr, targetAddress);
   console.log("chain:", targetChain);
-  const bridge = await import("bridge");
+  const bridge = await import("@certusone/wormhole-sdk/lib/solana/core/bridge");
   const feeAccount = await bridge.fee_collector_address(SOL_BRIDGE_ADDRESS);
   const bridgeStatePK = new PublicKey(bridge.state_address(SOL_BRIDGE_ADDRESS));
   // TODO: share connection in context?
@@ -165,7 +164,7 @@ export async function transferFromSolana(
     transfer_wrapped_ix,
     approval_authority_address,
     emitter_address,
-  } = await import("token-bridge");
+  } = await import("@certusone/wormhole-sdk/lib/solana/token/token_bridge");
   const approvalIx = Token.createApproveInstruction(
     TOKEN_PROGRAM_ID,
     new PublicKey(fromAddress),

+ 2 - 2
generate-wasm.ps1

@@ -1,7 +1,7 @@
 cd solana
 docker build -t localhost/certusone/wormhole-wasmpack:latest -f Dockerfile.wasm .
-docker run --rm -it --workdir /usr/src/bridge/bridge/program -v ${pwd}/../bridge_ui/rust_modules/core:/usr/src/bridge/bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm
-docker run --rm -it --workdir /usr/src/bridge/modules/token_bridge/program -v ${pwd}/../bridge_ui/rust_modules/token:/usr/src/bridge/modules/token_bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm
+docker run --rm -it --workdir /usr/src/bridge/bridge/program -v ${pwd}/../sdk/js/src/solana/core:/usr/src/bridge/bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm
+docker run --rm -it --workdir /usr/src/bridge/modules/token_bridge/program -v ${pwd}/../sdk/js/src/solana/token:/usr/src/bridge/modules/token_bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm
 docker run --rm -it --workdir /usr/src/bridge/bridge/program -v ${pwd}/../clients/solana/pkg:/usr/src/bridge/bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target nodejs -- --features wasm
 cp ${pwd}/../clients/solana/pkg/* ${pwd}/../clients/token_bridge/pkg/core
 docker run --rm -it --workdir /usr/src/bridge/modules/token_bridge/program -v ${pwd}/../clients/token_bridge/pkg/token:/usr/src/bridge/modules/token_bridge/program/pkg -e EMITTER_ADDRESS=11111111111111111111111111111115 localhost/certusone/wormhole-wasmpack:latest /usr/local/cargo/bin/wasm-pack build --target nodejs -- --features wasm

+ 5 - 4
generate-wasm.sh

@@ -1,18 +1,19 @@
 #!/usr/bin/env bash
-# Regenerate bridge_ui/rust_modules
+# Regenerate sdk/js/src/solana
 set -euo pipefail
 
 (
   cd solana
-  mkdir -p ../bridge_ui/rust_modules/core
+  mkdir -p ../sdk/js/src/solana/core
+  mkdir -p ../sdk/js/src/solana/token
   docker build -t localhost/certusone/wormhole-wasmpack:latest -f Dockerfile.wasm .
   docker run --rm -it --workdir /usr/src/bridge/bridge/program \
-    -v $(pwd)/../bridge_ui/rust_modules/core:/usr/src/bridge/bridge/program/pkg \
+    -v $(pwd)/../sdk/js/src/solana/core:/usr/src/bridge/bridge/program/pkg \
     -e EMITTER_ADDRESS=11111111111111111111111111111115 \
     localhost/certusone/wormhole-wasmpack:latest \
     /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm
   docker run --rm -it --workdir /usr/src/bridge/modules/token_bridge/program \
-    -v $(pwd)/../bridge_ui/rust_modules/token:/usr/src/bridge/modules/token_bridge/program/pkg \
+    -v $(pwd)/../sdk/js/src/solana/token:/usr/src/bridge/modules/token_bridge/program/pkg \
     -e EMITTER_ADDRESS=11111111111111111111111111111115 \
     localhost/certusone/wormhole-wasmpack:latest \
     /usr/local/cargo/bin/wasm-pack build --target bundler -- --features wasm

File diff suppressed because it is too large
+ 944 - 0
sdk/js/package-lock.json


+ 6 - 1
sdk/js/package.json

@@ -9,8 +9,10 @@
     "lib/**/*"
   ],
   "scripts": {
+    "postinstall": "npm run build-contracts",
+    "build-contracts": "npm run build --prefix ../../ethereum && node scripts/copyContracts.js && typechain --target=ethers-v5 --out-dir=src/ethers-contracts contracts/*.json",
     "test": "echo \"Error: no test specified\" && exit 1",
-    "build": "tsc",
+    "build": "tsc && node scripts/copyEthersTypes.js && node scripts/copyWasm.js",
     "format": "prettier --write \"src/**/*.ts\"",
     "lint": "tslint -p tsconfig.json",
     "prepare": "npm run build",
@@ -32,7 +34,10 @@
   "author": "certusone",
   "license": "Apache-2.0",
   "devDependencies": {
+    "@openzeppelin/contracts": "^4.2.0",
+    "@typechain/ethers-v5": "^7.0.1",
     "@types/long": "^4.0.1",
+    "copy-dir": "^1.3.0",
     "prettier": "^2.3.2",
     "tslint": "^6.1.3",
     "tslint-config-prettier": "^1.18.0",

+ 2 - 0
sdk/js/scripts/copyContracts.js

@@ -0,0 +1,2 @@
+const copydir = require("copy-dir");
+copydir.sync("../../ethereum/build/contracts", "./contracts");

+ 9 - 0
sdk/js/scripts/copyEthersTypes.js

@@ -0,0 +1,9 @@
+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}`
+    );
+  }
+});

+ 17 - 0
sdk/js/scripts/copyWasm.js

@@ -0,0 +1,17 @@
+const fs = require("fs");
+fs.copyFileSync(
+  "src/solana/core/bridge_bg.wasm",
+  "lib/solana/core/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/token/token_bridge_bg.wasm",
+  "lib/solana/token/token_bridge_bg.wasm"
+);
+fs.copyFileSync(
+  "src/solana/token/token_bridge_bg.wasm.d.ts",
+  "lib/solana/token/token_bridge_bg.wasm.d.ts"
+);

+ 2 - 0
sdk/js/src/index.ts

@@ -1,2 +1,4 @@
+export * from "./ethers-contracts";
+export * from "./solana";
 export * from "./rpc";
 export * from "./utils";

+ 1 - 0
sdk/js/src/solana/index.ts

@@ -0,0 +1 @@
+export * from "./rust";

+ 0 - 0
sdk/js/src/utils/rust.ts → sdk/js/src/solana/rust.ts


+ 0 - 1
sdk/js/src/utils/index.ts

@@ -1,2 +1 @@
 export * from "./consts";
-export * from "./rust";

+ 1 - 0
sdk/js/tsconfig.json

@@ -7,6 +7,7 @@
     "strict": true,
     "esModuleInterop": true,
     "downlevelIteration": true,
+    "allowJs": true
   },
   "include": ["src"],
   "exclude": ["node_modules", "**/__tests__/*"]

Some files were not shown because too many files changed in this diff