-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add rust app codegen template #1864
Changes from 7 commits
7e6828f
0156c2e
7feacfa
e8a4915
40d5182
14d4ce2
581b9d4
f7deeb0
a269b7a
d2a7610
949f1f1
e024085
d541e62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v17.9.1 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "template_plugin_rs" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be "template_app_rs" |
||
version = "0.1.0" | ||
license = "MIT" | ||
description = "Polywrap Rust Plugin Template" | ||
edition = "2021" | ||
|
||
include = [ | ||
"src/wrap/*", | ||
"src/lib.rs" | ||
] | ||
|
||
[dependencies] | ||
polywrap = { version = "~0.1.8" } | ||
serde = {version = "1.0.145", features = ["derive"]} | ||
|
||
[dev-dependencies] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "templates-app-rust", | ||
"description": "Polywrap App Rust Template", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for name, description, version |
||
"private": true, | ||
"version": "0.11.2", | ||
"scripts": { | ||
"build": "npx polywrap codegen", | ||
"test": "ts-node ./src/index.ts", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't work |
||
"ipfs:up": "npx polywrap infra up --modules=eth-ens-ipfs", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forget to remove! before I was using local ipfs in template but then migrate to just cat instead of add and cat |
||
"ipfs:down": "npx polywrap infra down --modules=eth-ens-ipfs" | ||
}, | ||
"dependencies": { | ||
"@polywrap/client-js": "~0.12.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not needed right |
||
}, | ||
"devDependencies": { | ||
"@types/node": "18.15.0", | ||
"polywrap": "0.11.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can only keep |
||
"ts-node": "10.9.1", | ||
"typescript": "4.9.5" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#import * into Logging from "ens/wraps.eth:logging@1.0.0" | ||
#import * into Ipfs from "wrapscan.io/polywrap/ipfs-http-client@1.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
format: 0.3.0 | ||
project: | ||
name: Sample | ||
type: app/rust | ||
source: | ||
schema: ./polywrap.graphql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
mod wrap; | ||
|
||
use polywrap::ByteBuf; | ||
use wrap::types::*; | ||
|
||
pub fn main() { | ||
let ipfs_provider = "https://ipfs.io"; | ||
let cid = "Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z"; | ||
let ipfs = IpfsModule::new(None, None, None); | ||
|
||
let data = ipfs.cat(&IpfsModuleArgsCat{ | ||
cid: cid.to_string(), | ||
ipfs_provider: ipfs_provider.to_string(), | ||
timeout: None, | ||
cat_options: None | ||
}, None, None, None).unwrap(); | ||
|
||
assert_eq!(data, ByteBuf::from("Hello World!\r\n".as_bytes().to_vec())); | ||
} | ||
|
||
#[cfg(test)] | ||
mod client_tests { | ||
|
||
#[test] | ||
fn test_client() { | ||
super::main(); | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can also remove this one right |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file isn't needed |
||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"lib": [ | ||
"es2015", | ||
"es5", | ||
"dom" | ||
], | ||
"downlevelIteration": true, | ||
"experimentalDecorators": true, | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"preserveSymlinks": true, | ||
"preserveWatchOutput": true, | ||
"pretty": false, | ||
"forceConsistentCasingInFileNames": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"module": "commonjs", | ||
"sourceMap": true, | ||
"target": "es5", | ||
"resolveJsonModule": true, | ||
"strictNullChecks": true | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be v18.15.0 like all other .nvmrc files in the CLI repo