Hi guys, I'm making some multi-sig contract, and I want to know how can I request my app user to make signature.

I'm testing my contract with 'mnemonicToWalletKey' exported from 'ton-crypto' so that I can get my private key, but I'm wondering

how can I request user tonkeeper to sign some data?
and
above all is it possible to request user tonkeeper to send external message to some contract?

Mar 6, 2023, 6:38 AM
There's no way to request a signature of custom data yet in tonkeeper.
And about external messages - you can send them from the browser or from anywhere else
Did you know about the official multisig contract by the way?
https://github.com/ton-blockchain/multisig-contract
Mar 6, 2023, 6:47 AM
yeah, I read it and making my own contract now
thx a lot! maybe I should use internal msg...
Mar 6, 2023, 6:50 AM
So if you do:
.store_uint(0, 3).store_uint(1, 2)

You'll have a cell that has "00011" bits value
And .load_uint() loads the values from the beginning of the slice. So:
a = s.load_uint(2); ;; '00'
b = s.load_uint(3); ;; '011'
If you store and load in the same order, you'll get the values correctly for sure
Mar 6, 2023, 7:03 AM
Thank you, now I understand it better!
Mar 6, 2023, 7:04 AM
I have some questions about external msg.

what I understood is that external msg doesn't carry value. but I know that if contract not 'accept_message()', the gas fee (like computation fee) is deducted from msg gas credit.
I think it is contradiction and I am misunderstanding it.
Mar 6, 2023, 7:13 AM
If contract does not accept external message, it looks like it never existed in blockchain (maybe except deployment message).
Mar 6, 2023, 7:24 AM
but isn't it okay if gas_credit is enough for computation even if contract doesn't 'accept_message()'?

I understood that the fee is deducted

from msg gas credit before 'accept_message()' and

from contract balance after 'accept_message()'

and if I'm right, I'm wondering where the gas credit came from, cause It is external msg
Mar 6, 2023, 7:30 AM
It's only credit: it has to be returned from contract's balance.
Mar 6, 2023, 7:32 AM
thanks bro. can you check did I understand rightly?

1. external msg carries msg without value and all the fee is due of contract

2. 'accept_message()' only means that I credit the msg so that I'll set gas limit sufficiently

3. in the forwarding gas fee point of view, the difference of external and internal msg is that external msg is up to contract(receiver), and internal is up to sender

4. so that the total (sender + contract) gas fee for external msg will be equivalent to that of internal msg

is it right?
Mar 6, 2023, 7:47 AM
accept_message() call means that contract confirms to pay for the fee for this message
Mar 6, 2023, 7:48 AM
Thanks a lot! Have a good day~
Mar 6, 2023, 7:49 AM
I wonder how can I store strings in the contract?
or some class?
Ex:
class student:
string name;
int mark;
Mar 6, 2023, 8:22 AM
You can store strings as slices https://ton.org/docs/develop/func/literals_identifiers#string-literals
you also can use these strings to send text comments in messages
:
slice my_string = "Hello world!";

...
builder msg_body = begin_cell().store_uint(0,32) ;; specify that it is a comment
.store_slice(my_string);
Mar 6, 2023, 8:25 AM
Also if you want to send a message with long comment (128+ characters), check this docs page:
https://ton.org/docs/develop/func/cookbook#how-to-send-a-message-with-a-long-text-comment
Mar 6, 2023, 8:28 AM
Thanks!
Mar 6, 2023, 8:29 AM
Maybe, separate kind of serializing strings should be added in FunC compiler, that would include those 32 zero bits in slice to reduce instructions count?
Mar 6, 2023, 8:57 AM
Concatenation of such strings become less obvious, store_comment/store_text_comment helper looks more appropriate choice here
Mar 6, 2023, 9:08 AM
Yes, however I honestly don't know how store_comment could modify passed slice, especially if it's not literal but rather generated in runtime.
Mar 6, 2023, 9:09 AM
👍🏿
What kind of situation will we get this? No response error code etc.

I think only because my contract didn't have better return message when I send the message?
why having this error when sending the message?
Jan 19, 2024, 6:25 AM
generated link is too long, use mnemonic
in the complex contracts, those with long code (green chars in background), for any operations those needs code, mnemonic is the best option. because you should send code too.
Jan 19, 2024, 7:05 AM
Thanks!
By the way, is there proper way to import the FunC Hex result? Right now it's mannuall paste is annoying for me
any chance that the sendMessage in FunC with mode 64 without need put the value right?
🌊 🫡 🥹
() send_text_message( slice to_addr, int value, int mode, builder content) impure {
var body = begin_cell()
.store_uint(0, 32)
.store_builder(content)
.end_cell();

var msg = begin_cell()
.store_uint(0x10, 6) ;; nobounce
.store_slice(to_addr)
.store_coins(value)
.store_uint(1, 1 + 4 + 4 + 64 + 32 + 1 + 1)
.store_ref(body)
.end_cell();

send_raw_message(msg, mode);
}
I need to put return() in the end.....
Jan 19, 2024, 11:20 AM
throw(0)
Jan 19, 2024, 11:21 AM
Another approach is to throw(0xffffff) at the end if none of the if conditions are met.
Is it possible that the first tx has already deployed, and then you sent another deployment message to this contract?🤔
Jan 19, 2024, 12:27 PM
trying on a new wallet now
any way to check the status?
Jan 19, 2024, 12:32 PM
Jan 19, 2024, 12:33 PM
I meant using @ton/ton
in JS
Jan 19, 2024, 12:39 PM
I haven't used @ton/ton to check, but I have used tonsdk to do so.
Jan 19, 2024, 12:40 PM
how do I deploy the wallet tho?
anyway to get the toncoin current price in usd?
Jan 19, 2024, 1:14 PM
Do you want to get the price within the Contract, or retrieve it in JS?
Jan 19, 2024, 1:22 PM
just any API
for current price of toncoin
thought coingecko might have it but nope
Jan 19, 2024, 1:23 PM
TON website lists some exchanges that provide TON prices, and you can access the price through the exchange's API.
Jan 19, 2024, 1:25 PM
there's no direct way of getting price in USDT so what I did is that I get the price of a pool of TON and jUSDT
Jan 19, 2024, 1:39 PM
https://help.crypt.bot/crypto-pay-api#getExchangeRates
Jan 19, 2024, 3:20 PM

© 2024 Draquery.com All rights reserved.