From 9741f1b0946828bd7bd37d75f2dac26785ca3399 Mon Sep 17 00:00:00 2001 From: Eric Corson Date: Mon, 30 Oct 2023 09:13:34 +0900 Subject: [PATCH] my stuff --- .envrc | 2 + .../deploy-wallet-at-merge-to-main.yml | 36 +- .github/workflows/deploy-wallet-at-pr.yml | 53 +- .gitignore | 4 + .ignore | 4 + .../ImportAccount/Steps/SeedPhraseImport.tsx | 16 +- .../src/background/keyring/keyring.ts | 2 +- apps/namada-interface/.env | 29 ++ apps/namada-interface/.gitignore | 2 +- e2e/genesis.toml | 2 +- e2e/namada.sh | 4 + e2e/setup-namada.sh | 82 +--- e2e/src/utils/helpers.ts | 2 +- e2e/start-namada.sh | 17 +- flake.lock | 61 +++ flake.nix | 29 ++ masp-params/package-lock.json | 455 ++++++++++++++++++ masp-params/package.json | 16 + packages/shared/src/index.ts | 2 +- wasm-bindgen-cli.nix | 52 ++ 20 files changed, 743 insertions(+), 127 deletions(-) create mode 100644 .envrc create mode 100644 .ignore create mode 100644 apps/namada-interface/.env create mode 100755 e2e/namada.sh create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 masp-params/package-lock.json create mode 100644 masp-params/package.json create mode 100644 wasm-bindgen-cli.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000000..ccade3047e --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake +CC=emcc diff --git a/.github/workflows/deploy-wallet-at-merge-to-main.yml b/.github/workflows/deploy-wallet-at-merge-to-main.yml index 7c364bd7b4..4cbfd8c739 100644 --- a/.github/workflows/deploy-wallet-at-merge-to-main.yml +++ b/.github/workflows/deploy-wallet-at-merge-to-main.yml @@ -39,24 +39,24 @@ jobs: REACT_APP_NAMADA_CHAIN_ID: "internal-devnet-6be.86067e06a5" REACT_APP_NAMADA_URL: "https://proxy.heliax.click/internal-devnet-6be.86067e06a5" - - name: Deploy to Netlify - if: false - uses: nwtgck/actions-netlify@v1.2.3 - with: - publish-dir: "./apps/namada-interface/build" - production-branch: main - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: "Merged PR ${{ github.event.number }} to main" - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }} - NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3 - - - name: Slack Notification - run: | - curl --header "Content-Type: application/json" \ - --request POST \ - --data '{"message":"https://wallet-preview-heliax-dev.netlify.app"}' \ - ${{ secrets.SLACK_WEBHOOK_WALLET_RELEASE }} + #- name: Deploy to Netlify + # if: false + # uses: nwtgck/actions-netlify@v1.2.3 + # with: + # publish-dir: "./apps/namada-interface/build" + # production-branch: main + # github-token: ${{ secrets.GITHUB_TOKEN }} + # deploy-message: "Merged PR ${{ github.event.number }} to main" + # env: + # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }} + # NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3 + + #- name: Slack Notification + # run: | + # curl --header "Content-Type: application/json" \ + # --request POST \ + # --data '{"message":"https://wallet-preview-heliax-dev.netlify.app"}' \ + # ${{ secrets.SLACK_WEBHOOK_WALLET_RELEASE }} rust-unit-test-js-cache: runs-on: ubuntu-latest diff --git a/.github/workflows/deploy-wallet-at-pr.yml b/.github/workflows/deploy-wallet-at-pr.yml index 337748df5a..37910de815 100644 --- a/.github/workflows/deploy-wallet-at-pr.yml +++ b/.github/workflows/deploy-wallet-at-pr.yml @@ -1,17 +1,6 @@ name: Deploy wallet preview to netlify at PR and pushes to it on: - pull_request: - paths: - - "apps/namada-interface/**" - - "apps/extension/**" - - "packages/integrations/**" - - "packages/rpc/**" - - "packages/shared/**" - - "packages/tx/**" - - "packages/utils/**" - - "packages/wallet/**" - - "packages/wasm/**" - - ".github/workflows/**" + push: env: CI: false @@ -143,26 +132,26 @@ jobs: REACT_APP_NAMADA_ALIAS: "Namada Devnet" REACT_APP_NAMADA_CHAIN_ID: "internal-devnet-6be.86067e06a5" REACT_APP_NAMADA_URL: "https://proxy.heliax.click/internal-devnet-6be.86067e06a5" - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2.3 - with: - publish-dir: "./apps/namada-interface/build" - production-branch: main - github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: "deploy ${{ github.event.number }} at creating a PR" - alias: pull-request-${{ github.event.number }} - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }} - NETLIFY_SITE_ID: 1f548c68-c620-4522-97e0-0d85c08366fb - # namada.me - # NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3 - - - name: Slack Notification - run: | - curl --header "Content-Type: application/json" \ - --request POST \ - --data '{"message":"New deployment for a PR\nhttps://pull-request-${{ github.event.number }}--wallet-development-heliax-dev.netlify.app\n \nthe PR\nhttps://github.com/anoma/namada-interface/pull/${{ github.event.number }}"}' \ - ${{ secrets.SLACK_WEBHOOK_WALLET_PR }} + #- name: Deploy to Netlify + # uses: nwtgck/actions-netlify@v1.2.3 + # with: + # publish-dir: "./apps/namada-interface/build" + # production-branch: main + # github-token: ${{ secrets.GITHUB_TOKEN }} + # deploy-message: "deploy ${{ github.event.number }} at creating a PR" + # alias: pull-request-${{ github.event.number }} + # env: + # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN_WALLET_PREVIEW }} + # NETLIFY_SITE_ID: 1f548c68-c620-4522-97e0-0d85c08366fb + # # namada.me + # # NETLIFY_SITE_ID: 2380782e-9b20-477a-bc27-b4e9d05e16f3 + + #- name: Slack Notification + # run: | + # curl --header "Content-Type: application/json" \ + # --request POST \ + # --data '{"message":"New deployment for a PR\nhttps://pull-request-${{ github.event.number }}--wallet-development-heliax-dev.netlify.app\n \nthe PR\nhttps://github.com/anoma/namada-interface/pull/${{ github.event.number }}"}' \ + # ${{ secrets.SLACK_WEBHOOK_WALLET_PR }} E2E-tests: needs: build timeout-minutes: 60 diff --git a/.gitignore b/.gitignore index 2d9dbb06e4..291c5a4acd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ target/ npm-debug.log* yarn-debug.log* yarn-error.log* + +masp-params/*.params +.direnv/ +trees/ diff --git a/.ignore b/.ignore new file mode 100644 index 0000000000..f01ea90f17 --- /dev/null +++ b/.ignore @@ -0,0 +1,4 @@ +node_modules +build +*.lock +trees diff --git a/apps/extension/src/Setup/ImportAccount/Steps/SeedPhraseImport.tsx b/apps/extension/src/Setup/ImportAccount/Steps/SeedPhraseImport.tsx index 43bd19d348..bee32467db 100644 --- a/apps/extension/src/Setup/ImportAccount/Steps/SeedPhraseImport.tsx +++ b/apps/extension/src/Setup/ImportAccount/Steps/SeedPhraseImport.tsx @@ -34,7 +34,21 @@ export const SeedPhraseImport: React.FC = ({ onConfirm, requester }) => { const [mnemonicLength, setMnemonicLength] = useState(SHORT_PHRASE_COUNT); const mnemonicsRange = Array.from(Array(mnemonicLength).keys()); const [mnemonics, setMnemonics] = useState( - mnemonicsRange.map(() => "") + //mnemonicsRange.map(() => "") + [ + "column", + "banana", + "aunt", + "acquire", + "dolphin", + "fruit", + "fever", + "rent", + "dawn", + "divert", + "book", + "amateur", + ] ); const isSubmitButtonDisabled = mnemonics.some((mnemonic) => !mnemonic); diff --git a/apps/extension/src/background/keyring/keyring.ts b/apps/extension/src/background/keyring/keyring.ts index 0a8799ed0e..a1097f90ab 100644 --- a/apps/extension/src/background/keyring/keyring.ts +++ b/apps/extension/src/background/keyring/keyring.ts @@ -403,7 +403,7 @@ export class KeyRing { return { path, info: accountInfo, balances }; }; - while (index < 999999999 && emptyBalanceCount < 20) { + while (index < 999999999 && emptyBalanceCount < 1) { const { path, info, balances } = await get(index++); const hasBalance = balances.some(([, value]) => { return !new BigNumber(value).isZero(); diff --git a/apps/namada-interface/.env b/apps/namada-interface/.env new file mode 100644 index 0000000000..b6579cad1a --- /dev/null +++ b/apps/namada-interface/.env @@ -0,0 +1,29 @@ +# Specify the following if you wish to override the defaults defined in @anoma/chains: + +# NAMADA +REACT_APP_NAMADA_ALIAS=Namada Testnet +REACT_APP_NAMADA_CHAIN_ID=dev-test.42324e8e5d09b566a0700 +REACT_APP_NAMADA_URL=http://127.0.0.1:27657 +REACT_APP_NAMADA_BECH32_PREFIX=atest +REACT_APP_NAMADA_FAUCET_ADDRESS=atest1v4ehgw368pprgvjygv652w2yg3znvd69xucnvde3xaz5ysenx5myx3f389z5yv3nxg65xv3kx0fkez +REACT_APP_NAMADA_FAUCET_LIMIT=1000 + +# COSMOS +REACT_APP_COSMOS_ALIAS=Cosmos Testnet +REACT_APP_COSMOS_CHAIN_ID=cosmoshub-4 +REACT_APP_COSMOS_URL=https://rpc.sentry-01.theta-testnet.polypore.xyz + +# OSMOSIS +REACT_APP_OSMOSIS_ALIAS=Osmosis Testnet +REACT_APP_OSMOSIS_CHAIN_ID=osmosis-testnet.123412341234 +REACT_APP_OSMOSIS_URL=http://127.0.0.1:54321 + +# ETH +REACT_APP_ETH_ALIAS=Eth Testnet +REACT_APP_ETH_CHAIN_ID="0x7A69" +REACT_APP_ETH_URL=http://127.0.0.1:12345 + +# ETH smart contracts +CONTRACT_ADDR_ETH_BRIDGE="0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9" + +MASP_PARAMS_PATH=http://127.0.0.1:8080 diff --git a/apps/namada-interface/.gitignore b/apps/namada-interface/.gitignore index 89b6cf041c..35b91d44fa 100644 --- a/apps/namada-interface/.gitignore +++ b/apps/namada-interface/.gitignore @@ -3,7 +3,7 @@ /.pnp .pnp.js /build -.env +#.env # Ignore parts of the lib/anoma artifact # Everything else will be tracked in repo to speed up CI builds /lib/anoma/.gitignore diff --git a/e2e/genesis.toml b/e2e/genesis.toml index 85d3bbfe19..65765d5dbd 100644 --- a/e2e/genesis.toml +++ b/e2e/genesis.toml @@ -190,7 +190,7 @@ max_signatures_per_transaction = 15 max_validator_slots = 128 # Pipeline length (in epochs). Any change in the validator set made in # epoch 'n' will become active in epoch 'n + pipeline_len'. -pipeline_len = 0 +pipeline_len = 2 # Unbonding length (in epochs). Validators may have their stake slashed # for a fault in epoch 'n' up through epoch 'n + unbonding_len'. unbonding_len = 0 diff --git a/e2e/namada.sh b/e2e/namada.sh new file mode 100755 index 0000000000..513f0a9c55 --- /dev/null +++ b/e2e/namada.sh @@ -0,0 +1,4 @@ +NAMADA_BIN_DIR="$HOME/src/namada/target/debug" +NAMADA_BASE_DIR=".namada/basedir" + +$NAMADA_BIN_DIR/namada --base-dir $NAMADA_BASE_DIR "$@" diff --git a/e2e/setup-namada.sh b/e2e/setup-namada.sh index e165dc7cb9..cc4dcb127e 100755 --- a/e2e/setup-namada.sh +++ b/e2e/setup-namada.sh @@ -1,66 +1,20 @@ -#!/bin/bash -x +#!/usr/bin/env bash -VERSION="v0.23.0" -CURRENT_VERSION="" -NAMADA_DIR=".namada" +NAMADA_DIR="$HOME/src/namada" +NAMADA_BIN_DIR="${NAMADA_DIR}/target/debug" NAMADA_BASE_DIR=".namada/basedir" OS="Linux" +(cd $NAMADA_DIR && nix develop -c make build) + if [[ $OSTYPE == "darwin"* ]]; then OS="Darwin" fi -# Read current version -CURRENT_VERSION_PATH="${NAMADA_DIR}/.version" -if test -f "$CURRENT_VERSION_PATH"; then - while read -r line; - do - CURRENT_VERSION=$line - - done < "$CURRENT_VERSION_PATH" -fi - -if [ "$CURRENT_VERSION" != "$VERSION" ]; then - # Download Namada binaries - FILENAME="namada-${VERSION}-${OS}-x86_64.tar.gz" - curl --location --remote-header-name --remote-name https://github.com/anoma/namada/releases/download/${VERSION}/${FILENAME} - mkdir $NAMADA_DIR - tar -xzf ${FILENAME} --directory $NAMADA_DIR --strip-components 1 - rm -rf ${FILENAME} - - # Download wasm checksums - curl --location --remote-header-name --remote-name https://raw.githubusercontent.com/anoma/namada/${VERSION}/wasm/checksums.json - mv checksums.json "${NAMADA_DIR}/checksums.json" - - # Download masp params - curl --location --remote-header-name --remote-name https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params - curl --location --remote-header-name --remote-name https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params - curl --location --remote-header-name --remote-name https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params - mv masp-*.params "${NAMADA_DIR}" - - # Download wasms - CHECKSUMS="${NAMADA_DIR}/checksums.json" - WASM="" - S3="https://namada-wasm-master.s3.eu-west-1.amazonaws.com" - - rm -rf "${NAMADA_DIR}/wasm" - mkdir "${NAMADA_DIR}/wasm" - - while read -r line; - do - WASM=$(echo "$line" | sed -E "s/\".+\":[[:space:]]\"//g" | sed -E "s/\".*//g"); - curl "${S3}/${WASM}" --output "${NAMADA_DIR}/wasm/${WASM}" - - done < "$CHECKSUMS" - - # Save version - echo "${VERSION}" > "${NAMADA_DIR}/.version" -fi - # Clear the basedir rm -rf $NAMADA_BASE_DIR -"${NAMADA_DIR}/namadac" --base-dir $NAMADA_BASE_DIR utils init-network \ +"${NAMADA_BIN_DIR}/namadac" --base-dir $NAMADA_BASE_DIR utils init-network \ --chain-prefix dev-test \ --wasm-checksums-path "${NAMADA_DIR}/checksums.json" \ --genesis-path genesis.toml \ @@ -71,7 +25,7 @@ CONFIG="${NAMADA_BASE_DIR}/global-config.toml" CHAIN_ID="" # Read CHAIN_ID from global-config.toml -while read -r line; +while read -r line; do CHAIN_ID=$(echo "$line" | sed "s/default_chain_id = \"//g" | sed "s/\"//"); @@ -81,18 +35,14 @@ done < "$CONFIG" cp -f ${NAMADA_DIR}/wasm/*.wasm ${NAMADA_BASE_DIR}/${CHAIN_ID}/setup/validator-0/.namada/${CHAIN_ID}/wasm/ cp -f ${NAMADA_DIR}/wasm/*.wasm ${NAMADA_BASE_DIR}/${CHAIN_ID}/wasm/ -echo "Replacing CHAIN_ID: $CHAIN_ID" -# Override envs - so we do not have to rebuild extension and app -if [[ $OS == "Darwin" ]]; then - LC_ALL=C find ../apps/extension/build/chrome -type f -name "*.js" -exec sed -i "" -E "s/dev-test\..{21}/$CHAIN_ID/g" {} + - LC_ALL=C find ../apps/namada-interface/build -type f -name "*.js" -exec sed -i "" -E "s/dev-test\..{21}/$CHAIN_ID/g" {} + -else - find ../apps/extension/build/chrome -type f -name "*.js" -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} + - find ../apps/namada-interface/build -type f -name "*.js" -exec sed -i -E "s/dev-test\..{21}/$CHAIN_ID/g" {} + -fi - echo "Fixing CORS" -find .namada/basedir -type f -name "config.toml" -exec sed -i -E "s/cors_allowed_origins[[:space:]]=[[:space:]]\[\]/cors_allowed_origins = [\"*\"]/g" {} + +find $NAMADA_BASE_DIR -type f -name "config.toml" -exec sed -i -E "s/cors_allowed_origins[[:space:]]=[[:space:]]\[\]/cors_allowed_origins = [\"*\"]/g" {} + + +#echo "Moving MASP params" +#cp -t $NAMADA_BIN_DIR ../masp-params/*.params + +echo "Writing chain ID to .env" +sed -i -E "s/(REACT_APP_NAMADA_CHAIN_ID=).*/\1$CHAIN_ID/" ../apps/namada-interface/.env -echo "Moving MASP params" -cp .namada/masp-*.params ../apps/namada-interface/build/assets +echo "Copying wallet" +cp ${NAMADA_BASE_DIR}/${CHAIN_ID}/setup/other/wallet.toml ${NAMADA_BASE_DIR}/${CHAIN_ID} diff --git a/e2e/src/utils/helpers.ts b/e2e/src/utils/helpers.ts index 281e139848..dc829ffa99 100644 --- a/e2e/src/utils/helpers.ts +++ b/e2e/src/utils/helpers.ts @@ -52,7 +52,7 @@ const getExtensionId = async (browser: puppeteer.Browser): Promise => { }; export const openInterface = async (page: puppeteer.Page): Promise => { - await page.goto("http://localhost:8080", { + await page.goto("http://localhost:3000", { waitUntil: ["domcontentloaded"], }); }; diff --git a/e2e/start-namada.sh b/e2e/start-namada.sh index daceba63d5..0ea19c76aa 100755 --- a/e2e/start-namada.sh +++ b/e2e/start-namada.sh @@ -1,16 +1,23 @@ -#!/bin/bash -x +#!/usr/bin/env bash -NAMADA_DIR=".namada" -NAMADA_BASE_DIR=".namada/basedir" +CURRENT_DIR=$(pwd) + +NAMADA_DIR="$HOME/src/namada" +NAMADA_BASE_DIR="$CURRENT_DIR/.namada/basedir" CONFIG="${NAMADA_BASE_DIR}/global-config.toml" +CHAIN_ID="" # Read CHAIN_ID from global-config.toml -while read -r line; +while read -r line; do CHAIN_ID=$(echo "$line" | sed "s/default_chain_id = \"//g" | sed "s/\"//"); done < "$CONFIG" # Start the chain -NAMADA_LOG=debug "${NAMADA_DIR}/namadan" --chain-id ${CHAIN_ID} --base-dir ${NAMADA_BASE_DIR}/${CHAIN_ID}/setup/validator-0/.namada ledger +( + cd $NAMADA_DIR + NAMADA_LOG=debug ENV_VAR_MASP_PARAMS_DIR=$CURRENT_DIR/../masp-params \ + nix develop -c ./target/debug/namadan --chain-id ${CHAIN_ID} --base-dir ${NAMADA_BASE_DIR}/${CHAIN_ID}/setup/validator-0/.namada ledger +) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..1006455647 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1688918189, + "narHash": "sha256-f8ZlJ67LgEUDnN7ZsAyd1/Fyby1VdOXWg4XY/irSGrQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "408c0e8c15a1c9cf5c3226931b6f283c9867c484", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..c1dda1b064 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + rustup + #wasm-bindgen-cli + (callPackage ./wasm-bindgen-cli.nix { }) + wasm-pack + binaryen + protobuf + yarn + nodejs-18_x + emscripten #using emcc because I can't get gcc or clang to work + nodePackages.web-ext + wget + cargo-watch + ]; + }; + } + ); +} diff --git a/masp-params/package-lock.json b/masp-params/package-lock.json new file mode 100644 index 0000000000..94dfc9c484 --- /dev/null +++ b/masp-params/package-lock.json @@ -0,0 +1,455 @@ +{ + "name": "masp-params", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "masp-params", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "http-server": "^14.1.1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dev": true, + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/basic-auth": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", + "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", + "dev": true, + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-server": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz", + "integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==", + "dev": true, + "dependencies": { + "basic-auth": "^2.0.1", + "chalk": "^4.1.2", + "corser": "^2.0.1", + "he": "^1.2.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy": "^1.18.1", + "mime": "^1.6.0", + "minimist": "^1.2.6", + "opener": "^1.5.1", + "portfinder": "^1.0.28", + "secure-compare": "3.0.1", + "union": "~0.5.0", + "url-join": "^4.0.1" + }, + "bin": { + "http-server": "bin/http-server" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/opener": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", + "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "dev": true, + "bin": { + "opener": "bin/opener-bin.js" + } + }, + "node_modules/portfinder": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz", + "integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==", + "dev": true, + "dependencies": { + "async": "^2.6.4", + "debug": "^3.2.7", + "mkdirp": "^0.5.6" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/secure-compare": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz", + "integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==", + "dev": true + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/union": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz", + "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==", + "dev": true, + "dependencies": { + "qs": "^6.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "dev": true + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + } + } +} diff --git a/masp-params/package.json b/masp-params/package.json new file mode 100644 index 0000000000..c23fd5c2f3 --- /dev/null +++ b/masp-params/package.json @@ -0,0 +1,16 @@ +{ + "name": "masp-params", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "http-server . --cors", + "download": "rm -f *.params && wget https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-{convert,output,spend}.params" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "http-server": "^14.1.1" + } +} diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 53122d6a5c..4a754a970a 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -39,7 +39,7 @@ const promiseWithTimeout = export class Query extends RustQuery { query_balance = promiseWithTimeout(super.query_balance.bind(this), { - timeout: 10000, + //timeout: 10000, }); query_epoch = promiseWithTimeout(super.query_epoch.bind(this)); query_all_validator_addresses = promiseWithTimeout( diff --git a/wasm-bindgen-cli.nix b/wasm-bindgen-cli.nix new file mode 100644 index 0000000000..74d2454d4f --- /dev/null +++ b/wasm-bindgen-cli.nix @@ -0,0 +1,52 @@ +{ lib +, rustPlatform +, fetchCrate +, nodejs +, pkg-config +, openssl +, stdenv +, curl +#, Security +, runCommand +}: + +rustPlatform.buildRustPackage rec { + pname = "wasm-bindgen-cli"; + #version = "0.2.84"; + version = "0.2.87"; + + # Note when bumping version: + # There are two hashes: `sha256` and `cargo256`, but `nix develop` + # isn't nice about telling you which one is wrong. So to upgrade, + # just bump the version, and when `nix develop` throws an error, + # check the hash it got and replace that one. It will error twice + # and you'll need to replace both. + + src = fetchCrate { + inherit pname version; + # sha256 = "sha256-0rK+Yx4/Jy44Fw5VwJ3tG243ZsyOIBBehYU54XP/JGk="; + sha256 = "sha256-0u9bl+FkXEK2b54n7/l9JOCtKo+pb42GF9E1EnAUQa0="; + }; + + #cargoSha256 = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50="; + cargoSha256 = "sha256-AsZBtE2qHJqQtuCt/wCAgOoxYMfvDh8IzBPAOkYSYko="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ]; # ++ lib.optionals stdenv.isDarwin [ curl Security ]; + + nativeCheckInputs = [ nodejs ]; + + # other tests require it to be ran in the wasm-bindgen monorepo + #cargoTestFlags = [ "--test wasm-bindgen" ]; + + dontCargoCheck = true; + + meta = with lib; { + homepage = "https://rustwasm.github.io/docs/wasm-bindgen/"; + license = with licenses; [ asl20 /* or */ mit ]; + description = "Facilitating high-level interactions between wasm modules and JavaScript"; + maintainers = with maintainers; [ nitsky rizary ]; + mainProgram = "wasm-bindgen"; + }; +}