diff --git a/go.mod b/go.mod index 605be16161d4..b6b873db7f63 100644 --- a/go.mod +++ b/go.mod @@ -128,6 +128,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.10.0 // indirect + go.uber.org/mock v0.2.0 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sys v0.11.0 // indirect @@ -140,4 +141,4 @@ require ( replace github.com/ava-labs/avalanche-ledger-go => github.com/chain4travel/camino-ledger-go v0.0.13-c4t -replace github.com/ava-labs/coreth => github.com/chain4travel/caminoethvm v1.1.0-rc8 +replace github.com/ava-labs/coreth => github.com/chain4travel/caminoethvm v1.1.0-rc11 diff --git a/go.sum b/go.sum index 5f38c8187c64..7886bcb42ad1 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chain4travel/caminoethvm v1.1.0-rc8 h1:z4OiRWsvdRL74vz1Vu1yUFXbXzzN3zpUsExv2IuBksQ= -github.com/chain4travel/caminoethvm v1.1.0-rc8/go.mod h1:ixUAfU9q6XKc+vj2eF2QMUMJTstz24+0gnUb5NtXwYo= +github.com/chain4travel/caminoethvm v1.1.0-rc11 h1:VrtBEpxDF85sT66+nts8/bR9U0YOMn2bDRLFuz59jpQ= +github.com/chain4travel/caminoethvm v1.1.0-rc11/go.mod h1:UqYeExLmuw9fp8ZqOz52bN8l6o6OhgEcdRsX/Q0C5B8= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -508,6 +508,8 @@ go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= +go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= diff --git a/vms/platformvm/camino_client.go b/vms/platformvm/camino_client.go index 16e0e24ec975..a184f12feadd 100644 --- a/vms/platformvm/camino_client.go +++ b/vms/platformvm/camino_client.go @@ -13,6 +13,7 @@ import ( "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/utils/json" "github.com/ava-labs/avalanchego/utils/rpc" + as "github.com/ava-labs/avalanchego/vms/platformvm/addrstate" platformapi "github.com/ava-labs/avalanchego/vms/platformvm/api" "github.com/ava-labs/avalanchego/vms/platformvm/state" "github.com/ava-labs/avalanchego/vms/secp256k1fx" @@ -31,6 +32,7 @@ type CaminoClient interface { GetLastAcceptedBlock(ctx context.Context, encoding formatting.Encoding, options ...rpc.Option) (any, error) GetBlockAtHeight(ctx context.Context, height uint32, encoding formatting.Encoding, options ...rpc.Option) (any, error) GetClaimables(ctx context.Context, owners []*secp256k1fx.OutputOwners, options ...rpc.Option) ([]*state.Claimable, error) + GetAddressStates(ctx context.Context, addr ids.ShortID, options ...rpc.Option) (as.AddressState, error) } func (c *client) GetConfiguration(ctx context.Context, options ...rpc.Option) (*GetConfigurationReply, error) { @@ -53,10 +55,10 @@ func (c *client) GetAllDepositOffers(ctx context.Context, getAllDepositOffersArg return res, err } -func (c *client) GetRegisteredShortIDLink(ctx context.Context, addrStr ids.ShortID, options ...rpc.Option) (string, error) { +func (c *client) GetRegisteredShortIDLink(ctx context.Context, addr ids.ShortID, options ...rpc.Option) (string, error) { res := &api.JSONAddress{} - err := c.requester.SendRequest(ctx, "platform.getMultisigAlias", &api.JSONAddress{ - Address: addrStr.String(), + err := c.requester.SendRequest(ctx, "platform.getRegisteredShortIDLink", &api.JSONAddress{ + Address: addr.String(), }, res, options...) return res.Address, err } @@ -88,6 +90,14 @@ func (c *client) GetClaimables(ctx context.Context, owners []*secp256k1fx.Output return claimablesFromAPI(res.Claimables) } +func (c *client) GetAddressStates(ctx context.Context, addr ids.ShortID, options ...rpc.Option) (as.AddressState, error) { + res := new(json.Uint64) + err := c.requester.SendRequest(ctx, "platform.getAddressStates", &api.JSONAddress{ + Address: addr.String(), + }, res, options...) + return as.AddressState(*res), err +} + func claimablesFromAPI(apiClaimables []APIClaimable) ([]*state.Claimable, error) { claimables := make([]*state.Claimable, len(apiClaimables)) for i := range claimables {