From 13718f05008268dd887257d87a4116b37afb1eeb Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Fri, 4 Sep 2020 16:15:23 -0700 Subject: TWEAK: Change /ava API to /avax. --- plugin/evm/service.go | 11 ++++++----- 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 29ef35d..dbd6d46 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") db, err := service.vm.ctx.Keystore.GetDatabase(args.Username, args.Password) if err != nil { @@ -168,7 +169,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 service.vm.ctx.Keystore == nil { return fmt.Errorf("oh no") @@ -223,7 +224,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) @@ -271,7 +272,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{"*"})}, } } -- cgit v1.2.3