Git Product home page Git Product logo

filecoinj's People

Contributors

apufvqsp avatar juzi-code avatar lishitao1992 avatar nnhjjjjhjhj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

filecoinj's Issues

转账支持BLS Public Key Address (f3开头的地址)

我修改后,转账失败。不知道什么地方错了。用的是ganache-filecoin 做开发用的api服务。

  • 报错信息
Exception in thread "main" com.filecoinj.exception.SendException: send error {"id":1,"jsonrpc":"2.0","error":{"message":"Cannot read property 'value' of undefined","stack":"TypeError: Cannot read property 'value' of undefined\n    at sigCacheKey (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\@ganache\\filecoin\\dist\\node\\ganache-filecoin.min.js:2:804447)\n    at verifyMessageSignature (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\@ganache\\filecoin\\dist\\node\\ganache-filecoin.min.js:2:804531)\n    at Object.checkMessage (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\@ganache\\filecoin\\dist\\node\\ganache-filecoin.min.js:2:805672)\n    at Blockchain.pushSigned (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\@ganache\\filecoin\\dist\\node\\ganache-filecoin.min.js:2:778470)\n    at FilecoinApi.Filecoin.MpoolPush (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\@ganache\\filecoin\\dist\\node\\ganache-filecoin.min.js:2:764697)\n    at C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\ganache.min.js:2:3790243\n    at RequestCoordinator.<anonymous> (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\ganache.min.js:2:3790075)\n    at C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\ganache.min.js:2:3790310\n    at new Promise (<anonymous>)\n    at RequestCoordinator.queue (C:\\Program Files\\WindowsApps\\GanacheUI_2.6.0.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache\\dist\\node\\ganache.min.js:2:3790173)","code":-32700}}
  • AddressUtil.java修改后代码
package com.filecoinj.utils;

import cn.hutool.core.codec.Base32;
import cn.hutool.core.util.StrUtil;
import com.filecoinj.exception.AddressException;
import com.filecoinj.model.Address;

public class AddressUtil {
    /**
     * secp256k1地址字节长度
     */
    private final static int addressLength_1 = 21;
    // private final static int addressLength_1 = 21;
    private final static int addressLength_3 = 43;

    public static Address initAddress(String addressStr) throws AddressException {
        if (StrUtil.isBlank(addressStr)){
            throw new NullPointerException("addressStr 参数不能为空");
        }
        //去掉拼接的前两位
        String substring = addressStr.substring(2);
        //获取type
        String typeStr = addressStr.substring(1, 2);
        //获取网络类型
        String network = addressStr.substring(0,1);
        int type = Integer.parseInt(typeStr);
        if (type != 1 && type !=2 && type != 3){
            throw new AddressException("错误的地址类型");
        }

        int addrLen = addressLength_1;
        if(type==3){
            addrLen = addressLength_3;
        }

        byte[] addressBytes = new byte[addrLen];

        // f099
        // f1abjxfbp274xpdqcpuaykwkfb43omjotacm2p3za
        // f2plku564ddywnmb5b2ky7dhk4mb6uacsxuuev3pi
        // f3tfhgkbq6h55fqhumadd7wvogx3bbhgm3ifg6mk6hq35ob3fex2uei7hfbo2nwqkzudjzjidmshxpvo3ja4iq
        switch (type){
            case 1:
                //secp256k1 地址类型
                addressBytes[0] = (byte) type;
                break;
            case 2:
            case 3:
                // throw new AddressException("暂不支持的地址类型");
                addressBytes[0] = (byte) type;
                break;
            default:
                throw new AddressException("错误地址类型");
        }

        System.arraycopy(Base32.decode(substring), 0, addressBytes, 1, addrLen-1);
        return Address.builder().address(addressStr)
                .bytes(addressBytes)
                .network(network).build();

    }
}

创建钱包接口问题

filecoin.createWallet()这个接口没有调用api,生成的地址要通过import调用导入进去吗?如果你生成的钱包地址在链上存在了这样会有问题吧

发送交易,签名失效

地址创建,秘钥类型是:secp256k1,发送交易时,生成的秘钥格式例如(fTeCO1/I76rrLg5WfPOMcpi1WPTrqnj8=)无法签名:
错误信息:

`java.lang.RuntimeException: Illegal hexadecimal character u at index 0
	at cn.hutool.core.util.HexUtil.toDigit(HexUtil.java:398)
	at cn.hutool.core.util.HexUtil.decodeHex(HexUtil.java:182)
	at cn.hutool.core.util.HexUtil.decodeHex(HexUtil.java:203)
	at com.filecoinj.handler.FilecoinHandler.send(FilecoinHandler.java:194)`

充值入账API咨询,谢谢。

13.获取指定高度的所有消息(非充值入账业务标准API!!!)
14.获取消息收据(非充值入账业务标准API!!!)
大佬,请教一下,这2个为什么不能作为充值入账?
扫描到指定高度的所有消息,然后按顺序获取所有交易的收据,这个有什么问题呢?

获取gas费异常

如果value传from地址的全部余额请求报错:estimating gas used: message execution failed: exit SysErrInsufficientFunds(6), reason: failed to transfer funds (RetCode=6): transfer failed when deducting funds (xxxx FIL): not enough funds (RetCode=6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.