Skip to content
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: update typescript/app template to latest bindings #1855

Merged
merged 3 commits into from
Aug 21, 2023
Merged
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
2 changes: 1 addition & 1 deletion packages/schema/bind/src/bindings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function getGenerateBindingFn(
);
case "app-ts":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/app-typescript"
"https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-typescript"
);
default:
throw Error(`Error: Language binding unsupported - ${bindLanguage}`);
Expand Down
36 changes: 15 additions & 21 deletions packages/templates/app/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import {
Logging_Module,
Ethereum_Module,
} from "./wrap";

import { PolywrapClient } from "@polywrap/client-js";

const client = new PolywrapClient();
import { Ethereum, Logging } from "./wrap";

async function main() {
console.log("Invoking: Logging.info(...)");

await Logging_Module.info({
const logger = new Logging();

await logger.info({
message: "Hello there",
}, client);
});

await Logging_Module.info({
await logger.info({
message: "Hello again",
}, client);
});

await Logging_Module.info({
await logger.info({
message: "One last time...",
}, client);
});

console.log("Invoking: Ethereum.encodeParams(...)");

const result = await Ethereum_Module.encodeParams(
{
types: ["address", "uint256"],
values: ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"],
},
client
);
const eth = new Ethereum();

const result = await eth.encodeParams({
types: ["address", "uint256"],
values: ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"],
});

if (result.ok) {
console.log(`Ethereum.encodeParams:\n${result.value}`);
Expand Down
Loading
Loading