Skip to content

Commit

Permalink
update ledger and nns did file (#31)
Browse files Browse the repository at this point in the history
* update ledger and nns did file

* use dfx for test

* fmt

* fix

* fix

* fix

* update account return type

* use clap v3

* fmt

Co-authored-by: Yan Chen <yan.chen@dfinity.org>
  • Loading branch information
chenyan2002 and chenyan-dfinity authored Jul 28, 2022
1 parent 40c28d0 commit 50e211b
Show file tree
Hide file tree
Showing 11 changed files with 465 additions and 220 deletions.
44 changes: 7 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,9 @@ jobs:
test:
runs-on: ubuntu-latest
env:
ghc: '8.10.7'
spec: 'f771c6b3e7cdde413d3b960f63165c6ecf3e0b7c'
DFX_VERSION: 0.11.0
steps:
- uses: actions/checkout@v2

- name: Checkout ic-ref
uses: actions/checkout@v2
with:
repository: 'dfinity/ic-hs'
path: ic-hs
ref: ${{ env.spec }}
- name: Cache cabal
uses: actions/cache@v2
with:
path: |
~/.cabal/store
key: cabal-${{ runner.os }}-${{ env.ghc }}-${{ env.spec }}-${{ hashFiles('ic-hs/cabal.project', 'ic-hs/cabal.project.freeze') }}
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ env.ghc }}
cabal-version: '3.2'
- name: Build ic-ref
run: |
cabal --version
mkdir -p $HOME/bin
cd ic-hs/
cabal update
cabal install -w ghc-${{ env.ghc }} --overwrite-policy=always --installdir=$HOME/bin
- name: Running ic-ref
id: ic_ref
run: |
set -ex
$HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port &
sleep 1
echo "::set-output name=IC_REF_PORT::$(cat $HOME/ic_ref_port)"
- name: Install stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -68,10 +35,13 @@ jobs:
run: cargo fmt -v -- --check
- name: lint
run: cargo clippy --tests -- -D clippy::all
- name: install dfx
run: |
echo y | DFX_VERSION=$DFX_VERSION bash -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo '{}' > dfx.json
dfx start --background
- name: e2e tests
run: |
set -ex
target/debug/ic-repl -r http://localhost:${{ steps.ic_ref.outputs.IC_REF_PORT }} examples/install.sh
- name: clean up
run: killall ic-ref
target/debug/ic-repl -r http://localhost:8000 examples/install.sh
137 changes: 65 additions & 72 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ic-repl"
version = "0.1.4"
version = "0.2.0"
authors = ["DFINITY Team"]
edition = "2018"

Expand All @@ -26,8 +26,7 @@ anyhow = "1.0"
rand = "0.8"
logos = "0.12"
lalrpop-util = "0.19"
clap = "2.33"
structopt = "0.3.16"
clap = { version = "3.2", features = ["derive"] }
ring = "0.16"
serde = "1.0"
serde_json = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ assert _ == result;
// nns and ledger canisters are auto-imported if connected to the mainnet
call nns.get_pending_proposals()
identity private "./private.pem";
call ledger.account_balance_dfx(record { account = account(private) });
call ledger.account_balance(record { account = account(private) });
function transfer(to, amount, memo) {
call ledger.send_dfx(
call ledger.transfer(
record {
to = to;
fee = record { e8s = 10_000 };
Expand Down
2 changes: 1 addition & 1 deletion examples/neuron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
identity private "../private.pem";

function transfer(to, amount, memo) {
call ledger.send_dfx(
call ledger.transfer(
record {
to = to;
fee = record { e8s = 10_000 };
Expand Down
Loading

0 comments on commit 50e211b

Please sign in to comment.