package examples import ( "errors" "regexp" "strconv" "strings" ) type SendCommand struct { AmountSat int64 Address string } var sendPattern = regexp.MustCompile(`(?i)^@send ([1-9][0-9]*) sats to (tb1[023456789acdefghjklmnpqrstuvwxyz]{8,87})$`) func ParseTestnetSend(input string) (SendCommand, error) { m := sendPattern.FindStringSubmatch(strings.TrimSpace(input)) if m == nil { return SendCommand{}, errors.New("expected @send sats to ") } n, e := strconv.ParseInt(m[1], 10, 64) if e != nil { return SendCommand{}, e } // Syntax screening only: the Engine must perform full address and network validation. return SendCommand{AmountSat: n, Address: m[2]}, nil }