From 0063f6ab69d2b7281fd49b99ee5df6098e87164f Mon Sep 17 00:00:00 2001 From: justinschuldt Date: Fri, 1 Apr 2022 10:31:32 -0500 Subject: [PATCH] clients/nft_bridge - minor usability improvements --- clients/nft_bridge/.vscode/launch.json | 29 +++ clients/nft_bridge/README.md | 9 + clients/nft_bridge/main.ts | 37 ++-- clients/nft_bridge/package-lock.json | 260 +++++++++++++++++++++++++ clients/nft_bridge/package.json | 4 +- clients/token_bridge/main.ts | 2 +- 6 files changed, 321 insertions(+), 20 deletions(-) create mode 100644 clients/nft_bridge/.vscode/launch.json create mode 100644 clients/nft_bridge/README.md diff --git a/clients/nft_bridge/.vscode/launch.json b/clients/nft_bridge/.vscode/launch.json new file mode 100644 index 000000000..c706e3fb1 --- /dev/null +++ b/clients/nft_bridge/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "main.ts generate-register-chain-vaa", + "type": "node", + "request": "launch", + "args": [ + "${workspaceFolder}/main.ts", + "generate_register_chain_vaa", + "1", + "0x00000000000000000000000026b4afb60d6c903165150c6f0aa14f8016be4aec", + "--guardian_secret", + "cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0,c3b2e45c422a1602333a64078aeb42637370b0f48fe385f9cfa6ad54a8e0c47e,9f790d3f08bc4b5cd910d4278f3deb406e57bb5e924906ccd52052bb078ccd47,b20cc49d6f2c82a5e6519015fc18aa3e562867f85f872c58f1277cfbd2a0c8e4", + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "${workspaceRoot}/node_modules/ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}", + "protocol": "inspector", + }, + ] +} diff --git a/clients/nft_bridge/README.md b/clients/nft_bridge/README.md new file mode 100644 index 000000000..c5170c9ae --- /dev/null +++ b/clients/nft_bridge/README.md @@ -0,0 +1,9 @@ +### usage + +either build the typescript to javascript to run: + + npm run build && node main.js solana execute_governance_vaa vaaHex... + +or, run the typescript with ts-node: + + npm run main -- solana execute_governance_vaa vaaHex... diff --git a/clients/nft_bridge/main.ts b/clients/nft_bridge/main.ts index 703540cb6..f58d10748 100644 --- a/clients/nft_bridge/main.ts +++ b/clients/nft_bridge/main.ts @@ -1,6 +1,6 @@ import yargs from "yargs"; -const { hideBin } = require('yargs/helpers') +import { hideBin } from 'yargs/helpers' import * as elliptic from "elliptic"; import * as ethers from "ethers"; @@ -12,7 +12,7 @@ import { base58, solidityKeccak256 } from "ethers/lib/utils"; import { setDefaultWasm, importCoreWasm, importNftWasm, ixFromRust, BridgeImplementation__factory } from '@certusone/wormhole-sdk' setDefaultWasm("node") -const signAndEncodeVM = function( +const signAndEncodeVM = function ( timestamp, nonce, emitterChainId, @@ -84,14 +84,19 @@ yargs(hideBin(process.argv)) type: "string", required: true }) - }, async (argv: any) => { + .option('guardian_secret', { + describe: 'Guardian\'s secret key, CSV allowed', + type: "string", + default: "cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0" + }) + }, async (argv) => { let data = [ "0x", "00000000000000000000000000000000000000000000004e4654427269646765", // NFT Bridge header "01", "0000", ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)), - ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2), + ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(String(argv.contract_address))]).substring(2), ].join('') const vm = signAndEncodeVM( @@ -101,9 +106,7 @@ yargs(hideBin(process.argv)) "0x0000000000000000000000000000000000000000000000000000000000000004", Math.floor(Math.random() * 100000000), data, - [ - "cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0" - ], + argv.guardian_secret.split(','), 0, 0 ); @@ -123,17 +126,17 @@ yargs(hideBin(process.argv)) required: true }) .option('guardian_secret', { - describe: 'Guardian\'s secret key', + describe: 'Guardian\'s secret key, CSV allowed', type: "string", default: "cfb12303a19cde580bb4dd771639b0d26bc68353645571a8cff516ab2ee113a0" }) - }, async (argv: any) => { + }, async (argv) => { let data = [ "0x", "00000000000000000000000000000000000000000000004e4654427269646765", // NFT Bridge header "02", ethers.utils.defaultAbiCoder.encode(["uint16"], [argv.chain_id]).substring(2 + (64 - 4)), - ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(argv.contract_address)]).substring(2), + ethers.utils.defaultAbiCoder.encode(["bytes32"], [fmtAddress(String(argv.contract_address))]).substring(2), ].join('') const vm = signAndEncodeVM( @@ -143,9 +146,7 @@ yargs(hideBin(process.argv)) "0x0000000000000000000000000000000000000000000000000000000000000004", Math.floor(Math.random() * 100000000), data, - [ - argv.guardian_secret - ], + argv.guardian_secret.split(','), 0, 0 ); @@ -183,7 +184,7 @@ yargs(hideBin(process.argv)) description: 'Private key of the wallet', required: false }) - }, async (argv: any) => { + }, async (argv) => { const bridge = await importCoreWasm() const nft_bridge = await importNftWasm() @@ -203,7 +204,7 @@ yargs(hideBin(process.argv)) await connection.confirmTransaction(airdropSignature); } - let vaa = Buffer.from(argv.vaa, "hex"); + let vaa = Buffer.from(String(argv.vaa), "hex"); await post_vaa(connection, bridge_id, from, vaa); let parsed_vaa = await bridge.parse_vaa(vaa); @@ -258,7 +259,7 @@ yargs(hideBin(process.argv)) description: 'Private key of the wallet', default: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d" }) - }, async (argv: any) => { + }, async (argv) => { const bridge = await importCoreWasm() let provider = new ethers.providers.JsonRpcProvider(argv.rpc) @@ -266,7 +267,7 @@ yargs(hideBin(process.argv)) let t = new BridgeImplementation__factory(signer); let tb = t.attach(argv.nft_bridge); - let vaa = Buffer.from(argv.vaa, "hex"); + let vaa = Buffer.from(String(argv.vaa), "hex"); let parsed_vaa = await bridge.parse_vaa(vaa); switch (parsed_vaa.payload[32]) { @@ -348,7 +349,7 @@ function setupConnection(argv: yargs.Arguments): web3s.Connection { ); } -function fmtAddress(addr: string) : string { +function fmtAddress(addr: string): string { let address = (addr.search("0x") == 0) ? addr.substring(2) : addr; return "0x" + zeroPadBytes(address, 32); } diff --git a/clients/nft_bridge/package-lock.json b/clients/nft_bridge/package-lock.json index 3de95e62a..7f4be18c3 100644 --- a/clients/nft_bridge/package-lock.json +++ b/clients/nft_bridge/package-lock.json @@ -25,6 +25,7 @@ "@types/bs58": "^4.0.1", "@types/yargs": "^17.0.2", "copy-dir": "^1.3.0", + "ts-node": "^10.7.0", "typescript": "^4.3.5" } }, @@ -505,6 +506,27 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@ethereumjs/common": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.4.0.tgz", @@ -1836,6 +1858,30 @@ "async-limiter": "~1.0.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "node_modules/@types/bn.js": { "version": "5.1.0", "license": "MIT", @@ -1956,6 +2002,27 @@ "node": ">= 0.6" } }, + "node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", @@ -1998,6 +2065,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -2928,6 +3001,12 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-fetch": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.5.tgz", @@ -3085,6 +3164,15 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -5088,6 +5176,12 @@ "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=", "dev": true }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -9255,6 +9349,49 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, "node_modules/tslib": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", @@ -9437,6 +9574,12 @@ "uuid": "bin/uuid" } }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "node_modules/varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", @@ -10099,6 +10242,15 @@ "node": ">=10" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "pkg": { "name": "bridge", "version": "0.1.0", @@ -10500,6 +10652,21 @@ } } }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, "@ethereumjs/common": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.4.0.tgz", @@ -11441,6 +11608,30 @@ } } }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "@types/bn.js": { "version": "5.1.0", "requires": { @@ -11540,6 +11731,18 @@ "negotiator": "0.6.2" } }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", @@ -11569,6 +11772,12 @@ "color-convert": "^2.0.1" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -12347,6 +12556,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-fetch": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.5.tgz", @@ -12471,6 +12686,12 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -14156,6 +14377,12 @@ "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=", "dev": true }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -17177,6 +17404,27 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + } + }, "tslib": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", @@ -17316,6 +17564,12 @@ "uuid": { "version": "3.4.0" }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", @@ -17876,6 +18130,12 @@ "version": "20.2.9", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==" + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/clients/nft_bridge/package.json b/clients/nft_bridge/package.json index 306984c61..5ffd9c057 100644 --- a/clients/nft_bridge/package.json +++ b/clients/nft_bridge/package.json @@ -16,7 +16,8 @@ "scripts": { "start": "tsc && node main.js", "build": "tsc", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "main": "ts-node main.ts" }, "devDependencies": { "@truffle/hdwallet-provider": "^1.4.1", @@ -24,6 +25,7 @@ "@types/bs58": "^4.0.1", "@types/yargs": "^17.0.2", "copy-dir": "^1.3.0", + "ts-node": "^10.7.0", "typescript": "^4.3.5" } } diff --git a/clients/token_bridge/main.ts b/clients/token_bridge/main.ts index 4f9e7ee34..7878b9135 100644 --- a/clients/token_bridge/main.ts +++ b/clients/token_bridge/main.ts @@ -277,7 +277,7 @@ yargs(hideBin(process.argv)) await connection.confirmTransaction(airdropSignature); } - let vaa = Buffer.from(argv.vaa, "hex"); + let vaa = Buffer.from(String(argv.vaa), "hex"); await post_vaa(connection, bridge_id, from, vaa); let parsed_vaa = await bridge.parse_vaa(vaa);