Skip to content

Commit

Permalink
feat: test ed25519
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpiotzh committed Feb 11, 2022
1 parent f2aa47a commit c60de5a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 20 deletions.
55 changes: 52 additions & 3 deletions example/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
)

func TestTransactionSend(t *testing.T) {
str := `{"sign_key":"6c6833be5e0e4ab02ab4808007148fcf","sign_list":[{"sign_type":6,"sign_msg":"0x860d46babd290ee09968eb4f257d351c9457b2556f64f2e2004c28c265f0a1f9d263eeaf6c5b1947da33421837cc25dc60620f890ab0e02d5913ae9c8aa1770701"}],"mm_json":null}`
str := `{"sign_key":"3006b6f61c704cd33d19f6e52bf033b6","sign_list":[{"sign_type":6,"sign_msg":"0x7fc2127e46a95588f28ec3cc069645e8f46d974eee48b6830712bfd8734212d914744d0765a4fbfd8368dc57ff4cfedb82936ee8147285df7b6802ce4e0dc20801"}],"mm_json":null}`

var req handle.ReqTransactionSend
if err := json.Unmarshal([]byte(str), &req); err != nil {
Expand Down Expand Up @@ -73,10 +73,10 @@ func TestEditOwner(t *testing.T) {

var req handle.ReqEditOwner
req.ChainType = common.ChainTypeMixin
req.Address = "0xe1090ce82474cbe0b196d1e62ec349ec05a61076c68d14129265370ca7e051c4"
req.Address = "0x99c648a7968540a630dc665a676cf90adaeaad923685f03803abd23bc17c5b58"
req.Account = "1234567871.bit"
req.RawParam.ReceiverChainType = common.ChainTypeMixin
req.RawParam.ReceiverAddress = "0x99c648a7968540a630dc665a676cf90adaeaad923685f03803abd23bc17c5b58"
req.RawParam.ReceiverAddress = "0xe1090ce82474cbe0b196d1e62ec349ec05a61076c68d14129265370ca7e051c4"
req.EvmChainId = 97

var data handle.RespEditOwner
Expand Down Expand Up @@ -162,6 +162,43 @@ func TestReverseDeclare(t *testing.T) {
fmt.Println(toolib.JsonString(signReq))
}

func TestReverseRedeclare(t *testing.T) {
url := TestUrl + "/reverse/redeclare"
var req handle.ReqReverseRedeclare
req.ChainType = common.ChainTypeMixin
req.Address = "0xe1090ce82474cbe0b196d1e62ec349ec05a61076c68d14129265370ca7e051c4"
req.Account = "1234567872.bit"
req.EvmChainId = 5

var data handle.RespReverseRedeclare
if err := doReq(url, req, &data); err != nil {
t.Fatal(err)
}
var signReq handle.ReqSignTx
signReq.SignInfo = data.SignInfo
signReq.ChainId = 5
signReq.Private = ""
fmt.Println(toolib.JsonString(signReq))
}

func TestReverseRetract(t *testing.T) {
var req handle.ReqReverseRetract
req.ChainType = common.ChainTypeMixin
req.Address = "0xe1090ce82474cbe0b196d1e62ec349ec05a61076c68d14129265370ca7e051c4"
req.EvmChainId = 5
url := TestUrl + "/reverse/retract"

var data handle.RespReverseRetract
if err := doReq(url, req, &data); err != nil {
t.Fatal(err)
}
var signReq handle.ReqSignTx
signReq.SignInfo = data.SignInfo
signReq.ChainId = 5
signReq.Private = ""
fmt.Println(toolib.JsonString(signReq))
}

func TestBalanceInfo(t *testing.T) {
url := TestUrl + "/balance/info"
var req handle.ReqBalanceInfo
Expand All @@ -174,3 +211,15 @@ func TestBalanceInfo(t *testing.T) {
}
fmt.Println(toolib.JsonString(data))
}

func TestReverseLatest(t *testing.T) {
url := TestUrl + "/reverse/latest"
var req handle.ReqReverseLatest
req.ChainType = common.ChainTypeMixin
req.Address = "0xe1090ce82474cbe0b196d1e62ec349ec05a61076c68d14129265370ca7e051c4"
var data handle.RespReverseLatest
if err := doReq(url, req, &data); err != nil {
t.Fatal(err)
}
fmt.Println(toolib.JsonString(data))
}
17 changes: 0 additions & 17 deletions example/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,6 @@ func getClientTestnet2() (rpc.Client, error) {
return rpc.DialWithIndexer(ckbUrl, indexerUrl)
}

func TestReverseRetract(t *testing.T) {
var req handle.ReqReverseRetract
req.ChainType = common.ChainTypeEth
req.Address = "0x15a33588908cF8Edb27D1AbE3852Bf287Abd3891"
req.EvmChainId = 5
url := TestUrl + "/reverse/retract"

var data handle.RespReverseRetract
var resp api_code.ApiResp
resp.Data = &data
_, _, errs := gorequest.New().Post(url).SendStruct(&req).EndStruct(&resp)
if errs != nil {
t.Fatal(errs)
}
fmt.Println(toolib.JsonString(data))
}

func TestEIP712Signature(t *testing.T) {
mmjson := `{
"types":{
Expand Down

0 comments on commit c60de5a

Please sign in to comment.