Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions .github/workflows/e2e-test-nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,33 @@ jobs:
- name: Setup PNPM
uses: dfinity/ci-tools/actions/setup-pnpm@main

- name: Setup DFX
uses: dfinity/setup-dfx@main
- name: Install ICP CLI tools
run: pnpm add -g @icp-sdk/icp-cli @icp-sdk/ic-wasm

- name: Cache Mops
uses: actions/cache@v4
with:
path: |
~/.cache/mops
~/Library/Caches/mops
.mops
key: mops-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mops.toml') }}

- name: Setup Motoko toolchain
run: |
pnpm add -g ic-mops
mops install

- name: Cache Cargo
uses: actions/cache@v4
with:
dfx-version: 'auto'
path: |
~/.cargo/registry
target
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}

- name: Add wasm32 Rust target
run: rustup target add wasm32-unknown-unknown

- name: Build
run: pnpm run build
Expand Down Expand Up @@ -64,10 +87,33 @@ jobs:
shell: bash
run: bun i --frozen-lockfile

- name: Setup DFX
uses: dfinity/setup-dfx@main
- name: Install ICP CLI tools
run: bun add -g @icp-sdk/icp-cli @icp-sdk/ic-wasm

- name: Cache Mops
uses: actions/cache@v4
with:
path: |
~/.cache/mops
~/Library/Caches/mops
.mops
key: mops-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('mops.toml') }}

- name: Setup Motoko toolchain
run: |
bun add -g ic-mops
mops install

- name: Cache Cargo
uses: actions/cache@v4
with:
dfx-version: 'auto'
path: |
~/.cargo/registry
target
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}

- name: Add wasm32 Rust target
run: rustup target add wasm32-unknown-unknown

- name: Build
run: bun run build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.dfx/
/.icp/cache/
/.mops/
/node_modules/
/target/

Expand Down
6 changes: 5 additions & 1 deletion bun.lock

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

118 changes: 0 additions & 118 deletions dfx.json

This file was deleted.

3 changes: 3 additions & 0 deletions examples/clock/clock.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
service : {
get : () -> (int) query;
}
4 changes: 2 additions & 2 deletions examples/clock/src/main.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Time "mo:base/Time";
import { setTimer; recurringTimer } = "mo:base/Timer";
import Time "mo:core/Time";
import { setTimer; recurringTimer } = "mo:core/Timer";

persistent actor Clock {
private type Time = Time.Time;
Expand Down
7 changes: 3 additions & 4 deletions examples/clock/tests/src/clock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ const WASM_PATH = resolve(
'..',
'..',
'..',
'.dfx',
'local',
'canisters',
'.icp',
'cache',
'artifacts',
'clock',
'clock.wasm.gz',
);

describe('Clock', () => {
Expand Down
6 changes: 6 additions & 0 deletions examples/counter/counter.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service : (nat) -> {
get : () -> (nat) query;
set : (nat) -> ();
inc : () -> ();
dec : () -> ();
}
2 changes: 1 addition & 1 deletion examples/counter/src/main.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Nat "mo:base/Nat";
import Nat "mo:core/Nat";

persistent actor class Counter(initial_count : Nat) {
private var counter = initial_count;
Expand Down
7 changes: 3 additions & 4 deletions examples/counter/tests/src/counter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ const WASM_PATH = resolve(
'..',
'..',
'..',
'.dfx',
'local',
'canisters',
'.icp',
'cache',
'artifacts',
'counter',
'counter.wasm.gz',
);

describe('Counter', () => {
Expand Down
20 changes: 20 additions & 0 deletions examples/google_search/google_search.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type HttpHeader = record {
name : text;
value : text;
};

type CanisterHttpResponsePayload = record {
status : nat;
headers : vec HttpHeader;
body : vec nat8;
};

type TransformArgs = record {
response : CanisterHttpResponsePayload;
context : blob;
};

service : {
google_search : () -> (text);
transform : (TransformArgs) -> (CanisterHttpResponsePayload) query;
}
4 changes: 2 additions & 2 deletions examples/google_search/src/main.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Blob "mo:base/Blob";
import Text "mo:base/Text";
import Blob "mo:core/Blob";
import Text "mo:core/Text";
import Types "types";

persistent actor {
Expand Down
7 changes: 3 additions & 4 deletions examples/google_search/tests/src/google-search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ const WASM_PATH = resolve(
'..',
'..',
'..',
'.dfx',
'local',
'canisters',
'.icp',
'cache',
'artifacts',
'google_search',
'google_search.wasm.gz',
);

describe('GoogleSearch', () => {
Expand Down
7 changes: 3 additions & 4 deletions examples/icp_features/tests/src/icp-features.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ const WASM_PATH = resolve(
'..',
'..',
'..',
'.dfx',
'local',
'canisters',
'.icp',
'cache',
'artifacts',
'icp_features',
'icp_features.wasm.gz',
);

const E8S_PER_ICP = 100_000_000;
Expand Down
13 changes: 13 additions & 0 deletions examples/multicanister/interfaces/phonebook.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module {
public type ContactName = Text;
public type PhoneNumber = Text;
public type PhoneBookEntry = {
phone : PhoneNumber;
description : Text;
};

public type Self = actor {
insert : shared (ContactName, PhoneBookEntry) -> async ();
lookup : shared query (ContactName) -> async ?PhoneBookEntry;
};
}
12 changes: 12 additions & 0 deletions examples/multicanister/interfaces/superheroes.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module {
public type SuperHeroId = Nat32;
public type SuperHero = {
name : Text;
superpowers : [Text];
};

public type Self = actor {
insert : shared (SuperHero) -> async SuperHeroId;
lookup : shared query (SuperHeroId) -> async ?SuperHero;
};
}
26 changes: 26 additions & 0 deletions examples/multicanister/multicanister.did
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type PhoneBookEntry = record {
phone : text;
description : text;
};

type SuperHero = record {
name : text;
superpowers : vec text;
};

type PhoneBookService = service {
insert : (text, PhoneBookEntry) -> ();
lookup : (text) -> (opt PhoneBookEntry) query;
};

type SuperHeroesService = service {
insert : (SuperHero) -> (nat32);
lookup : (nat32) -> (opt SuperHero) query;
};

service : (PhoneBookService, SuperHeroesService) -> {
insert_phone_book_entry : (text, PhoneBookEntry) -> ();
lookup_phone_book_entry : (text) -> (opt PhoneBookEntry) composite_query;
insert_super_hero : (SuperHero) -> (nat32);
lookup_super_hero : (nat32) -> (opt SuperHero);
}
Loading