diff --git a/init.go b/init.go index 6bf29a7..c16c64b 100644 --- a/init.go +++ b/init.go @@ -214,6 +214,7 @@ func DefaultServicesConfig() Services { ExchangeDomain: "https://exchange.bt.co", SolidityDomain: "grpc.trongrid.io:50052", FullnodeDomain: "grpc.trongrid.io:50051", + TrongridDomain: "https://api.trongrid.io", EscrowPubKeys: []string{"CAISIQPAfB2Mt2ic+n3JcL4vrKXxBCmB0iNh+5BYiXdJNWed/Q=="}, GuardPubKeys: []string{"CAISIQJ16EiwvGko4SaBEEUFyMdNZp1vKsTLgIXCY6fRa3/Obg=="}, } @@ -229,6 +230,7 @@ func DefaultServicesConfigDev() Services { ExchangeDomain: "https://exchange-dev.bt.co", SolidityDomain: "grpc.trongrid.io:50052", FullnodeDomain: "grpc.trongrid.io:50051", + TrongridDomain: "https://api.shasta.trongrid.io", EscrowPubKeys: []string{"CAISIQJOcRK0q4TOwpswAkvMMq33ksQfhplEyhHcZnEUFbthQg=="}, GuardPubKeys: []string{"CAISIQJhPBQWKPPjYcuPWR9sl+QlN0wJSRbQs3yUKmggvubXwg=="}, } @@ -244,6 +246,7 @@ func DefaultServicesConfigTestnet() Services { ExchangeDomain: "https://exchange-staging.bt.co", SolidityDomain: "grpc.trongrid.io:50052", FullnodeDomain: "grpc.trongrid.io:50051", + TrongridDomain: "https://api.shasta.trongrid.io", EscrowPubKeys: []string{"CAISIQJOcRK0q4TOwpswAkvMMq33ksQfhplEyhHcZnEUFbthQg=="}, GuardPubKeys: []string{"CAISIQJhPBQWKPPjYcuPWR9sl+QlN0wJSRbQs3yUKmggvubXwg=="}, } diff --git a/migrations.go b/migrations.go index f6a0cb4..f00c976 100644 --- a/migrations.go +++ b/migrations.go @@ -225,6 +225,23 @@ func migrate_15_MissingRemoteAPI(cfg *Config) bool { return false } +func migrate_16_TrongridDomain(cfg *Config) bool { + if strings.Contains(cfg.Services.EscrowDomain, "dev") || strings.Contains(cfg.Services.EscrowDomain, "staging") { + if len(cfg.Services.TrongridDomain) == 0 { + ds := DefaultServicesConfigTestnet() + cfg.Services.TrongridDomain = ds.TrongridDomain + return true + } + } else { + if len(cfg.Services.TrongridDomain) == 0 { + ds := DefaultServicesConfig() + cfg.Services.TrongridDomain = ds.TrongridDomain + return true + } + } + return false +} + // MigrateConfig migrates config options to the latest known version // It may correct incompatible configs as well // inited = just initialized in the same call @@ -248,5 +265,6 @@ func MigrateConfig(cfg *Config, inited, hasHval bool) bool { updated = migrate_13_HostContractManager(cfg) || updated updated = migrate_14_TestnetBootstrapNodes(cfg) || updated updated = migrate_15_MissingRemoteAPI(cfg) || updated + updated = migrate_16_TrongridDomain(cfg) || updated return updated } diff --git a/services.go b/services.go index 135683e..6f039df 100644 --- a/services.go +++ b/services.go @@ -8,6 +8,7 @@ type Services struct { ExchangeDomain string SolidityDomain string FullnodeDomain string + TrongridDomain string EscrowPubKeys []string GuardPubKeys []string