Skip to content
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/templates/app/typescript/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#import * into HelloWorld from "ens/helloworld.polytest.eth"
#import * into Logging from "ens/wraps.eth:logging@1.0.0"
#import * into Ethereum from "ens/wraps.eth:ethereum@1.0.0"
36 changes: 22 additions & 14 deletions packages/templates/app/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
import { HelloWorld_Module, Ethereum_Module } from "./wrap";
import {
Logging_Module,
Ethereum_Module,
} from "./wrap";

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

const client = new PolywrapClient();

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

await HelloWorld_Module.logMessage({
message: "Hello there"
await Logging_Module.info({
message: "Hello there",
}, client);

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

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

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

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

if (result.ok) {
console.log(`Ethereum_Module.encodeParams:\n${result.value}`);
console.log(`Ethereum.encodeParams:\n${result.value}`);
} else {
console.log(`Error - Ethereum_Module.encodeParams:\n${result.error}`);
console.log(`Error - Ethereum.encodeParams:\n${result.error}`);
}
}

Expand Down