xiaoyong931011
2021-01-15 292a4634d9c52ce193eca9de356d65960bdc35f4
src/test/java/com/xcong/excoin/SRCTest.java
@@ -23,6 +23,9 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
@@ -37,22 +40,11 @@
    private static final String SIGN_STR = "w@a!llokmet";
    public static void main(String[] args) {
        Map<String, Object> param = new HashMap<>();
        String orderNo = "123445";
        String userid = "11";
        String symbol = "USDT";
        String amount = "1";
        String toAddress = "Ox";
        param.put("orderno", orderNo);
        param.put("userid", userid);
        param.put("symbol", symbol);
        param.put("toAddress", toAddress);
        param.put("amount", new BigDecimal(amount));
        param.put("sign", SecureUtil.md5(orderNo + userid + symbol + amount + toAddress + SIGN_STR));
        HttpRequest request = HttpRequest.post(SRC_API + "transout/created");
        String body = request.body(JSONObject.toJSONString(param)).execute().body();
        System.out.println(body);
    public static void main(String[] args) throws NoSuchAlgorithmException {
//        String applyOrderInfo = TRC20ApiUtils.getApplyOrderInfo("2020111140230002");
//        System.out.println(applyOrderInfo);
        md5Test();
    }
    private static void sign() {
@@ -64,7 +56,9 @@
    @Test
    public void addressInsertTest() throws IOException {
        File file = new File("/Users/helius/Desktop/src20.xls");
//        String src = "/Users/helius/Desktop/src20.xls";
        String src = "C:/Users/wzy19/Desktop/ace2.xls";
        File file = new File(src);
        FileInputStream input = new FileInputStream(file);
        Workbook wb = null;
@@ -76,7 +70,7 @@
        Sheet sheet = wb.getSheetAt(0);
        int lastRowNum = sheet.getLastRowNum();
        for (int i = 0; i < lastRowNum; i++) {
        for (int i = 0; i <= lastRowNum; i++) {
            Row row = sheet.getRow(i);
            Cell cell = row.getCell(0);
            TrcAddressEntity addressEntity =  new TrcAddressEntity();
@@ -92,4 +86,24 @@
        TRC20ApiUtils.createWallet(1L, "111111", "USDT", "111111111");
        System.out.println(System.currentTimeMillis());
    }
    public static void md5Test() throws NoSuchAlgorithmException {
        String str = "88" + "100.00000000" + "USDT" + "1" + TRC20ApiUtils.SIGN_STR;
        MessageDigest md5 = MessageDigest.getInstance("md5");
        md5.update(str.getBytes());
        str = new BigInteger(1, md5.digest()).toString(16);
        if (str.length() < 32) {
            String str0 = "";
            for (int i = 0; i < 32 - str.length(); i++) {
                str0 += "0";
            }
            str = str0 + str;
        }
        System.out.println(str);
    }
}