hello I'm using nodejs ton sdk
How can I get txHash when I send externalMessage?
there is no return value
anyone help?
Oct 22, 2023, 4:47 AM
I'm not sure if node sdk has same strategy, but in dotnet sdk there is no async response and we need to get TX manually, read the related part in the documents at github
if you are using ton sdk (not tonweb):
export const getTxHash = (
tx: SendTransactionResponse,
encoding: BufferEncoding = 'base64',
): string => {
return Cell.fromBoc(Buffer.from(tx.boc, 'base64'))[0].hash().toString(encoding);
};
usage:
const tx = await connector.sendTransaction({ your transaction body });
const txHash = getTxHash(tx);
export const getTxHash = (
tx: SendTransactionResponse,
encoding: BufferEncoding = 'base64',
): string => {
return Cell.fromBoc(Buffer.from(tx.boc, 'base64'))[0].hash().toString(encoding);
};
usage:
const tx = await connector.sendTransaction({ your transaction body });
const txHash = getTxHash(tx);
Oct 22, 2023, 6:09 AM
@pcrafter @Gusarich 👍
Oct 22, 2023, 11:12 AM
is blueprint builder/deployer is configurable with dotenv? this can be useful for CI build 🤔🧐
I know that, I figured there was a way to do it directly using tonkeeper as default deploy settings
pc too
Oct 22, 2023, 1:32 PM
Do you mean deploy directly from TonKeeper App?
Yeah it is possible to deploy it by setting .env. But it requires some setting for deploy script.
In this case, we deploy a contract by loading mnemonic and wallet version from .env.test
`.env.test` looks like
WALLET_MNEMONIC=...
WALLET_VERSION=v4
WALLET_MNEMONIC=...
WALLET_VERSION=v4
Oct 22, 2023, 1:42 PM
nice, I just start reading your repo, thanks for sharing, I had same idea about reusable trait as package for tact in hack-ton-berfest, however this bounty matches my skills, let me know if you needs help
Oct 22, 2023, 1:44 PM
I think the first issue (as I comment in README): tact import system seems not supporting importing from node_modules. I have opened issues but there is no any further discussion.
reusable trait truely shines when we can easily download other's trait by npm install or yarn
Like Openzepplin does on Ethereum
Oct 22, 2023, 1:48 PM
I'm sure if you complete the lib, the blueprint team will investigate how to define a space for such libraries, keep continuing your useful package 🙏
Oct 22, 2023, 1:53 PM
Thank you for your support! If any of you have any new ideas or would like to help with implementing TEP code that has not been implemented yet, we would be happy to engage in discussions!
https://github.com/Ton-Dynasty/tondynasty-contracts
https://github.com/Ton-Dynasty/tondynasty-contracts
Oct 22, 2023, 1:56 PM
The easiest option that comes to my mind is to download the binary from the address when adding imports before compile
Oct 22, 2023, 1:56 PM
Is the address an uri or something else?
Oct 22, 2023, 1:57 PM
If it is URI, it helps a lot to develop the library from community and update the clients
but it can be a local path from modules folder by configuring compiler file for imports
"imports" : [
"@traits" : "path/to/node_modules/traits/package"
]
but it can be a local path from modules folder by configuring compiler file for imports
"imports" : [
"@traits" : "path/to/node_modules/traits/package"
]
Oct 22, 2023, 2:03 PM
Wow, it looks quite simple!
So we only need to modify the resolve path right?
Oct 22, 2023, 2:04 PM
if tact compiler adds support for it, you can open an issue for it in tact repo
Oct 22, 2023, 2:05 PM
It will open the next era for tact
Thanks dude
Oct 22, 2023, 2:06 PM
Thank you and your team for developing useful products
I'm on phone, send it again via code style or a screen shot please
'tonConnectUI.sendTransaction' returns transactionResponse as promise
Oct 22, 2023, 2:56 PM
Oh I think you should use setInterval in js to query it
I'm not 100% sure
Oct 22, 2023, 3:03 PM
it's depend on your need, if you need tx you should export sender as separated method
const sendAndGetTx ....
then return it via
tx: await sendAndGetTx(transactionBody)
sorry I'm on phone to share full code
const sendAndGetTx ....
then return it via
tx: await sendAndGetTx(transactionBody)
sorry I'm on phone to share full code
but you must implement sender.send to work with tonConnect as a provider
Oct 22, 2023, 3:06 PM
what if i need only a smart contract response?
Oct 22, 2023, 3:17 PM
what you mean? e.x get a value from a counter?
Oct 22, 2023, 3:19 PM
Yes like that... actually this method is for staking nft and will return response code. But its not waiting for response. 😅
And i can identify with the code that what happened. Like if 708 thats mean you can't stake. If its 200 then staking success like that
Oct 22, 2023, 3:23 PM
var value = await counterContract.getValue(); 🥸 without need to track transaction response
var nftAddress = await nftCollectionContract.getNftAddressByIndex(nftIndex);
Oct 22, 2023, 3:27 PM
Okk.. and i need to use for other method too like claim rewards... like transactions success but if nft not claimable then we can not identify the result of this method.
So the smart contract method does not provide response?
So the smart contract method does not provide response?
Can you send full code of hook to get transactions response whenever you free... actually I didn't understand how to implement both for one transaction.
I have launching at morning.
I have launching at morning.
Oct 22, 2023, 3:33 PM
I didn't understand why you need to implement both for one transaction☹️
sender.send inside this hook uses to simplify your send when you call contract.send, we haven't any receiver with response because you are send messages to chain.
you can create and then send transaction without using connectUI hooks and get tx whenever you need tx:
const tx = await tonConnectUI.sendTransaction({ your transaction body });
sender.send inside this hook uses to simplify your send when you call contract.send, we haven't any receiver with response because you are send messages to chain.
you can create and then send transaction without using connectUI hooks and get tx whenever you need tx:
const tx = await tonConnectUI.sendTransaction({ your transaction body });
Oct 22, 2023, 4:06 PM
so i am sending a message using contract.send so i can't received the response from tonconnectUI right.
then how can get the transaction response or wait for response with contract.send? because i am using setTimeout to get response but its never return a reponse
then how can get the transaction response or wait for response with contract.send? because i am using setTimeout to get response but its never return a reponse
Oct 22, 2023, 4:13 PM
This is (or should be) explained at docs.ton.org.
Oct 22, 2023, 4:14 PM
if i get boc or any type of response i will find the solution but its does not return anything.
in any smart contract if we do transactions then normally how we can manage transaction?
or we can't and just do the transaction?
Oct 22, 2023, 4:16 PM
You can search transactions by user's wallet address and payload.
I believe you need something like this: https://github.com/toncenter/examples/blob/main/deposits-jettons-single-wallet.js
I believe you need something like this: https://github.com/toncenter/examples/blob/main/deposits-jettons-single-wallet.js
A translator, if you use one, doesn't seem to work well.
Oct 22, 2023, 4:17 PM
you mean need to use AccountSubscription ?
Oct 22, 2023, 4:21 PM
Either that or polling account state with setInterval and checking whether the transaction appeared.
Oct 22, 2023, 4:22 PM
and one more thing, you know we transaction failed or succeed then ton SDK print console log like this
how can we get this and watch on this ton sdk to get this type of result
TON SDK print this every time when transaction failed and succeed. how can we access this?
Oct 22, 2023, 4:27 PM
Use @tonconnect/sdk instead of @tonconnect/ui. Examples at https://docs.ton.org/develop/dapps/ton-connect/integration#logging-in-with-tonkeeper-1.
Oct 22, 2023, 4:28 PM
thanks
Oct 22, 2023, 4:31 PM
We have been trying to integrate ton connect into our react native app for a while now and facing road block. Can we use this sdk for react native instead of tonconnect react?
I have asked before and was told to use @tonconnect/ui but we are facing the same issue.
Can you simply guide us how to integrate to react native?
We are asking for help.
Oct 22, 2023, 4:49 PM
I'd say "not use React", since it seems significantly heavier than, for instance, Svelte.
Oct 22, 2023, 4:50 PM
So what can we use instead?
Oct 22, 2023, 4:51 PM
Svelte with @tonconnect/sdk library. The only thing you'd need to do manually is create connect popup.
Oct 22, 2023, 4:53 PM
Ok thank you will check it.
Oct 22, 2023, 4:53 PM
Is svelte native a thing?)
Oct 23, 2023, 2:37 AM
I think it can be embedded into WebView just as well?
Oct 23, 2023, 2:42 AM
react native is not react webview
Oct 23, 2023, 2:49 AM
Thanks a lot!!
Oct 23, 2023, 3:07 AM
I just created a issue for this as feature request. they already supported imports for built-in traits, let's wait to receive a response from the team, if I can understand its mechanism, I will send PR for it.
https://github.com/tact-lang/tact/issues/77
https://github.com/tact-lang/tact/issues/77
Oct 25, 2023, 6:17 AM
Thanks 🙌 I hope this feature can be adopted soon.
Oct 25, 2023, 6:22 AM
I'm looking for a function to get readable|real datetime from Unix Timestamp, is there any pre-built method available in func/asm?
Oct 25, 2023, 7:37 AM
how do pass a sender in the simplest way?
with tonConnectUi
what is the simplest way to pass a sender with a contract method? a
Oct 25, 2023, 9:29 AM