mirror of
https://github.com/luxfi/oraclevm.git
synced 2026-10-30 15:23:15 +00:00
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
// Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package registry
|
|
|
|
import (
|
|
"github.com/ava-labs/avalanchego/utils/wrappers"
|
|
"github.com/ava-labs/avalanchego/vms/platformvm/warp"
|
|
"github.com/ava-labs/hypersdk/chain"
|
|
"github.com/ava-labs/hypersdk/codec"
|
|
|
|
"github.com/bianyuanop/oraclevm/actions"
|
|
"github.com/bianyuanop/oraclevm/auth"
|
|
"github.com/bianyuanop/oraclevm/consts"
|
|
)
|
|
|
|
// Setup types
|
|
func init() {
|
|
consts.ActionRegistry = codec.NewTypeParser[chain.Action, *warp.Message]()
|
|
consts.AuthRegistry = codec.NewTypeParser[chain.Auth, *warp.Message]()
|
|
|
|
errs := &wrappers.Errs{}
|
|
errs.Add(
|
|
// When registering new actions, ALWAYS make sure to append at the end.
|
|
consts.ActionRegistry.Register((&actions.Transfer{}).GetTypeID(), actions.UnmarshalTransfer, false),
|
|
consts.ActionRegistry.Register((&actions.UploadEntity{}).GetTypeID(), actions.UnmarshalUploadEntity, false),
|
|
consts.ActionRegistry.Register((&actions.Query{}).GetTypeID(), actions.UnmarshalQuery, true),
|
|
|
|
// When registering new auth, ALWAYS make sure to append at the end.
|
|
consts.AuthRegistry.Register((&auth.ED25519{}).GetTypeID(), auth.UnmarshalED25519, false),
|
|
)
|
|
if errs.Errored() {
|
|
panic(errs.Err)
|
|
}
|
|
}
|