NewHTTPClientFromTrustedStore initiates an instance of a light client using HTTP addresses for both the primary provider and witnesses and uses a trusted store as the root of trust. See all Option(s) for the additional configuration. See NewClientFromTrustedStore.
( chainID string, trustingPeriod time.Duration, primaryAddress string, witnessesAddresses []string, trustedStore store.Store, options ...Option)
| 46 | // See all Option(s) for the additional configuration. |
| 47 | // See NewClientFromTrustedStore. |
| 48 | func NewHTTPClientFromTrustedStore( |
| 49 | chainID string, |
| 50 | trustingPeriod time.Duration, |
| 51 | primaryAddress string, |
| 52 | witnessesAddresses []string, |
| 53 | trustedStore store.Store, |
| 54 | options ...Option) (*Client, error) { |
| 55 | |
| 56 | providers, err := providersFromAddresses(append(witnessesAddresses, primaryAddress), chainID) |
| 57 | if err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | |
| 61 | return NewClientFromTrustedStore( |
| 62 | chainID, |
| 63 | trustingPeriod, |
| 64 | providers[len(providers)-1], |
| 65 | providers[:len(providers)-1], |
| 66 | trustedStore, |
| 67 | options...) |
| 68 | } |
| 69 | |
| 70 | func providersFromAddresses(addrs []string, chainID string) ([]provider.Provider, error) { |
| 71 | providers := make([]provider.Provider, len(addrs)) |
nothing calls this directly
no test coverage detected
searching dependent graphs…