Skip to content

Commit

Permalink
Merge pull request #1855 from polywrap/update-typescript-app-template
Browse files Browse the repository at this point in the history
Feat: update typescript/app template to latest bindings
  • Loading branch information
dOrgJelli authored Aug 21, 2023
2 parents 0e04bc9 + 29ed2df commit cb1d37c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
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

0 comments on commit cb1d37c

Please sign in to comment.