diff --git a/address/address.go b/address/address.go index df7bc5cb..1cc4865d 100644 --- a/address/address.go +++ b/address/address.go @@ -3,8 +3,8 @@ package address import ( "errors" "fmt" - "github.com/nervosnetwork/ckb-sdk-go/crypto/bech32" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/bech32" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type Address struct { @@ -226,4 +226,4 @@ func fromHrp(hrp string) (types.Network, error) { default: return 0, errors.New("unknown hrp") } -} \ No newline at end of file +} diff --git a/address/address_test.go b/address/address_test.go index 6d4bf55d..581c74be 100644 --- a/address/address_test.go +++ b/address/address_test.go @@ -2,7 +2,7 @@ package address import ( "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) @@ -145,4 +145,4 @@ func TestInvalidDecode(t *testing.T) { assert.NotNil(t, err) _, err = Decode("ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqj0k2lzuhgvrgacvnhnzl8") assert.NotNil(t, err) -} \ No newline at end of file +} diff --git a/address/address_tools.go b/address/address_tools.go index 4c0b8f84..04845045 100644 --- a/address/address_tools.go +++ b/address/address_tools.go @@ -4,11 +4,11 @@ import ( "errors" "fmt" "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction/signer" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction/signer" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) func GenerateScriptSecp256K1Blake160SignhashAll(key *secp256k1.Secp256k1Key) *types.Script { @@ -108,4 +108,4 @@ func GenerateSecp256k1Blake160MultisigScript(requireN, threshold int, publicKeys HashType: types.HashTypeType, Args: args, }, multisigScript.Encode(), nil -} \ No newline at end of file +} diff --git a/address/address_tools_test.go b/address/address_tools_test.go index 81ba7678..a99c7e3a 100644 --- a/address/address_tools_test.go +++ b/address/address_tools_test.go @@ -3,9 +3,9 @@ package address import ( "encoding/hex" "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) @@ -111,4 +111,4 @@ func TestGenerateSecp256k1MultisigScriptByHash(t *testing.T) { t.Error(err) } assert.Equal(t, "ckt1qpw9q60tppt7l3j7r09qcp7lxnp3vcanvgha8pmvsa3jplykxn32sq0sfnkgf0ph76pkzwld9ujzex4pkeuwnlsdc5tqu", encoded) -} \ No newline at end of file +} diff --git a/api/api.go b/api/api.go index 4e0165f1..7b76fd24 100644 --- a/api/api.go +++ b/api/api.go @@ -2,14 +2,14 @@ package api import ( "context" - "github.com/nervosnetwork/ckb-sdk-go/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" "github.com/ethereum/go-ethereum/rpc" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/mercury" - "github.com/nervosnetwork/ckb-sdk-go/mercury/model" - C "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/mercury" + "github.com/nervosnetwork/ckb-sdk-go/v2/mercury/model" + C "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type CkbApi interface { diff --git a/collector/builder/builder.go b/collector/builder/builder.go index fe83f90d..a835878d 100644 --- a/collector/builder/builder.go +++ b/collector/builder/builder.go @@ -2,11 +2,11 @@ package builder import ( "errors" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/collector/handler" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector/handler" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" "strconv" ) diff --git a/collector/builder/builder_test.go b/collector/builder/builder_test.go index d8fba130..92686dee 100644 --- a/collector/builder/builder_test.go +++ b/collector/builder/builder_test.go @@ -2,7 +2,7 @@ package builder import ( "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/collector/builder/ckb.go b/collector/builder/ckb.go index 24190369..1bff5387 100644 --- a/collector/builder/ckb.go +++ b/collector/builder/ckb.go @@ -2,11 +2,11 @@ package builder import ( "errors" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/collector/handler" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector/handler" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type CkbTransactionBuilder struct { diff --git a/collector/builder/dao.go b/collector/builder/dao.go index 8999a2d1..019a725f 100644 --- a/collector/builder/dao.go +++ b/collector/builder/dao.go @@ -5,11 +5,11 @@ import ( "context" "encoding/binary" "errors" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/collector/handler" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector/handler" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" ) diff --git a/collector/builder/sudt.go b/collector/builder/sudt.go index 4310ae49..1fe2df8b 100644 --- a/collector/builder/sudt.go +++ b/collector/builder/sudt.go @@ -2,11 +2,11 @@ package builder import ( "errors" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" "math/big" "reflect" ) diff --git a/collector/builder/sudt_test.go b/collector/builder/sudt_test.go index 4b8988b3..27636ea3 100644 --- a/collector/builder/sudt_test.go +++ b/collector/builder/sudt_test.go @@ -2,9 +2,9 @@ package builder import ( "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" "github.com/stretchr/testify/assert" "math/big" "testing" @@ -73,8 +73,7 @@ func TestSudtTransactionBuilderBalance(t *testing.T) { t.Error(err) } - if _, err = b.AddSudtOutputByAddress("ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqdamwzrffgc54ef48493nfd2sd0h4cjnxg4850up", big.NewInt(1)) - err != nil { + if _, err = b.AddSudtOutputByAddress("ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqdamwzrffgc54ef48493nfd2sd0h4cjnxg4850up", big.NewInt(1)); err != nil { t.Error(err) } b.FeeRate = 1000 diff --git a/collector/example/example.go b/collector/example/example.go index 6d1f5a63..25d962f6 100644 --- a/collector/example/example.go +++ b/collector/example/example.go @@ -4,15 +4,15 @@ import ( "context" "fmt" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/collector" - builder2 "github.com/nervosnetwork/ckb-sdk-go/collector/builder" - "github.com/nervosnetwork/ckb-sdk-go/collector/handler" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/transaction/signer" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + builder2 "github.com/nervosnetwork/ckb-sdk-go/v2/collector/builder" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector/handler" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction/signer" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" ) diff --git a/collector/handler/ckb.go b/collector/handler/ckb.go index cbc3ce74..3c2943d1 100644 --- a/collector/handler/ckb.go +++ b/collector/handler/ckb.go @@ -1,10 +1,10 @@ package handler import ( - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/transaction/signer" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction/signer" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/collector/handler/dao.go b/collector/handler/dao.go index be069ba8..7db9af17 100644 --- a/collector/handler/dao.go +++ b/collector/handler/dao.go @@ -4,10 +4,10 @@ import ( "bytes" "context" "errors" - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/collector/handler/sudt.go b/collector/handler/sudt.go index c33e195f..d9349964 100644 --- a/collector/handler/sudt.go +++ b/collector/handler/sudt.go @@ -1,9 +1,9 @@ package handler import ( - "github.com/nervosnetwork/ckb-sdk-go/collector" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/collector" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/collector/interface.go b/collector/interface.go index 9227a386..17972998 100644 --- a/collector/interface.go +++ b/collector/interface.go @@ -1,8 +1,8 @@ package collector import ( - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type TransactionBuilder interface { diff --git a/collector/iterator.go b/collector/iterator.go index d4e089f2..27d6eacc 100644 --- a/collector/iterator.go +++ b/collector/iterator.go @@ -2,9 +2,9 @@ package collector import ( "context" - "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type CellIterator interface { diff --git a/collector/iterator_test.go b/collector/iterator_test.go index af26fca1..9960ab22 100644 --- a/collector/iterator_test.go +++ b/collector/iterator_test.go @@ -2,8 +2,8 @@ package collector import ( "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/collector/live_cell_collector.go b/collector/live_cell_collector.go index a905f57d..c4ef63bb 100644 --- a/collector/live_cell_collector.go +++ b/collector/live_cell_collector.go @@ -2,9 +2,9 @@ package collector import ( "context" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/pkg/errors" ) diff --git a/crypto/key.go b/crypto/key.go index 7e12c88a..a75661d0 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -1,8 +1,8 @@ package crypto import ( - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) // Key key pair diff --git a/crypto/secp256k1/key.go b/crypto/secp256k1/key.go index 44d83a8a..89200d1f 100644 --- a/crypto/secp256k1/key.go +++ b/crypto/secp256k1/key.go @@ -12,10 +12,10 @@ import ( "github.com/ethereum/go-ethereum/crypto/secp256k1" "math/big" - "github.com/nervosnetwork/ckb-sdk-go/crypto" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) var ( diff --git a/dao/deposit.go b/dao/deposit.go index c98a7c1d..7252eafe 100644 --- a/dao/deposit.go +++ b/dao/deposit.go @@ -3,8 +3,8 @@ package dao import ( "errors" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) type Deposit struct { diff --git a/dao/helper.go b/dao/helper.go index 7f23e88a..8f4cb865 100644 --- a/dao/helper.go +++ b/dao/helper.go @@ -4,8 +4,8 @@ import ( "context" "encoding/binary" "errors" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" ) diff --git a/dao/helper_test.go b/dao/helper_test.go index f4f9887d..78122102 100644 --- a/dao/helper_test.go +++ b/dao/helper_test.go @@ -1,8 +1,8 @@ package dao import ( - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/dao/withdraw.go b/dao/withdraw.go index 4551ac4c..573394a5 100644 --- a/dao/withdraw.go +++ b/dao/withdraw.go @@ -5,9 +5,9 @@ import ( "errors" "fmt" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) type WithdrawPhase1 struct { diff --git a/go.mod b/go.mod index 14a9fd2a..aca84f6f 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nervosnetwork/ckb-sdk-go +module github.com/nervosnetwork/ckb-sdk-go/v2 go 1.17 diff --git a/indexer/indexer_test.go b/indexer/indexer_test.go index 20bf8f94..bca360bb 100644 --- a/indexer/indexer_test.go +++ b/indexer/indexer_test.go @@ -3,7 +3,7 @@ package indexer import ( "context" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "runtime/debug" "testing" @@ -55,7 +55,7 @@ func TestGetCells(t *testing.T) { Args: ethcommon.FromHex("0x06c1c47ac39653cc231e31f4316b5a4903056512"), }, ScriptType: ScriptTypeLock, - WithData: true, + WithData: true, } resp, err = c.GetCells(context.Background(), s, SearchOrderAsc, 10, "") checkError(t, err) @@ -82,4 +82,4 @@ func checkError(t *testing.T, err error) { if err != nil { t.Error(err, string(debug.Stack())) } -} \ No newline at end of file +} diff --git a/indexer/json.go b/indexer/json.go index 84b8d2a2..bfd6b4d2 100644 --- a/indexer/json.go +++ b/indexer/json.go @@ -3,7 +3,7 @@ package indexer import ( "encoding/json" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type jsonCellsFilter struct { @@ -109,4 +109,4 @@ func (r *TipHeader) UnmarshalJSON(input []byte) error { BlockNumber: uint64(jsonObj.BlockNumber), } return nil -} \ No newline at end of file +} diff --git a/indexer/json_test.go b/indexer/json_test.go index ab2af7cf..3882daf3 100644 --- a/indexer/json_test.go +++ b/indexer/json_test.go @@ -3,7 +3,7 @@ package indexer import ( "encoding/json" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/indexer/types.go b/indexer/types.go index 0fa52876..c59f1278 100644 --- a/indexer/types.go +++ b/indexer/types.go @@ -1,7 +1,7 @@ package indexer import ( - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type ScriptType string @@ -69,4 +69,4 @@ type Capacity struct { Capacity uint64 `json:"capacity"` BlockHash types.Hash `json:"block_hash"` BlockNumber uint64 `json:"block_number"` -} \ No newline at end of file +} diff --git a/mercury/client.go b/mercury/client.go index 74738630..37d7ff0b 100644 --- a/mercury/client.go +++ b/mercury/client.go @@ -2,11 +2,11 @@ package mercury import ( "context" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/ethereum/go-ethereum/rpc" - "github.com/nervosnetwork/ckb-sdk-go/mercury/model" + "github.com/nervosnetwork/ckb-sdk-go/v2/mercury/model" ) type Client interface { diff --git a/mercury/client_test.go b/mercury/client_test.go index bbde00a0..bef444ad 100644 --- a/mercury/client_test.go +++ b/mercury/client_test.go @@ -1,8 +1,8 @@ package mercury import ( - "github.com/nervosnetwork/ckb-sdk-go/mercury/model" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/mercury/model" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "math/big" "runtime/debug" diff --git a/mercury/model/asset.go b/mercury/model/asset.go index cf83d935..3e00fffd 100644 --- a/mercury/model/asset.go +++ b/mercury/model/asset.go @@ -1,6 +1,6 @@ package model -import "github.com/nervosnetwork/ckb-sdk-go/types" +import "github.com/nervosnetwork/ckb-sdk-go/v2/types" type AssetType string diff --git a/mercury/model/item.go b/mercury/model/item.go index db5e06a0..1b022be1 100644 --- a/mercury/model/item.go +++ b/mercury/model/item.go @@ -3,8 +3,8 @@ package model import ( "errors" "github.com/ethereum/go-ethereum/common/hexutil" - address2 "github.com/nervosnetwork/ckb-sdk-go/address" - "github.com/nervosnetwork/ckb-sdk-go/types" + address2 "github.com/nervosnetwork/ckb-sdk-go/v2/address" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/mercury/model/payload.go b/mercury/model/payload.go index b9e22b54..29d291ad 100644 --- a/mercury/model/payload.go +++ b/mercury/model/payload.go @@ -1,7 +1,7 @@ package model import ( - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" ) diff --git a/mercury/model/payload_json.go b/mercury/model/payload_json.go index 6646f47b..7485a4ec 100644 --- a/mercury/model/payload_json.go +++ b/mercury/model/payload_json.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/mercury/model/resp.go b/mercury/model/resp.go index 801267d1..15aeafd0 100644 --- a/mercury/model/resp.go +++ b/mercury/model/resp.go @@ -1,7 +1,7 @@ package model import ( - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" ) diff --git a/mercury/model/resp_json.go b/mercury/model/resp_json.go index e65b5f4e..06030d42 100644 --- a/mercury/model/resp_json.go +++ b/mercury/model/resp_json.go @@ -3,7 +3,7 @@ package model import ( "encoding/json" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/pkg/errors" "math/big" "reflect" @@ -240,3 +240,18 @@ func (e *DaoState) UnmarshalJSON(input []byte) error { } return nil } + +func (r *DaoInfo) UnmarshalJSON(input []byte) error { + var jsonObj struct { + State DaoState + Reward hexutil.Uint64 + } + if err := json.Unmarshal(input, &jsonObj); err != nil { + return err + } + *r = DaoInfo{ + State: jsonObj.State, + Reward: uint64(jsonObj.Reward), + } + return nil +} diff --git a/mocks/Client.go b/mocks/Client.go index 0ef12c9e..514ba277 100644 --- a/mocks/Client.go +++ b/mocks/Client.go @@ -5,10 +5,10 @@ package mocks import ( context "context" - indexer "github.com/nervosnetwork/ckb-sdk-go/indexer" + indexer "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" mock "github.com/stretchr/testify/mock" - types "github.com/nervosnetwork/ckb-sdk-go/types" + types "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) // Client is an autogenerated mock type for the Client type @@ -158,7 +158,6 @@ func (_m *Client) DryRunTransaction(ctx context.Context, transaction *types.Tran return r0, r1 } - // GetBannedAddresses provides a mock function with given fields: ctx func (_m *Client) GetBannedAddresses(ctx context.Context) ([]*types.BannedAddress, error) { ret := _m.Called(ctx) diff --git a/rpc/client.go b/rpc/client.go index 7bf88f20..e1f957b1 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -3,13 +3,13 @@ package rpc import ( "context" "errors" - "github.com/nervosnetwork/ckb-sdk-go/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" "reflect" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) var ( diff --git a/rpc/client_test.go b/rpc/client_test.go index 9d89d3ef..c2159560 100644 --- a/rpc/client_test.go +++ b/rpc/client_test.go @@ -3,7 +3,7 @@ package rpc import ( "context" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/transaction/context.go b/transaction/context.go index 537ec55a..0a8db1de 100644 --- a/transaction/context.go +++ b/transaction/context.go @@ -1,7 +1,7 @@ package transaction import ( - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" "github.com/pkg/errors" ) diff --git a/transaction/script_group.go b/transaction/script_group.go index 0f62234e..35ac1f0a 100644 --- a/transaction/script_group.go +++ b/transaction/script_group.go @@ -4,7 +4,7 @@ import ( "encoding/json" "errors" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "strings" ) @@ -67,4 +67,4 @@ func (r *ScriptGroup) UnmarshalJSON(input []byte) error { OutputIndices: toUint32Array(jsonObj.OutputIndices), } return nil -} \ No newline at end of file +} diff --git a/transaction/signer/any_can_pay.go b/transaction/signer/any_can_pay.go index 8556acb7..b6014d4e 100644 --- a/transaction/signer/any_can_pay.go +++ b/transaction/signer/any_can_pay.go @@ -1,9 +1,9 @@ package signer import ( - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type AnyCanPaySigner struct { diff --git a/transaction/signer/pw_lock.go b/transaction/signer/pw_lock.go index 64577a42..c82f540c 100644 --- a/transaction/signer/pw_lock.go +++ b/transaction/signer/pw_lock.go @@ -3,9 +3,9 @@ package signer import ( "bytes" "github.com/ethereum/go-ethereum/crypto" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "strconv" ) diff --git a/transaction/signer/secp256k1_blake160_multisig_all.go b/transaction/signer/secp256k1_blake160_multisig_all.go index 592ee101..ac64fceb 100644 --- a/transaction/signer/secp256k1_blake160_multisig_all.go +++ b/transaction/signer/secp256k1_blake160_multisig_all.go @@ -3,10 +3,10 @@ package signer import ( "bytes" "errors" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "reflect" ) diff --git a/transaction/signer/secp256k1_blake160_sighash_all.go b/transaction/signer/secp256k1_blake160_sighash_all.go index dd2cb660..7a2dffdc 100644 --- a/transaction/signer/secp256k1_blake160_sighash_all.go +++ b/transaction/signer/secp256k1_blake160_sighash_all.go @@ -3,10 +3,10 @@ package signer import ( "bytes" "errors" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type Secp256k1Blake160SighashAllSigner struct { diff --git a/transaction/signer/signer.go b/transaction/signer/signer.go index 54aae889..c4830320 100644 --- a/transaction/signer/signer.go +++ b/transaction/signer/signer.go @@ -2,9 +2,9 @@ package signer import ( "errors" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) type ScriptSigner interface { @@ -122,7 +122,7 @@ func checkScriptGroup(group *transaction.ScriptGroup) error { } switch group.GroupType { case transaction.ScriptTypeType: - if len(group.OutputIndices) + len(group.InputIndices) < 0 { + if len(group.OutputIndices)+len(group.InputIndices) < 0 { return errors.New("groupType is Type but OutputIndices and InputIndices are empty") } case transaction.ScriptTypeLock: @@ -133,4 +133,4 @@ func checkScriptGroup(group *transaction.ScriptGroup) error { return errors.New("unknown group type " + string(group.GroupType)) } return nil -} \ No newline at end of file +} diff --git a/transaction/signer/signer_test.go b/transaction/signer/signer_test.go index 3f43c3ea..e4be65d3 100644 --- a/transaction/signer/signer_test.go +++ b/transaction/signer/signer_test.go @@ -6,9 +6,9 @@ import ( "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/transaction" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/transaction" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "io/ioutil" "runtime/debug" @@ -197,4 +197,4 @@ func (r *signerChecker) UnmarshalJSON(input []byte) error { r.Contexts.Add(ctx) } return nil -} \ No newline at end of file +} diff --git a/transaction/transaction.go b/transaction/transaction.go index 86c200c8..b1c86ff3 100644 --- a/transaction/transaction.go +++ b/transaction/transaction.go @@ -3,10 +3,10 @@ package transaction import ( "encoding/binary" "errors" - "github.com/nervosnetwork/ckb-sdk-go/crypto" - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" ) var ( diff --git a/transaction/transaction_test.go b/transaction/transaction_test.go index 5afe64a4..4215f73c 100644 --- a/transaction/transaction_test.go +++ b/transaction/transaction_test.go @@ -3,10 +3,10 @@ package transaction import ( "context" "github.com/ethereum/go-ethereum/common" - s "github.com/nervosnetwork/ckb-sdk-go/crypto/secp256k1" - "github.com/nervosnetwork/ckb-sdk-go/mocks" - "github.com/nervosnetwork/ckb-sdk-go/types" - "github.com/nervosnetwork/ckb-sdk-go/utils" + s "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/secp256k1" + "github.com/nervosnetwork/ckb-sdk-go/v2/mocks" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils" "github.com/stretchr/testify/assert" "testing" ) diff --git a/types/chain.go b/types/chain.go index 5babb569..28c1a2f7 100644 --- a/types/chain.go +++ b/types/chain.go @@ -1,8 +1,8 @@ package types import ( - "github.com/nervosnetwork/ckb-sdk-go/crypto/blake2b" - "github.com/nervosnetwork/ckb-sdk-go/utils/amount" + "github.com/nervosnetwork/ckb-sdk-go/v2/crypto/blake2b" + "github.com/nervosnetwork/ckb-sdk-go/v2/utils/amount" "math/big" ) diff --git a/types/json.go b/types/json.go index f9489f53..9bbdd268 100644 --- a/types/json.go +++ b/types/json.go @@ -510,8 +510,8 @@ func (r *RemoteNode) UnmarshalJSON(input []byte) error { type RemoteAlias RemoteNode var jsonObj struct { RemoteAlias - ConnectedDuration hexutil.Uint64 `json:"connected_duration"` - LastPingDuration hexutil.Uint64 `json:"last_ping_duration,omitempty"` + ConnectedDuration hexutil.Uint64 `json:"connected_duration"` + LastPingDuration *hexutil.Uint64 `json:"last_ping_duration,omitempty"` } if err := json.Unmarshal(input, &jsonObj); err != nil { return err @@ -522,10 +522,12 @@ func (r *RemoteNode) UnmarshalJSON(input []byte) error { Addresses: jsonObj.Addresses, IsOutbound: jsonObj.IsOutbound, ConnectedDuration: uint64(jsonObj.ConnectedDuration), - LastPingDuration: uint64(jsonObj.LastPingDuration), SyncState: jsonObj.SyncState, Protocols: jsonObj.Protocols, } + if jsonObj.LastPingDuration != nil { + r.LastPingDuration = uint64(*jsonObj.LastPingDuration) + } return nil } diff --git a/types/molecule.go b/types/molecule.go index e91b44aa..7f643a60 100644 --- a/types/molecule.go +++ b/types/molecule.go @@ -2,7 +2,7 @@ package types import ( "encoding/binary" - "github.com/nervosnetwork/ckb-sdk-go/molecule" + "github.com/nervosnetwork/ckb-sdk-go/v2/molecule" ) func (r *WitnessArgs) Pack() *molecule.WitnessArgs { diff --git a/types/serialize.go b/types/serialize.go index 44a2b614..87d5690c 100644 --- a/types/serialize.go +++ b/types/serialize.go @@ -3,7 +3,7 @@ package types import ( "errors" "fmt" - "github.com/nervosnetwork/ckb-sdk-go/molecule" + "github.com/nervosnetwork/ckb-sdk-go/v2/molecule" ) func SerializeUint32(n uint32) []byte { diff --git a/utils/cheque_cell.go b/utils/cheque_cell.go index 7865ae15..7fcaea52 100644 --- a/utils/cheque_cell.go +++ b/utils/cheque_cell.go @@ -1,6 +1,6 @@ package utils -import "github.com/nervosnetwork/ckb-sdk-go/types" +import "github.com/nervosnetwork/ckb-sdk-go/v2/types" func ChequeCellArgs(senderLock, receiverLock *types.Script) ([]byte, error) { senderLockHash, err := senderLock.Hash() diff --git a/utils/cheque_cell_test.go b/utils/cheque_cell_test.go index ab1a7be9..0b29990e 100644 --- a/utils/cheque_cell_test.go +++ b/utils/cheque_cell_test.go @@ -2,7 +2,7 @@ package utils import ( "github.com/ethereum/go-ethereum/common" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/utils/system.go b/utils/system.go index 06f94db5..781c5ecb 100644 --- a/utils/system.go +++ b/utils/system.go @@ -4,8 +4,8 @@ import ( "context" "github.com/pkg/errors" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" ) const ( diff --git a/utils/system_test.go b/utils/system_test.go index 2b3287fb..23144e1a 100644 --- a/utils/system_test.go +++ b/utils/system_test.go @@ -2,8 +2,8 @@ package utils import ( "context" - "github.com/nervosnetwork/ckb-sdk-go/mocks" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/mocks" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "testing" ) diff --git a/utils/util.go b/utils/util.go index 9771212a..5a8a8224 100644 --- a/utils/util.go +++ b/utils/util.go @@ -3,9 +3,9 @@ package utils import ( "context" "errors" - "github.com/nervosnetwork/ckb-sdk-go/indexer" - "github.com/nervosnetwork/ckb-sdk-go/rpc" - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/indexer" + "github.com/nervosnetwork/ckb-sdk-go/v2/rpc" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "math/big" "regexp" "strconv" diff --git a/utils/util_test.go b/utils/util_test.go index 773dc809..516362b6 100644 --- a/utils/util_test.go +++ b/utils/util_test.go @@ -1,7 +1,7 @@ package utils import ( - "github.com/nervosnetwork/ckb-sdk-go/types" + "github.com/nervosnetwork/ckb-sdk-go/v2/types" "github.com/stretchr/testify/assert" "math/big" "testing"