@@ -22,8 +22,27 @@ type RPCChainProviderConfig struct {
2222// ParticipantConfig is the configuration of a single participant.
2323// It contains the configuration details to connect and authenticate against a participant's APIs.
2424type ParticipantConfig struct {
25- // (HTTP) The URL to access the participant's JSON Ledger API
25+ // The endpoints used to connect to this participant's APIs.
26+ Endpoints
27+ // The (Docker) internal endpoints used to connect to the participant's APIs.
28+ // If Specified, the resulting chain will have its InternalEndpoints field populated with these values.
29+ // This is useful when having to connect Canton from within another Docker container.
30+ // Optional
31+ InternalEndpoints * Endpoints
32+ // The UserID of the user that should be used for accessing the participant's API endpoints.
33+ // Required
34+ UserID string
35+ // The PartyID of the party that should be used for accessing the participant's API endpoints.
36+ // Required
37+ PartyID string
38+ // An authentication.Provider implementation that provides the credentials for authenticating with the participant's API endpoints.
2639 // Required
40+ AuthProvider authentication.Provider
41+ }
42+
43+ type Endpoints struct {
44+ // (HTTP) The URL to access the participant's JSON Ledger API
45+ // Optional
2746 // https://docs.digitalasset.com/build/3.5/reference/json-api/json-api.html
2847 JSONLedgerAPIURL string
2948 // (gRPC) The URL to access the participant's gRPC Ledger API
@@ -35,34 +54,19 @@ type ParticipantConfig struct {
3554 // https://docs.digitalasset.com/operate/3.5/howtos/configure/apis/admin_api.html
3655 AdminAPIURL string
3756 // (HTTP) The URL to access the participant's Validator API
38- // Required
57+ // Optional
3958 // https://docs.sync.global/app_dev/validator_api/index.html
4059 ValidatorAPIURL string
41- // The UserID of the user that should be used for accessing the participant's API endpoints.
42- // Required
43- UserID string
44- // The PartyID of the party that should be used for accessing the participant's API endpoints.
45- // Required
46- PartyID string
47- // An authentication.Provider implementation that provides the credentials for authenticating with the participant's API endpoints.
48- // Required
49- AuthProvider authentication.Provider
5060}
5161
5262func (c RPCChainProviderConfig ) validate () error {
5363 if len (c .Participants ) == 0 {
5464 return errors .New ("no participants specified" )
5565 }
5666 for i , participant := range c .Participants {
57- if participant .JSONLedgerAPIURL == "" {
58- return fmt .Errorf ("participant %d has no JSON Ledger API URL set" , i + 1 )
59- }
6067 if participant .GRPCLedgerAPIURL == "" {
6168 return fmt .Errorf ("participant %d has no gRPC Ledger API URL set" , i + 1 )
6269 }
63- if participant .ValidatorAPIURL == "" {
64- return fmt .Errorf ("participant %d has no Validator API URL set" , i + 1 )
65- }
6670 if participant .UserID == "" {
6771 return fmt .Errorf ("participant %d has no User ID set" , i + 1 )
6872 }
@@ -140,6 +144,17 @@ func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, erro
140144 adminServices = & services
141145 }
142146
147+ // Populate internal endpoints (if set)
148+ var internalEndpoints * canton.ParticipantEndpoints
149+ if participant .InternalEndpoints != nil {
150+ internalEndpoints = & canton.ParticipantEndpoints {
151+ JSONLedgerAPIURL : participant .InternalEndpoints .JSONLedgerAPIURL ,
152+ GRPCLedgerAPIURL : participant .InternalEndpoints .GRPCLedgerAPIURL ,
153+ AdminAPIURL : participant .InternalEndpoints .AdminAPIURL ,
154+ ValidatorAPIURL : participant .InternalEndpoints .ValidatorAPIURL ,
155+ }
156+ }
157+
143158 p .chain .Participants [i ] = canton.Participant {
144159 Name : fmt .Sprintf ("Participant %v" , i + 1 ),
145160 Endpoints : canton.ParticipantEndpoints {
@@ -148,11 +163,12 @@ func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, erro
148163 AdminAPIURL : participant .AdminAPIURL ,
149164 ValidatorAPIURL : participant .ValidatorAPIURL ,
150165 },
151- LedgerServices : ledgerServices ,
152- AdminServices : adminServices ,
153- TokenSource : tokenSource ,
154- UserID : participant .UserID ,
155- PartyID : participant .PartyID ,
166+ InternalEndpoints : internalEndpoints ,
167+ LedgerServices : ledgerServices ,
168+ AdminServices : adminServices ,
169+ TokenSource : tokenSource ,
170+ UserID : participant .UserID ,
171+ PartyID : participant .PartyID ,
156172 }
157173 }
158174
0 commit comments