Open spacesudo opened 3 months ago
Shouldn't it work like any regular contract, like calling methods from ABI on proxied contract?
Well unfortunately, it doesn't work. For typescript, there's a trigger smart contract function that is used to call proxy functions but I don't think there's such a thing on tronpy.
Could you please point me to such a function in typescript version? If it's indeed required I can implement it
const contractAddress = "TTfvyrAz86hbZk5iDpKD78pqLGgi8C7AAw";
export async function buyTRXPump(address, amountTRX) {
try {
const transaction = await tronWeb.transactionBuilder.triggerSmartContract(
contractAddress,
"purchaseToken(address,uint256)",
{
feeLimit: 1000 * 10 ** 6,
callValue: amountTRX * 10 ** 6,
},
[
{ type: "address", value: address },
{ type: "uint256", value: "0" },
],
tronWeb.defaultAddress.base58
);
This is just a code snippet using tronweb
I don't see any proxy-specific code here
If you look at the contract address, it's a proxy contract and purchaseToken(address,uint256) is a write as proxy function.
My only question here is, as you can see, tronweb has a triggerSmartContract function which can be used in cases like this, but I don't think tronpy has something like this.
If I try to get the contract functions with contract.functions
it only lists the normal functions of the contract and not the proxy functions
So you get an error like contract has no method named purchaseToken?
Exactly
Well I find no references of proxy support in their API either plus even found this issue: https://github.com/tronprotocol/tronweb/issues/356
How do I interact with proxy contracts and use functions of write as proxy?