Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to v0.119.0 #226

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ func toHrp(network types.Network) (string, error) {
return "ckb", nil
case types.NetworkTest:
return "ckt", nil
case types.NetworkPreview:
return "ckt", nil
default:
return "", errors.New("unknown network")
}
Expand Down
2 changes: 1 addition & 1 deletion collector/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type SimpleTransactionBuilder struct {
//
// To create an empty builder without script handlers, just uses '&SimpleTransactionBuilder{}'.
func NewSimpleTransactionBuilder(network types.Network) *SimpleTransactionBuilder {
if network == types.NetworkMain || network == types.NetworkTest {
if network == types.NetworkMain || network == types.NetworkTest || network == types.NetworkPreview {
s := SimpleTransactionBuilder{}
s.Register(handler.NewSecp256k1Blake160SighashAllScriptHandler(network))
s.Register(handler.NewSecp256k1Blake160MultisigAllScriptHandler(network))
Expand Down
4 changes: 4 additions & 0 deletions collector/handler/ckb.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ func NewSecp256k1Blake160SighashAllScriptHandler(network types.Network) *Secp256
txHash = types.HexToHash("0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c")
} else if network == types.NetworkTest {
txHash = types.HexToHash("0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37")
} else if network == types.NetworkPreview {
txHash = types.HexToHash("0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816")
} else {
return nil
}
Expand Down Expand Up @@ -66,6 +68,8 @@ func NewSecp256k1Blake160MultisigAllScriptHandler(network types.Network) *Secp25
txHash = types.HexToHash("0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c")
} else if network == types.NetworkTest {
txHash = types.HexToHash("0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37")
} else if network == types.NetworkPreview {
txHash = types.HexToHash("0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816")
} else {
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions collector/handler/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func NewDaoScriptHandler(network types.Network) *DaoScriptHandler {
txHash = types.HexToHash("0xe2fb199810d49a4d8beec56718ba2593b665db9d52299a0f9e6e75416d73ff5c")
} else if network == types.NetworkTest {
txHash = types.HexToHash("0x8f8c79eb6671709633fe6a46de93c0fedc9c1b8a6527a18d3983879542635c9f")
} else if network == types.NetworkPreview {
txHash = types.HexToHash("0xe93c55bea88e10c64d9b218ee2b504bc89b9e5ee912186ff904c1827360a5362")
} else {
return nil
}
Expand Down
22 changes: 22 additions & 0 deletions collector/handler/omnilock.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,28 @@ func NewOmnilockScriptHandler(network types.Network) *OmnilockScriptHandler {
},
CodeHash: systemscript.GetCodeHash(network, systemscript.Omnilock),
}
case types.NetworkPreview:
return &OmnilockScriptHandler{
SingleSignCellDep: &types.CellDep{
OutPoint: &types.OutPoint{
TxHash: types.HexToHash("0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816"),
Index: 0,
},
DepType: types.DepTypeDepGroup,
},
MultiSignCellDep: &types.CellDep{
OutPoint: &types.OutPoint{
TxHash: types.HexToHash("0x0fab65924f2784f17ad7f86d6aef4b04ca1ca237102a68961594acebc5c77816"),
Index: 1,
},
DepType: types.DepTypeDepGroup,
},
CellDep: &types.CellDep{
OutPoint: systemscript.GetInfo(network, systemscript.Omnilock).OutPoint,
DepType: systemscript.GetInfo(network, systemscript.Omnilock).DepType,
},
CodeHash: systemscript.GetCodeHash(network, systemscript.Omnilock),
}
default:
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion crypto/bech32/bech32.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
var gen = []int{0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3}

const BECH32M_CONST = 0x2bc830a3

type Encoding uint

const (
BECH32 Encoding = iota
BECH32M
Expand Down Expand Up @@ -42,7 +44,7 @@ func Decode(bech string) (Encoding, string, []byte, error) {

decoded, err := toBytes(data)
if err != nil {
return BECH32, "", nil, errors.New(fmt.Sprintf("failed converting data to bytes: %v", err))
return BECH32, "", nil, errors.New(fmt.Sprintf("failed converting data to bytes: %v", err))
}

ints := make([]int, len(decoded))
Expand Down
2 changes: 1 addition & 1 deletion crypto/secp256k1/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ func TestPubKey(t *testing.T) {
assert.Equal(t, common.FromHex("0x04a0a7a7597b019828a1dda6ed52ab25181073ec3a9825d28b9abbb932fe1ec83dd117a8eef7649c25be5a591d08f80ffe7e9c14100ad1b58ac78afa606a576453"), encoded)
encoded = k.PubKey()
assert.Equal(t, common.FromHex("0x03a0a7a7597b019828a1dda6ed52ab25181073ec3a9825d28b9abbb932fe1ec83d"), encoded)
}
}
2 changes: 1 addition & 1 deletion indexer/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestGetCellsMaxLimit(t *testing.T) {
}
resp, err := c.GetCells(context.Background(), s, SearchOrderAsc, math.MaxUint32, "")
checkError(t, err)
// TODO fix later
// TODO fix later
// assert.Equal(t, 36, len(resp.Objects))

// Check response when `WithData` == true in request
Expand Down
Loading