Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you know if the transfer was successful or failed? #57

Open
3lang3 opened this issue Sep 5, 2024 · 6 comments
Open

How do you know if the transfer was successful or failed? #57

3lang3 opened this issue Sep 5, 2024 · 6 comments

Comments

@3lang3
Copy link

3lang3 commented Sep 5, 2024

I used the following code to transfer money, but it was actually unsuccessful but the code did not throw an error

import { TonClient, WalletContractV4, internal , toNano} from "@ton/ton";
import { mnemonicNew, mnemonicToPrivateKey } from "@ton/crypto";

// Create Client
const client = new TonClient({
  endpoint: 'https://toncenter.com/api/v2/jsonRPC',
});

let keyPair = await mnemonicToPrivateKey(" "); // balance 1ton

// Create wallet contract
let workchain = 0; // Usually you need a workchain 0
let wallet = WalletContractV4.create({ workchain, publicKey: keyPair.publicKey }); 
let contract = client.open(wallet);

// Get balance
let balance: bigint = await contract.getBalance();

// Create a transfer
let seqno: number = await contract.getSeqno();
let transfer = await contract.createTransfer({
  seqno,
  secretKey: keyPair.secretKey,
  messages: [internal({
    value: toNano('100'), // send 100 ton to receiver
    to: 'EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N',
    body: 'Hello world',
  })]
});
await client.sendExternalMessage(contract, transfer)

There is not enough balance in the sender's wallet, but the code will not throw an error

@3lang3
Copy link
Author

3lang3 commented Sep 5, 2024

It's so strange that I can't find any documents about this at all.

@3lang3
Copy link
Author

3lang3 commented Sep 8, 2024

anynone can help me?

@bluezdot
Copy link

@3lang3 I have the same problem. Maybe there's not a method to get tx status at this time. 

@3lang3
Copy link
Author

3lang3 commented Sep 26, 2024

@3lang3 I have the same problem. Maybe there's not a method to get tx status at this time.

I don't know how others solved it, it's a very basic function

@bluezdot
Copy link

bluezdot commented Oct 3, 2024

@3lang3 I have the same problem. Maybe there's not a method to get tx status at this time.

I don't know how others solved it, it's a very basic function

I'm personally using this api to check tx fail or not. It's a bit complicated (need to process data and call the api many time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@3lang3 @bluezdot and others