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

I can not delegate my resources to other address, please help me #594

Open
godlovericea opened this issue Jan 7, 2025 · 1 comment
Open

Comments

@godlovericea
Copy link

I can not delegate my resources to other address
it failed with error:

Contract validate error : Account[419de6e2a685c61bfc6dc6049f9e91272a06b0cb62] not exists

my code is below:

 const tronWeb = new TronWeb({
      "https://api.trongrid.io/", 
      privateKey: senderPrivateKey, // 用代理账户的私钥签名
 });
const transaction = await tronWeb?.transactionBuilder?.undelegateResource(
            amount * 1e6, // 代理的能量对应的 TRX 数量(以 sun 为单位)
            receiverAddress,             // 被代理账户的地址
            resource,              // 资源类型(能量 ENERGY 或带宽 BANDWIDTH)
            address, // 代理账户的地址(默认从私钥中获取)
 );

// 签名交易
const signedTransaction = await tronWeb?.trx?.sign(transaction);

 // 广播交易
 const receipt = await tronWeb?.trx?.sendRawTransaction(signedTransaction);

my Address is TDb6PSHZ5rPe1X5TXcr49RPMbSNQV2h9aC , to address is TQN7gNXZYHxgNUSwc1TZm25bwKsEMkYm5K

@Satan-web3
Copy link
Contributor

Please use tronWeb.transactionBuilder.delegateResource.

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

4 participants
@godlovericea @Satan-web3 and others