Skip to content

Commit cb1d37c

Browse files
authored
Merge pull request #1855 from polywrap/update-typescript-app-template
Feat: update typescript/app template to latest bindings
2 parents 0e04bc9 + 29ed2df commit cb1d37c

2 files changed

Lines changed: 16 additions & 22 deletions

File tree

packages/schema/bind/src/bindings/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function getGenerateBindingFn(
4343
);
4444
case "app-ts":
4545
return WrapBindgen.getGenerateBindingFn(
46-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/app-typescript"
46+
"https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-typescript"
4747
);
4848
default:
4949
throw Error(`Error: Language binding unsupported - ${bindLanguage}`);

packages/templates/app/typescript/src/index.ts

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
1-
import {
2-
Logging_Module,
3-
Ethereum_Module,
4-
} from "./wrap";
5-
6-
import { PolywrapClient } from "@polywrap/client-js";
7-
8-
const client = new PolywrapClient();
1+
import { Ethereum, Logging } from "./wrap";
92

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

13-
await Logging_Module.info({
6+
const logger = new Logging();
7+
8+
await logger.info({
149
message: "Hello there",
15-
}, client);
10+
});
1611

17-
await Logging_Module.info({
12+
await logger.info({
1813
message: "Hello again",
19-
}, client);
14+
});
2015

21-
await Logging_Module.info({
16+
await logger.info({
2217
message: "One last time...",
23-
}, client);
18+
});
2419

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

27-
const result = await Ethereum_Module.encodeParams(
28-
{
29-
types: ["address", "uint256"],
30-
values: ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"],
31-
},
32-
client
33-
);
22+
const eth = new Ethereum();
23+
24+
const result = await eth.encodeParams({
25+
types: ["address", "uint256"],
26+
values: ["0xB1B7586656116D546033e3bAFF69BFcD6592225E", "500"],
27+
});
3428

3529
if (result.ok) {
3630
console.log(`Ethereum.encodeParams:\n${result.value}`);

0 commit comments

Comments
 (0)