Skip to content

Commit

Permalink
Update package references and remove unnecessary files
Browse files Browse the repository at this point in the history
  • Loading branch information
b3hr4d committed Apr 18, 2024
1 parent e637d20 commit 69b5063
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = ["packages/parser/rust"]
members = ["packages/parser"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 84 additions & 1 deletion packages/parser/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
This package provides a visitor pattern implementation for the IC-Reactor framework.
<div align="center">

<h1><code>wasm-pack-template</code></h1>

<strong>A template for kick starting a Rust and WebAssembly project using <a href="https://github.com/rustwasm/wasm-pack">wasm-pack</a>.</strong>

<p>
<a href="https://travis-ci.org/rustwasm/wasm-pack-template"><img src="https://img.shields.io/travis/rustwasm/wasm-pack-template.svg?style=flat-square" alt="Build Status" /></a>
</p>

<h3>
<a href="https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html">Tutorial</a>
<span> | </span>
<a href="https://discordapp.com/channels/442252698964721669/443151097398296587">Chat</a>
</h3>

<sub>Built with 🦀🕸 by <a href="https://rustwasm.github.io/">The Rust and WebAssembly Working Group</a></sub>
</div>

## About

[**📚 Read this template tutorial! 📚**][template-docs]

This template is designed for compiling Rust libraries into WebAssembly and
publishing the resulting package to NPM.

Be sure to check out [other `wasm-pack` tutorials online][tutorials] for other
templates and usages of `wasm-pack`.

[tutorials]: https://rustwasm.github.io/docs/wasm-pack/tutorials/index.html
[template-docs]: https://rustwasm.github.io/docs/wasm-pack/tutorials/npm-browser-packages/index.html

## 🚴 Usage

### 🐑 Use `cargo generate` to Clone this Template

[Learn more about `cargo generate` here.](https://github.com/ashleygwilliams/cargo-generate)

```
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project
cd my-project
```

### 🛠️ Build with `wasm-pack build`

```
wasm-pack build
```

### 🔬 Test in Headless Browsers with `wasm-pack test`

```
wasm-pack test --headless --firefox
```

### 🎁 Publish to NPM with `wasm-pack publish`

```
wasm-pack publish
```

## 🔋 Batteries Included

* [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) for communicating
between WebAssembly and JavaScript.
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
for logging panic messages to the developer console.
* `LICENSE-APACHE` and `LICENSE-MIT`: most Rust projects are licensed this way, so these are included for you

## License

Licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
8 changes: 0 additions & 8 deletions packages/parser/rust/.github/dependabot.yml

This file was deleted.

84 changes: 0 additions & 84 deletions packages/parser/rust/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions packages/parser/rust/src/utils.rs

This file was deleted.

3 changes: 1 addition & 2 deletions packages/parser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "@ic-reactor/core/dist/utils/constants"
import { CandidAdapterParameters, CandidDefenition } from "./types"
import { CanisterId, IDL, Principal } from "@ic-reactor/core/dist/types"
import { did_to_js } from "../rust/pkg/didjs"
import { did_to_js } from "../pkg/didjs"

export class CandidAdapter {
public agent: HttpAgent
Expand Down Expand Up @@ -109,7 +109,6 @@ export class CandidAdapter {
// })

const js = did_to_js(candidSource)
console.log("🚀 ~ CandidAdapter ~ didTojs ~ js:", js)

const dataUri =
"data:text/javascript;charset=utf-8," + encodeURIComponent(js as string)
Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion packages/parser/test/candid.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createActorManager } from "@ic-reactor/core"
import { CandidAdapter } from "../src"
import { createAgentManager } from "@ic-reactor/core"

Expand All @@ -10,7 +11,16 @@ describe("createReactorStore", () => {
const candid = await candidAdapter.didTojs(
`service:{icrc1_name:()->(text) query;}`
)
console.log("🚀 ~ it ~ candid:", candid)

const { callMethod } = createActorManager({
canisterId: "ryjl3-tyaaa-aaaaa-aaaba-cai",
idlFactory: candid.idlFactory,
agentManager,
})

const name = await callMethod("icrc1_name")

expect(name).toEqual("Internet Computer")
})

// it("should return candid idlFactory", async () => {
Expand Down
File renamed without changes.

0 comments on commit 69b5063

Please sign in to comment.