Want to see if there is any example on how to connect to a custom smart contract using purely JS and html

Oct 4, 2023, 5:33 AM
like just using ABI.json and contract address together with web3.js. Can I find something similar on tonweb.js?
Oct 4, 2023, 6:04 AM
maybe this can help you https://github.com/getgems-community-tact/nft-template-editable/blob/tutorial/sources/contract.read.ts
Oct 4, 2023, 6:27 AM
any pure frontend js example?
Oct 4, 2023, 6:38 AM
sorry I hadn't
Oct 4, 2023, 6:38 AM
I couldn't find any either
Oct 4, 2023, 6:39 AM
I remember that I had one, currently trying to find.
https://github.com/ProgramCrafter/ton-qr-deployer/blob/feffa25bff67f9a9a901585a4f7970a0fcc24671/index.html
Oct 4, 2023, 6:43 AM
is it the same thing, I am looking for a pure frontend js connecting with custom smart contract. This one seems to be a contract deployer?
Or I should ask what is the way to load the ABI at the frontend side using javascript
I guess shd be something like this, but it is lacking examples: https://github.com/toncenter/tonweb/blob/master/src/contract/README.md#implement-your-custom-contract
Oct 4, 2023, 7:10 AM
There is no automated ABI for smart contacts at all.
Btw, it's known as TL-B.
Oct 4, 2023, 7:17 AM
so I have to write the wrapper class all by myself if I want to use tonweb.contract at the frontend side?
Oct 4, 2023, 7:17 AM
Yes.
Oct 4, 2023, 7:18 AM
oh that's not good 🙈
export class MyContract extends Contract {
constructor(provider, options) {
options.code = hexToBytes('abcd..');
super(provider, options);

this.method.myMethod = ...
}

// @override
createDataCell() {
}
}

can the team at least provide an example of this?
Oct 4, 2023, 7:19 AM
You can use blueprint with Tact, it generates [non-tonweb] wrappers.
Oct 4, 2023, 7:19 AM
yes but I cannot use it at the frontend side
Oct 4, 2023, 7:19 AM
You can, just pack them with rollup.
https://github.com/ProgramCrafter/ton-stable-timer/blob/master/timer.ts
Oct 4, 2023, 7:20 AM
I know how to do it using typescript, but I am not good at typescript and I want to connect to the smart contract using simple JS
let me check, I dont know how to do the rollup
thank you for your help
but this is ton-core, I am looking tonweb, are they the same?
and where can I find the base64 code? I have build my tact file
😮‍💨
Btw anyone tried this tutorial?
https://ton-community.github.io/tutorials/03-client/
it doesnt work starting form Step 6: Read the counter value from the chain
I dont what the problem is, but everything doesn't work once I have useTonClient in my code
but there is no error at all
Oct 4, 2023, 8:35 AM
Either build/ directory or the result of invoking compilator contains all the artifacts, including the code cell which you can encode in base64.
Though, you don't necessarily need one to write a wrapper for a contract.
They are approximately same, yes.
Their protocol is ADNL.
Oct 4, 2023, 12:30 PM
What is the file extension?
Oct 4, 2023, 2:35 PM

© 2024 Draquery.com All rights reserved.