diff options
Diffstat (limited to 'plugin/evm')
-rw-r--r-- | plugin/evm/service.go | 11 | ||||
-rw-r--r-- | plugin/evm/vm.go | 10 |
2 files changed, 11 insertions, 10 deletions
diff --git a/plugin/evm/service.go b/plugin/evm/service.go index ade03e7..fdbfd91 100644 --- a/plugin/evm/service.go +++ b/plugin/evm/service.go @@ -44,7 +44,8 @@ type SnowmanAPI struct{ vm *VM } // NetAPI offers network related API methods type NetAPI struct{ vm *VM } -type AvaAPI struct{ vm *VM } +// AvaxAPI offers Avalanche network related API methods +type AvaxAPI struct{ vm *VM } // NewNetAPI creates a new net API instance. func NewNetAPI(vm *VM) *NetAPI { return &NetAPI{vm} } @@ -144,7 +145,7 @@ type ExportKeyReply struct { } // ExportKey returns a private key from the provided user -func (service *AvaAPI) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error { +func (service *AvaxAPI) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error { service.vm.ctx.Log.Info("Platform: ExportKey called") address, err := service.vm.ParseEthAddress(args.Address) @@ -174,7 +175,7 @@ type ImportKeyArgs struct { } // ImportKey adds a private key to the provided user -func (service *AvaAPI) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JsonAddress) error { +func (service *AvaxAPI) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JsonAddress) error { service.vm.ctx.Log.Info("Platform: ImportKey called for user '%s'", args.Username) if !strings.HasPrefix(args.PrivateKey, constants.SecretKeyPrefix) { @@ -226,7 +227,7 @@ type ImportAVAXArgs struct { // ImportAVAX issues a transaction to import AVAX from the X-chain. The AVAX // must have already been exported from the X-Chain. -func (service *AvaAPI) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, response *api.JsonTxID) error { +func (service *AvaxAPI) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, response *api.JsonTxID) error { service.vm.ctx.Log.Info("Platform: ImportAVAX called") chainID, err := service.vm.ctx.BCLookup.Lookup(args.SourceChain) @@ -275,7 +276,7 @@ type ExportAVAXArgs struct { // ExportAVAX exports AVAX from the P-Chain to the X-Chain // It must be imported on the X-Chain to complete the transfer -func (service *AvaAPI) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JsonTxID) error { +func (service *AvaxAPI) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, response *api.JsonTxID) error { service.vm.ctx.Log.Info("Platform: ExportAVAX called") if args.Amount == 0 { diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index e1fdc33..b0073da 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -519,9 +519,9 @@ func (vm *VM) CreateHandlers() map[string]*commonEng.HTTPHandler { handler.RegisterName("admin", &admin.Performance{}) return map[string]*commonEng.HTTPHandler{ - "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler}, - "/ava": newHandler("ava", &AvaAPI{vm}), - "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, + "/rpc": {LockOptions: commonEng.NoLock, Handler: handler}, + "/avax": newHandler("avax", &AvaxAPI{vm}), + "/ws": {LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, } } @@ -530,8 +530,8 @@ func (vm *VM) CreateStaticHandlers() map[string]*commonEng.HTTPHandler { handler := rpc.NewServer() handler.RegisterName("static", &StaticService{}) return map[string]*commonEng.HTTPHandler{ - "/rpc": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler}, - "/ws": &commonEng.HTTPHandler{LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, + "/rpc": {LockOptions: commonEng.NoLock, Handler: handler}, + "/ws": {LockOptions: commonEng.NoLock, Handler: handler.WebsocketHandler([]string{"*"})}, } } |