// Create a subscribe command to watch multiple addresses.
Create a subscribe command to watch multiple addresses.
// Create a subscribe command to watch multiple addresses .
func createAddressCommand(baseMsg map[string]interface{}, whitelist map[common.Address]bool, to_or_from bool) []map[string]interface{} {
	if len(whitelist) == 0 {
		return nil
	}
	filters := make([]map[string]interface{}, 0)
	keyStr := ""
	if to_or_from {
		keyStr = "to"
	} else {
		keyStr = "from"
	}
	for address := range whitelist {
		toFilter := map[string]interface{}{
			"status": "pending",
			keyStr:   address,
		}
		baseMsg["categoryCode"] = "configs"
		baseMsg["eventCode"] = "put"
		baseMsg["config"] = map[string]interface{}{
			"scope":        address,
			"filters":      []map[string]interface{}{toFilter},
			"watchAddress": true,
		}
		filters = append(filters, baseMsg)
	}
	return filters
}
func createAddressCommand ( baseMsg map [ string ] interface { } , whitelist map [ common . Address ] bool , to_or_from bool ) [ ] map [ string ] interface { } { if len ( whitelist ) == 0 { return nil } filters := make ( [ ] map [ string ] interface { } , 0 ) keyStr := " " if to_or_from { keyStr = " " } else { keyStr = " " } for address := range whitelist { toFilter := map [ string ] interface { } { " " : " " , keyStr : address , } baseMsg [ " " ] = " " baseMsg [ " " ] = " " baseMsg [ " " ] = map [ string ] interface { } { " " : address , " " : [ ] map [ string ] interface { } { toFilter } , " " : true , } filters = append ( filters , baseMsg ) } return filters }
Create a subscribe command to watch multiple addresses.
Create a subscribe command to watch multiple addresses .
// see https://docs.blocknative.com/websocket#configurations