status-go/services/wallet/thirdparty/fourbyte/client_test.go

32 lines
1.4 KiB
Go

package fourbyte
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestRun(t *testing.T) {
client := NewClient()
res, err := client.Run("0x40e8d703000000000000000000000000670dca62b3418bddd08cbc69cb4490a5a3382a9f0000000000000000000000000000000000000000000000000000000000000064")
require.Nil(t, err)
require.Equal(t, res.Signature, "processDepositQueue(address,uint256)")
require.Equal(t, res.Name, "processDepositQueue")
require.Equal(t, res.ID, "0xf94d2")
require.Equal(t, res.Inputs, map[string]string{
"0": "0x3030303030303030303030303637306463613632",
"1": "44417128579249187980157595307322491418158007948522794164811090501355597543782",
})
res, err = client.Run("0xb88d4fde000000000000000000000000af1857535160973f42c34cb20f5ed7cd29099ad9000000000000000000000000baa4b7858c3277da9cb9cdadf405f2017afea19a00000000000000000000000000000000000000000000000000000000000000cb00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000360c6ebe")
require.Nil(t, err)
require.Equal(t, res.Signature, "safeTransferFrom(address,address,uint256,bytes)")
require.Equal(t, res.Name, "safeTransferFrom")
require.Equal(t, res.ID, "0x73e0")
require.Equal(t, res.Inputs, map[string]string{
"0": "0x3030303030303030303030306166313835373533",
"1": "0x3463623230663565643763643239303939616439",
"2": "21796157974083048550319244236929488537086114760591164995666220774418197985333",
})
}