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

NEED HELP: DelegateResource method add to the Library. #193

Open
maksus opened this issue Mar 8, 2024 · 1 comment
Open

NEED HELP: DelegateResource method add to the Library. #193

maksus opened this issue Mar 8, 2024 · 1 comment

Comments

@maksus
Copy link

maksus commented Mar 8, 2024

I have tried to add method from Tron FullNode HTTP API 'DelegateResource' to be able to send ENERGY and BANDWIDTH from Staking2.0 to another address (https://developers.tron.network/reference/delegateresource-1).
But Library doesn't catch it up.

Can anyone please help me (ready to pay for the help)?

Code I am trying to add to 'TransactionBuilder.php' file in 'src' directory:

public function DelegateEnergy(float $amount, string $resource, string $address, string $toaddress) {
return $this->tron->getManager()->request('wallet/delegateresource', [
'owner_address' => $this->tron->address2HexString($address),
'receiver_address' => $this->tron->address2HexString($toaddress),
'balance' => $this->tron->toTron($amount),
'resource' => $resource,
'lock' => false,
'visible' => true
]);
}

Code I am calling the method:

 $raw_tx = $tron->tron->DelegateEnergy('1000', 'ENERGY', 'from_address', 'destination_address');

ERROR I get - "Fatal error: Uncaught Error: Call to a member function DelegateEnergy() on null in".

My Method doesn't show when checking the TRON Class's method.

@ufado
Copy link

ufado commented Jun 19, 2024

You can try to use this library https://github.com/ufado/tron-api.

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
@maksus @ufado and others