Is there way to let user withdraw jetton or nft from our wallet without permission?

I want to let user to withdraw their nft and jetton reward when staking period over.

Please let me know if its possible i am using node ja and react js.

Sep 2, 2023, 9:46 AM
And it is necessary to include destination address in external message because i have already added destination, src ans nft address in internal msg body?

Its like everywhere is address ๐Ÿ˜…
I try with src wallet address as external msg address and its still working.
I didn't understand what is the point of external message address when we transfer tokens.
Or we can remove destination or src address from nft internal msg body? And use when create external msg body.
Sep 2, 2023, 9:59 AM
Plugins on wallet v5 (https://github.com/ProgramCrafter/wallet-contract) or a special contract in place of your wallet.
Sep 2, 2023, 11:03 AM
hey is there any platform that we can create test jetton TOKEN (FT)?
like testnet.getgems where we can create test NFT.
Sep 2, 2023, 12:32 PM
minter.ton.org/?testnet=true
Sep 2, 2023, 12:32 PM
hello,
In tonweb js sdk, they load wallet from base64 so where i can get this base64 of my wallet ?
const seed = TonWeb.utils.base64ToBytes('vt58J2v6FaSuXFGcyGtqT5elpVxcZ+I1zgu/GUfA5uY=');
or can i get seed from mnemonic ? using tonweb
Sep 2, 2023, 1:40 PM
This works for me:
const words = "govno zalupa penis her davalka..."
const tonweb = isTestnet ? new TonWeb(new TonWeb.HttpProvider('https://testnet.toncenter.com/api/v2/jsonRPC'))
: new TonWeb(new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC'));

const key = await mnemonicToKeyPair(words)

var wallet: any = undefined;
if (walletType === 'v4R1') {
wallet = new tonweb.wallet.all.v4R1(tonweb.provider, {publicKey: key.publicKey, wc: 0});
} else if (walletType === 'v3R2') {
wallet = new tonweb.wallet.all.v3R2(tonweb.provider, {publicKey: key.publicKey, wc: 0});
} else if (walletType === 'v3R1') {
wallet = new tonweb.wallet.all.v3R1(tonweb.provider, {publicKey: key.publicKey, wc: 0});
} else { // v4R2
wallet = new tonweb.wallet.all.v4R2(tonweb.provider, {publicKey: key.publicKey, wc: 0});
}

const address = await wallet.getAddress();
Sep 2, 2023, 2:08 PM
you mention mnemonicToKeyPair, where did you get from? i mean is that from tonweb? i didnt find this.
Sep 2, 2023, 2:12 PM
tonweb-mnemonic module.
Sep 2, 2023, 2:12 PM
"tonweb-mnemonic": "^1.0.1",

import { mnemonicToKeyPair } from 'tonweb-mnemonic'
Sep 2, 2023, 2:12 PM
ok thanks but can i use this in node js because i am creating this from backend
ok let me check
we can use this for test wallet words?
because its not working
const tonwebMnemonic = require('tonweb-mnemonic');
const mnemonic = "word1 word2 word3"
const key = await tonwebMnemonic.mnemonicToKeyPair(mnemonic)
giving me error like this
mnemonicArray.join is not a function
i think i need to pass array right
its working now ๐Ÿ˜
Hello, jetton transfer giving me exit_code: 11. any idea what this is about?
Sep 2, 2023, 3:28 PM
https://docs.ton.org/learn/tvm-instructions/tvm-exit-codes
Sep 2, 2023, 4:15 PM
Exit code: 65535
OpCode: Jetton Transfer

am i missing somthing?

const jettonWallet = new JettonWallet(tonweb.provider, {
address: new Address(jetton token address)
});
const bank = new WalletClass(tonweb.provider, {
publicKey: keyPair.publicKey,
wc: 0
});
const seqno = (await bank.methods.seqno().call()) || 0;

const comment = new Uint8Array([... new Uint8Array(4), ... new TextEncoder().encode('gift')]);
const address = await bank.getAddress();
const transaction = await bank.methods.transfer({
secretKey: keyPair.secretKey,
toAddress: new Address(jetton token address),
amount: TonWeb.utils.toNano('0.05'),
seqno: seqno,
payload: await jettonWallet.createTransferBody({
jettonAmount: TonWeb.utils.toNano('10'),
toAddress: toWallet,
forwardAmount: TonWeb.utils.toNano('0.01'),
forwardPayload: comment,
responseAddress: address
}),
sendMode: 3,
}).send()
can i create second testnet wallet in tonkeeper?
Sep 2, 2023, 4:59 PM
go to settings ยป tap version number 5 times.
Sep 2, 2023, 5:01 PM
and then?
Sep 2, 2023, 5:10 PM
then you will be asked to select mainnet or testnet
Sep 3, 2023, 12:05 AM
I have one already i know this process. I want second test wallet of v4r2
Sep 3, 2023, 6:04 AM
You can use other wallet app or log out of current wallet in Tonkeeper and create new one.
Sep 3, 2023, 6:06 AM
Hey do you know this...
I am trying to transfer Token but they giving me error.. i am using v4r2 wallet and i have created Tokens using this wallet. I am trying to transfer from this v4r2 wallet to v3 wallet.
Sep 3, 2023, 6:09 AM
You need to send transfer request to your jetton wallet, not to jetton master contract.
Sep 3, 2023, 6:17 AM
Jetton wallet means the wallet which use to create tokens? Or admin?
I have 3 address token address, token admin address and wallet address which i used to create token?
Sep 3, 2023, 6:19 AM
Token address is jetton master?
You need to call jetton master to get address of jetton wallet corresponding to bank.
Sep 3, 2023, 6:21 AM
Oh ok let me check
I didn't use jetton master let me use that
what is minter address? is that token address?
Sep 3, 2023, 7:41 AM
Example:
Token (master) address: EQDQoc5M3Bh8eWFephi9bClhevelbZZvWhkqdo80XuY_0qXv (WTON)
Jetton wallet address: EQDHa6jyCSpYx9PiJ1EvM8FID3W6U1bfnrX8Z5R4YzdT-Hn0
Wallet address: EQCyoez1VF4HbNNq5Rbqfr3zKuoAjKorhK-YZr7LIIiVrSD7
Sep 3, 2023, 7:44 AM
i have this
Sep 3, 2023, 7:47 AM
Token (master) address: EQBAplc...KLP
Your wallet address: kQDuAuT...
Jetton wallet address: can be found via testnet.tonscan.org, for example.
Sep 3, 2023, 7:49 AM
so token master address is token address.
I need to send jetton wallet address and i can get from using jetton master. with tonweb can i get jetton master? there is two option jetton minter and jetton wallet
this is wallet address?
Sep 3, 2023, 7:52 AM
EQAwj-...w4 is, though it's not for that wallet...
Sep 3, 2023, 7:53 AM
but i have 1000 tokens they show me 10 tokens only
Sep 3, 2023, 7:53 AM
Have you sent some jettons to the master contract itself?
Sep 3, 2023, 7:53 AM
yes i think 10 token
Sep 3, 2023, 7:54 AM
Your jetton wallet will be shown when you open kQDuAuT...
Sep 3, 2023, 7:54 AM
so i have to send this when i transfer right? need to replace this address to JETTON_WALLET_ADDRESS right?
await bank.methods.transfer({
secretKey: keyPair.secretKey,
toAddress: JETTON_WALLET_ADDRESS,
amount: TonWeb.utils.toNano('0.05'),
seqno: seqno,
payload: cell,
sendMode: 3,
}).send()
ok
oh you edit this message now i am more confuse ๐Ÿ˜„
Sep 3, 2023, 8:01 AM
Open kQDuAuT... in testnet explorer and go to jettons tab.
Sep 3, 2023, 8:02 AM
ok
is it ok when i search my wallet address and address will be different?
so this EQDuAuT4Ajjgx5R9mRXwlqfyglc2FG5zpJ7YuhnXJKzQZwQn is my wallet contract address and this kQDuAuT4Ajjgx5R9mRXwlqfyglc2FG5zpJ7YuhnXJKzQZ7-t is my wallet address right that why its diff?
Sep 3, 2023, 8:06 AM
kQ has testnet tag and EQ hasn't, that's normal. The characters at end are checksum and thus are also different. You can check the middle part of address.
So, your jetton wallet address is EQA5Lf...s4.
Sep 3, 2023, 8:09 AM
let me try with this now
exitcode=33, steps=23, gas_used=0

Now i can relief i think now at least my setup is right ๐Ÿ˜
there is no 33 code in this page ๐Ÿ˜ณ
https://docs.ton.org/learn/tvm-instructions/tvm-exit-codes

LITE_SERVER_UNKNOWN: cannot apply external message to current state : External message was not acceptedCannot run message on account: inbound external message rejected by transaction EE02E4F80238E0C7947D9915F096A7F2825736146E73A49ED8BA19D724ACD067:
exitcode=33, steps=23, gas_used=0
Sep 3, 2023, 8:23 AM
You have to look in jetton wallet code.
Sep 3, 2023, 8:28 AM
const mainWalletAddress = new Address('kQDuAuT4Ajjgx5R9mRXwlqfyglc2FG5zpJ7YuhnXJKzQZ7-t');
const mnemonic = mainWalletAddress mnemonic
const JETTON_WALLET_ADDRESS = 'EQA5LfYBwjM5pJQ8QcOfqYs-MDKgpwZSDlNuV1_EfNNt4Xs4';
const toWallet = new Address('kQBr2FM-Aju7lqOsnrJvTGye7X2uYZoL3Gn-OGgxfClH1Yqp');

const jettonWallet = new JettonWallet(tonweb.provider, {
address: JETTON_WALLET_ADDRESS
});

const keyPair = await tonwebMnemonic.mnemonicToKeyPair(mnemonic.split(" "))
const WalletClass = tonweb.wallet.all['v4R2'];
const bank = new WalletClass(tonweb.provider, {
publicKey: keyPair.publicKey,
wc: 0
});

const seqno = (await bank.methods.seqno().call()) || 0;
const comment = new Uint8Array([... new Uint8Array(4), ... new TextEncoder().encode('gift')]);

const transaction = await bank.methods.transfer({
secretKey: keyPair.secretKey,
toAddress: JETTON_WALLET_ADDRESS,
amount: TonWeb.utils.toNano('0.05'),
seqno: seqno,
payload: await jettonWallet.createTransferBody({
jettonAmount: TonWeb.utils.toNano('10'),
toAddress: toWallet,
forwardAmount: TonWeb.utils.toNano('0.01'),
forwardPayload: comment,
responseAddress: mainWalletAddress
}),
sendMode: 3,
}).send()
is this right setup now?
Sep 3, 2023, 8:38 AM
Does bank key pair correspond to kQDuAuT4Ajjgx5R9mRXwlqfyglc2FG5zpJ7YuhnXJKzQZ7-t?
Sep 3, 2023, 8:48 AM
Yes
Sep 3, 2023, 8:48 AM
It seems that amount of TON you send is insufficient. Could you try the same with 0.35 TON?
Or, since your token has 0 decimals, maybe you need to set jettonAmount: 10n (because toNano multiplies input value by 10^9).
Sep 3, 2023, 8:52 AM
Let me try
oh god, thank @pcrafter now its working fine ๐Ÿ‘ ๐Ÿ˜
can we increase the limit of toncenter.com/api/v2 ?
https://tonapi.io/v2
https://toncenter.com/api/v2

both are same or different?
Sep 3, 2023, 10:33 AM
Though, attempt to use millions of addresses (given that user has enough TON to cover fees) won't slow down TON too, as it will be sharded.
Sep 3, 2023, 11:10 AM
@pcrafter ?
Sep 3, 2023, 11:18 AM
Different.
Use Orbs ton-access.
Sep 3, 2023, 11:21 AM
means? what is Orbs ton-access and how can i access?
Sep 3, 2023, 11:38 AM
https://t.me/tondev_eng/33917
Sep 3, 2023, 11:41 AM
ton-acess to ton-blockchain is what infura is to EVM. its an npm package and a network of nodes giving devs access to the ton blockchain mainnet and testnet using v2 and v4 protocols
https://www.npmjs.com/package/@orbs-network/ton-access
https://t.me/TONAccessSupport
Sep 3, 2023, 12:09 PM
Also, there are no wallets that accept private keys instead of mnemonic as input.
Sep 3, 2023, 1:39 PM
Trust wallet can
Sep 3, 2023, 1:43 PM
hello, How to write 10n dynamicly ?
Sep 3, 2023, 1:45 PM
Probably new BigInt(amount)
Sep 3, 2023, 1:45 PM
idk what any of that means lol
Sep 3, 2023, 1:52 PM
Then you probably shouldn't generate private key directly because of security implications.
You may also have a look at TonWeb's algorithm for key generation: https://github.com/toncenter/tonweb-mnemonic/tree/master/src/functions
Sep 3, 2023, 1:53 PM
so there are no web wallets where i can run the githubs you sent, online? do I have to run it myself?
Sep 3, 2023, 2:12 PM
You shouldn't give any remote servers access to your wallet secret key.
You can open dev console on https://wallet.ton.org and calculate everything locally in your browser (TonWeb is available in that environment).
Sep 3, 2023, 2:14 PM
okay thanks
so i loaded up a new wallet in wallet.ton.org and opened the console, what would i paste in to get my privkey of the newly generated wallet, and how can i generate dozens quickly?
https://i.imgur.com/IfnGMp4.png
Sep 3, 2023, 2:18 PM
(await TonWeb.mnemonic.mnemonicToKeyPair('your mnemonic words'.split(' '))).secretKey.toString()
And await TonWeb.mnemonic.generateMnemonic() to generate new mnemonics.
Sep 3, 2023, 2:20 PM
Having trouble formatting it, if my 24 word phrase is "this is my phrase" would it be:

(await TonWeb.mnemonic.mnemonicToKeyPair('this is my phrase'.split(' '))).secretKey.toString()

or what should it look like
Thanks for your patience btw
Sep 3, 2023, 2:23 PM
hello @pcrafter , seqnumber getting same during multiple transaction is there any solution for that?
Sep 3, 2023, 2:24 PM
Old transfers could be in external messages pool and not be processed yet, if I understand your problem correctly.
The fix is to wait for the previous transfer to be sent (usually 30 seconds are enough).
Sep 3, 2023, 2:26 PM
it gives me this result, which doesnt look like a private key, or is it?

'243,37,51,57,90,202,87,116,24,192,24,112,255,170,72,73,191,214,147,32,189,171,195,58,98,87,207,253,49,33,9,60,97,184,128,40,60,41,132,18,96,112,143,63,105,66,41,195,42,33,195,214,55,174,68,43,158,62,110,0,108,135,67,119'

(btw the address is not funded and will not be funded, so its ok if it leaks the key to this chat)
Sep 3, 2023, 2:26 PM
This is private key, where each byte is not encoded as HEX but rather output as number (since I don't remember how to encode it properly).
Sep 3, 2023, 2:27 PM
i think yes you are right so i can add by 1 right. but another problem is when multiple user requesting same time that time it will be problem
Sep 3, 2023, 2:27 PM
I've looked it up:
TonWeb.utils.bytesToHex((await TonWeb.mnemonic.mnemonicToKeyPair('your mnemonic words'.split(' '))).secretKey)
That returns 32 bytes of private key + 32 bytes of public key in HEX format.
You have to do some synchronization. Also you can send up to 4 messages from usual wallet at a time.
Sep 3, 2023, 2:29 PM
Thanks so much
Assuming my device/network is not compromised and never will be, is it safe to generate keys with this method?
Sep 3, 2023, 2:34 PM
Assuming that browser doesn't send console logs as telemetry, the method is safe.
Sep 3, 2023, 2:35 PM
let me give you scenario,
suppose 20 user requesting in 5 second.
so we have to transfer tokens and nft both so two request call per user.
but its backend so per user we can create synchronization but for multiple users i dont think its possible

so what do you think its still possible?
Sep 3, 2023, 2:35 PM
1. you can use highload wallet (higher gas usage though no synchronization required at all)
2. you can put all the requests in one queue. Once there is a request, wait for 2-5 seconds for other possible requests, then form the transaction and send it.
Sep 3, 2023, 2:37 PM
how do i send an nft that is held by my ton address, through tonweb commands
Sep 3, 2023, 2:38 PM
... that's complicated to explain. You can search for examples on Github, and here's the required method: https://github.com/toncenter/tonweb/blob/-/src/contract/token/nft/NftItem.js#L65
Sep 3, 2023, 2:41 PM
Oh okay
Basically i have ~40 telegram username NFTs and i want to put them in different ton addresses and be able to access them easily, thats why i was asking how to generate private keys and how to send nfts from them. Is what i'm asking too complicated for a beginner and there is no simple way?
Sep 3, 2023, 2:43 PM
It is a bit hard.
Sep 3, 2023, 2:49 PM
can i convert current wallet to highload wallet? ๐Ÿ˜„
Sep 3, 2023, 3:26 PM
No. You need to create new wallet (with same mnemonic if you want).
Sep 3, 2023, 3:31 PM
I see
Jan 19, 2024, 11:20 AM

ยฉ 2024 Draquery.com All rights reserved.